Update app.py
Browse files
app.py
CHANGED
@@ -1,23 +1,29 @@
|
|
1 |
import gradio as gr
|
2 |
import torch
|
3 |
from transformers import pipeline, AutoTokenizer
|
|
|
4 |
|
5 |
-
#
|
|
|
6 |
|
7 |
-
#
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
# ).launch(inbrowser=True)
|
12 |
|
13 |
pipe = pipeline(
|
14 |
-
"
|
15 |
-
model="
|
16 |
-
model_kwargs={"torch_dtype": torch.bfloat16},
|
17 |
-
device_map="auto"
|
18 |
)
|
19 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
gr.Interface.from_pipeline(pipe,
|
21 |
-
title="
|
22 |
-
description="Using pipeline with
|
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)
|