Fix: [SeamlessM4T - S2TT] Bug in batch loading of audio in torch.Tensor format in the SeamlessM4TFeatureExtractor class
Author: nicholasneo78
Pull request: yes

# What does this PR do?

<!--
Congratulations! You've made it this far! You're not quite done yet though.

Once merged, your PR is going to appear in the release notes with the title you set, so make sure it's a great title that fully reflects the extent of your awesome contribution.

Then, please replace this with a description of the change and which issue is fixed (if applicable). Please also include relevant motivation and context. List any dependencies (if any) that are required for this change.

Once you're done, someone will review your PR shortly (see the section "Who can review?" below to tag some potential reviewers). They may suggest changes to make the code even better. If no one reviewed your PR after a week has passed, don't hesitate to post a new comment @-mentioning the same persons---sometimes notifications get lost.
-->

<!-- Remove if not applicable -->

Fixes # (issue)
Based on the documentation for the [SeamlessM4TProcessor](https://github.com/huggingface/transformers/blob/main/src/transformers/models/seamless_m4t/processing_seamless_m4t.py#L22) class, the class is supposed to take in either `List[np.ndarray]` or `List[torch.Tensor]` for batch decoding when `processor(audios=...)` is called. It would then return a batch of transcriptions (S2TT task of SeamlessM4T). However, when `List[torch.Tensor]` is passed into the `audios` arg, only one translated transcript is being returned even though a batch of audio is passed in. After adding the check for `torch.Tensor` in the `SeamlessM4TFeatureExtractor` class, the translated batch transcript returned as expected.

Below is a code snippet that I use to test the issue:
```python
from transformers import SeamlessM4Tv2Model, SeamlessM4TProcessor
import torch
from datasets import load_dataset

processor = SeamlessM4TProcessor.from_pretrained("facebook/seamless-m4t-v2-large")
model = SeamlessM4Tv2Model.from_pretrained("facebook/seamless-m4t-v2-large", use_safetensors=True)
dataset = load_dataset("arabic_speech_corpus", split="test", streaming=True)

# numpy array as audio_inputs
audio_sample = next(iter(dataset))["audio"]
print(type(audio_sample["array"])) # <class 'numpy.ndarray'>
# get a list of two numpy arrays to simulate batch size=2 when loading the audio arrays
audio_sample_batch = [audio_sample["array"], audio_sample["array"]]

audio_inputs = processor(audios=audio_sample_batch, return_tensors="pt", sampling_rate=16000)
output_tokens = model.generate(**audio_inputs, tgt_lang="eng", generate_speech=False)
translated_text_from_audio = processor.batch_decode(output_tokens[0].tolist(), skip_special_tokens=True)
print(f"Translated text from audio (numpy array): {translated_text_from_audio}\n")
# >>> Translated text from audio (numpy array): ['The first is the fact that the sun is shining brightly on the moon.', 'The first is the fact that the sun is shining brightly on the moon.']

# torch tensors as audio_inputs
torch_tensor_audio_sample = torch.from_numpy(audio_sample["array"])
print(type(torch_tensor_audio_sample)) # <class 'torch.Tensor'>
# get a list of two torch tensors to simulate batch size=2 when loading the audio arrays
torch_tensor_audio_sample_batch = [torch_tensor_audio_sample,torch_tensor_audio_sample]

audio_inputs = processor(audios=torch_tensor_audio_sample_batch, return_tensors="pt", sampling_rate=16000)
output_tokens = model.generate(**audio_inputs, tgt_lang="eng", generate_speech=False)
translated_text_from_audio = processor.batch_decode(output_tokens[0].tolist(), skip_special_tokens=True)
print(f"Translated text from audio (torch tensors): {translated_text_from_audio}")
# >>> Translated text from audio (torch tensors): ['The first is the fact that the sun is shining brightly on the moon.']
# expects two translated sentences just like the numpy array inputs but only one sentence is translated 
``` 

Environment:
```shell
- `transformers` version: 4.36.0.dev0
- Platform: Linux-6.1.11-76060111-generic-x86_64-with-glibc2.35
- Python version: 3.10.6
- Huggingface_hub version: 0.19.4
- Safetensors version: 0.4.1
- Accelerate version: not installed
- Accelerate config: not found
- PyTorch version (GPU?): 2.1.1+cu121 (True)
- Tensorflow version (GPU?): not installed (NA)
- Flax version (CPU?/GPU?/TPU?): not installed (NA)
- Jax version: not installed
- JaxLib version: not installed
- Using GPU in script?: Yes
- Using distributed or parallel set-up in script?: No
```

## Before submitting
- [ x] Did you read the [contributor guideline](https://github.com/huggingface/transformers/blob/main/CONTRIBUTING.md#start-contributing-pull-requests), Pull Request section?


cc: @sanchit-gandhi


Comments:
Awesome @nicholasneo78!

cc @ylacombe 

Hi @ylacombe,

Yes this works for me. Have updated the code `feature_extraction_seamless_m4t.py` and added test in `test_feature_extraction_seamless_m4t.py`

Thanks for the suggestion!

The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_27914). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.