Update README.md
Browse files
README.md
CHANGED
@@ -37,7 +37,28 @@ This model is a fine-tuned version of [biodatlab/whisper-th-small-combined](http
|
|
37 |
|
38 |
## Model description
|
39 |
|
40 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
|
42 |
## Intended uses & limitations
|
43 |
|
|
|
37 |
|
38 |
## Model description
|
39 |
|
40 |
+
Use the model with huggingface's `transformers` as follows:
|
41 |
+
|
42 |
+
```py
|
43 |
+
from transformers import pipeline
|
44 |
+
|
45 |
+
MODEL_NAME = "FILM6912/Whisper-small-thai" # specify the model name
|
46 |
+
lang = "th" # change to Thai langauge
|
47 |
+
|
48 |
+
device = 0 if torch.cuda.is_available() else "cpu"
|
49 |
+
|
50 |
+
pipe = pipeline(
|
51 |
+
task="automatic-speech-recognition",
|
52 |
+
model=MODEL_NAME,
|
53 |
+
chunk_length_s=30,
|
54 |
+
device=device,
|
55 |
+
)
|
56 |
+
pipe.model.config.forced_decoder_ids = pipe.tokenizer.get_decoder_prompt_ids(
|
57 |
+
language=lang,
|
58 |
+
task="transcribe"
|
59 |
+
)
|
60 |
+
text = pipe("audio.mp3")["text"] # give audio mp3 and transcribe text
|
61 |
+
```
|
62 |
|
63 |
## Intended uses & limitations
|
64 |
|