Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[hotfix] Init typo #229

Merged
merged 1 commit into from
Mar 8, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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