Views
No views yet
1import torch
2from transformers import pipeline
3
4model_id = "rose3/kana-anime-whisper"
5
6generate_kwargs = {
7 "language": "Japanese",
8 "num_beams": 2,
9 "repetition_penalty": 1.1,
10}
11pipe = pipeline(
12 "automatic-speech-recognition",
13 model=model_id,
14 device="cuda" if torch.cuda.is_available() else "cpu",
15 torch_dtype=torch.float16 if torch.cuda.is_available() else torch.float32,
16 chunk_length_s=30.0,
17 batch_size=64,
18)
19
20audio_path = "test.wav"
21result = pipe(audio_path, generate_kwargs=generate_kwargs)
22print(result["text"])