Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -10,6 +10,7 @@ import gradio as gr
|
|
10 |
import mdtex2html
|
11 |
|
12 |
model_name = "THUDM/chatglm2-6b"
|
|
|
13 |
|
14 |
tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True)
|
15 |
|
@@ -24,9 +25,9 @@ has_cuda = torch.cuda.is_available()
|
|
24 |
# has_cuda = False # force cpu
|
25 |
|
26 |
if has_cuda:
|
27 |
-
model = AutoModel.from_pretrained(
|
28 |
else:
|
29 |
-
model = AutoModel.from_pretrained(
|
30 |
|
31 |
model = model.eval()
|
32 |
|
@@ -100,7 +101,7 @@ def reset_state():
|
|
100 |
|
101 |
|
102 |
with gr.Blocks() as demo:
|
103 |
-
gr.HTML("""<h1 align="center">ChatGLM2-6B</h1>""")
|
104 |
|
105 |
chatbot = gr.Chatbot()
|
106 |
with gr.Row():
|
|
|
10 |
import mdtex2html
|
11 |
|
12 |
model_name = "THUDM/chatglm2-6b"
|
13 |
+
model_name = "THUDM/chatglm2-6b-int4"
|
14 |
|
15 |
tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True)
|
16 |
|
|
|
25 |
# has_cuda = False # force cpu
|
26 |
|
27 |
if has_cuda:
|
28 |
+
model = AutoModel.from_pretrained(model_name,trust_remote_code=True).cuda() # 3.92
|
29 |
else:
|
30 |
+
model = AutoModel.from_pretrained(model_name,trust_remote_code=True).float()
|
31 |
|
32 |
model = model.eval()
|
33 |
|
|
|
101 |
|
102 |
|
103 |
with gr.Blocks() as demo:
|
104 |
+
gr.HTML("""<h1 align="center">ChatGLM2-6B-4bit</h1>""")
|
105 |
|
106 |
chatbot = gr.Chatbot()
|
107 |
with gr.Row():
|