mikeee commited on
Commit
a35c034
1 Parent(s): bc9925c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
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("THUDM/chatglm2-6b-int4",trust_remote_code=True).cuda() # 3.92
28
  else:
29
- model = AutoModel.from_pretrained("THUDM/chatglm2-6b-int4",trust_remote_code=True).float()
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():