Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion tests/test_modeling_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -2831,7 +2831,11 @@ def test_inputs_embeds_matches_input_ids_with_generate(self):
model_forward_args = inspect.signature(model.forward).parameters
if "inputs_embeds" not in model_forward_args:
self.skipTest(reason="This model doesn't use `inputs_embeds`")

has_inputs_embeds_forwarding = "inputs_embeds" in set(
inspect.signature(model.prepare_inputs_for_generation).parameters.keys()
)
if not has_inputs_embeds_forwarding:
self.skipTest(reason="This model doesn't support `inputs_embeds` passed to `generate`.")
inputs = copy.deepcopy(self._prepare_for_class(inputs_dict, model_class))
pad_token_id = config.pad_token_id if config.pad_token_id is not None else 1

Expand Down
5 changes: 2 additions & 3 deletions tests/utils/test_modeling_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2427,8 +2427,7 @@ def test_not_available_flash(self):
_ = AutoModel.from_pretrained(
"hf-internal-testing/tiny-random-GPTBigCodeModel", attn_implementation="flash_attention_2"
)

self.assertTrue("the package flash_attn seems not to be installed" in str(cm.exception))
self.assertTrue("the package flash_attn seems to be not installed" in str(cm.exception))

def test_not_available_flash_with_config(self):
if is_flash_attn_2_available():
Expand All @@ -2443,7 +2442,7 @@ def test_not_available_flash_with_config(self):
attn_implementation="flash_attention_2",
)

self.assertTrue("the package flash_attn seems not to be installed" in str(cm.exception))
self.assertTrue("the package flash_attn seems to be not installed" in str(cm.exception))

def test_not_available_sdpa(self):
if is_torch_sdpa_available():
Expand Down