MOSS550V commited on
Commit
e5f9abd
·
1 Parent(s): 12714cc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -4
app.py CHANGED
@@ -2,8 +2,11 @@ from transformers import AutoModel, AutoTokenizer
2
  import gradio as gr
3
  import mdtex2html
4
 
5
- tokenizer = AutoTokenizer.from_pretrained("MOSS550V/divination", trust_remote_code=True)
6
- model = AutoModel.from_pretrained("MOSS550V/divination", trust_remote_code=True).quantize(8).half().float()
 
 
 
7
  model = model.eval()
8
 
9
  """Override Chatbot.postprocess"""
@@ -86,9 +89,9 @@ with gr.Blocks() as demo:
86
  submitBtn = gr.Button("Submit", variant="primary")
87
  with gr.Column(scale=1):
88
  emptyBtn = gr.Button("Clear History")
89
- max_length = gr.Slider(0, 4096, value=2048, step=1.0, label="Maximum length", interactive=True)
90
  top_p = gr.Slider(0, 1, value=0.7, step=0.01, label="Top P", interactive=True)
91
- temperature = gr.Slider(0, 1, value=0.95, step=0.01, label="Temperature", interactive=True)
92
 
93
  history = gr.State([])
94
 
 
2
  import gradio as gr
3
  import mdtex2html
4
 
5
+ tokenizer = AutoTokenizer.from_pretrained("THUDM/chatglm-6b", trust_remote_code=True)
6
+ model = AutoModel.from_pretrained("MOSS550V/divination", trust_remote_code=True)
7
+ model = model.quantize(4)
8
+ model = model.half().cuda()
9
+ model.transformer.prefix_encoder.float()
10
  model = model.eval()
11
 
12
  """Override Chatbot.postprocess"""
 
89
  submitBtn = gr.Button("Submit", variant="primary")
90
  with gr.Column(scale=1):
91
  emptyBtn = gr.Button("Clear History")
92
+ max_length = gr.Slider(0, 4096, value=64, step=1.0, label="Maximum length", interactive=True)
93
  top_p = gr.Slider(0, 1, value=0.7, step=0.01, label="Top P", interactive=True)
94
+ temperature = gr.Slider(0, 1, value=0.45, step=0.01, label="Temperature", interactive=True)
95
 
96
  history = gr.State([])
97