txya900619
commited on
Commit
•
82bd857
1
Parent(s):
f410c9c
Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,57 @@
|
|
1 |
-
---
|
2 |
-
license: cc-by-
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: cc-by-4.0
|
3 |
+
language:
|
4 |
+
- hak
|
5 |
+
pipeline_tag: automatic-speech-recognition
|
6 |
+
---
|
7 |
+
# Model Card for whisper-large-v3-taiwanese-hakka
|
8 |
+
|
9 |
+
<!-- Provide a quick summary of what the model is/does. -->
|
10 |
+
This model is a early fine-tuned version of the Taiwanese indigenous [openai/whisper-large-v3](https://huggingface.co/openai/whisper-large-v3), which uses the ids of each dialect as prompts during training.
|
11 |
+
Note: we use indonesian as whisper language id
|
12 |
+
|
13 |
+
## Dialect and Id
|
14 |
+
- 阿美語: ami
|
15 |
+
- 賽德克語: sdq
|
16 |
+
- 太魯閣語: trv
|
17 |
+
|
18 |
+
### Training process
|
19 |
+
The training of the model was performed with the following hyperparameters
|
20 |
+
|
21 |
+
- Batch size: 32
|
22 |
+
- Epochs: 4
|
23 |
+
- Warmup Steps: 1170
|
24 |
+
- Total Steps: 11700
|
25 |
+
- Learning rate: 7e-5
|
26 |
+
- Data augmentation: No
|
27 |
+
|
28 |
+
|
29 |
+
### How to use
|
30 |
+
|
31 |
+
```python
|
32 |
+
import torch
|
33 |
+
from transformers import AutoModelForSpeechSeq2Seq, AutoProcessor, pipeline
|
34 |
+
device = "cuda:0" if torch.cuda.is_available() else "cpu"
|
35 |
+
torch_dtype = torch.float16 if torch.cuda.is_available() else torch.float32
|
36 |
+
model_id = "formospeech/whisper-large-v3-formosan-iso-prompt"
|
37 |
+
dialect_id = "ami"
|
38 |
+
model = AutoModelForSpeechSeq2Seq.from_pretrained(
|
39 |
+
model_id, torch_dtype=torch_dtype, low_cpu_mem_usage=True, use_safetensors=True
|
40 |
+
)
|
41 |
+
model.to(device)
|
42 |
+
processor = AutoProcessor.from_pretrained(model_id)
|
43 |
+
pipe = pipeline(
|
44 |
+
"automatic-speech-recognition",
|
45 |
+
model=model,
|
46 |
+
tokenizer=processor.tokenizer,
|
47 |
+
feature_extractor=processor.feature_extractor,
|
48 |
+
max_new_tokens=128,
|
49 |
+
chunk_length_s=30,
|
50 |
+
batch_size=16,
|
51 |
+
torch_dtype=torch_dtype,
|
52 |
+
device=device,
|
53 |
+
)
|
54 |
+
generate_kwargs = {"language": "id", "prompt_ids": torch.from_numpy(processor.get_prompt_ids(dialect_id)).to(device)}
|
55 |
+
transcription = pipe("path/to/my_audio.wav", generate_kwargs=generate_kwargs)
|
56 |
+
print(transcription.replace(f" {dialect_id}", ""))
|
57 |
+
```
|