Skip to content

Commit 078df59

Browse files
committed
Commits from #462
1 parent e1a40be commit 078df59

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
### New Features
88

99
### Bug fixes
10+
- Replaced deprecated `huggingface_hub.Repository` when pushing to Hugging Face Hub by the recommended `HfApi` (see https://huggingface.co/docs/huggingface_hub/concepts/git_vs_http) (@cochaviz)
1011

1112
### Documentation
1213

rl_zoo3/push_to_hub.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -198,10 +198,9 @@ def package_to_hub(
198198

199199
# Git pull
200200
repo_local_path = Path(local_repo_path) / repo_name
201-
repo = Repository(repo_local_path, clone_from=repo_url)
202-
repo.git_pull(rebase=True)
203201

204-
repo.lfs_track(["*.mp4"])
202+
# Retrieve current repo state
203+
api.hf_hub_download(repo_id=repo_id, local_dir=local_repo_path)
205204

206205
# Step 1: Save the model
207206
print("Saving model to:", repo_local_path / model_name)
@@ -269,7 +268,7 @@ def package_to_hub(
269268
save_model_card(repo_local_path, generated_model_card, metadata)
270269

271270
msg.info(f"Pushing repo {repo_name} to the Hugging Face Hub")
272-
repo.push_to_hub(commit_message=commit_message)
271+
api.upload_folder(repo_id=repo_id, folder_path=repo_local_path, commit_message=commit_message)
273272

274273
msg.info(f"Your model is pushed to the hub. You can view your model here: {repo_url}")
275274
return repo_url

0 commit comments

Comments
 (0)