transformers
a4aa9890 - Relax static-cache tolerance in test_generate_with_static_cache (1e-5 → 5e-5) (#48815)

Commit
79 days ago
Relax static-cache tolerance in test_generate_with_static_cache (1e-5 → 5e-5) (#48815) * Relax static-cache tolerance in test_generate_with_static_cache (1e-5 → 5e-5) The test compares dynamic-cache vs static-cache generation outputs and has been flaking intermittently since early 2026 with max score diffs just above 1e-5 (observed max ~2.3e-05, mean ~5.5e-06). Raising the threshold to 5e-5 eliminates spurious failures while still catching any real divergence. CI history for Gemma2ModelTest::test_generate_with_static_cache: - The test passed consistently through all of 2024 and 2025. - Starting around 2026-03-01 (multi-GPU) and 2026-05-05 (single-GPU), occasional failures began appearing with the error: "Generate outputs are not similar enough (atol=1e-05, rtol=1e-05)" - From 2026-05-04 onwards the failures occur a few times per month on both single and multi-GPU runners, suggesting a subtle increase in floating-point divergence between the two cache paths (possibly due to a GPU driver or CUDA library update around that time). - The observed diff (max ~2.3e-05) is well within a reasonable tolerance; 5e-5 provides ~5x headroom without masking real bugs. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Add LayerNorm1P to set_model_for_less_flaky_test target names NemotronLayerNorm1P subclasses nn.LayerNorm but its class name ends with "1P", so it was missed by the endswith check. Adding "LayerNorm1P" ensures its eps is set to 1.0 during less-flaky tests. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Fix gemma3n test_generate_with_static_cache: use float16 and align tolerances with parent class Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Use 1e-5 for fp32, 5e-5 for fp16/bf16 in test_generate_with_static_cache Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> --------- Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>
Author
Parents
Loading