Repository: huggingface/transformers
Pull request: Remove `num_frames` in ASR pipeline

Script:
```python
import torch
from transformers import pipeline
from datasets import load_dataset

device = "cuda:0" if torch.cuda.is_available() else "cpu"
pipe = pipeline(
  "automatic-speech-recognition",
  model="openai/whisper-small",
  device=device,
)
ds = load_dataset("hf-internal-testing/librispeech_asr_dummy", "clean", split="validation")
sample = ds[0]["audio"]
prediction = pipe(sample, batch_size=8)["text"]
```

error:
```
Traceback (most recent call last):
  File "/home/jiqing/HuggingFace/tests/workloads/test_whisper.py", line 16, in <module>
    prediction = pipe(sample, batch_size=8)["text"]
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jiqing/transformers/src/transformers/pipelines/automatic_speech_recognition.py", line 266, in __call__
    return super().__call__(inputs, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jiqing/transformers/src/transformers/pipelines/base.py", line 1266, in __call__
    return next(
           ^^^^^
  File "/home/jiqing/transformers/src/transformers/pipelines/pt_utils.py", line 126, in __next__
    item = next(self.iterator)
           ^^^^^^^^^^^^^^^^^^^
  File "/home/jiqing/transformers/src/transformers/pipelines/pt_utils.py", line 271, in __next__
    processed = self.infer(next(self.iterator), **self.params)
                           ^^^^^^^^^^^^^^^^^^^
  File "/opt/venv/lib/python3.12/site-packages/torch/utils/data/dataloader.py", line 741, in __next__
    data = self._next_data()
           ^^^^^^^^^^^^^^^^^                                                                                                           File "/opt/venv/lib/python3.12/site-packages/torch/utils/data/dataloader.py", line 801, in _next_data
    data = self._dataset_fetcher.fetch(index)  # may raise StopIteration                                                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venv/lib/python3.12/site-packages/torch/utils/data/_utils/fetch.py", line 35, in fetch
    data.append(next(self.dataset_iter))
                ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jiqing/transformers/src/transformers/pipelines/pt_utils.py", line 188, in __next__                                         processed = next(self.subiterator)
                ^^^^^^^^^^^^^^^^^^^^^^                                                                                                 File "/home/jiqing/transformers/src/transformers/pipelines/automatic_speech_recognition.py", line 486, in preprocess                   extra["num_frames"] = processed.pop("num_frames")
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen _collections_abc>", line 945, in pop
  File "/home/jiqing/transformers/src/transformers/feature_extraction_utils.py", line 90, in __getitem__
    return self.data[item]
           ~~~~~~~~~^^^^^^
KeyError: 'num_frames'
```

This change can fix this error by returning None if there is no `num_frames` in processors.

Changed files:
filename: src/transformers/pipelines/automatic_speech_recognition.py
patch: @@ -480,10 +480,8 @@ def preprocess(self, inputs, chunk_length_s=0, stride_length_s=None):
                         inputs,
                         sampling_rate=self.feature_extractor.sampling_rate,
                         return_tensors="pt",
-                        return_token_timestamps=True,
                         return_attention_mask=True,
                     )
-                    extra["num_frames"] = processed.pop("num_frames")
                 else:
                     processed = self.feature_extractor(
                         inputs,