test: filter generation compatibility models#1352
Merged
jlarson4 merged 1 commit intoJun 1, 2026
Merged
Conversation
Collaborator
|
Hi @axelray-dev! A few requests:
|
Replace the GENERATING_MODELS allowlist with a supports_generation flag on ArchitectureAdapter. The flag defaults to True and is set to False on encoder-only adapters (BERT, HuBERT) that don't support text generation. The test now checks model.adapter.supports_generation at runtime and skips via pytest.skip instead of maintaining a static model list. Fixes TransformerLensOrg#1328
945f507 to
e7117a9
Compare
Author
|
Updated. Here is what changed:
Tests run: All 14 tests passed. The diff is additions-only for the adapter and test files (no unrelated changes). |
Collaborator
|
Excellent work, thank you @axelray-dev |
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.
Fixes #1328
What changed
Replaced the runtime
try/except+pytest.skippattern intest_generation_compatibilitywith a dedicatedgenerating_modelfixture that only includes generation-capable models.GENERATING_MODELSclass constant (currently["gpt2"])generating_model_nameandgenerating_modelfixturestest_generation_compatibilityto use the newgenerating_modelfixtureexcept (AttributeError, RuntimeError)+pytest.skipWhy filtering is better than runtime skip
The previous approach silently skipped the generation test when
AttributeErrororRuntimeErrorwas raised, hiding the fact that some models don't support generation. By filtering at the fixture level:model_namefixture won't accidentally suppress the generation testGENERATING_MODELSChecks run
uv run pytest tests/unit/model_bridge/compatibility/test_utils.py -v -x # 14 passed in 77.38s (including test_generation_compatibility[gpt2])Skipped checks