Add T5 architecture adapter test#1349
Open
RecreationalMath wants to merge 2 commits into
Open
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.
Description
Adds a unit test suite for
T5ArchitectureAdapterundertests/unit/model_bridge/supported_architectures/. It needs no model downloads or real checkpoints as it uses tiny programmaticTransformerBridgeConfigobjects, so it runs on CPU in seconds.The suite (50 tests) covers:
positional_embedding_type = "relative_positional_bias",final_rms = False,supports_fold_ln = False(fold-LN would corrupt T5 RMSNorm weights), and the gated-MLP switch driven bycfg.is_gated_act.pos_embed,encoder_blocks,encoder_ln_final), the decoder stack (decoder_pos_embed,decoder_blocks,decoder_ln_final), plus sharedembedandunembed.block.0.layer.0).q/k/v/oLinearBridges andrequires_relative_position_bias=True, plainMLPBridge(orGatedMLPBridgein Flan-T5).is_cross_attention=Trueand the encoder self-attention must not be.cfg.is_gated_act=True, both encoder and decoder MLPs becomeGatedMLPBridgewithwi_0(gate),wi_1(in),wo(out).T5ForConditionalGenerationandMT5ForConditionalGenerationboth dispatch back toT5ArchitectureAdapter.cross_attnorln3; weight conversions stay empty.Contributes to #1302 (T5 checkbox).
Type of change
Checklist: