Skip to content

Commit

Permalink
Webdataset special columns in last position (#7349)
Browse files Browse the repository at this point in the history
webdataset keys in last position
  • Loading branch information
lhoestq authored Jan 3, 2025
1 parent 6c6a82a commit ccccf10
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/datasets/packaged_modules/webdataset/webdataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ def _get_pipeline_from_tar(cls, tar_path, tar_iterator):
if example_key is None:
continue
if current_example and current_example["__key__"] != example_key:
# reposition some keys in last position
current_example["__key__"] = current_example.pop("__key__")
current_example["__url__"] = current_example.pop("__url__")
yield current_example
current_example = {}
current_example["__key__"] = example_key
Expand Down

0 comments on commit ccccf10

Please sign in to comment.