Spaces:
Runtime error
Runtime error
ffreemt
commited on
Commit
·
9263f1a
1
Parent(s):
68482b0
Update
Browse files
app.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
# pylint: disable=broad-exception-caught, redefined-outer-name, missing-function-docstring, missing-module-docstring, too-many-arguments, line-too-long, invalid-name, redefined-builtin
|
| 2 |
# import gradio as gr
|
| 3 |
|
| 4 |
# model_name = "models/THUDM/chatglm2-6b-int4"
|
|
@@ -7,10 +7,10 @@
|
|
| 7 |
# %%writefile demo-4bit.py
|
| 8 |
|
| 9 |
from textwrap import dedent
|
| 10 |
-
import torch
|
| 11 |
|
| 12 |
import gradio as gr
|
| 13 |
import mdtex2html
|
|
|
|
| 14 |
from loguru import logger
|
| 15 |
|
| 16 |
# credit to https://github.com/THUDM/ChatGLM2-6B/blob/main/web_demo.py
|
|
@@ -99,7 +99,12 @@ def predict(
|
|
| 99 |
chatbot.append((parse_text(input), ""))
|
| 100 |
except Exception as exc:
|
| 101 |
logger.error(exc)
|
| 102 |
-
chatbot
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 103 |
yield chatbot, history, past_key_values
|
| 104 |
|
| 105 |
for response, history, past_key_values in model.stream_chat(
|
|
@@ -230,7 +235,7 @@ with gr.Blocks(title="ChatGLM2-6B-int4", theme=gr.themes.Soft(text_size="sm")) a
|
|
| 230 |
max_length = gr.Slider(
|
| 231 |
0,
|
| 232 |
32768,
|
| 233 |
-
value=8192
|
| 234 |
step=1.0,
|
| 235 |
label="Maximum length",
|
| 236 |
interactive=True,
|
|
|
|
| 1 |
+
# pylint: disable=broad-exception-caught, redefined-outer-name, missing-function-docstring, missing-module-docstring, too-many-arguments, line-too-long, invalid-name, redefined-builtin, redefined-argument-from-local
|
| 2 |
# import gradio as gr
|
| 3 |
|
| 4 |
# model_name = "models/THUDM/chatglm2-6b-int4"
|
|
|
|
| 7 |
# %%writefile demo-4bit.py
|
| 8 |
|
| 9 |
from textwrap import dedent
|
|
|
|
| 10 |
|
| 11 |
import gradio as gr
|
| 12 |
import mdtex2html
|
| 13 |
+
import torch
|
| 14 |
from loguru import logger
|
| 15 |
|
| 16 |
# credit to https://github.com/THUDM/ChatGLM2-6B/blob/main/web_demo.py
|
|
|
|
| 99 |
chatbot.append((parse_text(input), ""))
|
| 100 |
except Exception as exc:
|
| 101 |
logger.error(exc)
|
| 102 |
+
logger.debug(f"{chatbot=}")
|
| 103 |
+
_ = """
|
| 104 |
+
if chatbot:
|
| 105 |
+
chatbot[-1] = (parse_text(input), str(exc))
|
| 106 |
+
yield chatbot, history, past_key_values
|
| 107 |
+
# """
|
| 108 |
yield chatbot, history, past_key_values
|
| 109 |
|
| 110 |
for response, history, past_key_values in model.stream_chat(
|
|
|
|
| 235 |
max_length = gr.Slider(
|
| 236 |
0,
|
| 237 |
32768,
|
| 238 |
+
value=8192,
|
| 239 |
step=1.0,
|
| 240 |
label="Maximum length",
|
| 241 |
interactive=True,
|