Repository navigation
Conversation
…compares their gradients. On XPU, the two paths generate different attention-dropout masks, so this comparison fails even though compiled SDPA's output and gradients match a reference calculation using its actual mask. We could not find a PyTorch documentation guarantee that eager execution and torch.compile must produce element-wise identical dropout masks from the same seed. The reproducibility documentation discusses repeatability within the same environment, not equivalence between these execution paths. This change sets attention dropout to 0 only for EuroBERT's compile-training test, preserving its gradient comparison without relying on that undocumented assumption. Signed-off-by: Wang, Yi A <yi.a.wang@intel.com>
|
EuroBERT is not uniquely affected by a model bug. The shared compile-training test resets the seed before the eager and compiled runs, then compares their gradients element by element. That comparison assumes both runs generate the same dropout mask, which is not guaranteed. In this environment, even standalone F.dropout produces different masks across the two paths with the same seed, while each path is reproducible on its own. EuroBERT exposes the assumption because its test configuration actually passes attention_dropout=0.1 into attention. Other participating models generally use zero attention dropout in this test. T5Gemma, for example, has a fixture field set to 0.1, but its final encoder and decoder attention_dropout values are both 0.0; some models with nonzero dropout do not opt into the shared test. Setting EuroBERT’s dropout to zero therefore makes this deterministic gradient-equivalence test valid, but it does not test compiled training with dropout. That deserves separate coverage using a controlled mask or checks that do not require eager and compiled RNG streams to match. |
|
cc @ydshieh |
| @require_torch_accelerator | ||
| @pytest.mark.torch_compile_test | ||
| def test_torch_compile_for_training(self): | ||
| self.model_tester.attention_probs_dropout_prob = 0.0 |
There was a problem hiding this comment.
hmm shouldnt we reset to initial value afterwards? but overall fine to me, id just do this after all the setups, prepare_xx etc
…piled runs, then compares their gradients. the two runs can produce different attention-dropout masks despite using the same seed, making EuroBERT's gradient comparison fail. This PR sets `attention_dropout=0.0` only for EuroBERT's compile-training test. The setting is applied to the prepared config before model creation, without modifying or restoring shared tester state. Other EuroBERT tests retain their original dropout setting. Signed-off-by: Wang, Yi A <yi.a.wang@intel.com>
|
[For maintainers] Suggested jobs to run (before merge) run-slow: eurobert |
…compares their gradients. On XPU, the two paths generate different attention-dropout masks, so this comparison fails even though compiled SDPA's output and gradients match a reference calculation using its actual mask.
We could not find a PyTorch documentation guarantee that eager execution
and torch.compile must produce element-wise identical dropout masks from the same seed.
The reproducibility documentation discusses repeatability within the same environment,
not equivalence between these execution paths.
This change sets attention dropout to 0 only for EuroBERT's compile-training test,
preserving its gradient comparison without relying on that undocumented assumption.
@IlyasMoutawwakil please help review