JqzAugUST commited on
Commit
7149349
·
verified ·
1 Parent(s): 218ac8e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -10
app.py CHANGED
@@ -158,14 +158,13 @@ def gpu_handler_s(
158
  # for output_ids in model.ea_generate(**cuda_inputs):
159
  new_tokens, gen_tk_count = mtp_new_tokens(output_ids, gen_tk_count, existing_tk_count, stop_token_ids)
160
  new_token_text = tokenizer.decode(new_tokens, skip_special_tokens=False)
161
- logger.info(f"[TOKEN]'''{new_token_text}'''")
162
  stream_text += new_token_text
163
  token_per_sec = gen_tk_count / (time.time() - start_time)
164
  display_text = stream2display_text(stream_text, token_per_sec)
165
  history[-1] = (history[-1][0], display_text)
166
  yield "", history
167
 
168
- # logger.info(f"all gen text: \n{stream_text}")
169
  history[-1] = (history[-1][0], stream_text.replace("<|im_end|>", ""))
170
  # 替换 history 为非 display 形态的 text
171
 
@@ -238,9 +237,8 @@ def gen_response_stream(
238
 
239
  def create_app():
240
  assets_path = Path.cwd().absolute()/"assets"
241
- logger.info(f"设置静态资源路径: {assets_path}")
242
  gr.set_static_paths(paths=[assets_path])
243
- logger.info("静态资源路径设置完成")
244
 
245
  theme = gr.themes.Soft(
246
  primary_hue="blue",
@@ -249,12 +247,6 @@ def create_app():
249
  font=[gr.themes.GoogleFont("Inter"), "Arial", "sans-serif"],
250
  )
251
 
252
- # # Add border styling to components
253
- # theme = theme.set(
254
- # primary_border_size='1px', # 组件外框
255
- # primary_border_color='*neutral_400', # 用主题里的 slate-400 灰色
256
- # )
257
-
258
  with gr.Blocks(
259
  theme=theme,
260
  css="""
 
158
  # for output_ids in model.ea_generate(**cuda_inputs):
159
  new_tokens, gen_tk_count = mtp_new_tokens(output_ids, gen_tk_count, existing_tk_count, stop_token_ids)
160
  new_token_text = tokenizer.decode(new_tokens, skip_special_tokens=False)
161
+ logger.info(f"[MTP]'''{new_token_text}'''")
162
  stream_text += new_token_text
163
  token_per_sec = gen_tk_count / (time.time() - start_time)
164
  display_text = stream2display_text(stream_text, token_per_sec)
165
  history[-1] = (history[-1][0], display_text)
166
  yield "", history
167
 
 
168
  history[-1] = (history[-1][0], stream_text.replace("<|im_end|>", ""))
169
  # 替换 history 为非 display 形态的 text
170
 
 
237
 
238
  def create_app():
239
  assets_path = Path.cwd().absolute()/"assets"
 
240
  gr.set_static_paths(paths=[assets_path])
241
+ logger.info(f"Static resource path: {assets_path}. READY.")
242
 
243
  theme = gr.themes.Soft(
244
  primary_hue="blue",
 
247
  font=[gr.themes.GoogleFont("Inter"), "Arial", "sans-serif"],
248
  )
249
 
 
 
 
 
 
 
250
  with gr.Blocks(
251
  theme=theme,
252
  css="""