Skip to content

Commit

Permalink
Commits from #462
Browse files Browse the repository at this point in the history
  • Loading branch information
qgallouedec committed Jul 23, 2024
1 parent e1a40be commit 078df59
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
### New Features

### Bug fixes
- 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)

### Documentation

Expand Down
7 changes: 3 additions & 4 deletions rl_zoo3/push_to_hub.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,10 +198,9 @@ def package_to_hub(

# Git pull
repo_local_path = Path(local_repo_path) / repo_name
repo = Repository(repo_local_path, clone_from=repo_url)
repo.git_pull(rebase=True)

repo.lfs_track(["*.mp4"])
# Retrieve current repo state
api.hf_hub_download(repo_id=repo_id, local_dir=local_repo_path)

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

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

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

0 comments on commit 078df59

Please sign in to comment.