feat: Enhanced LoRA transforms with flexible path mapping and Pydantic model support - #46
Draft
zhaozuy wants to merge 13 commits into
Draft
feat: Enhanced LoRA transforms with flexible path mapping and Pydantic model support#46zhaozuy wants to merge 13 commits into
zhaozuy wants to merge 13 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Introduces enhanced LoRA adapter transforms that address architectural limitations in the current implementation while maintaining full backward compatibility.
Motivation
The current LoRA transform implementation has several limitations:
Changes Made
🆕 Enhanced Transform Architecture:
BaseLoRAApiTransform: Clean ABC-based architecture with separation of concernsLoadLoraApiTransform&UnloadLoraApiTransform: Modular, specialized transform classeslora_factory.py: Enhanced decorator factory with flexible configurationEnhanced Public API:
register_load_adapter_handler()andregister_unload_adapter_handler()engine_request_lora_name_path&engine_request_lora_src_path: Flexible path mappingengine_request_model_cls: Pydantic model support for request validationengine_request_defaults: Automatic default value injectionInfrastructure Improvements:
set_value()utility with better typing and optional depth limitsAPI Examples
Old API (still supported):
New API:
Backward Compatibility
request_shapeAPI continues to work unchangedTesting
Files Changed
python/model_hosting_container_standards/sagemaker/lora2/- New enhanced transformspython/model_hosting_container_standards/sagemaker/__init__.py- Enhanced decoratorspython/model_hosting_container_standards/common/transforms/utils.py- Utility improvementsBy submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.