File size: 1,882 Bytes
8fafa40
 
 
 
 
 
 
9af51c5
8fafa40
 
 
 
9af51c5
3b9e89d
8fafa40
 
2ae117c
8fafa40
 
 
e04bef7
1f93bef
 
 
8fafa40
 
 
 
 
 
a085a59
 
 
 
 
 
 
 
 
 
 
a00aeef
 
 
 
a085a59
a00aeef
 
 
 
 
 
 
 
1f93bef
 
 
8fafa40
1f93bef
a085a59
1f93bef
a085a59
8fafa40
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
---
library_name: peft
base_model: openai/whisper-large-v3
---

# Model Card for Model ID

As of our knowledge SOTA in swiss german with wer=14.269151618793657 and normalized_wer=12.800897299473698.


## Model Details

Trained on RTX 3070 for 30 hours using SwissDial all Dialects with following guide: https://github.com/Vaibhavs10/fast-whisper-finetuning/blob/main/Whisper_w_PEFT.ipynb

### Model Description

<!-- Provide a longer summary of what this model is. -->



- **Developed by:** Flurin17, @chr1bs
- **Language(s) (NLP):** swiss-german
- **License:** IDK ask openai
- **Finetuned from model [optional]:** openai/whisper-large-v3

### Model Sources [optional]


## Uses

```
model_name_or_path = "openai/whisper-large-v3"
task = "transcribe"
import json
import os
from transformers import WhisperFeatureExtractor
from transformers import WhisperTokenizer

feature_extractor = WhisperFeatureExtractor.from_pretrained(model_name_or_path)
tokenizer = WhisperTokenizer.from_pretrained(model_name_or_path, task=task)


from peft import PeftModel, PeftConfig
from transformers import WhisperForConditionalGeneration, Seq2SeqTrainer

peft_model_id = "flurin17/whisper-large-v3-peft-swiss-german" # Use the same model ID as before.
peft_config = PeftConfig.from_pretrained(peft_model_id)
model = WhisperForConditionalGeneration.from_pretrained(
    peft_config.base_model_name_or_path, load_in_8bit=True, device_map="auto"
)
model = PeftModel.from_pretrained(model, peft_model_id)
model.config.use_cache = True


from transformers import AutomaticSpeechRecognitionPipeline
import torch
pipe = AutomaticSpeechRecognitionPipeline(model=model, tokenizer=tokenizer, feature_extractor=feature_extractor)

with torch.cuda.amp.autocast():
    result = pipe(r"L:\random\audio.mp3", generate_kwargs={"language": "german"})
print(result["text"])
```



### Framework versions

- PEFT 0.7.1