Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -6,11 +6,11 @@ import gradio as gr
|
|
| 6 |
from transformers import AutoTokenizer, AutoModelForCausalLM, TextIteratorStreamer
|
| 7 |
import time
|
| 8 |
|
| 9 |
-
model_id = "
|
| 10 |
-
assistant_id = "
|
| 11 |
|
| 12 |
-
model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.bfloat16, device_map="auto"
|
| 13 |
-
assistant_model = AutoModelForCausalLM.from_pretrained(assistant_id, torch_dtype=torch.bfloat16, device_map="auto"
|
| 14 |
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
| 15 |
|
| 16 |
@spaces.GPU
|
|
@@ -56,9 +56,9 @@ def reset_textbox():
|
|
| 56 |
with gr.Blocks() as demo:
|
| 57 |
gr.Markdown(
|
| 58 |
"# 🤗 Assisted Generation Demo\n"
|
| 59 |
-
f"- Model: {model_id} (
|
| 60 |
-
f"- Assistant Model: {assistant_id} (BF16, ~
|
| 61 |
-
"- Running on a T4 GPU"
|
| 62 |
"- Best results are obtained when the model size difference in parameters is >10x"
|
| 63 |
)
|
| 64 |
|
|
|
|
| 6 |
from transformers import AutoTokenizer, AutoModelForCausalLM, TextIteratorStreamer
|
| 7 |
import time
|
| 8 |
|
| 9 |
+
model_id = "facebook/opt-1.3b"
|
| 10 |
+
assistant_id = "facebook/opt-125m"
|
| 11 |
|
| 12 |
+
model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.bfloat16, device_map="auto")
|
| 13 |
+
assistant_model = AutoModelForCausalLM.from_pretrained(assistant_id, torch_dtype=torch.bfloat16, device_map="auto")
|
| 14 |
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
| 15 |
|
| 16 |
@spaces.GPU
|
|
|
|
| 56 |
with gr.Blocks() as demo:
|
| 57 |
gr.Markdown(
|
| 58 |
"# 🤗 Assisted Generation Demo\n"
|
| 59 |
+
f"- Model: {model_id} (BF16, ~3GB)\n"
|
| 60 |
+
f"- Assistant Model: {assistant_id} (BF16, ~0.3GB)\n"
|
| 61 |
+
"- Running on a T4 GPU\n"
|
| 62 |
"- Best results are obtained when the model size difference in parameters is >10x"
|
| 63 |
)
|
| 64 |
|