-
Notifications
You must be signed in to change notification settings - Fork 54
add modelzoo functionality #152
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
add modelzoo functionality #152
Conversation
| def test_download_huggingface_model(tmp_path_factory, model="full_cat"): | ||
| folder = tmp_path_factory.mktemp("temp") | ||
| dlclibrary.download_huggingface_model(model, str(folder)) | ||
|
|
||
| assert os.path.exists(folder / "pose_cfg.yaml") | ||
| assert any(f.startswith("snapshot-") for f in os.listdir(folder)) | ||
| # Verify that the Hugging Face folder was removed | ||
| assert not any(f.startswith("models--") for f in os.listdir(folder)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like we're just testing dlclibrary code here?
strongly prefer not duplicating code or configs unless it's unavoidable, getting in the habit of duplicating code trades off with just making a proper dependency tree so that things have a single place they are known to live. DLClibrary looks like pretty much all of its contents are modelzoo things, so basically everything except the export function that requires pytorch looks like a good enhancement for that package! not trying to be a busybody, i just have enjoyed how this package has been very solid and stable and i can just reach into my back pocket and use it whenever. the big code duplication of the pytorch models imo would also have been better as a separate package, but would really like to avoid any further code duplication, as that's a pretty quick path to bloat (and also confusing to downstream users, where rather than "use the model zoo package to do model zoo things" now there are model zoo things in 3 packages and they're all slightly different) |
Motivation:
It would be helpful to have easy access to the torch superanimal models without having to load export them first in DeepLabCut. This PR adds the functionality for direct downloading and exporting the pytorch models from the modelzoo.
Implementation:
The current implementation duplicates code from the DeepLabCut main repository (as is the case for other models). Other solutions are also possible (e.g. hosting the readily exported models online).
Example usage: