kyegomez / zeta

Build high-performance AI models with modular building blocks
https://zeta.apac.ai
Apache License 2.0
332 stars 28 forks source link

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

Closed dddlli closed 1 month ago

dddlli commented 3 months ago

RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu! (when checking argument for argument mat2 in method wrapper_CUDA_mm

import torch

from zeta.nn import MambaBlock

device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")

block = MambaBlock(dim=64, depth=1)

x = torch.randn(1, 10, 64).to(device)

y = block(x).to(device)

print(y.shape)

github-actions[bot] commented 3 months ago

Hello there, thank you for opening an Issue ! 🙏🏻 The team was notified and they will get back to you asap.

trefoil0219 commented 3 months ago

The same bug:
File "/home/miniconda3/lib/python3.11/site-packages/zeta/nn/modules/simple_mamba.py", line 205, in selective_scan x = deltaA[:, :, i] * x + deltaB_u[:, :, i]


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

add .to(x.device); but I think it is inefficient

Bool1020 commented 3 months ago

Replace the following code at line 202 in zeta/nn/modules/simple_mamba.py with:

x = torch.zeros((b, d_in, n)).to(next(self.parameters()).device)
github-actions[bot] commented 1 month ago

Stale issue message