totetecdev
commited on
Commit
•
49c560b
1
Parent(s):
a7d90e0
Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,27 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from peft import PeftModel, PeftConfig
|
2 |
+
from transformers import WhisperForConditionalGeneration, WhisperProcessor, pipeline
|
3 |
+
|
4 |
+
# PEFT model yolunu tanımlayın
|
5 |
+
peft_model_id = "/content/reach-vb/test/checkpoint-100"
|
6 |
+
|
7 |
+
# PEFT konfigürasyonunu yükleyin
|
8 |
+
peft_config = PeftConfig.from_pretrained(peft_model_id)
|
9 |
+
|
10 |
+
# Temel modeli yükleyin
|
11 |
+
model = WhisperForConditionalGeneration.from_pretrained(
|
12 |
+
peft_config.base_model_name_or_path,
|
13 |
+
load_in_8bit=True,
|
14 |
+
device_map="auto"
|
15 |
+
)
|
16 |
+
|
17 |
+
# PEFT modelini yükleyin
|
18 |
+
model = PeftModel.from_pretrained(model, peft_model_id)
|
19 |
+
|
20 |
+
# Önbelleği etkinleştirin
|
21 |
+
model.config.use_cache = True
|
22 |
+
|
23 |
+
# Whisper işlemcisini yükleyin (tokenizer yerine)
|
24 |
+
processor = WhisperProcessor.from_pretrained(peft_config.base_model_name_or_path)
|
25 |
+
|
26 |
+
# Pipeline'ı oluşturun
|
27 |
+
pipe = pipeline("automatic-speech-recognition", model=model, tokenizer=processor.tokenizer, feature_extractor=processor.feature_extractor)
|