You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Some of our dataloaders use custom Sequence subclasses, that cause errors in apply_to_collection.
The reason for this is, that these classes won't roundtrip, which is assumed by the implementation of apply_to_collection.
# minimal exampleclassX(list):
def__init__(self, x):
super().__init__(range(x))
data=X(4)
assertdata==type(data)(list(data)) # is False, because of how class X's constructor is implemented# but this is how apply_to_collection handles Sequences
Borda
changed the title
Non roundtrippable sequence subclasses raise error in apply_to_collection
Non roundtrippable sequence subclasses raise error in apply_to_collectionMar 31, 2024
🐛 Bug
Some of our dataloaders use custom
Sequence
subclasses, that cause errors inapply_to_collection
.The reason for this is, that these classes won't roundtrip, which is assumed by the implementation of
apply_to_collection
.The above is assumed implicitly here:
utilities/src/lightning_utilities/core/apply_func.py
Lines 123 to 137 in 7db19e0
To Reproduce
See example above.
Expected behavior
If an instance of a sequence subclass can't roundtrip it should just be passed through.
Additional context
N/A
Cheers,
Andreas
The text was updated successfully, but these errors were encountered: