Skip to content

Commit

Permalink
Don't alter input in Features.from_dict (#6189)
Browse files Browse the repository at this point in the history
don't alter input in Features.from_dict
  • Loading branch information
lhoestq authored Aug 29, 2023
1 parent 74d6021 commit 0b6bb2f
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/datasets/features/features.py
Original file line number Diff line number Diff line change
Expand Up @@ -1343,6 +1343,7 @@ def generate_from_dict(obj: Any):
# Otherwise we have a dict or a dataclass
if "_type" not in obj or isinstance(obj["_type"], dict):
return {key: generate_from_dict(value) for key, value in obj.items()}
obj = dict(obj)
class_type = globals()[obj.pop("_type")]

if class_type == Sequence:
Expand Down

0 comments on commit 0b6bb2f

Please sign in to comment.