Add TorchScript model (model.ts) for Swin UNETR segmentation
Fixes # .
Description
This PR adds a traced TorchScript model (model.ts) to address issue #511 in the monai-deploy-app-sdk repository, where the ai_unetr_seg_app example cannot run due to a missing traced model. The original error in the app was: monai.deploy.exceptions.ItemNotExistsError: A predictor of the model is not set. The example app expects a TorchScript model, but the current model provided in the Model Zoo (model_swin_unetr_btcv_segmentation_v1.pt) is a standard PyTorch model, not a TorchScript format.
Solution I've created a traced version of the Swin UNETR BTCV segmentation model by:
Loading the original model's state dictionary Creating a new SwinUNETR instance with the correct parameters Tracing the model using torch.jit.trace with appropriate input dimensions Preparing the necessary model file structure according to Model Zoo guidelines
Status
Ready
Please ensure all the checkboxes:
- [x] Codeformat tests passed locally by running
./runtests.sh --codeformat. - [ ] In-line docstrings updated.
- [ ] Update
versionandchangeloginmetadata.jsonif changing an existing bundle. - [ ] Please ensure the naming rules in config files meet our requirements (please refer to:
CONTRIBUTING.md). - [ ] Ensure versions of packages such as
monai,pytorchandnumpyare correct inmetadata.json. - [ ] Descriptions should be consistent with the content, such as
eval_metricsof the provided weights and TorchScript modules. - [x] Files larger than 25MB are excluded and replaced by providing download links in
large_file.yml. - [ ] Avoid using path that contains personal information within config files (such as use
/home/your_name/for"bundle_root").
@MMelQin In case you'd like to review as well.
Hi @cvbourne , thanks for the PR, could you also update the change log and version in the modified bundle's metadata.json? Thanks!