Chenyuwen commited on
Commit
2fc6750
1 Parent(s): 11a3207
Files changed (1) hide show
  1. app.py +6 -5
app.py CHANGED
@@ -63,7 +63,7 @@ all_input = st.text_area('模型输入', value=prompt, height=400)
63
 
64
 
65
  with st.expander("配置"):
66
- stop_tokens = []
67
  def cut_message(answer: str):
68
  end = []
69
  for etk in stop_tokens:
@@ -81,17 +81,17 @@ with st.expander("配置"):
81
  elif task_type == 'COMPLETION':
82
  default_top_p, default_temperature, default_n, default_tokens = 0.95, 0.85, 1, 150
83
  else:
84
- default_top_p, default_temperature, default_n, default_tokens = 0.95, 0.85, 5, 85
85
 
86
  model = st.selectbox("model", ["medium", "large", "xl"], index=2)
87
  top_p = st.slider('top p', 0.0, 1.0, default_top_p)
88
  top_k = st.slider('top k', 0, 100, 0)
89
  temperature = st.slider('temperature', 0.0, 1.0, default_temperature)
90
  n = st.slider('n', 1, 30, default_n)
91
- max_tokens = st.slider('max tokens', 4, 1500, default_tokens)
92
 
93
  if st.checkbox("使用换行符作为截断", value=True):
94
- stop_tokens.append("\n")
95
 
96
  def completion():
97
  resp = requests.post("https://welm.weixin.qq.com/v1/completions", json={
@@ -101,7 +101,8 @@ def completion():
101
  'top_p': top_p,
102
  'top_k': top_k,
103
  'n': n,
104
- 'model': model
 
105
  }, headers={"Authorization": f"Bearer {st.secrets['token']}"})
106
  answer = resp.json()
107
  for idx, choice in enumerate(answer['choices']):
 
63
 
64
 
65
  with st.expander("配置"):
66
+ stop_tokens = ""
67
  def cut_message(answer: str):
68
  end = []
69
  for etk in stop_tokens:
 
81
  elif task_type == 'COMPLETION':
82
  default_top_p, default_temperature, default_n, default_tokens = 0.95, 0.85, 1, 150
83
  else:
84
+ default_top_p, default_temperature, default_n, default_tokens = 0.95, 0.85, 5, 64
85
 
86
  model = st.selectbox("model", ["medium", "large", "xl"], index=2)
87
  top_p = st.slider('top p', 0.0, 1.0, default_top_p)
88
  top_k = st.slider('top k', 0, 100, 0)
89
  temperature = st.slider('temperature', 0.0, 1.0, default_temperature)
90
  n = st.slider('n', 1, 30, default_n)
91
+ max_tokens = st.slider('max tokens', 4, 512, default_tokens)
92
 
93
  if st.checkbox("使用换行符作为截断", value=True):
94
+ stop_tokens = "\n"
95
 
96
  def completion():
97
  resp = requests.post("https://welm.weixin.qq.com/v1/completions", json={
 
101
  'top_p': top_p,
102
  'top_k': top_k,
103
  'n': n,
104
+ 'model': model,
105
+ "stop": stop_tokens,
106
  }, headers={"Authorization": f"Bearer {st.secrets['token']}"})
107
  answer = resp.json()
108
  for idx, choice in enumerate(answer['choices']):