Update README.md
Browse files
README.md
CHANGED
@@ -73,33 +73,33 @@ The model used in this project is the **Whisper-V3-Turbo**. Whisper is a multili
|
|
73 |
|
74 |
To use the fine-tuned model, follow the steps below:
|
75 |
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
|
104 |
## Acknowledgements
|
105 |
|
|
|
73 |
|
74 |
To use the fine-tuned model, follow the steps below:
|
75 |
|
76 |
+
```python
|
77 |
+
import torch
|
78 |
+
from transformers import AutoModelForSpeechSeq2Seq, AutoProcessor, pipeline
|
79 |
+
|
80 |
+
device = "cuda:0" if torch.cuda.is_available() else "cpu"
|
81 |
+
torch_dtype = torch.float16 if torch.cuda.is_available() else torch.float32
|
82 |
+
|
83 |
+
model_id = "suzii/vi-whisper-large-v3-turbo-v1"
|
84 |
+
|
85 |
+
model = AutoModelForSpeechSeq2Seq.from_pretrained(
|
86 |
+
model_id, torch_dtype=torch_dtype, low_cpu_mem_usage=True, use_safetensors=True
|
87 |
+
)
|
88 |
+
model.to(device)
|
89 |
+
|
90 |
+
processor = AutoProcessor.from_pretrained(model_id)
|
91 |
+
|
92 |
+
pipe = pipeline(
|
93 |
+
"automatic-speech-recognition",
|
94 |
+
model=model,
|
95 |
+
tokenizer=processor.tokenizer,
|
96 |
+
feature_extractor=processor.feature_extractor,
|
97 |
+
torch_dtype=torch_dtype,
|
98 |
+
device=device,
|
99 |
+
)
|
100 |
+
result = pipe("your-audio.mp3", return_timestamps=True)
|
101 |
+
|
102 |
+
```
|
103 |
|
104 |
## Acknowledgements
|
105 |
|