Update app.py
Browse files
app.py
CHANGED
@@ -1,10 +1,22 @@
|
|
1 |
import gradio as gr
|
2 |
from transformers import pipeline, AutoTokenizer
|
3 |
|
4 |
-
tokenizer = AutoTokenizer.from_pretrained("microsoft/Phi-3-mini-128k-instruct")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
|
6 |
-
pipe = pipeline("text-generation", model="microsoft/Phi-3-mini-128k-instruct", trust_remote_code=True, tokenizer=tokenizer)
|
7 |
gr.Interface.from_pipeline(pipe,
|
8 |
title="TextGen",
|
9 |
-
description="Using pipeline with
|
10 |
).launch(inbrowser=True)
|
|
|
1 |
import gradio as gr
|
2 |
from transformers import pipeline, AutoTokenizer
|
3 |
|
4 |
+
# tokenizer = AutoTokenizer.from_pretrained("microsoft/Phi-3-mini-128k-instruct")
|
5 |
+
|
6 |
+
# pipe = pipeline("text-generation", model="microsoft/Phi-3-mini-128k-instruct", trust_remote_code=True, tokenizer=tokenizer)
|
7 |
+
# gr.Interface.from_pipeline(pipe,
|
8 |
+
# title="TextGen",
|
9 |
+
# description="Using pipeline with Phi3",
|
10 |
+
# ).launch(inbrowser=True)
|
11 |
+
|
12 |
+
pipe = pipeline(
|
13 |
+
"text-generation",
|
14 |
+
model="meta-llama/Meta-Llama-3-8B",
|
15 |
+
model_kwargs={"torch_dtype": torch.bfloat16},
|
16 |
+
device_map="auto"
|
17 |
+
)
|
18 |
|
|
|
19 |
gr.Interface.from_pipeline(pipe,
|
20 |
title="TextGen",
|
21 |
+
description="Using pipeline with Llama3",
|
22 |
).launch(inbrowser=True)
|