Skip to content

MONAI Pipeline Generator#550

Merged
MMelQin merged 32 commits into
mainfrom
vchang/monai-hf
Sep 26, 2025
Merged

MONAI Pipeline Generator#550
MMelQin merged 32 commits into
mainfrom
vchang/monai-hf

Conversation

@mocsharp
Copy link
Copy Markdown
Collaborator

@mocsharp mocsharp commented Aug 13, 2025

A new tool for creating a MONAI Deploy Application pipeline using a chosen MONAI model.

Tested MONAI models

❯ uv run pg list 
Fetching models from HuggingFace...
INFO     Checking TorchScript models from organization: MONAI                                                                                                                                                                                                           
INFO     Checking TorchScript model: LGAI-EXAONE/EXAONEPath                                                                                                                                                                                                             
INFO     Checking TorchScript model: LGAI-EXAONE/EXAONEPath-CRC-MSI-Predictor                                                                                                                                                                                           
                                                            Available Models                                                            
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━┓
┃ Model ID                                 ┃ Name                                      ┃ MONAI Bundle ┃ Status     ┃ Downloads ┃ Likes ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━┩
│ MONAI/brats_mri_segmentation             │ MONAI/brats_mri_segmentation              │ ✓ Yes        │            │       N/A │     3 │
│ MONAI/endoscopic_inbody_classification   │ MONAI/endoscopic_inbody_classification    │ ✓ Yes        │            │       N/A │   N/A │
│ MONAI/endoscopic_tool_segmentation       │ MONAI/endoscopic_tool_segmentation        │ ✓ Yes        │ ✓ Verified │       N/A │     2 │
│ MONAI/example_spleen_segmentation        │ MONAI/example_spleen_segmentation         │ ✓ Yes        │ ✓ Verified │       N/A │     6 │
│ MONAI/lung_nodule_ct_detection           │ MONAI/lung_nodule_ct_detection            │ ✓ Yes        │            │       N/A │     1 │
│ MONAI/multi_organ_segmentation           │ MONAI/multi_organ_segmentation            │ ✓ Yes        │ ✓ Verified │       N/A │   N/A │
│ MONAI/pancreas_ct_dints_segmentation     │ MONAI/pancreas_ct_dints_segmentation      │ ✓ Yes        │ ✓ Verified │       N/A │   N/A │
│ MONAI/pathology_nuclei_classification    │ MONAI/pathology_nuclei_classification     │ ✓ Yes        │            │       N/A │   N/A │
│ MONAI/pathology_nuclick_annotation       │ MONAI/pathology_nuclick_annotation        │ ✓ Yes        │            │       N/A │     1 │
│ MONAI/pediatric_abdominal_ct_segmentati… │ MONAI/pediatric_abdominal_ct_segmentation │ ✓ Yes        │ ✓ Verified │       N/A │     1 │
│ MONAI/prostate_mri_anatomy               │ MONAI/prostate_mri_anatomy                │ ✓ Yes        │            │       N/A │   N/A │
│ MONAI/spleen_ct_segmentation             │ MONAI/spleen_ct_segmentation              │ ✓ Yes        │ ✓ Verified │       N/A │   N/A │
│ MONAI/spleen_deepedit_annotation         │ MONAI/spleen_deepedit_annotation          │ ✓ Yes        │            │       N/A │   N/A │
│ MONAI/ventricular_short_axis_3label      │ MONAI/ventricular_short_axis_3label       │ ✓ Yes        │            │       N/A │     1 │
└──────────────────────────────────────────┴───────────────────────────────────────────┴──────────────┴────────────┴───────────┴───────┘

Total models: 14 (MONAI Bundles: 14, Verified: 6)

To list all available models:

uv run pg list --all
Fetching models from HuggingFace...
Note: Fetching detailed info for MONAI Bundles to show accurate extension data
INFO     Fetching models from organization: MONAI                                                                                                                                                                                                                       
INFO     Fetching model: LGAI-EXAONE/EXAONEPath                                                                                                                                                                                                                         
INFO     Fetching model: LGAI-EXAONE/EXAONEPath-CRC-MSI-Predictor                                                                                                                                                                                                       
                                                                    Available Models                                                                    
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━┓
┃ Model ID                                 ┃ Name                                               ┃ MONAI Bundle        ┃ Status     ┃ Downloads ┃ Likes ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━┩
│ LGAI-EXAONE/EXAONEPath                   │ LGAI-EXAONE/EXAONEPath                             │ ✗ No (.safetensors) │            │        65 │    19 │
│ LGAI-EXAONE/EXAONEPath-CRC-MSI-Predictor │ LGAI-EXAONE/EXAONEPath-CRC-MSI-Predictor           │ ✗ No (.pt)          │            │       N/A │     5 │
│ MONAI/Llama3-VILA-M3-13B                 │ MONAI/Llama3-VILA-M3-13B                           │ ✗ No (.safetensors) │ ✓ Verified │        87 │     8 │
│ MONAI/Llama3-VILA-M3-3B                  │ MONAI/Llama3-VILA-M3-3B                            │ ✗ No (.safetensors) │ ✓ Verified │       102 │     7 │
│ MONAI/Llama3-VILA-M3-8B                  │ MONAI/Llama3-VILA-M3-8B                            │ ✗ No (.safetensors) │ ✓ Verified │       250 │    10 │
│ MONAI/VISTA3D-HF                         │ MONAI/VISTA3D-HF                                   │ ✗ No (.safetensors) │            │       N/A │     3 │
│ MONAI/brain_image_synthesis_latent_diff… │ MONAI/brain_image_synthesis_latent_diffusion_model │ ✗ No (.pt)          │            │       N/A │     1 │
│ MONAI/brats_mri_axial_slices_generative… │ MONAI/brats_mri_axial_slices_generative_diffusion  │ ✗ No (.pt)          │            │       N/A │     1 │
│ MONAI/brats_mri_generative_diffusion     │ MONAI/brats_mri_generative_diffusion               │ ✗ No (.pt)          │            │       N/A │   N/A │
│ MONAI/brats_mri_segmentation             │ MONAI/brats_mri_segmentation                       │ ✓ Yes               │            │       N/A │     3 │
│ MONAI/breast_density_classification      │ MONAI/breast_density_classification                │ ✗ No (.pt)          │ ✓ Verified │       N/A │     1 │
│ MONAI/classification_template            │ MONAI/classification_template                      │ ✗ No (.pt)          │            │       N/A │   N/A │
│ MONAI/cxr_image_synthesis_latent_diffus… │ MONAI/cxr_image_synthesis_latent_diffusion_model   │ ✗ No (.pt)          │            │       N/A │     2 │
│ MONAI/endoscopic_inbody_classification   │ MONAI/endoscopic_inbody_classification             │ ✓ Yes               │            │       N/A │   N/A │
│ MONAI/endoscopic_tool_segmentation       │ MONAI/endoscopic_tool_segmentation                 │ ✓ Yes               │ ✓ Verified │       N/A │     2 │
│ MONAI/example_spleen_segmentation        │ MONAI/example_spleen_segmentation                  │ ✓ Yes               │ ✓ Verified │       N/A │     6 │
│ MONAI/lung_nodule_ct_detection           │ MONAI/lung_nodule_ct_detection                     │ ✓ Yes               │            │       N/A │     1 │
│ MONAI/maisi_ct_generative                │ MONAI/maisi_ct_generative                          │ ✗ No (.pt)          │            │       N/A │     1 │
│ MONAI/mediastinal-anatomy-v2.0.0         │ MONAI/mediastinal-anatomy-v2.0.0                   │ ✗ No (.pt)          │            │       N/A │   N/A │
│ MONAI/mednist_ddpm                       │ MONAI/mednist_ddpm                                 │ ✗ No (.pt)          │            │       N/A │   N/A │
│ MONAI/mednist_gan                        │ MONAI/mednist_gan                                  │ ✗ No (.pt)          │            │       N/A │   N/A │
│ MONAI/mednist_reg                        │ MONAI/mednist_reg                                  │ ✗ No (.pt)          │            │       N/A │   N/A │
│ MONAI/multi_organ_segmentation           │ MONAI/multi_organ_segmentation                     │ ✓ Yes               │ ✓ Verified │       N/A │   N/A │
│ MONAI/pancreas_ct_dints_segmentation     │ MONAI/pancreas_ct_dints_segmentation               │ ✓ Yes               │ ✓ Verified │       N/A │   N/A │
│ MONAI/pathology_nuclei_classification    │ MONAI/pathology_nuclei_classification              │ ✓ Yes               │            │       N/A │   N/A │
│ MONAI/pathology_nuclei_segmentation_cla… │ MONAI/pathology_nuclei_segmentation_classification │ ✗ No (.pt)          │            │       N/A │     1 │
│ MONAI/pathology_nuclick_annotation       │ MONAI/pathology_nuclick_annotation                 │ ✓ Yes               │            │       N/A │     1 │
│ MONAI/pathology_tumor_detection          │ MONAI/pathology_tumor_detection                    │ ✗ No (.pt)          │            │       N/A │   N/A │
│ MONAI/pediatric_abdominal_ct_segmentati… │ MONAI/pediatric_abdominal_ct_segmentation          │ ✓ Yes               │ ✓ Verified │       N/A │     1 │
│ MONAI/prostate_mri_anatomy               │ MONAI/prostate_mri_anatomy                         │ ✓ Yes               │            │       N/A │   N/A │
│ MONAI/renalStructures_CECT_segmentation  │ MONAI/renalStructures_CECT_segmentation            │ ✗ No (.pt)          │            │       N/A │   N/A │
│ MONAI/renalStructures_UNEST_segmentation │ MONAI/renalStructures_UNEST_segmentation           │ ✗ No (.pt)          │            │       N/A │   N/A │
│ MONAI/retinalOCT_RPD_segmentation        │ MONAI/retinalOCT_RPD_segmentation                  │ ✗ No (.pth)         │            │       N/A │   N/A │
│ MONAI/segmentation_template              │ MONAI/segmentation_template                        │ ✗ No (.pt)          │            │       N/A │   N/A │
│ MONAI/spleen_ct_segmentation             │ MONAI/spleen_ct_segmentation                       │ ✓ Yes               │ ✓ Verified │       N/A │   N/A │
│ MONAI/spleen_deepedit_annotation         │ MONAI/spleen_deepedit_annotation                   │ ✓ Yes               │            │       N/A │   N/A │
│ MONAI/swin_unetr_btcv_segmentation       │ MONAI/swin_unetr_btcv_segmentation                 │ ✗ No (.pt)          │ ✓ Verified │       N/A │     2 │
│ MONAI/valve_landmarks                    │ MONAI/valve_landmarks                              │ ✗ No (.pt)          │            │       N/A │     1 │
│ MONAI/ventricular_short_axis_3label      │ MONAI/ventricular_short_axis_3label                │ ✓ Yes               │            │       N/A │     1 │
│ MONAI/vista2d                            │ MONAI/vista2d                                      │ ✗ No (.pt)          │            │       N/A │     1 │
│ MONAI/vista3d                            │ MONAI/vista3d                                      │ ✗ No (.pt)          │            │       N/A │   N/A │
│ MONAI/wholeBody_ct_segmentation          │ MONAI/wholeBody_ct_segmentation                    │ ✗ No (.pt)          │ ✓ Verified │       N/A │     2 │
│ MONAI/wholeBrainSeg_Large_UNEST_segment… │ MONAI/wholeBrainSeg_Large_UNEST_segmentation       │ ✗ No (.pt)          │ ✓ Verified │       N/A │     3 │
└──────────────────────────────────────────┴────────────────────────────────────────────────────┴─────────────────────┴────────────┴───────────┴───────┘

Total models: 43 (MONAI Bundles: 14, Verified: 13)

Unit Test/Coverage

❯ uv run pytest --cov=pipeline_generator --cov-report=term

========================================================================================================================= test session starts ==========================================================================================================================
platform linux -- Python 3.10.18, pytest-8.4.1, pluggy-1.6.0
rootdir: /home/vicchang/sc/github/monai/monai-deploy-app-sdk
configfile: setup.cfg
plugins: cov-6.2.1
collected 145 items                                                                                                                                                                                                                                                    

tests/test_bundle_downloader.py ..........................                                                                                                                                                                                                       [ 17%]
tests/test_cli.py ...............                                                                                                                                                                                                                                [ 28%]
tests/test_gen_command.py ..........                                                                                                                                                                                                                             [ 35%]
tests/test_generator.py ..............................                                                                                                                                                                                                           [ 55%]
tests/test_hub_client.py .......................                                                                                                                                                                                                                 [ 71%]
tests/test_models.py .....                                                                                                                                                                                                                                       [ 75%]
tests/test_run_command.py ....................                                                                                                                                                                                                                   [ 88%]
tests/test_security.py ....                                                                                                                                                                                                                                      [ 91%]
tests/test_settings.py .......                                                                                                                                                                                                                                   [ 96%]
tests/test_vlm_generation.py .....                                                                                                                                                                                                                               [100%]

============================================================================================================================ tests coverage ============================================================================================================================
___________________________________________________________________________________________________________ coverage: platform linux, python 3.10.18-final-0 ___________________________________________________________________________________________________________

Name                                                Stmts   Miss  Cover
-----------------------------------------------------------------------
pipeline_generator/__init__.py                          1      0   100%
pipeline_generator/cli/__init__.py                      2      0   100%
pipeline_generator/cli/main.py                        135      1    99%
pipeline_generator/cli/run.py                         153     11    93%
pipeline_generator/config/__init__.py                   2      0   100%
pipeline_generator/config/settings.py                  41      0   100%
pipeline_generator/core/__init__.py                     3      0   100%
pipeline_generator/core/hub_client.py                 101     20    80%
pipeline_generator/core/models.py                      34      0   100%
pipeline_generator/generator/__init__.py                3      0   100%
pipeline_generator/generator/app_generator.py         229      2    99%
pipeline_generator/generator/bundle_downloader.py     124      4    97%
-----------------------------------------------------------------------
TOTAL                                                 828     38    95%
========================================================================================================================= 145 passed in 3.32s ==========================================================================================================================

@mocsharp mocsharp requested a review from MMelQin August 13, 2025 04:07
@mocsharp mocsharp self-assigned this Aug 13, 2025
Comment thread tools/pipeline-generator/pipeline_generator/generator/bundle_downloader.py Outdated
@MMelQin MMelQin requested a review from Copilot August 13, 2025 06:33

This comment was marked as outdated.

@mocsharp mocsharp force-pushed the vchang/monai-hf branch 3 times, most recently from 608e827 to 802691f Compare August 13, 2025 21:47
@mocsharp mocsharp requested a review from Copilot August 13, 2025 22:15

This comment was marked as outdated.

@mocsharp mocsharp requested a review from Copilot August 13, 2025 23:13
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces a new MONAI Pipeline Generator tool that automatically creates MONAI Deploy Application pipelines from MONAI models hosted on HuggingFace. The tool provides a CLI interface to discover, generate, and run medical imaging applications with minimal configuration.

Key changes include:

  • Complete implementation of the pipeline generator with 44 discoverable models from HuggingFace
  • Comprehensive test suite achieving 97% code coverage with 105 tests
  • Full CLI support for listing models, generating applications, and running them

Reviewed Changes

Copilot reviewed 46 out of 47 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
tools/pipeline-generator/pyproject.toml Project configuration with dependencies and build settings
tools/pipeline-generator/pipeline_generator/ Core module structure with generator, config, CLI, and templates
tools/pipeline-generator/tests/ Comprehensive test suite covering all functionality
tools/pipeline-generator/pipeline_generator/templates/ Jinja2 templates for generating application files
tools/pipeline-generator/pipeline_generator/cli/ CLI commands for list, gen, and run operations
Comments suppressed due to low confidence (1)

tools/pipeline-generator/pipeline_generator/generator/app_generator.py:99

  • The regex pattern has an incorrect escape sequence. The backslash before the opening bracket should be properly escaped as \/ instead of \[ to match the forward slash character correctly.
        model_id_pattern = r"^(?!.*\.\.)(?!/)(?!.*//)(?!.*\/$)[A-Za-z0-9_-]+(\/[A-Za-z0-9_-]+)*$"

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

Comment thread tools/pipeline-generator/tests/test_security.py
Comment thread tools/pipeline-generator/pipeline_generator/templates/app.py.j2 Outdated
Comment thread tools/pipeline-generator/pipeline_generator/templates/requirements.txt.j2 Outdated
Signed-off-by: Victor Chang <vicchang@nvidia.com>
Signed-off-by: Victor Chang <vicchang@nvidia.com>
- Introduced ImageOverlayWriter for blending segmentation masks onto RGB images and saving as PNG.
- Updated ImageDirectoryLoader to support channel-first output configuration and improved file searching logic.
- Adjusted documentation and examples to reflect the transition from Poetry to uv for command execution.
- Updated various configuration files and templates to accommodate new features and dependencies.

Signed-off-by: Victor Chang <vicchang@nvidia.com>
- Introduced PromptsLoaderOperator to read prompts from a YAML file and emit them sequentially.
- Added Llama3VILAInferenceOperator for running inference with the Llama3-VILA-M3-3B model, supporting multiple output types.
- Created VLMResultsWriterOperator to write results to disk based on the specified output type.
- Updated configuration files and templates to integrate new operators and support custom input/output types.
- Added unit tests for the new operators to ensure functionality and correctness.

Signed-off-by: [Your Name] <your.email@example.com>
Signed-off-by: Victor Chang <vicchang@nvidia.com>
- Enhanced README with links to MONAI Deploy and MONAI Bundles for better clarity.
- Clarified usage instructions and examples for generating applications from models.
- Updated design documentation to reflect the correct Python version requirement (changed from 3.12 to 3.10).
- Improved descriptions in the generated application structure and additional models section.

Signed-off-by: Victor Chang <vicchang@nvidia.com>
…ator

Signed-off-by: Victor Chang <vicchang@nvidia.com>
- Updated import statements in various operator files to use parentheses for better readability.
- Cleaned up whitespace and formatting inconsistencies across multiple files, enhancing overall code clarity.
- Ensured consistent handling of newlines and indentation in operator implementations and test files.

Signed-off-by: Victor Chang <vicchang@nvidia.com>
- Introduced a new GitHub Actions workflow for testing the pipeline generator, including steps for setting up Python 3.10, installing dependencies, and running tests.
- Updated the version of the pipeline-generator package from 0.1.0 to 1.0.0 in the uv.lock file.
- Refactored import statements and improved code formatting in various files for better readability and consistency.

Signed-off-by: Victor Chang <vicchang@nvidia.com>
…tion

- Moved the documentation for ImageOverlayWriter into the class docstring for better organization and clarity.
- Improved the model_id validation logic in AppGenerator to prevent code injection and path traversal, ensuring stricter input checks.
- Updated the generated application template to reflect changes in the channel_first logic.
- Added unit tests to verify the correctness of the refactored channel_first logic.

Signed-off-by: Victor Chang <vicchang@nvidia.com>
…e generator

- Updated the application class documentation to provide clearer descriptions of the vision-language model (VLM) functionality, including details on prompt processing and output generation.
- Refined the version constraints for the pydicom dependency in the requirements template to ensure compatibility with future updates while maintaining support for existing features.

Signed-off-by: Victor Chang <vicchang@nvidia.com>
…ionality

- Replaced ImageDirectoryLoader with a new GenericDirectoryScanner and ImageFileLoader for improved flexibility in file handling.
- Updated operator imports in the application template to reflect the new structure.
- Added unit tests for the GenericDirectoryScanner to ensure correct functionality, including edge cases for file detection and filtering.
- Removed deprecated NiftiDirectoryLoader and ImageDirectoryLoader to streamline the codebase.

Signed-off-by: Victor Chang <vicchang@nvidia.com>
- Removed deprecated operators from the MONAI Deploy SDK and updated the import paths in the application template to reflect the new structure.
- Introduced new operators such as GenericDirectoryScanner and ImageFileLoader for improved file handling.
- Enhanced the NiftiDataLoader to handle various dimensionalities correctly and added logging for unexpected shapes.
- Updated the pipeline generator to include new operators and refined the requirements for dependencies in the configuration files.
- Added comprehensive tests for the new operators and updated existing tests to ensure functionality and correctness.

Signed-off-by: Victor Chang <vicchang@nvidia.com>
- Updated operator imports in the MONAI Deploy SDK to streamline the structure and improve readability.
- Refined the NiftiDataLoader to ensure proper handling of various dimensionalities and added logging for unexpected shapes.
- Enhanced the pipeline generator to include new operators and improved the handling of output types.
- Cleaned up whitespace and formatting inconsistencies across multiple files for better code clarity.
- Removed deprecated test files related to GenericDirectoryScanner and VLM operators to maintain a clean codebase.

Signed-off-by: Victor Chang <vicchang@nvidia.com>
- Adjusted whitespace in print statements for better readability in the DICOM data loader operator.
- Enhanced the error message in the AppGenerator class to improve clarity regarding valid model_id formats.
- Corrected spacing in the file processing output of the generic directory scanner operator.
- Removed unused import from the test_run_command module to clean up the code.

Signed-off-by: Victor Chang <vicchang@nvidia.com>
- Deleted the __init__.py test file from the pipeline-generator tests directory to clean up the codebase and remove unused files.

Signed-off-by: Victor Chang <vicchang@nvidia.com>
- Added type hints for lists and dictionaries in various operator classes to improve code readability and maintainability.
- Updated import statements to include type ignoring for YAML to prevent type checking issues.
- Refined the initialization of file lists in the GenericDirectoryScanner operator for better type safety.

Signed-off-by: Victor Chang <vicchang@nvidia.com>
- Updated the CLI output to reflect "Verified" models instead of "Tested" for better clarity.
- Added new model configurations for pancreas segmentation and spleen segmentation in the config file.
- Implemented a method to organize downloaded bundle structures into the standard MONAI format, improving file management.
- Enhanced dependency handling in the AppGenerator to resolve conflicts between configuration and metadata.
- Added unit tests to verify the new bundle organization functionality and ensure correct behavior under various scenarios.

Signed-off-by: Victor Chang <vicchang@nvidia.com>
…nerator

- Added functionality to ensure the bundle root is included in sys.path for script imports.
- Introduced a new model configuration for pediatric abdominal CT segmentation in the config file.
- Improved the organization of model files by preferring PyTorch models over TensorRT models and handling subdirectory structures.
- Enhanced unit tests to verify the new model organization logic and ensure correct behavior under various scenarios.

Signed-off-by: Victor Chang <vicchang@nvidia.com>
Comment thread tools/pipeline-generator/docs/design.md
Comment thread tools/pipeline-generator/docs/design.md
Comment thread tools/pipeline-generator/docs/design.md Outdated
Comment thread tools/pipeline-generator/docs/design.md
Comment thread tools/pipeline-generator/docs/design.md
Comment thread tools/pipeline-generator/docs/design.md
Comment thread tools/pipeline-generator/docs/design.md Outdated
Comment thread tools/pipeline-generator/pipeline_generator/config/config.yaml
Comment thread tools/pipeline-generator/pipeline_generator/templates/README.md.j2 Outdated
…nceOperator

- Introduced helper functions to streamline model loading from directory-based bundles and ensure proper configuration parsing.
- Improved error handling for missing model files and configuration metadata.
- Refactored the get_bundle_config function to utilize the new helper for better code organization and readability.
- Updated the NiftiDataLoader to handle image dimensionalities more effectively using SimpleITK metadata.

Signed-off-by: Victor Chang <vicchang@nvidia.com>
…perator and NiftiDataLoader

- Removed unnecessary whitespace in the MonaiBundleInferenceOperator to enhance readability.
- Streamlined function definitions and logging statements in NiftiDataLoader for better organization and clarity.

Signed-off-by: Victor Chang <vicchang@nvidia.com>
- Enhanced exception handling by capturing the original exception in model loading functions to provide clearer error messages.
- Updated the handling of network instantiation errors to include the original exception context for better debugging.

Signed-off-by: Victor Chang <vicchang@nvidia.com>
- Added TYPE_CHECKING imports for torch to improve type hinting and static analysis.
- Utilized type casting for model loading return values to ensure proper type safety and clarity.

Signed-off-by: Victor Chang <vicchang@nvidia.com>
- Updated type hints for device and return values in model loading functions to use the alias `torch_typing` for improved clarity and consistency.
- Enhanced type safety by ensuring all model-related return types are correctly annotated.

Signed-off-by: Victor Chang <vicchang@nvidia.com>
@mocsharp mocsharp requested a review from MMelQin September 22, 2025 17:18
Comment thread monai/deploy/operators/monai_bundle_inference_operator.py Outdated
Comment thread monai/deploy/operators/monai_bundle_inference_operator.py Outdated
Comment thread monai/deploy/operators/monai_bundle_inference_operator.py Outdated
mocsharp and others added 5 commits September 24, 2025 10:34
…image conversion

- Updated bundle path handling to use `Path` objects for consistency and clarity.
- Simplified image conversion logic by consolidating conditional checks into a single line for better readability.
- Ensured that directory checks and model loading operations utilize the updated path handling.

Signed-off-by: Victor Chang <vicchang@nvidia.com>
- Improved handling of different dimensional outputs during image conversion to maintain DICOM pixel data arrangement.
- Added specific cases for 2D and 3D images to ensure correct axis handling and data type conversion.

Signed-off-by: Victor Chang <vicchang@nvidia.com>
… actual code

Signed-off-by: M Q <mingmelvinq@nvidia.com>
…ii loader

Signed-off-by: M Q <mingmelvinq@nvidia.com>
@sonarqubecloud
Copy link
Copy Markdown

Comment thread monai/deploy/operators/nii_data_loader_operator.py
@MMelQin
Copy link
Copy Markdown
Collaborator

MMelQin commented Sep 26, 2025

Merging the pull request, and the tool can only work for all supported models once the App SDK minor release v3.2.0 for folder based MONAI bundle support is released.

@MMelQin MMelQin merged commit d618e6d into main Sep 26, 2025
6 checks passed
@mocsharp mocsharp deleted the vchang/monai-hf branch September 26, 2025 16:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants