Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -75,10 +75,18 @@ def generate(prompt, history,max_new_tokens,health,temperature=temperature,top_p
|
|
| 75 |
yield "",[(prompt,output)],health
|
| 76 |
else:
|
| 77 |
yield "",[(prompt,output)],health
|
| 78 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 79 |
#history=""
|
| 80 |
#formatted_prompt2 = format_prompt(f"{ADJUST_STATS.format(history=output,health=health)}, {prompt}", history)
|
| 81 |
-
stream2 = client.text_generation(f"{ADJUST_STATS.format(history=output,health=health)}", **
|
| 82 |
output2=""
|
| 83 |
for response in stream2:
|
| 84 |
output2 += response.token.text
|
|
|
|
| 75 |
yield "",[(prompt,output)],health
|
| 76 |
else:
|
| 77 |
yield "",[(prompt,output)],health
|
| 78 |
+
generate_kwargs2 = dict(
|
| 79 |
+
temperature=temperature,
|
| 80 |
+
max_new_tokens=256,
|
| 81 |
+
top_p=top_p,
|
| 82 |
+
repetition_penalty=repetition_penalty,
|
| 83 |
+
do_sample=True,
|
| 84 |
+
seed=random.randint(1,99999999999)
|
| 85 |
+
#seed=42,
|
| 86 |
+
)
|
| 87 |
#history=""
|
| 88 |
#formatted_prompt2 = format_prompt(f"{ADJUST_STATS.format(history=output,health=health)}, {prompt}", history)
|
| 89 |
+
stream2 = client.text_generation(f"{ADJUST_STATS.format(history=output,health=health)}", **generate_kwargs2, stream=True, details=True, return_full_text=False)
|
| 90 |
output2=""
|
| 91 |
for response in stream2:
|
| 92 |
output2 += response.token.text
|