Skip to content

Commit

Permalink
Provide the default vocab size for the transformer demo model (#18963)
Browse files Browse the repository at this point in the history
  • Loading branch information
awaelchli authored Nov 8, 2023
1 parent 57cc01b commit 618e1c8
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/lightning/pytorch/demos/transformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,13 @@

class Transformer(nn.Module):
def __init__(
self, vocab_size: int, ninp: int = 200, nhead: int = 2, nhid: int = 200, nlayers: int = 2, dropout: float = 0.2
self,
vocab_size: int = 33278, # default for WikiText2
ninp: int = 200,
nhead: int = 2,
nhid: int = 200,
nlayers: int = 2,
dropout: float = 0.2,
) -> None:
super().__init__()
self.pos_encoder = PositionalEncoding(ninp, dropout)
Expand Down

0 comments on commit 618e1c8

Please sign in to comment.