Repository: huggingface/transformers
Pull request: fix(testing): Update stale device override test in GraniteSpeech

### What does this PR do?

The following issue was identified and fixed in this PR:

→ Updates the stale `test_device_override` in `test_processing_granite_speech.py` to verify that the device param controls where speech inputs are placed, rather than asserting outputs are unconditionally on CPU.
→ **Reasoning:** GraniteSpeech support was originally added (https://github.com/huggingface/transformers/commit/623d395aff) with [this condition in the feature extractor](https://github.com/huggingface/transformers/blob/623d395affc9099d0ad0223754097c1ad9b9f817/src/transformers/models/granite_speech/feature_extraction_granite_speech.py#L137-L138), and the test enforced that. Then [2d600a4363 ("Granite speech speedups")](https://github.com/huggingface/transformers/commit/2d600a4363) deliberately removed the `.cpu()` return as part of eliminating unnecessary device transfers, but the test was not updated. The updated test also aligns with the direction in `#43249`.

Fixes #44112.

**Before the fix (feel free to cross-check on CI; this error is reproducible):**

<img width="700" height="700" alt="Screenshot 2026-02-16 183613" src="https://github.com/user-attachments/assets/08afe321-2338-4e15-8b2a-f218b6ad6d2d" /><br>

**After the fix (feel free to cross-check):**

<img width="700" height="700" alt="image" src="https://github.com/user-attachments/assets/0b7c21bb-9db6-42fc-a104-83319bb5a8ad" />

### 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/granite_speech/test_processing_granite_speech.py
patch: @@ -25,7 +25,6 @@
     require_torch,
     require_torch_accelerator,
     require_torchaudio,
-    torch_device,
 )
 from transformers.utils import is_torchaudio_available
 
@@ -196,11 +195,10 @@ def test_audio_token_filling_varying_len_feature_list(self):
         assert num_calculated_features == [90, 171]
         assert sum(num_expected_features) == num_audio_tokens
 
+    @parameterized.expand(["cpu", "cuda"])
     @require_torch_accelerator
-    def test_device_override(self):
-        """Ensure that we regardless of the processing device, the tensors
-        produced are on the CPU.
-        """
+    def test_device_placement(self, device):
+        """Ensure that the device parameter controls where speech inputs are placed."""
         tokenizer = self.get_tokenizer()
         audio_processor = self.get_audio_processor()
         processor = GraniteSpeechProcessor(
@@ -215,7 +213,7 @@ def test_device_override(self):
             text=f"{processor.audio_token} Can you transcribe this audio?",
             audio=wav,
             return_tensors="pt",
-            device=torch_device,
+            device=device,
         )
 
-        assert inputs["input_features"].device.type == "cpu"
+        assert inputs["input_features"].device.type == device