Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -11,20 +11,13 @@ else:
|
|
11 |
print("Using CPU")
|
12 |
|
13 |
tokenizer = T5Tokenizer.from_pretrained("google/flan-t5-small")
|
14 |
-
model = T5ForConditionalGeneration.from_pretrained("roborovski/superprompt-v1", device_map="auto", torch_dtype=model_precision_type
|
15 |
-
|
16 |
-
model.to(device)
|
17 |
|
18 |
|
19 |
-
def generate(
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
top_p,
|
25 |
-
top_k,
|
26 |
-
seed
|
27 |
-
):
|
28 |
input_text = f"Expand the following prompt to add more detail: {prompt}"
|
29 |
input_ids = tokenizer(input_text, return_tensors="pt").input_ids.to(device)
|
30 |
|
|
|
11 |
print("Using CPU")
|
12 |
|
13 |
tokenizer = T5Tokenizer.from_pretrained("google/flan-t5-small")
|
|
|
|
|
|
|
14 |
|
15 |
|
16 |
+
def generate(prompt, model_precision_type, max_new_tokens, repetition_penalty, temperature, top_p, top_k, seed):
|
17 |
+
|
18 |
+
model = T5ForConditionalGeneration.from_pretrained("roborovski/superprompt-v1", device_map="auto", torch_dtype=model_precision_type)
|
19 |
+
model.to(device)
|
20 |
+
|
|
|
|
|
|
|
|
|
21 |
input_text = f"Expand the following prompt to add more detail: {prompt}"
|
22 |
input_ids = tokenizer(input_text, return_tensors="pt").input_ids.to(device)
|
23 |
|