-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Define python level abstraction for a Bundle #5821
Comments
CC @wyli @SachidanandAlle for more discussion. Thanks. |
part of #5821 . ### Description This PR enhanced the bundle CLI entry to support different customized bundle workflows. ### 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). - [ ] New tests added to cover the changes. - [ ] Integration tests passed locally by running `./runtests.sh -f -u --net --coverage`. - [ ] Quick tests passed locally by running `./runtests.sh --quick --unittests --disttests`. - [ ] In-line docstrings updated. - [ ] Documentation updated, tested `make html` command in the `docs/` folder. --------- Signed-off-by: Nic Ma <nma@nvidia.com>
part of #5821 Fixes #6303 ### Description This PR simplified the MONAI FL `MonaiAlgo` module to leverage `BundleWorkflow`. The main point is to decouple the bundle read / write related logic with FL module and use predefined required-properties. ### 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). - [ ] New tests added to cover the changes. - [ ] Integration tests passed locally by running `./runtests.sh -f -u --net --coverage`. - [ ] Quick tests passed locally by running `./runtests.sh --quick --unittests --disttests`. - [ ] In-line docstrings updated. - [ ] Documentation updated, tested `make html` command in the `docs/` folder. --------- Signed-off-by: Nic Ma <nma@nvidia.com> Signed-off-by: monai-bot <monai.miccai2019@gmail.com> Co-authored-by: Holger Roth <hroth@nvidia.com> Co-authored-by: monai-bot <monai.miccai2019@gmail.com>
Hi @Nic-Ma
From an end-user perspective, if the monai model weights should be available from the python script (as they are for pytorch and keras) without explicitly downloading the model. For example
or for keras
It will be nice to have similar interface for MONAI models. As far as I understand and used, we can create a model architecture in the similar way in MONAI, but they are not populated with model weights. We looked at loading torchvision models and fine-tuning their model weights in this pull request last year with @wyli. So maybe if we can reach a place where we can load the model weights as follows
At this point, the user might want to query the model I/O for the purposes of fine-tuning. A user should be able to call something like
which should produce an output
The user should be able to peel the last layer and attach a different layer for fine-tuning purposes. |
Hi Team, I would like to add my 2 cents to the issue based on what @vikashg proposed. We primarily use MONAI for our config parsing (through However, what we would really like is for users to have simplified access to a model-loading interface. The MONAI bundles on model zoo provide a very nice way to ship models for training and inference but I fear users could be a bit challenged by a new interface. Offering a standard torchvision-like interface, in addition to the existing interface, would be amazing. from monai.networks.nets import densenet121
model = densenet121(pretrained="pathology_nuclei_classification") # pretrained / weights Where the model now loads pre-trained weights from the In terms of implementation, I spotted that there is already a Line 341 in 5feb353
Could it be of interest to look at this feature for existing networks in the MONAI library? This way the weights could be loaded for inference (even finetuning, especially in our case as we provide self-supervised models) and users could be pointed toward the full bundle for reproducibility and more advanced use cases. So this would be sort of an easy "entry point" to existing MONAI bundle models. |
Hi @wyli, do you think something like the above would be of interest? |
yes, that's a good point, thanks for the comments @surajpaib, @KumoLiu is designing a new pythonic user experience https://docs.google.com/presentation/d/1z3rVJWX7LMcyTrCH-K9dFehBuEksFj0f8bobmJ-DJPA will let you know when a prototype is ready |
Hi @surajpaib, given your comment above, we were able to support getting instantiated nets directly from a bundle in the 1.3 release, which can be used directly in the existing pipeline.
Feel free to share the feedback. |
Is your feature request related to a problem? Please describe.
Currently, we developed many bundles in the
model-zoo
repo and developed theConfigParser
to load configs.But actually we don't have a clear definition about what a Bundle is in the python level.
It would be nice to define the Bundle class to represent a bundle and enable users to follow & define their customized bundle structure, and provide the APIs for other applications to easily load and handle a bundle, like
MONAI Label
,MONAI FL
, etc.Several draft steps to do:
BundleWorkflow
interface and implement config-based subclass, so bundle can be implemented with JSON/YAML config or python code, just need to follow the interface.BYOCBundleWorkflow
inbundle/scripts/
.Bundle
interface for the whole bundle, mainly about folder structure, files, download, etc.The text was updated successfully, but these errors were encountered: