Spaces:
Sleeping
Sleeping
fixing another intern error
Browse files
app.py
CHANGED
|
@@ -6,7 +6,7 @@ from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
|
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
-
pipe = pipeline("text-generation", model="TinyLlama/TinyLlama-1.1B-Chat-
|
| 10 |
|
| 11 |
DESC_SYSTEM_PROMPT = (
|
| 12 |
"Write a description of a fantasy character based on the user prompt"
|
|
@@ -35,6 +35,7 @@ def rand_char_description():
|
|
| 35 |
output1 = pipe(prompt1, return_full_text=False, max_new_tokens=256)
|
| 36 |
prompt2 = f"{BACK_SYSTEM_PROMPT}\n\n{output1}\n\nUser prompt: {rand_race}\n\nDescribe:"
|
| 37 |
output2 = pipe(prompt2, return_full_text=False, max_new_tokens=256)
|
|
|
|
| 38 |
|
| 39 |
#if the prompt is blank, use random number to choose a race and class from lists. The lists will only
|
| 40 |
# include the most common of each. This will be fed in as the user prompt in leiu of a real one.
|
|
|
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
+
pipe = pipeline("text-generation", model="TinyLlama/TinyLlama-1.1B-Chat-v1.0", torch_dtype=torch.bfloat16, device_map="auto")
|
| 10 |
|
| 11 |
DESC_SYSTEM_PROMPT = (
|
| 12 |
"Write a description of a fantasy character based on the user prompt"
|
|
|
|
| 35 |
output1 = pipe(prompt1, return_full_text=False, max_new_tokens=256)
|
| 36 |
prompt2 = f"{BACK_SYSTEM_PROMPT}\n\n{output1}\n\nUser prompt: {rand_race}\n\nDescribe:"
|
| 37 |
output2 = pipe(prompt2, return_full_text=False, max_new_tokens=256)
|
| 38 |
+
return output1, output2
|
| 39 |
|
| 40 |
#if the prompt is blank, use random number to choose a race and class from lists. The lists will only
|
| 41 |
# include the most common of each. This will be fed in as the user prompt in leiu of a real one.
|