File size: 840 Bytes
4571fa6
45ba322
f6cc7ad
0ed3a98
def81e4
0ed3a98
 
71126de
0ed3a98
 
 
 
71126de
 
0ed3a98
 
71126de
f6cc7ad
0ed3a98
 
 
 
 
 
 
4571fa6
0ed3a98
 
4571fa6
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import gradio as gr
import torch
from transformers import pipeline, AutoTokenizer
from nemo.collections.asr.models import EncDecMultiTaskModel

# load model
canary_model = EncDecMultiTaskModel.from_pretrained('nvidia/canary-1b')

# update dcode params
decode_cfg = canary_model.cfg.decoding
decode_cfg.beam.beam_size = 1
canary_model.change_decoding_strategy(decode_cfg)

pipe = pipeline(
    "automatic-speech-recognition", 
    model="nvidia/canary-1b"
)

# pipe = pipeline(
#     "text-generation", 
#     model="QuantFactory/Meta-Llama-3-8B-Instruct-GGUF", 
#     model_kwargs={"torch_dtype": torch.bfloat16}, 
#     device_map="auto"
# )

gr.Interface.from_pipeline(pipe,
                           title="ASR",
                           description="Using pipeline with Canary-1B",
                           ).launch(inbrowser=True)