almncarlo commited on
Commit
0ed3a98
1 Parent(s): 1167eef

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -12
app.py CHANGED
@@ -1,23 +1,29 @@
1
  import gradio as gr
2
  import torch
3
  from transformers import pipeline, AutoTokenizer
 
4
 
5
- # tokenizer = AutoTokenizer.from_pretrained("microsoft/Phi-3-mini-128k-instruct")
 
6
 
7
- # pipe = pipeline("text-generation", model="microsoft/Phi-3-mini-128k-instruct", trust_remote_code=True, tokenizer=tokenizer)
8
- # gr.Interface.from_pipeline(pipe,
9
- # title="TextGen",
10
- # description="Using pipeline with Phi3",
11
- # ).launch(inbrowser=True)
12
 
13
  pipe = pipeline(
14
- "text-generation",
15
- model="QuantFactory/Meta-Llama-3-8B-Instruct-GGUF",
16
- model_kwargs={"torch_dtype": torch.bfloat16},
17
- device_map="auto"
18
  )
19
 
 
 
 
 
 
 
 
20
  gr.Interface.from_pipeline(pipe,
21
- title="TextGen",
22
- description="Using pipeline with Llama3",
23
  ).launch(inbrowser=True)
 
1
  import gradio as gr
2
  import torch
3
  from transformers import pipeline, AutoTokenizer
4
+ from nemo.collections.asr.models import EncDecMultiTaskModel
5
 
6
+ # load model
7
+ canary_model = EncDecMultiTaskModel.from_pretrained('nvidia/canary-1b')
8
 
9
+ # update dcode params
10
+ decode_cfg = canary_model.cfg.decoding
11
+ decode_cfg.beam.beam_size = 1
12
+ canary_model.change_decoding_strategy(decode_cfg)
 
13
 
14
  pipe = pipeline(
15
+ "automatic-speech-recognition",
16
+ model="nvidia/canary-1b"
 
 
17
  )
18
 
19
+ # pipe = pipeline(
20
+ # "text-generation",
21
+ # model="QuantFactory/Meta-Llama-3-8B-Instruct-GGUF",
22
+ # model_kwargs={"torch_dtype": torch.bfloat16},
23
+ # device_map="auto"
24
+ # )
25
+
26
  gr.Interface.from_pipeline(pipe,
27
+ title="ASR",
28
+ description="Using pipeline with Canary-1B",
29
  ).launch(inbrowser=True)