Skip to content

Commit

Permalink
fix local dir; handle lfs for mp4
Browse files Browse the repository at this point in the history
  • Loading branch information
qgallouedec committed Jul 23, 2024
1 parent d2b28f6 commit 96efcb3
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions rl_zoo3/push_to_hub.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,12 +195,15 @@ def package_to_hub(
private=False,
exist_ok=True,
)

# Git pull
# Retrieve current repo state
repo_local_path = Path(local_repo_path) / repo_name
api.snapshot_download(repo_id=repo_id, local_dir=repo_local_path)

# Retrieve current repo state
api.snapshot_download(repo_id=repo_id, local_dir=local_repo_path)
# Add mp4 files to .gitattributes
with open(repo_local_path / ".gitattributes", "a+") as f:
f.seek(0) # Move the file pointer to the beginning of the file
if not any("*.mp4" in line for line in f):
f.write("*.mp4 filter=lfs diff=lfs merge=lfs -text\n")

# Step 1: Save the model
print("Saving model to:", repo_local_path / model_name)
Expand Down

0 comments on commit 96efcb3

Please sign in to comment.