almncarlo commited on
Commit
da7f2d9
·
verified ·
1 Parent(s): e1a15c6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -1
app.py CHANGED
@@ -49,6 +49,14 @@ llm_model = transformers.AutoModelForCausalLM.from_pretrained(
49
  trust_remote_code=True,
50
  )
51
 
 
 
 
 
 
 
 
 
52
  tokenizer = transformers.AutoTokenizer.from_pretrained("microsoft/Phi-3-mini-128k-instruct")
53
 
54
  llm_pipe = transformers.pipeline(
@@ -238,7 +246,7 @@ def on_src_or_tgt_lang_change(src_lang_value, tgt_lang_value, pnc_value):
238
 
239
  def main(audio_filepath, src_lang, tgt_lang, pnc):
240
  translated = transcribe(audio_filepath, src_lang, tgt_lang, pnc)
241
- answer = llm_pipe(translated)
242
  return answer
243
 
244
 
 
49
  trust_remote_code=True,
50
  )
51
 
52
+ generation_args = {
53
+ "max_new_tokens": 500,
54
+ "return_full_text": True,
55
+ "temperature": 0.0,
56
+ "do_sample": False,
57
+ }
58
+
59
+
60
  tokenizer = transformers.AutoTokenizer.from_pretrained("microsoft/Phi-3-mini-128k-instruct")
61
 
62
  llm_pipe = transformers.pipeline(
 
246
 
247
  def main(audio_filepath, src_lang, tgt_lang, pnc):
248
  translated = transcribe(audio_filepath, src_lang, tgt_lang, pnc)
249
+ answer = llm_pipe(translated, **generation_args)
250
  return answer
251
 
252