Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions src/datasets/utils/_dill.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,7 @@ def save(self, obj, save_persistent_id=True):
obj = getattr(obj, "_torchdynamo_orig_callable", obj)
dill.Pickler.save(self, obj, save_persistent_id=save_persistent_id)

def _batch_setitems(self, items):
if self._legacy_no_dict_keys_sorting:
return super()._batch_setitems(items)
def _batch_setitems(self, items, *args, **kwargs):
# Ignore the order of keys in a dict
try:
# Faster, but fails for unorderable elements
Expand All @@ -80,7 +78,7 @@ def _batch_setitems(self, items):
from datasets.fingerprint import Hasher

items = sorted(items, key=lambda x: Hasher.hash(x[0]))
dill.Pickler._batch_setitems(self, items)
return super()._batch_setitems(items, *args, **kwargs)

def memoize(self, obj):
# Don't memoize strings since two identical strings can have different Python ids
Expand Down
Loading