-
Notifications
You must be signed in to change notification settings - Fork 84
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
type inference: mismatched dtype in cat operator #750
Comments
Note that PyTorch upcasts automatically when given tensors of varying dtype while Thunder currently errors. When I tried to add this (clumsily) #41 , it seemed that I hit some inconsistency in torch eager vs. compile. |
Ahh, yeah, I suspected something is off there; thanks for the confirmation! But I think something more insidious is going on here---when run in eager, the types match. i.e.: If we were to actually do #41, it should get us through this but would actually end up masking the deeper bug. |
The actual issue here is that the factory functions like lightning-thunder/thunder/clang/__init__.py Lines 275 to 277 in a3e432f
Also, this is hidden during execution with
Minimal Repro (output is float but in trace we see that proxy has integer dtype): import torch
import thunder
def foo(x: torch.Tensor) -> torch.Tensor:
o = torch.zeros((2,1,2), device=x.device)
return o
jfoo = thunder.jit(foo)
o = jfoo(torch.randn(3, 3))
print(o.dtype)
print(thunder.last_traces(jfoo)[0]) Output
I think this is a duplicate of #621 |
triage review:
|
🚀 Model / language coverage
The following code results in a
error in
cat
s implementation. It seems we end up confused about the proper dtype of thesecond
tensor.As the comment in the
zeros
line indicates, thunder can be coerced into compiling this by explicitly adding adtype
to thezeros
call. However, it seems the bug is more global than justzeros
, as ourzeros
works perfectly on its own:Pitch
This came about while using Nik's patch to try to get #343 to work. Nik and I still need some iteration on his patch, so there's no guarantee that this will be the next bug after #124, but it's plausibly a blocker.
cc @apaz-cli @tfogal
The text was updated successfully, but these errors were encountered: