Skip to content

Commit

Permalink
Generate: increase left-padding test atol (huggingface#23448)
Browse files Browse the repository at this point in the history
increase atol
  • Loading branch information
gante authored and novice03 committed Jun 23, 2023
1 parent b516c02 commit df895a9
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions tests/generation/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1608,7 +1608,6 @@ def test_generate_with_head_masking(self):
attn_weights = out[attn_name] if attn_name == attention_names[0] else out[attn_name][-1]
self.assertEqual(sum([w.sum().item() for w in attn_weights]), 0.0)

@slow # TODO (Joao): fix GPTBigCode
def test_left_padding_compatibility(self):
# The check done in this test is fairly difficult -- depending on the model architecture, passing the right
# position index for the position embeddings can still result in a different output, due to numerical masking.
Expand Down Expand Up @@ -1648,7 +1647,7 @@ def test_left_padding_compatibility(self):
position_ids.masked_fill_(padded_attention_mask == 0, 1)
model_kwargs["position_ids"] = position_ids
next_logits_with_padding = model(**model_kwargs).logits[:, -1, :]
if not torch.allclose(next_logits_wo_padding, next_logits_with_padding):
if not torch.allclose(next_logits_wo_padding, next_logits_with_padding, atol=1e-7):
no_failures = False
break

Expand Down

0 comments on commit df895a9

Please sign in to comment.