test: add adapter unit tests for Phi-3 and Granite (+ GraniteMoe)#1399
Merged
jlarson4 merged 1 commit intoJun 18, 2026
Merged
Conversation
Adds focused test suites for three architecture adapters per the proposal in issue TransformerLensOrg#1302. tests/unit/model_bridge/supported_architectures/test_phi3_adapter.py - Component mapping structure (bridge types and HF module paths) - Weight conversion key set and source keys for fused qkv/gate_up - _SizedSplitConversion numerical correctness (Q/K/V GQA splits) - Config flags (RMS norm, rotary, gated MLP, supports_fold_ln=False) - preprocess_weights LN folding into QKV and gate/up projections tests/unit/model_bridge/supported_architectures/test_granite_adapter.py - Component mapping for dense GraniteArchitectureAdapter - Weight conversion key set (standard QKVO rearrangements) - Config flags (final_rms=True, default_prepend_bos=False, GQA heads) - GraniteMoeArchitectureAdapter: MoE bridge replaces dense MLP, all other components and config flags match dense Granite Closes part of TransformerLensOrg#1302.
Collaborator
|
Excellent work on this! Merging |
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.
Adds focused test suites for three architecture adapters per issue #1302.
What this adds
test_phi3_adapter.py(33 tests)qkv_projandgate_up_proj_SizedSplitConversionnumerical correctness: Q/K/V GQA splits along dim=0 and dim=1, value correctness, three-slice reconstructionnormalization_type="RMS",positional_embedding_type="rotary",gated_mlp=True,supports_fold_ln=Falsepreprocess_weights: LN scale folded into QKV and gate/up weights, LN set to ones afterwards, skipped when_fold_ln_requested=Falsetest_granite_adapter.py(22 tests)GraniteArchitectureAdapter: component mapping, weight conversion key set, config flags (final_rms=True,default_prepend_bos=False, GQA head propagation)GraniteMoeArchitectureAdapter: MoE bridge replaces dense MLP withblock_sparse_moe; all other components and config flags match the dense variantAll 55 tests pass locally.
Checklist