-
Notifications
You must be signed in to change notification settings - Fork 361
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🐛 [Bug] torch._subclasses.fake_tensor.MetadataMismatchError: Devices cpu and cuda:0 are not equal! (_scaled_dot_product_flash_attention) #3408
Comments
Probably also fixed by #3336. I cannot access paligemma2 to confirm it. |
I rebased onto the latest branch and tested it, but the same error still occurs. |
It looks more like a PyTorch issue rather than Torch-TRT issue. import torch
import torch.nn.functional as F
from torch.export._draft_export import draft_export
class MyModule(torch.nn.Module):
def forward(self, query: torch.Tensor, key: torch.Tensor, value: torch.Tensor) -> torch.Tensor:
return F.scaled_dot_product_attention(query, key, value)
with torch.inference_mode():
model = MyModule().eval().cuda().half()
inputs = (
torch.rand(32, 8, 128, 64, dtype=torch.half, device="cuda"),
torch.rand(32, 8, 128, 64, dtype=torch.half, device="cuda"),
torch.rand(32, 8, 128, 64, dtype=torch.half, device="cuda"),
)
exported_program = draft_export(model, inputs, strict=False)[0]
print(exported_program._report) When executing the above script with
But when executing with
|
In toy test cases you provided, this issue was reproducible on PyTorch 2.7.0.dev20250207+cu126 but seems resolved in PyTorch 2.7.0.dev20250228+cu126. |
You may want to insert |
Bug Description
After resolving issues from pytorch/pytorch#147096, a
MetadataMismatchError
occurs at_scaled_dot_product_flash_attention
.To Reproduce
Steps to reproduce the behavior:
Environment
pytorch-triton 3.2.0+git4b3bb1f8
torch 2.7.0.dev20250207+cu124
torch-tensorrt 2.7.0.dev0+5a4dd33ef /develop/TensorRT/py
torchvision 0.22.0.dev20250207+cu124
The text was updated successfully, but these errors were encountered: