Skip to content

Migrate the remaining 95 testers to static small-config defaults - #50944

Merged
tarekziade merged 1 commit into
mainfrom
tarek-static-defaults-batch2
Nov 19, 2026
Merged

tarekziade merged 1 commit into
mainfrom
tarek-static-defaults-batch2

Conversation

@tarekziade

@tarekziade tarekziade commented Nov 19, 2026 •

Copy link
Copy Markdown
Collaborator

🤗 Transformers CI

Follow-up to #50462 and #50916: migrate every tester still in TESTERS_NOT_YET_STATIC (95 testers across 88 model test files) to literal small_config_overrides, with values computed from other values in get_small_config_defaults(). The exception list is now empty, so StaticRuntimeParityTest covers every tester on the shared bases.

Also makes hy_v4_vl's vision_out_hidden_size, grid_hw and num_image_patches literals (with their derivation in a comment) instead of computing them in get_small_config_defaults(), so a static reader sees them. Nothing constructs that tester with different sizes.

What changed in the testers

  • kwargs.setdefault(...) and literal self.x = ... in __init__ move into small_config_overrides; the __init__ is removed wherever nothing else was left in it.
  • Legacy signatures (def __init__(self, parent, batch_size=13, ...)) become small_config_overrides; no caller passes positional arguments to any of them. gemma3n's text tester never called super().__init__, so it declares defaults = {} like BERT does.
  • Values derived from others (e.g. out_hidden_size = hidden_size, max_source_positions from feat_seq_length) are computed in get_small_config_defaults(), keeping the runtime precedence: values.setdefault where a caller's value used to win, plain assignment where __init__ set the value after super().__init__().
  • Three values that were computed indirectly on main are now literals, so the built testers stay identical: blt's head_dim (16, derived from the shared defaults before the tester narrowed hidden_size), fun_asr_nano's adaptor_intermediate_size (16 # 64 // 4) and nemotron_h_omni's audio layer count (the shared set_omni_tester_defaults() helper is folded into each tester's dict).
  • Every small_config_overrides in tests/models (127) parses with ast.literal_eval.

Proof

  • For all 95 testers, the attributes of the tester setUp() builds and the config from prepare_config_and_inputs_for_common() were snapshotted on 943ef884e6 (main) and on this branch: 95/95 identical, and no static/runtime mismatch.
  • tests/utils/test_model_tester_defaults.py: 12 passed, with an empty TESTERS_NOT_YET_STATIC. Putting a migrated tester back on the list makes it fail ("now match ... remove them from the list"), so the parity check does run.
  • Model tests on CPU (macOS) for every touched model, -k "config or common_attributes or test_model" excluding tensor/expert-parallel tests: all pass. inkling's run needs scipy.
  • Tensor/expert-parallel tests: beam (4) and cohere2_moe (13) fail identically on main and on this branch on macOS CPU.
  • ruff check and ruff format --check pass on the changed files; git diff --check is clean.

The values are now readable without importing the test modules (by transformers-mic, for instance). A few testers derive values in forms a static reader needs to evaluate (comprehensions, len(), or setting kwargs before calling super(), such as llava_next and hunyuan_vl); those are correct at runtime and covered by the parity test.

🤖 Generated with Claude Code

@github-actions

Copy link
Copy Markdown
Contributor

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

run-slow: afmoe, apertus, aria, audioflamingo3, axk1, axk2, bailing_hybrid, beam, blt, cohere2_moe, cohere_compass, cosmos3_edge, cosmos3_omni, dbrx, deepseek_ocr2, deepseek_v2

@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.

@tarekziade

Copy link
Copy Markdown
Collaborator Author

run-slow: afmoe, apertus, aria, audioflamingo3, axk1, axk2, bailing_hybrid, beam, blt, cohere2_moe, cohere_compass, cosmos3_edge, cosmos3_omni, dbrx, deepseek_ocr2, deepseek_v2

@tarekziade
tarekziade added this pull request to the merge queue Nov 19, 2026
Merged via the queue into main with commit 719604d Nov 19, 2026
129 of 130 checks passed
@tarekziade
tarekziade deleted the tarek-static-defaults-batch2 branch November 19, 2026 12:33
@github-actions

Copy link
Copy Markdown
Contributor

CI (Nvidia + AMD)

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

Failures (2 pre-existing)

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

        Same error (2):

        - blt:
            tests/models/blt/test_modeling_blt.py::BltIntegrationTest::test_model_logits
            tests/models/blt/test_modeling_blt.py::BltIntegrationTest::test_model_logits_bf16

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

Failures (27 pre-existing)

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

        Same error (27):

show all 27

 
    - aria:
        tests/models/aria/test_modeling_aria.py::AriaForConditionalGenerationModelTest::test_onnx_export_dynamic
        tests/models/aria/test_modeling_aria.py::AriaForConditionalGenerationModelTest::test_onnx_export_generate_dynamic
        tests/models/aria/test_modeling_aria.py::AriaForConditionalGenerationModelTest::test_onnx_export_generate_static
        tests/models/aria/test_modeling_aria.py::AriaForConditionalGenerationModelTest::test_onnx_export_static
        tests/models/aria/test_modeling_aria.py::AriaForConditionalGenerationIntegrationTest::test_batched_generation
        tests/models/aria/test_modeling_aria.py::AriaForConditionalGenerationIntegrationTest::test_small_model_integration_test
        tests/models/aria/test_modeling_aria.py::AriaForConditionalGenerationIntegrationTest::test_small_model_integration_test_batch
        tests/models/aria/test_modeling_aria.py::AriaForConditionalGenerationIntegrationTest::test_small_model_integration_test_llama_batched
        tests/models/aria/test_modeling_aria.py::AriaForConditionalGenerationIntegrationTest::test_small_model_integration_test_llama_batched_regression
        tests/models/aria/test_modeling_aria.py::AriaForConditionalGenerationIntegrationTest::test_small_model_integration_test_llama_single
        tests/models/aria/test_modeling_aria.py::AriaForConditionalGenerationIntegrationTest::test_tokenizer_integration

    - axk1:
        tests/models/axk1/test_modeling_axk1.py::AXK1IntegrationTest::test_model_logits_batched

    - axk2:
        tests/models/axk2/test_modeling_axk2.py::AXK2IntegrationTest::test_model_generation
        tests/models/axk2/test_modeling_axk2.py::AXK2IntegrationTest::test_model_logits_batched

    - beam:
        tests/models/beam/test_modeling_beam.py::BeamModelTest::test_flash_attn_2_equivalence

    - blt:
        tests/models/blt/test_modeling_blt.py::BltIntegrationTest::test_model_logits
        tests/models/blt/test_modeling_blt.py::BltIntegrationTest::test_model_logits_bf16

    - cosmos3_edge:
        tests/models/cosmos3_edge/test_modeling_cosmos3_edge.py::Cosmos3EdgeForConditionalGenerationIntegrationTest::test_image_generation

    - cosmos3_omni:
        tests/models/cosmos3_omni/test_modeling_cosmos3_omni.py::Cosmos3OmniForConditionalGenerationIntegrationTest::test_small_model_integration_batched

    - deepseek_ocr2:
        tests/models/deepseek_ocr2/test_modeling_deepseek_ocr2.py::DeepseekOcr2ModelTest::test_onnx_export_dynamic
        tests/models/deepseek_ocr2/test_modeling_deepseek_ocr2.py::DeepseekOcr2ModelTest::test_onnx_export_generate_dynamic
        tests/models/deepseek_ocr2/test_modeling_deepseek_ocr2.py::DeepseekOcr2ModelTest::test_onnx_export_generate_dynamic_static_cache
        tests/models/deepseek_ocr2/test_modeling_deepseek_ocr2.py::DeepseekOcr2ModelTest::test_onnx_export_generate_static
        tests/models/deepseek_ocr2/test_modeling_deepseek_ocr2.py::DeepseekOcr2ModelTest::test_onnx_export_generate_static_static_cache
        tests/models/deepseek_ocr2/test_modeling_deepseek_ocr2.py::DeepseekOcr2ModelTest::test_onnx_export_static

    - deepseek_v2:
        tests/models/deepseek_v2/test_modeling_deepseek_v2.py::DeepseekV2IntegrationTest::test_batch_fa2
        tests/models/deepseek_v2/test_modeling_deepseek_v2.py::DeepseekV2IntegrationTest::test_logits_eager

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