Views
No views yet
openai/whisper-large-v31from transformers import pipeline
2from peft import PeftModel, PeftConfig
3
4# Load the adapter configuration
5config = PeftConfig.from_pretrained("Bruno7/ksa-whisper")
6
7# Load base model and apply adapter
8pipe = pipeline(
9 "automatic-speech-recognition",
10 model=config.base_model_name_or_path,
11 device="cuda" if torch.cuda.is_available() else "cpu"
12)
13
14# Load and apply the adapter
15model = PeftModel.from_pretrained(pipe.model, "Bruno7/ksa-whisper")
16pipe.model = model
17
18# Process audio
19result = pipe("path_to_audio.wav")
20print(result["text"])1from transformers import AutoProcessor, AutoModelForSpeechSeq2Seq
2from peft import PeftModel
3
4# Load base model and processor
5processor = AutoProcessor.from_pretrained("openai/whisper-large-v3")
6model = AutoModelForSpeechSeq2Seq.from_pretrained("openai/whisper-large-v3")
7
8# Apply adapter
9model = PeftModel.from_pretrained(model, "Bruno7/ksa-whisper")
10
11# Your inference code here