Model fine-tuning
When MAISI NIM is running, by default, it automatically downloads the MAISI model bundle and weights from NGC into the NIM container. However, if you wish to fine-tune MAISI and continue using it within NIM, here is detailed guide to utilize a custom model bundle and weights in MAISI NIM.
Fine-tune the Model
Please follow this tutorial on Project MONAI to learn about how to train a MAISI model.
Use the fine-tuned model in NIM
Once you have the fine-tuned MAISI bundle at your local storage, you simply need to mount it to /opt/bundle and set the correct model manifest profile for it by setting NIM_MANIFEST_PROFILE environment variable.
Here is the full command to run the NIM with fine-tuned model.
Here is the list of available profiles:
56df3d486bbd1c8ac4a1de4d613d4037927bd462d751bf4fe9cbeb8d14890cb8: (default profile) downloads and use MAISI bundle on NGC.43d0baebee73b7bdc2f9c7edf5c726b2323b4f7283eab92fab893d451592656d: utilizes the user provided MAISI bundle (fine-tuned model) at/opt/bundle.
Troubleshooting
If you encounter issues while using the fine-tuned model, here are some common troubleshooting steps:
Common Issues
-
Model not loading: Ensure that the path to the fine-tuned bundle is correct and that the bundle is properly mounted to /opt/bundle. You may see this error if the bundle is not mounted under
/opt/bundle:and this one if the local directory (which is mounted to
/opt/bundle) does not contain the necessary bundle files: -
Incorrect Profile: Verify that the NIM_MANIFEST_PROFILE environment variable is set to the correct profile ID. The profile ID needs to be one of the above-mentioned IDs. Otherwise, you may end up with some automatic profile selection. For fine-tuned model, you can check in the logs to see if the profile is properly set:
-
Docker Permissions: Make sure you have the necessary permissions to run Docker commands and access the specified directories.
Logs and Debugging
To view logs and debug issues, you can use the following Docker commands:
View Logs:
Access Container Shell: