ihanif commited on
Commit
d24accd
·
verified ·
1 Parent(s): 230ae0e

Use correct model configs

Browse files
Files changed (1) hide show
  1. app.py +8 -3
app.py CHANGED
@@ -6,9 +6,10 @@ from transformers import pipeline
6
  from huggingface_hub import model_info
7
 
8
  #MODEL_NAME = "ihanif/whisper-medium-ps-augmented" #this always needs to stay in line 8 :D sorry for the hackiness
9
- MODEL_NAME = "ihanif/whisper-turbo-ar"
10
  MODEL_NAME = "ihanif/whisper-small-tunning-v2"
11
- lang = "ps"
 
12
 
13
  device = 0 if torch.cuda.is_available() else "cpu"
14
  pipe = pipeline(
@@ -18,7 +19,11 @@ pipe = pipeline(
18
  device=device,
19
  )
20
 
21
- pipe.model.config.forced_decoder_ids = pipe.tokenizer.get_decoder_prompt_ids(language=lang, task="transcribe")
 
 
 
 
22
 
23
  def transcribe(microphone, file_upload):
24
  warn_output = ""
 
6
  from huggingface_hub import model_info
7
 
8
  #MODEL_NAME = "ihanif/whisper-medium-ps-augmented" #this always needs to stay in line 8 :D sorry for the hackiness
9
+ # MODEL_NAME = "ihanif/whisper-turbo-ar"
10
  MODEL_NAME = "ihanif/whisper-small-tunning-v2"
11
+ lang = "Pashto"
12
+ task="transcribe"
13
 
14
  device = 0 if torch.cuda.is_available() else "cpu"
15
  pipe = pipeline(
 
19
  device=device,
20
  )
21
 
22
+ # pipe.model.config.forced_decoder_ids = pipe.tokenizer.get_decoder_prompt_ids(language=lang, task=task)
23
+
24
+ pipe.model.generation_config.language = lang
25
+ pipe.model.generation_config.task = task
26
+ pipe.model.generation_config.forced_decoder_ids = None
27
 
28
  def transcribe(microphone, file_upload):
29
  warn_output = ""