fb700 commited on
Commit
fb5377c
1 Parent(s): 25f26cb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -5
app.py CHANGED
@@ -2,8 +2,10 @@ from transformers import AutoModel, AutoTokenizer
2
  import gradio as gr
3
  import mdtex2html
4
 
5
- tokenizer = AutoTokenizer.from_pretrained("fb700/chatglm-fitness-RLHF", trust_remote_code=True)
6
- model = AutoModel.from_pretrained("fb700/chatglm-fitness-RLHF", trust_remote_code=True).quantize(8).half().cuda()
 
 
7
  model = model.eval()
8
 
9
  """Override Chatbot.postprocess"""
@@ -74,7 +76,7 @@ def reset_state():
74
 
75
 
76
  with gr.Blocks() as demo:
77
- gr.HTML("""<h1 align="center">帛凡 ChatGLM-6b-fitness-RLHF 演示</h1>""")
78
 
79
  chatbot = gr.Chatbot()
80
  with gr.Row():
@@ -86,7 +88,7 @@ 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, 409600, 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
 
@@ -98,4 +100,4 @@ with gr.Blocks() as demo:
98
 
99
  emptyBtn.click(reset_state, outputs=[chatbot, history], show_progress=True)
100
 
101
- demo.queue().launch(share=True, inbrowser=True)
 
2
  import gradio as gr
3
  import mdtex2html
4
 
5
+ checkpoint = "fb700/chatglm-fitness-RLHF"
6
+
7
+ tokenizer = AutoTokenizer.from_pretrained(checkpoint, trust_remote_code=True)
8
+ model = AutoModel.from_pretrained(checkpoint, trust_remote_code=True).quantize(4).half().cuda()
9
  model = model.eval()
10
 
11
  """Override Chatbot.postprocess"""
 
76
 
77
 
78
  with gr.Blocks() as demo:
79
+ gr.HTML("""<h1 align="center">帛凡 ChatGLM-6b-fitness-RLHF 演示 </h1>""")
80
 
81
  chatbot = gr.Chatbot()
82
  with gr.Row():
 
88
  submitBtn = gr.Button("Submit", variant="primary")
89
  with gr.Column(scale=1):
90
  emptyBtn = gr.Button("Clear History")
91
+ max_length = gr.Slider(0, 40960, value=20480, step=1.0, label="Maximum length", interactive=True)
92
  top_p = gr.Slider(0, 1, value=0.7, step=0.01, label="Top P", interactive=True)
93
  temperature = gr.Slider(0, 1, value=0.95, step=0.01, label="Temperature", interactive=True)
94
 
 
100
 
101
  emptyBtn.click(reset_state, outputs=[chatbot, history], show_progress=True)
102
 
103
+ demo.queue().launch(share=False, inbrowser=True)