Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -4,7 +4,7 @@ import torch
|
|
4 |
import gradio as gr
|
5 |
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM, TextIteratorStreamer
|
6 |
|
7 |
-
model_id = "
|
8 |
torch_device = "cuda" if torch.cuda.is_available() else "cpu"
|
9 |
print("Running on device:", torch_device)
|
10 |
print("CPU threads:", torch.get_num_threads())
|
@@ -17,7 +17,7 @@ else:
|
|
17 |
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
18 |
|
19 |
|
20 |
-
def run_generation(user_text, top_p, temperature, top_k, max_new_tokens):
|
21 |
# Get the model and tokenizer, and tokenize the user text.
|
22 |
model_inputs = tokenizer([user_text], return_tensors="pt").to(torch_device)
|
23 |
|
|
|
4 |
import gradio as gr
|
5 |
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM, TextIteratorStreamer
|
6 |
|
7 |
+
model_id = "pszemraj/flan-t5-large-instruct-dolly_hhrlhf"
|
8 |
torch_device = "cuda" if torch.cuda.is_available() else "cpu"
|
9 |
print("Running on device:", torch_device)
|
10 |
print("CPU threads:", torch.get_num_threads())
|
|
|
17 |
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
18 |
|
19 |
|
20 |
+
def run_generation(user_text, top_p, temperature, top_k, max_new_tokens, use_generation_config=False):
|
21 |
# Get the model and tokenizer, and tokenize the user text.
|
22 |
model_inputs = tokenizer([user_text], return_tensors="pt").to(torch_device)
|
23 |
|