File size: 620 Bytes
5397a6e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
from transformers import WhisperProcessor, WhisperForConditionalGeneration

def load_model_and_processor(model_name="openai/whisper-base"):
    """
    Loads the Whisper model and processor.
    
    Parameters:
        model_name (str): The model to load. Defaults to 'openai/whisper-base'.
    
    Returns:
        model (WhisperForConditionalGeneration): Loaded Whisper model.
        processor (WhisperProcessor): Loaded processor for the model.
    """
    model = WhisperForConditionalGeneration.from_pretrained(model_name)
    processor = WhisperProcessor.from_pretrained(model_name)
    return model, processor