Skip to content

Commit 348e908

Browse files
committed
instructions for adding a model; unskip tests to download all
1 parent e603bd7 commit 348e908

File tree

2 files changed

+12
-19
lines changed

2 files changed

+12
-19
lines changed

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,14 @@ model_dir = Path("./superanimal_quadruped_model")
3434
model_dir.mkdir()
3535
download_huggingface_model("superanimal_quadruped", model_dir)
3636
```
37+
38+
## How to add a new model?
39+
40+
Pick a good model_name. Follow the (novel) naming convention (modeltype_species), e.g. ```superanimal_topviewmouse```.
41+
42+
1. Add the model_name with path and commit ID to: https://github.com/DeepLabCut/DLClibrary/blob/main/dlclibrary/dlcmodelzoo/modelzoo_urls.yaml
43+
44+
2. Add the model name to the constant: MODELOPTIONS
45+
https://github.com/DeepLabCut/DLClibrary/blob/main/dlclibrary/dlcmodelzoo/modelzoo_download.py#L15
46+
47+
3. For superanimal models also fill in the configs!

tests/test_modeldownload.py

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -23,24 +23,6 @@ def test_download_huggingface_model(tmp_path_factory, model="full_cat"):
2323
# Verify that the Hugging Face folder was removed
2424
assert not any(f.startswith("models--") for f in os.listdir(folder))
2525

26-
def test_download_huggingface_superanimalmousemodel(tmp_path_factory, model="superanimal_topviewmouse"):
27-
folder = tmp_path_factory.mktemp("temp")
28-
dlclibrary.download_huggingface_model(model, str(folder))
29-
30-
assert os.path.exists(folder / "pose_cfg.yaml")
31-
assert any(f.startswith("snapshot-") for f in os.listdir(folder))
32-
# Verify that the Hugging Face folder was removed
33-
assert not any(f.startswith("models--") for f in os.listdir(folder))
34-
35-
def test_download_huggingface_superquadrupedmodel(tmp_path_factory, model="superanimal_quadruped"):
36-
folder = tmp_path_factory.mktemp("temp")
37-
dlclibrary.download_huggingface_model(model, str(folder))
38-
39-
assert os.path.exists(folder / "pose_cfg.yaml")
40-
assert any(f.startswith("snapshot-") for f in os.listdir(folder))
41-
# Verify that the Hugging Face folder was removed
42-
assert not any(f.startswith("models--") for f in os.listdir(folder))
43-
4426

4527
def test_download_huggingface_wrong_model():
4628
with pytest.raises(ValueError):
@@ -53,7 +35,7 @@ def test_parse_superanimal_models():
5335
assert "superanimal_topviewmouse" in dict_
5436

5537

56-
@pytest.mark.skip
38+
#@pytest.mark.skip # Not skipping as rarely run!
5739
@pytest.mark.parametrize("model", MODELOPTIONS)
5840
def test_download_all_models(tmp_path_factory, model):
5941
print("Downloading ...", model)

0 commit comments

Comments
 (0)