Add weight-coverage walker to converter test suite#527
Open
jlamypoirier wants to merge 1 commit into
Open
Conversation
For each test fixture with a checkpoint format, materialise the Fast-LLM base model (CPU, ParameterMeta — no distributed setup) and assert every parameter is consumed by some leaf WeightConverter emitted by base_model_converter_class.get_converters(config). Runtime-tied parameters count as covered when any group member has a converter, matching export behaviour. Gemma4 is xfailed against pre-existing coverage gaps in its declarations. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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.
Summary
tests/models/test_converters.pywith a per-fixture weight-coverage check: for eachModelTestingConfigwith acheckpoint_format, materialise the Fast-LLM base model and assert everynamed_parameters()entry is consumed by some leafWeightConverteremitted bybase_model_converter_class.get_converters(config).gemma4is xfailed (strict) against pre-existing coverage gaps in its converter declarations; the xfail reason describes the three specific gaps.Why
The strict HF-side coverage check landed by #523 catches an HF dict carrying a key with no Fast-LLM consumer. There was no equivalent symmetric check on the Fast-LLM side — a model parameter without a converter is silently skipped by
ExternalStateDictCheckpointHandler._convert_state_dict, so its trained value is lost on HF export. This test closes that gap statically.Implementation notes
bm.base_model_class(bm, DistributedConfig())— CPU-only,ParameterMetaweights, no distributed setup or NCCL. Iteratesnamed_parameters()for the canonical Fast-LLM name set.id(parameter)) sinceParameterMeta.tensor_nameisn't assigned until stage setup, which we deliberately skip.Test plan
pytest -v tests/models/test_converters.py→ 36 pass, 1 xfail (gemma4)tests/models/test_converters.py + test_checkpoint.py + test_hf_roundtrip.pysweep — converters tests pass + xfail as designedtest_conversion[*]torchscript coverage andtest_hf_roundtripGemma4 import) verified unrelated to this PR (diff is +71 lines in test_converters.py only)🤖 Generated with Claude Code