Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@aravindpai
Last active January 27, 2020 16:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aravindpai/ea3c14a06f5890d1011627f35d25f397 to your computer and use it in GitHub Desktop.
Save aravindpai/ea3c14a06f5890d1011627f35d25f397 to your computer and use it in GitHub Desktop.
#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