Skip to content

Move older-style testers of 123 popular models onto static small-config defaults - #50972

Merged
tarekziade merged 2 commits into
mainfrom
tarek-static-defaults-batch3
Nov 19, 2026
Merged

tarekziade merged 2 commits into
mainfrom
tarek-static-defaults-batch3

Conversation

@tarekziade

@tarekziade tarekziade commented Nov 19, 2026 •

Copy link
Copy Markdown
Collaborator

Follow-up to #50916 and #50944. Those made every tester on the shared bases static; this moves 177 older-style testers (plain classes whose sizes are __init__ keyword defaults) onto ModelTesterConfigMixin, for 123 widely used models (t5, bart, clip, vit, whisper, wav2vec2, siglip, llava, qwen2_vl, qwen2_5_vl, deepseek_v3, modernbert, …). The parity test in tests/utils/test_model_tester_defaults.py now covers them.

The pattern (as bert/gpt_neox/opt in #50916)

  • Keyword defaults become a literal small_config_overrides, with defaults = {}; __init__(self, parent, **kwargs) sets the merged values. Explanatory comments stay next to their key.
  • Values __init__ computed (seq_length from patches, token ids from vocab_size, sizes read from a sub-tester's or text_config's defaults) move to get_small_config_defaults(), assigned or setdefault to keep the old precedence. Sub-testers and other objects stay in __init__; composites keep explicit text_kwargs/vision_kwargs parameters.
  • Each TestCase whose setUp builds the tester sets model_tester_class.
  • A TestCase that built its tester with different arguments gets a small subclass tester instead (Wav2Vec2RobustModelTester, GPTBigCodeMHAModelTester, LongT5TGlobalModelTester, …), so the parity check holds without arguments. Three that only vary one-off arguments (HubertRobust, BeitBackbone, SeamlessM4Tv2 text input) keep building it with those arguments and don't set model_tester_class.
  • Standalone decoder testers whose only caller passed is_training=False now default to it. Parameters that were accepted but never stored (is_decoder) are dropped.
  • ChineseCLIP's tester now defaults to the text_kwargs/vision_kwargs its only caller passed.
  • owlv2, mt5 and umt5 are regenerated from their Copied from sources (check_copies --fix_and_overwrite).

Left unchanged: GraniteMoeHybridModelTester (inherits Bamba's tester, which isn't migrated yet) and PerceiverModelTester (its subsampling attribute holds tensors, which the parity check can't compare).

Proof

  • For all 179 tester classes, what the test suite builds (attributes, sub-testers included, and the config from prepare_config_and_inputs_for_common()/prepare_config_and_inputs()) was snapshotted on 96227f0fd5 and on this branch: 177/179 identical and on the mixin with no static/runtime mismatch; the 2 others are the unchanged testers above.
  • tests/utils/test_model_tester_defaults.py: 12 passed. Its parity check now builds 355 TestCases' testers, with no mismatch.
  • Model tests on CPU (macOS) for every touched folder, plus the folders that import these testers (encoder_decoder, vision_encoder_decoder, speech_encoder_decoder, vision_text_dual_encoder, cohere2, rag), -k "config or common_attributes or test_model" excluding tensor/expert-parallel tests: all pass, except failures that are identical on main (test_backbone_selection ImportError for detr, dpt, rt_detr, rt_detr_v2) and padding-free flakes that also fail on main (ernie, electra).
  • utils/check_copies.py, ruff check and ruff format --check pass; git diff --check is clean.

🤖 Generated with Claude Code

@tarekziade tarekziade changed the title Move older-style testers of 124 popular models onto static small-config defaults Move older-style testers of 123 popular models onto static small-config defaults Nov 19, 2026
@tarekziade

Copy link
Copy Markdown
Collaborator Author

run-slow: albert, bart, beit, big_bird, bigbird_pegasus, blenderbot, blip, canary, canine, chinese_clip, clap, clip, clipseg, codegen, cohere, cohere2

@ydshieh ydshieh left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

identical!

@HuggingFaceDocBuilderDev

Copy link
Copy Markdown

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@github-actions

Copy link
Copy Markdown
Contributor

[For maintainers] Suggested jobs to run (before merge)

run-slow: albert, bart, beit, big_bird, bigbird_pegasus, blenderbot, blip, canary, canine, chinese_clip, clap, clip, clipseg, codegen, cohere, cohere2

@github-actions

Copy link
Copy Markdown
Contributor

CI (Nvidia + AMD)

Nvidia · ✅ No new failures 🎉👏 · ⚙️ Workflow · 📊 Dashboard

Failures (3 pre-existing)

    Pre-existing failures (still failing) — 3 total:

        Same error (3):

        - big_bird:
            tests/models/big_bird/test_modeling_big_bird.py::BigBirdModelIntegrationTest::test_fill_mask

        - codegen:
            tests/models/codegen/test_modeling_codegen.py::CodeGenModelLanguageGenerationTest::test_codegen_sample

        - cohere2:
            tests/models/cohere2/test_modeling_cohere2.py::Cohere2IntegrationTest::test_model_pipeline_bf16

AMD · ✅ No new failures 🎉👏 · ⚙️ Workflow · 📊 Dashboard

Failures (5 pre-existing)

    Pre-existing failures (still failing) — 5 total:

        Same error (5):

        - big_bird:
            tests/models/big_bird/test_modeling_big_bird.py::BigBirdModelIntegrationTest::test_fill_mask

        - codegen:
            tests/models/codegen/test_modeling_codegen.py::CodeGenModelLanguageGenerationTest::test_codegen_sample

        - cohere2:
            tests/models/cohere2/test_modeling_cohere2.py::Cohere2IntegrationTest::test_export_static_cache
            tests/models/cohere2/test_modeling_cohere2.py::Cohere2IntegrationTest::test_model_bf16
            tests/models/cohere2/test_modeling_cohere2.py::Cohere2IntegrationTest::test_model_fp16

@tarekziade
tarekziade added this pull request to the merge queue Nov 19, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 19, 2026
@tarekziade
tarekziade added this pull request to the merge queue Nov 19, 2026
Merged via the queue into main with commit 297aafd Nov 19, 2026
219 of 235 checks passed
@tarekziade
tarekziade deleted the tarek-static-defaults-batch3 branch November 19, 2026 21:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants