-
Notifications
You must be signed in to change notification settings - Fork 659
Whisper models are incorrectly mapped to Seq2SeqLM #1903
Copy link
Copy link
Open
Description
Problem
The auto-generated inference notebook/code on the model page is incorrect.
It uses:
from transformers import AutoModelForSeq2SeqLM
base_model = AutoModelForSeq2SeqLM.from_pretrained("openai/whisper-small")This fails with:
ValueError: Unrecognized configuration class WhisperConfig for AutoModelForSeq2SeqLMbecause Whisper is a speech-to-text model and must be loaded with WhisperForConditionalGeneration or AutoModelForSpeechSeq2Seq.
Correct code
from transformers import WhisperForConditionalGeneration
from peft import PeftModel
base_model = WhisperForConditionalGeneration.from_pretrained(
"openai/whisper-small"
)
model = PeftModel.from_pretrained(
base_model,
"<your-peft-adapter-in-huggingface>"
)Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels