Skip to content
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

Automatically download / upload models with hugging face, torch hub #4042

Closed
Nic-Ma opened this issue Apr 1, 2022 · 2 comments · Fixed by #6454
Closed

Automatically download / upload models with hugging face, torch hub #4042

Nic-Ma opened this issue Apr 1, 2022 · 2 comments · Fixed by #6454
Assignees
Labels
Bundles Anything related to bundles Feature request

Comments

@Nic-Ma
Copy link
Contributor

Nic-Ma commented Apr 1, 2022

Is your feature request related to a problem? Please describe.
As MONAI bundle features are ready to use, it would be nice to manage bundle models with hugging face and torch hub, etc.
Like: https://huggingface.co/MONAI/example_spleen_segmentation

So it's necessary to develop features to automatically download / apply models from the hubs, may support bundle package, checkpoint, torchscript model. And for future steps, we can think about how to review new models and execute CICD before approving or uploading to the hub.

@Nic-Ma
Copy link
Contributor Author

Nic-Ma commented Apr 1, 2022

@yiheng-wang-nv is investigating requirements, ideas, solutions, will prepare a proposal soon.

Thanks.

@Nic-Ma Nic-Ma changed the title Automatically download / upload models from hugging face, torch hub Automatically download / upload models with hugging face, torch hub Apr 4, 2022
@Nic-Ma
Copy link
Contributor Author

Nic-Ma commented Apr 4, 2022

Hi @yiheng-wang-nv ,

In my simple mind, I think maybe we can start from the download features and think about below initial ideas first:

  1. Use cases to download with CLI python -m monai.bundle download XXX:
    1.1. download the whole bundle package
    1.2. download the model weights
    1.3. download the TorchScript model
    1.4. download any file, refer to: https://huggingface.co/docs/hub/how-to-downstream
  2. Data source:
    2.1. bundle packages on hugging face
    2.2. (P1) bundle packages on NVIDIA NGC
    2.3. (P1) bundle packages on amazon AWS
    (I think torch hub is just APIs, no storage)
  3. Support 3rd APIs for advanced features:
    3.1. use torch.hub.XXX, refer to: https://github.com/huggingface/transformers/blob/main/hubconf.py
    3.2. (P1) use hugging face API, refer to: https://huggingface.co/docs/hub/adding-a-library
  4. Update the tutorial example to show features.

Thanks.

@ericspod ericspod added the Bundles Anything related to bundles label Jul 6, 2023
wyli pushed a commit that referenced this issue Oct 19, 2023
Fixes #4042 .

### Description
- [x] Add functionality to download a model bundle from the Hugging Face
Hub.
- [x] Add functionality to upload a model bundle to the Hugging Face
Hub.

### Types of changes
<!--- Put an `x` in all the boxes that apply, and remove the not
applicable items -->
- [x] Non-breaking change (fix or new feature that would not break
existing functionality).
- [ ] Breaking change (fix or new feature that would cause existing
functionality to change).
- [x] New tests added to cover the changes.
- [x] Integration tests passed locally by running `./runtests.sh -f -u
--net --coverage`.
- [x] Quick tests passed locally by running `./runtests.sh --quick
--unittests --disttests`.
- [x] In-line docstrings updated.
- [ ] Documentation updated, tested `make html` command in the `docs/`
folder.

---------

Signed-off-by: katielink <link.katie.e@gmail.com>
@wyli wyli moved this to ✅ Done in MONAI core backlog Oct 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bundles Anything related to bundles Feature request
Projects
Status: Done
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants