Skip to content

Commit 7a7f0f0

Browse files
authored
Merge pull request #5 from jeylau/main
Minor improvements, fixes and addition of GitHub's CI workflow
2 parents 793e8ea + aad8e51 commit 7a7f0f0

File tree

6 files changed

+50
-6
lines changed

6 files changed

+50
-6
lines changed

.github/workflows/test_package.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Test suite
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
7+
jobs:
8+
build:
9+
runs-on: ${{ matrix.os }}
10+
11+
strategy:
12+
fail-fast: true
13+
matrix:
14+
os: [ubuntu-latest, macos-11, windows-latest]
15+
python-version: [3.9]
16+
17+
steps:
18+
- name: Checkout code
19+
uses: actions/checkout@v3
20+
- name: Set up Python ${{ matrix.python-version }}
21+
uses: actions/setup-python@v4
22+
with:
23+
python-version: ${{ matrix.python-version }}
24+
25+
- name: Install dependencies
26+
run: |
27+
python -m pip install --upgrade pip
28+
pip install pytest
29+
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
30+
31+
- name: Run pytest tests
32+
run: |
33+
pytest

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,3 +130,4 @@ dmypy.json
130130
.pyre/
131131

132132
*DS_STORE
133+
.vscode/*

dlclibrary/modelzoo_urls.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212

1313

1414
#Model Zoo from HuggingFace
15-
full_human: mwmathis/DeepLabCutModelZoo-DLC_human_fullbody_resnet_101/DLC_human_fullbody_resnet_101.tar.gz
16-
full_human_commit: 7438131c2ee7754a9732bef6fbf46b8189a16c48
15+
full_human: mwmathis/DeepLabCutModelZoo-DLC_human_fullbody_resnet_101/DLC_human_dancing_resnet_101_iteration-0_shuffle-1.tar.gz
16+
full_human_commit: 01acf989bfec7a25110b94677449d9e861b5ea81
1717
full_cat: AlexEMG/DeepLabCutModelZoo-cat/DLC_Cat_resnet_50_iteration-0_shuffle-0.tar.gz
1818
full_cat_commit: 972f82dc575c820ce556e140465495a32d18ee9b
1919
full_dog: AlexEMG/DeepLabCutModelZoo-dog/DLC_Dog_resnet_50_iteration-0_shuffle-0.tar.gz

requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
huggingface_hub==0.11.1
2+
ruamel.yaml==0.17.21

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
url="https://github.com/DeepLabCut/DLClib",
2525
install_requires=[
2626
"huggingface_hub",
27+
"ruamel.yaml>=0.15.0",
2728
],
2829
packages=setuptools.find_packages(),
2930
data_files=[

tests/test_modeldownload.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,25 @@
1111
import dlclibrary
1212
import os
1313
import pytest
14+
from dlclibrary.dlcmodelzoo.modelzoo_download import MODELOPTIONS
1415

1516

16-
def test_download_huggingface_model(tmp_path_factory):
17-
folder = tmp_path_factory.mktemp("cat")
18-
dlclibrary.download_huggingface_model("full_cat", str(folder))
17+
def test_download_huggingface_model(tmp_path_factory, model="full_cat"):
18+
folder = tmp_path_factory.mktemp("temp")
19+
dlclibrary.download_huggingface_model(model, str(folder))
1920

2021
assert os.path.exists(folder / "pose_cfg.yaml")
21-
assert os.path.exists(folder / "snapshot-75000.meta")
22+
assert any(f.startswith("snapshot-") for f in os.listdir(folder))
2223
# Verify that the Hugging Face folder was removed
2324
assert not any(f.startswith("models--") for f in os.listdir(folder))
2425

2526

2627
def test_download_huggingface_wrong_model():
2728
with pytest.raises(ValueError):
2829
dlclibrary.download_huggingface_model("wrong_model_name")
30+
31+
32+
@pytest.mark.skip
33+
@pytest.mark.parametrize("model", MODELOPTIONS)
34+
def test_download_all_models(tmp_path_factory, model):
35+
test_download_huggingface_model(tmp_path_factory, model)

0 commit comments

Comments
 (0)