Last active
January 27, 2020 16:56
-
-
Save aravindpai/ea3c14a06f5890d1011627f35d25f397 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#architecture | |
print(model) | |
#No. of trianable parameters | |
def count_parameters(model): | |
return sum(p.numel() for p in model.parameters() if p.requires_grad) | |
print(f'The model has {count_parameters(model):,} trainable parameters') | |
#Initialize the pretrained embedding | |
pretrained_embeddings = TEXT.vocab.vectors | |
model.embedding.weight.data.copy_(pretrained_embeddings) | |
print(pretrained_embeddings.shape) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment