[tests] Improve ideogram4 tests#13862
Conversation
| # 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. |
There was a problem hiding this comment.
This seems a bit concerning to me.
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. |
* improve ideogram4 tests * fix --------- Co-authored-by: dg845 <[email protected]>
What does this PR do?
New model tests must use
pytestand newly added mixins.