kyegomez / LongNet

Implementation of plug in and play Attention from "LongNet: Scaling Transformers to 1,000,000,000 Tokens"
https://discord.gg/qUtxnK2NMf
Apache License 2.0
663 stars 63 forks source link

example.py does not work #11

Closed SowreshMS closed 8 months ago

SowreshMS commented 11 months ago

RuntimeError Traceback (most recent call last) in <cell line: 25>() 24 #test forward pass 25 with torch.no_grad(): ---> 26 output = model(x) 27 print(f"Output shape: {output.shape}") # expected (batch_size, seq_Len) 28

4 frames in apply_rotary_pos_emb(x, sin, cos, scale) 33 sin, cos = map(lambda t: duplicate_interleave(t scale), (sin, cos)) 34 # einsum notation for lambda t: repeat(t[offset:x.shape[1]+offset,:], "n d -> () n () (d j)", j=2) ---> 35 return (x cos) + (rotate_every_two(x) * sin) 36 37

RuntimeError: The size of tensor a (512) must match the size of tensor b (64) at non-singleton dimension 2

Upvote & Fund

Fund with Polar

kyegomez commented 10 months ago

@SowreshMS Hey please excuse me for this, i was experimenting, it should work now.

kyegomez commented 8 months ago

@SowreshMS Hey please excuse me, it works now try again!