mohar07 commited on
Commit
fa974cd
·
verified ·
1 Parent(s): 249299c

train slm: 17.78M params

Browse files
Files changed (2) hide show
  1. README.md +1 -1
  2. model.py +2 -1
README.md CHANGED
@@ -1,4 +1,4 @@
1
- # PunyPunk
2
 
3
  Tiny transformer LM trained from scratch on a toy corpus in Colab.
4
 
 
1
+ # SLM (small human model)
2
 
3
  Tiny transformer LM trained from scratch on a toy corpus in Colab.
4
 
model.py CHANGED
@@ -22,7 +22,8 @@ class DenseTransformerBlock(nn.Module):
22
  self.register_buffer("mask", torch.triu(torch.full((block_size, block_size), float("-inf")), diagonal=1))
23
 
24
  def forward(self, x):
25
- a, _ = self.attn(self.ln1(x), self.ln1(x), self.ln1(x), attn_mask=self.mask)
 
26
  x = x + a
27
  x = x + self.mlp(self.ln2(x))
28
  return x
 
22
  self.register_buffer("mask", torch.triu(torch.full((block_size, block_size), float("-inf")), diagonal=1))
23
 
24
  def forward(self, x):
25
+ t = x.shape[1]
26
+ a, _ = self.attn(self.ln1(x), self.ln1(x), self.ln1(x), attn_mask=self.mask[:t, :t])
27
  x = x + a
28
  x = x + self.mlp(self.ln2(x))
29
  return x