[tests] Improve ideogram4 tests#13862
Merged
Merged
Conversation
sayakpaul
commented
Jun 4, 2026
Comment on lines
+146
to
+149
| # Skip: the non-persistent fp32 RoPE inv_freq buffer is truncated to fp16 by the in-memory | ||
| # .to(dtype) path but kept fp32 by from_pretrained, so the two outputs diverge well beyond any | ||
| # meaningful tolerance. Dtype preservation is already covered by test_from_save_pretrained_dtype | ||
| # and test_keep_in_fp32_modules. |
Member
Author
There was a problem hiding this comment.
This seems a bit concerning to me.
Collaborator
There was a problem hiding this comment.
I think an underlying issue with test_from_save_pretrained_dtype_inference is that the model.to(dtype) cast at
is not dtype-aware (it will cast everything to dtype), but from_pretrained(..., torch_dtype=dtype) is dtype-aware (it respects _keep_in_fp32_modules, etc.). This causes the behavior of the two to diverge in several scenarios:
- There are
_keep_in_fp32_modulesspecified on themodel(the more common case) - A non-persistent buffer like
inv_freqis created with an explicit dtype (which is the case here)
which leads to a divergence between the outputs of model and model_loaded.
|
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. |
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.
What does this PR do?
New model tests must use
pytestand newly added mixins.