fix: extend LISA trainer to support missing model architectures#968
Open
Bhavyashah20 wants to merge 1 commit intoOptimalScale:mainfrom
Open
fix: extend LISA trainer to support missing model architectures#968Bhavyashah20 wants to merge 1 commit intoOptimalScale:mainfrom
Bhavyashah20 wants to merge 1 commit intoOptimalScale:mainfrom
Conversation
The class_to_layers_map in DynamicLayerActivationCallback covered only 7 model families. Attempting LISA with Gemma2, Phi3, DeepSeek, OLMo, Falcon or any other modern architecture would hit a cryptic AssertionError with no guidance on how to fix it. Changes: - Expand CLASS_TO_LAYERS_MAP from 7 to 20 architectures - Add _get_layers_attribute() with three-tier resolution: user override first, then map lookup, then dynamic fallback via getattr introspection - Replace eval() calls with _resolve_layers() using getattr traversal - Move user override to highest priority so it can correct map entries - Replace print() with logger.info() for distributed training compatibility - Add pytest suite covering map lookup, fallback, override, DataParallel unwrapping, and non-default paths (Falcon, GPT-NeoX) Fixes OptimalScale#862
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.
Found this while trying to use LISA with a Gemma2 model. The
class_to_layers_map only covered 7 architectures — anything else
hits a cryptic AssertionError with no guidance on how to fix it.
Traced the issue through DynamicLayerActivationCallback.init
and rewrote the resolution logic to handle modern architectures.
Changes:
Phi3, DeepSeek V2/V3, OLMo, Falcon, Cohere, Qwen2-MoE, GPT-NeoX)
wins over the map