Skip to content

Commit 1cf1d26

Browse files
authored
Merge branch 'master' into master
2 parents a601674 + 726e2f1 commit 1cf1d26

File tree

4 files changed

+77
-70
lines changed

4 files changed

+77
-70
lines changed

.github/workflows/ci.yml

+41-38
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ name: CI
55

66
on:
77
push:
8-
branches: [ master ]
8+
branches: [master]
99
pull_request:
10-
branches: [ master ]
10+
branches: [master]
1111

1212
jobs:
1313
build:
@@ -20,43 +20,46 @@ jobs:
2020
strategy:
2121
matrix:
2222
python-version: ["3.8", "3.9", "3.10", "3.11"]
23+
2324
steps:
24-
- uses: actions/checkout@v2
25-
with:
26-
submodules: true
27-
- name: Set up Python ${{ matrix.python-version }}
28-
uses: actions/setup-python@v2
29-
with:
30-
python-version: ${{ matrix.python-version }}
31-
- name: Install dependencies
32-
run: |
33-
python -m pip install --upgrade pip
25+
- uses: actions/checkout@v3
26+
with:
27+
submodules: true
28+
- name: Set up Python ${{ matrix.python-version }}
29+
uses: actions/setup-python@v4
30+
with:
31+
python-version: ${{ matrix.python-version }}
32+
- name: Install dependencies
33+
run: |
34+
python -m pip install --upgrade pip
3435
35-
# Install Atari Roms
36-
pip install autorom
37-
wget https://gist.githubusercontent.com/jjshoots/61b22aefce4456920ba99f2c36906eda/raw/00046ac3403768bfe45857610a3d333b8e35e026/Roms.tar.gz.b64
38-
base64 Roms.tar.gz.b64 --decode &> Roms.tar.gz
39-
AutoROM --accept-license --source-file Roms.tar.gz
36+
# Install Atari Roms
37+
pip install autorom
38+
wget https://gist.githubusercontent.com/jjshoots/61b22aefce4456920ba99f2c36906eda/raw/00046ac3403768bfe45857610a3d333b8e35e026/Roms.tar.gz.b64
39+
base64 Roms.tar.gz.b64 --decode &> Roms.tar.gz
40+
AutoROM --accept-license --source-file Roms.tar.gz
4041
41-
# cpu version of pytorch - faster to download
42-
pip install torch==2.3.1 --index-url https://download.pytorch.org/whl/cpu
42+
# cpu version of pytorch - faster to download
43+
pip install torch==2.3.1 --index-url https://download.pytorch.org/whl/cpu
4344
44-
pip install -r requirements.txt
45-
# Use headless version
46-
pip install opencv-python-headless
47-
pip install -e .[plots,tests]
48-
- name: Lint with ruff
49-
run: |
50-
make lint
51-
- name: Check codestyle
52-
run: |
53-
make check-codestyle
54-
- name: Build doc
55-
run: |
56-
make doc
57-
- name: Type check
58-
run: |
59-
make type
60-
- name: Test with pytest
61-
run: |
62-
make pytest
45+
pip install -r requirements.txt
46+
# Use headless version
47+
pip install opencv-python-headless
48+
pip install -e .[plots,tests]
49+
- name: Lint with ruff
50+
run: |
51+
make lint
52+
- name: Check codestyle
53+
run: |
54+
make check-codestyle
55+
- name: Build the doc
56+
run: |
57+
make doc
58+
- name: Type check
59+
run: |
60+
make type
61+
# Do not run for python 3.8 (mypy internal error)
62+
if: matrix.python-version != '3.8'
63+
- name: Test with pytest
64+
run: |
65+
make pytest

.github/workflows/trained_agents.yml

+27-26
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ name: Check-Trained-Agents
55

66
on:
77
push:
8-
branches: [ master ]
8+
branches: [master]
99
pull_request:
10-
branches: [ master ]
10+
branches: [master]
1111

1212
jobs:
1313
build:
@@ -21,30 +21,31 @@ jobs:
2121
strategy:
2222
matrix:
2323
python-version: ["3.8", "3.9", "3.10", "3.11"]
24+
2425
steps:
25-
- uses: actions/checkout@v3
26-
with:
27-
submodules: true
28-
- name: Set up Python ${{ matrix.python-version }}
29-
uses: actions/setup-python@v4
30-
with:
31-
python-version: ${{ matrix.python-version }}
32-
- name: Install dependencies
33-
run: |
34-
python -m pip install --upgrade pip
26+
- uses: actions/checkout@v3
27+
with:
28+
submodules: true
29+
- name: Set up Python ${{ matrix.python-version }}
30+
uses: actions/setup-python@v4
31+
with:
32+
python-version: ${{ matrix.python-version }}
33+
- name: Install dependencies
34+
run: |
35+
python -m pip install --upgrade pip
3536
36-
# Install Atari Roms
37-
pip install autorom
38-
wget https://gist.githubusercontent.com/jjshoots/61b22aefce4456920ba99f2c36906eda/raw/00046ac3403768bfe45857610a3d333b8e35e026/Roms.tar.gz.b64
39-
base64 Roms.tar.gz.b64 --decode &> Roms.tar.gz
40-
AutoROM --accept-license --source-file Roms.tar.gz
37+
# Install Atari Roms
38+
pip install autorom
39+
wget https://gist.githubusercontent.com/jjshoots/61b22aefce4456920ba99f2c36906eda/raw/00046ac3403768bfe45857610a3d333b8e35e026/Roms.tar.gz.b64
40+
base64 Roms.tar.gz.b64 --decode &> Roms.tar.gz
41+
AutoROM --accept-license --source-file Roms.tar.gz
4142
42-
# cpu version of pytorch - faster to download
43-
pip install torch==2.3.1 --index-url https://download.pytorch.org/whl/cpu
44-
pip install -r requirements.txt
45-
# Use headless version
46-
pip install opencv-python-headless
47-
pip install -e .[plots,tests]
48-
- name: Check trained agents
49-
run: |
50-
make check-trained-agents
43+
# cpu version of pytorch - faster to download
44+
pip install torch==2.3.1 --index-url https://download.pytorch.org/whl/cpu
45+
pip install -r requirements.txt
46+
# Use headless version
47+
pip install opencv-python-headless
48+
pip install -e .[plots,tests]
49+
- name: Check trained agents
50+
run: |
51+
make check-trained-agents

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
- Added `CrossQ` hyperparameters for SB3-contrib
99

1010
### Bug fixes
11+
- 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)
1112

1213
### Documentation
1314

rl_zoo3/push_to_hub.py

+8-6
Original file line numberDiff line numberDiff line change
@@ -195,13 +195,15 @@ def package_to_hub(
195195
private=False,
196196
exist_ok=True,
197197
)
198-
199-
# Git pull
198+
# Retrieve current repo state
200199
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)
200+
api.snapshot_download(repo_id=repo_id, local_dir=repo_local_path)
203201

204-
repo.lfs_track(["*.mp4"])
202+
# Add mp4 files to .gitattributes
203+
with open(repo_local_path / ".gitattributes", "a+") as f:
204+
f.seek(0) # Move the file pointer to the beginning of the file
205+
if not any("*.mp4" in line for line in f):
206+
f.write("*.mp4 filter=lfs diff=lfs merge=lfs -text\n")
205207

206208
# Step 1: Save the model
207209
print("Saving model to:", repo_local_path / model_name)
@@ -269,7 +271,7 @@ def package_to_hub(
269271
save_model_card(repo_local_path, generated_model_card, metadata)
270272

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

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

0 commit comments

Comments
 (0)