Commit d618e6d
MONAI Pipeline Generator (#550)
* Initial check-in for pipeline generator
Signed-off-by: Victor Chang <vicchang@nvidia.com>
* Remove duplicated MONAI models
Signed-off-by: Victor Chang <vicchang@nvidia.com>
* Add ImageOverlayWriter and update ImageDirectoryLoader
- 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>
* Add support for Llama3-VILA-M3 models with new operators
- 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>
* Update README and design documentation for pipeline generator
- 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>
* Bump version from 0.1.0 to 1.0.0 in pyproject.toml for pipeline-generator
Signed-off-by: Victor Chang <vicchang@nvidia.com>
* Refactor operator imports and improve code formatting
- 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>
* Add test pipeline generator workflow and bump version to 1.0.0
- 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>
* Refactor ImageOverlayWriter documentation and enhance model_id validation
- 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>
* Enhance application documentation and refine requirements for pipeline 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>
* Refactor image loading operators and enhance directory scanning functionality
- 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>
* Refactor operator imports and enhance pipeline generator functionality
- 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>
* Refactor operator imports and enhance code clarity
- 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>
* Fix formatting inconsistencies and improve error message clarity
- 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>
* Remove deprecated test file for the pipeline generator
- 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>
* Enhance type hinting and improve code clarity across operators
- 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>
* Enhance pipeline generator functionality and improve bundle organization
- 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>
* Enhance bundle organization and improve model handling in pipeline generator
- 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>
* Refactor whitespace and improve code clarity in pipeline generator
- Removed unnecessary whitespace in the app_generator and bundle_downloader files to enhance readability.
- Streamlined import statements in test files for better organization.
- Ensured consistent formatting across various sections of the codebase.
Signed-off-by: Victor Chang <vicchang@nvidia.com>
* Enhance model handling and CLI functionality in pipeline generator
- Added support for listing all models regardless of file extension with the `--all` flag in the CLI.
- Updated the model listing logic to differentiate between verified and non-verified models.
- Enhanced the model information structure to include detected file extensions and primary extension for better clarity.
- Improved documentation to reflect the new model handling capabilities and supported file formats.
Signed-off-by: Victor Chang <vicchang@nvidia.com>
* Fix formatting
Signed-off-by: Victor Chang <vicchang@nvidia.com>
* Refactor model retrieval logic in HuggingFaceClient
- Updated variable name from 'model' to 'model_info' for clarity in the model retrieval process.
- Ensured consistent naming conventions to enhance code readability.
Signed-off-by: Victor Chang <vicchang@nvidia.com>
* Enhance model loading and configuration handling in MonaiBundleInferenceOperator
- 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>
* Refactor whitespace and improve code clarity in MonaiBundleInferenceOperator 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>
* Improve error handling in model loading for MonaiBundleInferenceOperator
- 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>
* Enhance type hinting in MonaiBundleInferenceOperator
- 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>
* Refactor type hinting in MonaiBundleInferenceOperator
- 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>
* Refactor MonaiBundleInferenceOperator for improved path handling and 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>
* Enhance image conversion logic in MonaiBundleInferenceOperator
- 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>
* Pin monai<=1.5.0 since newly released 1.5.1 introduced breaking changes
Signed-off-by: M Q <mingmelvinq@nvidia.com>
* Was wondering but did not expect the test is asseting on the value in actual code
Signed-off-by: M Q <mingmelvinq@nvidia.com>
* Use bundle_path property for consistency, and added warning note on nii loader
Signed-off-by: M Q <mingmelvinq@nvidia.com>
---------
Signed-off-by: Victor Chang <vicchang@nvidia.com>
Signed-off-by: [Your Name] <your.email@example.com>
Signed-off-by: M Q <mingmelvinq@nvidia.com>
Co-authored-by: M Q <mingmelvinq@nvidia.com>1 parent 4d3e1ab commit d618e6d
45 files changed
Lines changed: 10162 additions & 13 deletions
File tree
- .github/workflows
- monai/deploy/operators
- tools/pipeline-generator
- docs
- pipeline_generator
- cli
- config
- core
- generator
- templates
- operators
- tests
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
Lines changed: 320 additions & 12 deletions
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
26 | 33 | | |
27 | 34 | | |
28 | 35 | | |
| |||
80 | 87 | | |
81 | 88 | | |
82 | 89 | | |
83 | | - | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
84 | 124 | | |
85 | 125 | | |
86 | 126 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
0 commit comments