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

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -41,7 +41,10 @@ frame_asr = FrameBatchMultiTaskAED(
41
 
42
  amp_dtype = torch.float16
43
 
44
- llm_pipeline = transformers.pipeline("text-generation", model="meta-llama/Meta-Llama-3-8B-Instruct")
 
 
 
45
 
46
  def convert_audio(audio_filepath, tmpdir, utt_id):
47
  """
@@ -224,7 +227,7 @@ def on_src_or_tgt_lang_change(src_lang_value, tgt_lang_value, pnc_value):
224
 
225
  def main(audio_filepath, src_lang, tgt_lang, pnc):
226
  translated = transcribe(audio_filepath, src_lang, tgt_lang, pnc)
227
- answer = llm_pipeline(translated)
228
  return answer
229
 
230
 
 
41
 
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
 
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