Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -48,16 +48,9 @@ def generate(
|
|
| 48 |
top_p: float,
|
| 49 |
top_k: int,
|
| 50 |
) -> Iterator[list[tuple[str, str]]]:
|
| 51 |
-
if max_new_tokens > MAX_MAX_NEW_TOKENS:
|
| 52 |
-
raise ValueError
|
| 53 |
|
| 54 |
history = history_with_input[:-1]
|
| 55 |
generator = run(message, history, system_prompt, max_new_tokens, temperature, top_p, top_k)
|
| 56 |
-
try:
|
| 57 |
-
first_response = next(generator)
|
| 58 |
-
yield history + [(message, first_response)]
|
| 59 |
-
except StopIteration:
|
| 60 |
-
yield history + [(message, '')]
|
| 61 |
for response in generator:
|
| 62 |
yield history + [(message, response)]
|
| 63 |
|
|
|
|
| 48 |
top_p: float,
|
| 49 |
top_k: int,
|
| 50 |
) -> Iterator[list[tuple[str, str]]]:
|
|
|
|
|
|
|
| 51 |
|
| 52 |
history = history_with_input[:-1]
|
| 53 |
generator = run(message, history, system_prompt, max_new_tokens, temperature, top_p, top_k)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
for response in generator:
|
| 55 |
yield history + [(message, response)]
|
| 56 |
|