-
Notifications
You must be signed in to change notification settings - Fork 54
MONAI Pipeline Generator #550
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
base: main
Are you sure you want to change the base?
Conversation
tools/pipeline-generator/pipeline_generator/generator/bundle_downloader.py
Outdated
Show resolved
Hide resolved
Signed-off-by: Victor Chang <[email protected]>
Signed-off-by: Victor Chang <[email protected]>
- 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 <[email protected]>
- 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] <[email protected]> Signed-off-by: Victor Chang <[email protected]>
- 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 <[email protected]>
…ator Signed-off-by: Victor Chang <[email protected]>
- 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 <[email protected]>
ef7242b
to
14dbba4
Compare
- 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 <[email protected]>
608e827
to
802691f
Compare
…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 <[email protected]>
There was a problem hiding this 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.
tools/pipeline-generator/pipeline_generator/templates/app.py.j2
Outdated
Show resolved
Hide resolved
tools/pipeline-generator/pipeline_generator/templates/requirements.txt.j2
Outdated
Show resolved
Hide resolved
…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 <[email protected]>
…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 <[email protected]>
- 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 <[email protected]>
- 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 <[email protected]>
- 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 <[email protected]>
- 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 <[email protected]>
- 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 <[email protected]>
- 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 <[email protected]>
…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 <[email protected]>
- 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 <[email protected]>
|
A new tool for creating a MONAI Deploy Application pipeline using a chosen MONAI model.
Tested MONAI models
Unit Test/Coverage