Open IvanYashchuk opened 1 month ago
Note that #461 was about avoiding the inf recursion.
This is from the dataclass decorator(?) setting __dataclass_params__
on the BaseModelOutput
class (to _DataclassParams(init=True,repr=True,eq=True,order=False,unsafe_hash=False,frozen=False)
)
The trouble very likely stems from either _setattr_lookaside
not properly handling assigning to classes and calling __setattr__
erroneously (see the dance that _getattr_lookaside
does) or from the unbinding in the _call_dispatch
going wrong) as the "missing a required argument" could well be that we miss "self", the object being assigned to.
Note also that the above (the creation of the BaseModelOutput class) is triggered by the lazy loading of transformers leading to the importing of the modeling_outputs
module being done by the interpreter.
One option might be to deliberately not trace through the lazy importing but making it opaque.
Here is an even more minimal repro (different error message due to different setattr method)
class A:
pass
def fn(x):
A.x = x
fn(1) # works as expected
print(A.x)
jfn = thunder.jit(fn)
jfn(2) # fails because it calls the `__setattr__` intended for A-objects on the A-class.
🐛 Bug
A minimal repro for the fixed issue (https://github.com/Lightning-AI/lightning-thunder/issues/461#issuecomment-2178023346) doesn't work anymore with a failure in Thunder's interpreter:
I used transformers-4.35.0.