almncarlo commited on
Commit
a4c3e3f
1 Parent(s): 3461539

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -4
app.py CHANGED
@@ -42,9 +42,20 @@ frame_asr = FrameBatchMultiTaskAED(
42
  amp_dtype = torch.float16
43
 
44
 
45
- tokenizer = transformers.AutoTokenizer.from_pretrained("meta-llama/Meta-Llama-3-8B-Instruct")
46
- llm_model = transformers.AutoModelForCausalLM.from_pretrained("meta-llama/Meta-Llama-3-8B-Instruct")
47
- accelerate.disk_offload(model=llm_model, offload_dir="../offload/")
 
 
 
 
 
 
 
 
 
 
 
48
 
49
  def convert_audio(audio_filepath, tmpdir, utt_id):
50
  """
@@ -227,7 +238,7 @@ def on_src_or_tgt_lang_change(src_lang_value, tgt_lang_value, pnc_value):
227
 
228
  def main(audio_filepath, src_lang, tgt_lang, pnc):
229
  translated = transcribe(audio_filepath, src_lang, tgt_lang, pnc)
230
- answer = llm_model(translated)
231
  return answer
232
 
233
 
 
42
  amp_dtype = torch.float16
43
 
44
 
45
+ llm_model = transformers.AutoModelForCausalLM.from_pretrained(
46
+ "microsoft/Phi-3-mini-128k-instruct",
47
+ device_map="cuda",
48
+ torch_dtype="auto",
49
+ trust_remote_code=True,
50
+ )
51
+
52
+ tokenizer = transformers.AutoTokenizer.from_pretrained("microsoft/Phi-3-mini-128k-instruct")
53
+
54
+ llm_pipe = pipeline(
55
+ "text-generation",
56
+ model=llm_model,
57
+ tokenizer=tokenizer,
58
+ )
59
 
60
  def convert_audio(audio_filepath, tmpdir, utt_id):
61
  """
 
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