wingedsheep / transformer

MIT License
16 stars 13 forks source link

RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu! #4

Open bitdom8 opened 1 year ago

bitdom8 commented 1 year ago

RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu!

bitdom8 commented 1 year ago

Ok, fixed, just include get_device inside of positional encoding, easy:

return torch.from_numpy(positional_encoding).float().to(get_device())

vincentbons89 commented 1 year ago

Thanks I'll update the code