Skip to content

Commit

Permalink
Add missing revision argument (#6191)
Browse files Browse the repository at this point in the history
* add revision

* style

* add revision

* fix dataset info
  • Loading branch information
qgallouedec authored Aug 31, 2023
1 parent 00cb5cc commit 439e115
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions src/datasets/arrow_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -5331,7 +5331,7 @@ def path_in_repo(_index, shard):
]
download_config = DownloadConfig(token=token)
deleted_size = sum(
xgetsize(hf_hub_url(repo_id, data_file), download_config=download_config)
xgetsize(hf_hub_url(repo_id, data_file, revision=branch), download_config=download_config)
for data_file in data_files_to_delete
)

Expand Down Expand Up @@ -5446,15 +5446,15 @@ def push_to_hub(
download_config.download_desc = "Downloading metadata"
download_config.token = token
dataset_readme_path = cached_path(
hf_hub_url(repo_id, "README.md"),
hf_hub_url(repo_id, "README.md", revision=branch),
download_config=download_config,
)
dataset_card = DatasetCard.load(Path(dataset_readme_path))
dataset_card_data = dataset_card.data
metadata_configs = MetadataConfigs.from_dataset_card_data(dataset_card_data)
dataset_infos: DatasetInfosDict = DatasetInfosDict.from_dataset_card_data(dataset_card_data)
if dataset_infos:
repo_info = dataset_infos[next(iter(dataset_infos))]
if dataset_infos and config_name in dataset_infos:
repo_info = dataset_infos[config_name]
else:
repo_info = None
# get the deprecated dataset_infos.json to update them
Expand All @@ -5466,7 +5466,7 @@ def push_to_hub(
download_config.download_desc = "Downloading metadata"
download_config.token = token
dataset_infos_path = cached_path(
hf_hub_url(repo_id, config.DATASETDICT_INFOS_FILENAME),
hf_hub_url(repo_id, config.DATASETDICT_INFOS_FILENAME, revision=branch),
download_config=download_config,
)
with open(dataset_infos_path, encoding="utf-8") as f:
Expand Down Expand Up @@ -5547,7 +5547,7 @@ def push_to_hub(
download_config.download_desc = "Downloading deprecated dataset_infos.json"
download_config.use_auth_token = token
dataset_infos_path = cached_path(
hf_hub_url(repo_id, config.DATASETDICT_INFOS_FILENAME),
hf_hub_url(repo_id, config.DATASETDICT_INFOS_FILENAME, revision=branch),
download_config=download_config,
)
with open(dataset_infos_path, encoding="utf-8") as f:
Expand Down
4 changes: 2 additions & 2 deletions src/datasets/dataset_dict.py
Original file line number Diff line number Diff line change
Expand Up @@ -1670,7 +1670,7 @@ def push_to_hub(
download_config.download_desc = "Downloading metadata"
download_config.token = token
dataset_readme_path = cached_path(
hf_hub_url(repo_id, "README.md"),
hf_hub_url(repo_id, "README.md", revision=branch),
download_config=download_config,
)
dataset_card = DatasetCard.load(Path(dataset_readme_path))
Expand Down Expand Up @@ -1713,7 +1713,7 @@ def push_to_hub(
download_config.download_desc = "Downloading metadata"
download_config.token = token
dataset_infos_path = cached_path(
hf_hub_url(repo_id, config.DATASETDICT_INFOS_FILENAME),
hf_hub_url(repo_id, config.DATASETDICT_INFOS_FILENAME, revision=branch),
download_config=download_config,
)
with open(dataset_infos_path, encoding="utf-8") as f:
Expand Down

0 comments on commit 439e115

Please sign in to comment.