Repository: huggingface/transformers
Pull request: fix(testing): Fix Parakeet, Evolla, Pi0, and Phi-3 test failures on main CI

### What does this PR do?

The following failing tests were identified and fixed in this PR (grouped them together since they share related root causes OR the code changes were extremely minimal and didn't warrant separate PRs):
  
→ **Phi-3**: I made a similar fix for LongCat-Flash in another PR, but it's essentially the same pattern. [The PR [V5] Return a BatchEncoding dict from apply_chat_template by default again](https://github.com/huggingface/transformers/pull/42567) changed [apply_chat_template to return a BatchEncoding dict instead of a tensor](https://github.com/huggingface/transformers/blob/main/src/transformers/tokenization_utils_base.py#L2961). The test was passing this dict directly to `model.generate` and then accessing `.shape`; this fixes that.
→ **Pi0 / Parakeet / Evolla**: `test_sdpa_can_dispatch_on_flash` [forces only the Flash kernel](https://github.com/huggingface/transformers/blob/main/tests/test_modeling_common.py#L3667), which rejects any non-null attention mask. Pi0 wraps PaliGemma which [creates a causal mask mapping](https://github.com/huggingface/transformers/blob/main/src/transformers/models/paligemma/modeling_paligemma.py#L373-L382) even when `attention_mask=None` ([PaliGemma is already skipped for the very reason](https://github.com/huggingface/transformers/blob/main/tests/test_modeling_common.py#L3610-L3613), so Pi0 should follow suit); Parakeet [always passes a relative-position bias as attention_mask](https://github.com/huggingface/transformers/blob/main/src/transformers/models/parakeet/modeling_parakeet.py#L338), so the mask is never `None` even when the test removes it; and Evolla's protein encoder [generates an attention mask internally when none is provided](https://github.com/huggingface/transformers/blob/main/src/transformers/models/evolla/modeling_evolla.py#L553-L554), which then reaches SDPA as a non-null mask. Added the missing three to the skip list.

cc: @Rocketknight1

[**CI Failures**](https://github.com/huggingface/transformers/actions/runs/23523226603)

**Before the fixes (feel free to cross-check; these errors are reproducible):**

<img width="900" height="450" alt="image" src="https://github.com/user-attachments/assets/6c124c89-4365-4df6-8a8a-75305e85c494" />
<img width="900" height="450" alt="image" src="https://github.com/user-attachments/assets/c4f87be6-550a-4f7f-a1a8-1795d3b58125" />

**After the fixes (feel free to cross-check):**

<img width="900" height="450" alt="image" src="https://github.com/user-attachments/assets/1ba8e00b-d972-4048-b6fc-83a03ee34728" />
<img width="900" height="450" alt="image" src="https://github.com/user-attachments/assets/b9c1e35e-62c2-4001-8361-f0fb09d51141" />

### Before submitting
- [ ] This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
- [x] Did you read the [contributor guideline](https://github.com/huggingface/transformers/blob/main/CONTRIBUTING.md#create-a-pull-request),
      Pull Request section?
- [x] Was this discussed/approved via a Github issue or the [forum](https://discuss.huggingface.co/)? Please add a link
      to it if that's the case.
- [ ] Did you make sure to update the documentation with your changes? Here are the
      [documentation guidelines](https://github.com/huggingface/transformers/tree/main/docs), and
      [here are tips on formatting docstrings](https://github.com/huggingface/transformers/tree/main/docs#writing-source-documentation).
- [x] Did you fix any necessary existing tests?

Changed files:
filename: tests/models/phi3/test_modeling_phi3.py
patch: @@ -139,11 +139,11 @@ def test_phi3_mini_4k_instruct_generation(self):
         ]
         inputs = tokenizer.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt")
 
-        outputs = model.generate(inputs, max_new_tokens=32)
+        outputs = model.generate(**inputs, max_new_tokens=32)
         output_text = tokenizer.batch_decode(outputs)
 
         EXPECTED_OUTPUT = [
-            "
 You are a helpful digital assistant. Please provide safe, ethical and accurate information to the user.

 Can you provide ways to eat combinations of bananas and dragonfruits?

 Certainly! Bananas and dragonfruits can be combined in various delicious ways. Here are some ideas for incorporating these fruits into your"
+            "
 You are a helpful digital assistant. Please provide safe, ethical and accurate information to the user.

 Can you provide ways to eat combinations of bananas and dragonfruits?

 Certainly! Bananas and dragonfruits can be combined in various delicious and healthy ways. Here are some creative ideas to enjoy these"
         ]
 
         self.assertListEqual(output_text, EXPECTED_OUTPUT)
@@ -161,7 +161,7 @@ def test_phi3_mini_4k_instruct_with_static_cache(self):
         ]
         inputs = tokenizer.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt")
 
-        response_tokens = Phi3MiniWithStaticCache.generate(model, inputs, 64)
+        response_tokens = Phi3MiniWithStaticCache.generate(model, inputs["input_ids"], 64)
 
         output_text = tokenizer.batch_decode(torch.tensor([response_tokens], dtype=torch.long, device=torch_device))
 
@@ -207,7 +207,7 @@ def test_phi3_mini_128k_instruct_generation(self):
         ]
         inputs = tokenizer.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt")
 
-        outputs = model.generate(inputs, max_new_tokens=32)
+        outputs = model.generate(**inputs, max_new_tokens=32)
         output_text = tokenizer.batch_decode(outputs)
 
         EXPECTED_OUTPUT = [
@@ -229,7 +229,7 @@ def test_phi3_mini_128k_instruct_with_static_cache(self):
         ]
         inputs = tokenizer.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt")
 
-        response_tokens = Phi3MiniWithStaticCache.generate(model, inputs, 64)
+        response_tokens = Phi3MiniWithStaticCache.generate(model, inputs["input_ids"], 64)
 
         output_text = tokenizer.batch_decode(torch.tensor([response_tokens], dtype=torch.long, device=torch_device))
 
@@ -324,7 +324,7 @@ def test_phi3_mini_4k_sliding_window(self):
         outputs = model.generate(**inputs, max_new_tokens=100)
         output_text = tokenizer.batch_decode(outputs[:, inputs.input_ids.shape[1] :], skip_special_tokens=True)
         EXPECTED_OUTPUT = [
-            '1. Coq au Vin: Coq au Vin is a classic French dish that translates to "rooster in wine." The dish consists of chicken braised with wine, lardons, mushrooms, and garlic. It is a hearty and flavorful dish that is often served with potatoes or rice.\n\n            2. Boeuf Bourguignon: Boeuf Bourguignon is a traditional French beef stew that'
+            '1. Coq au Vin: Coq au Vin is a classic French dish that translates to "rooster in wine." The dish consists of chicken braised in red wine, typically Burgundy, along with mushrooms, onions, and sometimes bacon. The dish is known for its rich, savory flavor and tender chicken.\n\n            2. Boeuf Bourguignon: Boeuf Bourguignon is a hearty'
         ]
 
         self.assertListEqual(output_text, EXPECTED_OUTPUT)

filename: tests/test_modeling_common.py
patch: @@ -3612,6 +3612,7 @@ def test_sdpa_can_dispatch_on_flash(self):
                     "PaliGemma-like models currently (transformers==4.41.0) requires an attention_mask input"
                 )
             if config.model_type in [
+                "EvollaModel",
                 "modernbert",
                 "gemma3",
                 "t5gemma",
@@ -3623,6 +3624,9 @@ def test_sdpa_can_dispatch_on_flash(self):
                 "kosmos-2",
                 "mllama",
                 "lighton_ocr",
+                "parakeet_encoder",
+                "parakeet_ctc",
+                "pi0",
                 "pixtral",
                 "sam",
                 "sam_hq",