Skip to content

Commit

Permalink
caught while implementing 227
Browse files Browse the repository at this point in the history
  • Loading branch information
blefaudeux committed Mar 7, 2022
1 parent dc80aeb commit 80f4280
Showing 1 changed file with 0 additions and 12 deletions.
12 changes: 0 additions & 12 deletions xformers/factory/model_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,22 +184,10 @@ def __init__(
)
self.decoders = torch.nn.ModuleList(decoders)

if len(self.decoders) > 0:
# Use Xavier init for encoding/decoding tasks
self._reset_parameters()

@classmethod
def from_config(cls, config: xFormerConfig):
return cls(config.stack_configs, config.tie_embedding_weights)

def _reset_parameters(self):
r"""Initiate parameters in the transformer model
following the Xavier distribution."""

for p in self.parameters():
if p.dim() > 1:
torch.nn.init.xavier_uniform_(p)

def _verify_reversible(self, stack_configs: List[xFormerBlockConfig]):
reversible = [
c.reversible
Expand Down

0 comments on commit 80f4280

Please sign in to comment.