Aismantas commited on
Commit
f9fff63
1 Parent(s): e9a9f56

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +12 -27
README.md CHANGED
@@ -44,33 +44,18 @@ The original code repository can be found [here](https://github.com/openai/whisp
44
  ## Usage
45
 
46
  ```python
47
- import torch
48
- from transformers import AutoModelForSpeechSeq2Seq, AutoProcessor, pipeline
49
- from datasets import load_dataset
50
- device = "cuda:0" if torch.cuda.is_available() else "cpu"
51
- torch_dtype = torch.float16 if torch.cuda.is_available() else torch.float32
52
- model_id = "openai/whisper-large-v3"
53
- model = AutoModelForSpeechSeq2Seq.from_pretrained(
54
- model_id, torch_dtype=torch_dtype, low_cpu_mem_usage=True, use_safetensors=True
55
- )
56
- model.to(device)
57
- processor = AutoProcessor.from_pretrained(model_id)
58
- pipe = pipeline(
59
- "automatic-speech-recognition",
60
- model=model,
61
- tokenizer=processor.tokenizer,
62
- feature_extractor=processor.feature_extractor,
63
- max_new_tokens=128,
64
- chunk_length_s=30,
65
- batch_size=16,
66
- return_timestamps=True,
67
- torch_dtype=torch_dtype,
68
- device=device,
69
- )
70
- dataset = load_dataset("distil-whisper/librispeech_long", "clean", split="validation")
71
- sample = dataset[0]["audio"]
72
- result = pipe(sample)
73
- print(result["text"])
74
  ```
75
 
76
  ## Fine-Tuning
 
44
  ## Usage
45
 
46
  ```python
47
+ import whisper
48
+ from transformers import pipeline
49
+
50
+ model_name = "Aismantas/whisper-base-lithuanian"
51
+ asr_pipeline = pipeline("automatic-speech-recognition", model=model_name)
52
+
53
+ # Assuming the file is named 'audio.wav'
54
+ audio_file = "example_1.wav"
55
+
56
+ # Run the transcription
57
+ transcription = asr_pipeline(audio_file)
58
+ print(transcription)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59
  ```
60
 
61
  ## Fine-Tuning