Issue 1:
I want to specify the generate params in the line below:

generate(tokenized_input.input_ids,
max_length=64,
no_repeat_ngram_size=2,
early_stopping=True,
num_beams=4,
num_return_sequences=3)

transformers/examples/pytorch/summarization/run_summarization.py

Line 662
in
93d3fd8

predictions = tokenizer.batch_decode(

I specified the args as following. I did not get any error, but it is still getting one sequence instead of 3 as expected.

batch_decode(
predict_results.predictions,
skip_special_tokens=True,
early_stopping=True,
clean_up_tokenization_spaces=False,
no_repeat_ngram_size=2,
num_return_sequences=3
)

Issue 2:
System Info

transformers version: 4.26.1

Platform: macOS-13.1-x86_64-i386-64bit

Python version: 3.9.16

Huggingface_hub version: 0.12.1

PyTorch version (GPU?): 1.13.0 (False)

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?: no

Using distributed or parallel set-up in script?: no

Who can help?

@sanchit-gandhi @Narsil

When running a simple whisper pipeline, e.g., using the options 'return_dict_in_generate': True and 'output_scores': True, e.g.,

from pathlib import Path
from transformers import pipeline, AutomaticSpeechRecognitionPipeline, Pipeline, GenerationConfig

audio_path = 'xxx.wav'

generate_kwargs = {'temperature': 1, 'max_length': 448, 'return_dict_in_generate': True, 'output_scores': True}

pipe = pipeline(
model="openai/whisper-small",
chunk_length_s=10,
framework="pt",
batch_size=1
)

print(pipe(audio_path, return_timestamps=True, generate_kwargs=generate_kwargs))

I am getting the following error:

Traceback (most recent call last):
File "/Users/sofia/PycharmProjects/openAI-whisper/test4.py", line 39, in <module>
print(pipe(audio_path, return_timestamps=True, generate_kwargs=generate_kwargs))
File "/Users/sofia/miniforge3/envs/openAI-whisper/lib/python3.9/site-packages/transformers/pipelines/automatic_speech_recognition.py", line 378, in __call__
return super().__call__(inputs, **kwargs)
File "/Users/sofia/miniforge3/envs/openAI-whisper/lib/python3.9/site-packages/transformers/pipelines/base.py", line 1076, in __call__
return next(
File "/Users/sofia/miniforge3/envs/openAI-whisper/lib/python3.9/site-packages/transformers/pipelines/pt_utils.py", line 125, in __next__
processed = self.infer(item, **self.params)
File "/Users/sofia/miniforge3/envs/openAI-whisper/lib/python3.9/site-packages/transformers/pipelines/automatic_speech_recognition.py", line 611, in postprocess
items = outputs[key].numpy()
AttributeError: 'ModelOutput' object has no attribute 'numpy'

Information

The official example scripts

My own modified scripts

Tasks

An officially supported task in the examples folder (such as GLUE/SQuAD, ...)

My own task or dataset (give details below)

Reproduction

Run the code

from pathlib import Path
from transformers import pipeline, AutomaticSpeechRecognitionPipeline, Pipeline, GenerationConfig

audio_path = 'xxx.wav'

generate_kwargs = {'temperature': 1, 'max_length': 448, 'return_dict_in_generate': True, 'output_scores': True}

pipe = pipeline(
model="openai/whisper-small",
chunk_length_s=10,
framework="pt",
batch_size=1
)

print(pipe(audio_path, return_timestamps=True, generate_kwargs=generate_kwargs))

Expected behavior

I expect to get the text result accompanied with the timestamps and the prediction scores