BlinkDL commited on
Commit
ea44723
1 Parent(s): 4ae533d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -17
app.py CHANGED
@@ -20,6 +20,7 @@ device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
20
 
21
  ctx_limit = 2500
22
  gen_limit = 500
 
23
  ENABLE_VISUAL = False
24
 
25
  ########################## text rwkv ################################################################
@@ -32,8 +33,8 @@ model_v6 = RWKV(model=model_path_v6, strategy='cuda fp16')
32
  pipeline_v6 = PIPELINE(model_v6, "rwkv_vocab_v20230424")
33
 
34
  args = model_v6.args
35
- eng_name = 'rwkv-x060-eng_single_round_qa-3B-20240430-ctx1024'
36
- chn_name = 'rwkv-x060-chn_single_round_qa-3B-20240511-ctx1024'
37
 
38
  # state_eng_raw = torch.load(f'/mnt/e/RWKV-Runner/models/{eng_name}.pth', map_location=torch.device('cpu'))
39
  # state_chn_raw = torch.load(f'/mnt/e/RWKV-Runner/models/{chn_name}.pth', map_location=torch.device('cpu'))
@@ -267,22 +268,22 @@ examples = [
267
  ]
268
 
269
  examples_eng = [
270
- ["How can I craft an engaging story featuring vampires on Mars?", gen_limit, 1, 0.2, 0.3, 0.3],
271
- ["Compare the business models of Apple and Google.", gen_limit, 1, 0.2, 0.3, 0.3],
272
- ["In JSON format, list the top 5 tourist attractions in Paris.", gen_limit, 1, 0.2, 0.3, 0.3],
273
- ["Write an outline for a fantasy novel where dreams can alter reality.", gen_limit, 1, 0.2, 0.3, 0.3],
274
- ["Can fish get thirsty?", gen_limit, 1, 0.2, 0.3, 0.3],
275
- ["Write a Bash script to check disk usage and send alerts if it's too high.", gen_limit, 1, 0.2, 0.3, 0.3],
276
- ["Write a simple website in HTML. When a user clicks the button, it shows a random joke from a list of 4 jokes.", gen_limit, 1, 0.2, 0.3, 0.3],
277
  ]
278
 
279
  examples_chn = [
280
- ["怎样写一个在火星上的吸血鬼的有趣故事?", gen_limit, 1, 0.2, 0.3, 0.3],
281
- ["比较苹果和谷歌的商业模式。", gen_limit, 1, 0.2, 0.3, 0.3],
282
- ["鱼会口渴吗?", gen_limit, 1, 0.2, 0.3, 0.3],
283
- ["以 JSON 格式列举北京的美食。", gen_limit, 1, 0.2, 0.3, 0.3],
284
- ["编写一个Bash脚本来检查磁盘使用情况,如果使用量过高则发送警报。", gen_limit, 1, 0.2, 0.3, 0.3],
285
- ["用HTML编写一个简单的网站。当用户点击按钮时,从4个笑话的列表中随机显示一个笑话。", gen_limit, 1, 0.2, 0.3, 0.3],
286
  ]
287
 
288
  if ENABLE_VISUAL:
@@ -450,7 +451,7 @@ with gr.Blocks(title=title_v6) as demo:
450
  with gr.Row():
451
  with gr.Column():
452
  prompt = gr.Textbox(lines=2, label="Prompt", value="How can I craft an engaging story featuring vampires on Mars?")
453
- token_count = gr.Slider(10, gen_limit, label="Max Tokens", step=10, value=gen_limit)
454
  temperature = gr.Slider(0.2, 2.0, label="Temperature", step=0.1, value=1.0)
455
  top_p = gr.Slider(0.0, 1.0, label="Top P", step=0.05, value=0.2)
456
  presence_penalty = gr.Slider(0.0, 1.0, label="Presence Penalty", step=0.1, value=0.3)
@@ -470,7 +471,7 @@ with gr.Blocks(title=title_v6) as demo:
470
  with gr.Row():
471
  with gr.Column():
472
  prompt = gr.Textbox(lines=2, label="Prompt", value="怎样写一个在火星上的吸血鬼的有趣故事?")
473
- token_count = gr.Slider(10, gen_limit, label="Max Tokens", step=10, value=gen_limit)
474
  temperature = gr.Slider(0.2, 2.0, label="Temperature", step=0.1, value=1.0)
475
  top_p = gr.Slider(0.0, 1.0, label="Top P", step=0.05, value=0.2)
476
  presence_penalty = gr.Slider(0.0, 1.0, label="Presence Penalty", step=0.1, value=0.3)
 
20
 
21
  ctx_limit = 2500
22
  gen_limit = 500
23
+ gen_limit_long = 800
24
  ENABLE_VISUAL = False
25
 
26
  ########################## text rwkv ################################################################
 
33
  pipeline_v6 = PIPELINE(model_v6, "rwkv_vocab_v20230424")
34
 
35
  args = model_v6.args
36
+ eng_name = 'rwkv-x060-eng_single_round_qa-3B-20240516-ctx2048'
37
+ chn_name = 'rwkv-x060-chn_single_round_qa-3B-20240516-ctx2048'
38
 
39
  # state_eng_raw = torch.load(f'/mnt/e/RWKV-Runner/models/{eng_name}.pth', map_location=torch.device('cpu'))
40
  # state_chn_raw = torch.load(f'/mnt/e/RWKV-Runner/models/{chn_name}.pth', map_location=torch.device('cpu'))
 
268
  ]
269
 
270
  examples_eng = [
271
+ ["How can I craft an engaging story featuring vampires on Mars?", gen_limit_long, 1, 0.2, 0.3, 0.3],
272
+ ["Compare the business models of Apple and Google.", gen_limit_long, 1, 0.2, 0.3, 0.3],
273
+ ["In JSON format, list the top 5 tourist attractions in Paris.", gen_limit_long, 1, 0.2, 0.3, 0.3],
274
+ ["Write an outline for a fantasy novel where dreams can alter reality.", gen_limit_long, 1, 0.2, 0.3, 0.3],
275
+ ["Can fish get thirsty?", gen_limit_long, 1, 0.2, 0.3, 0.3],
276
+ ["Write a Bash script to check disk usage and send alerts if it's too high.", gen_limit_long, 1, 0.2, 0.3, 0.3],
277
+ ["Write a simple website in HTML. When a user clicks the button, it shows a random joke from a list of 4 jokes.", gen_limit_long, 1, 0.2, 0.3, 0.3],
278
  ]
279
 
280
  examples_chn = [
281
+ ["怎样写一个在火星上的吸血鬼的有趣故事?", gen_limit_long, 1, 0.2, 0.3, 0.3],
282
+ ["比较苹果和谷歌的商业模式。", gen_limit_long, 1, 0.2, 0.3, 0.3],
283
+ ["鱼会口渴吗?", gen_limit_long, 1, 0.2, 0.3, 0.3],
284
+ ["以 JSON 格式列举北京的美食。", gen_limit_long, 1, 0.2, 0.3, 0.3],
285
+ ["编写一个Bash脚本来检查磁盘使用情况,如果使用量过高则发送警报。", gen_limit_long, 1, 0.2, 0.3, 0.3],
286
+ ["用HTML编写一个简单的网站。当用户点击按钮时,从4个笑话的列表中随机显示一个笑话。", gen_limit_long, 1, 0.2, 0.3, 0.3],
287
  ]
288
 
289
  if ENABLE_VISUAL:
 
451
  with gr.Row():
452
  with gr.Column():
453
  prompt = gr.Textbox(lines=2, label="Prompt", value="How can I craft an engaging story featuring vampires on Mars?")
454
+ token_count = gr.Slider(10, gen_limit_long, label="Max Tokens", step=10, value=gen_limit_long)
455
  temperature = gr.Slider(0.2, 2.0, label="Temperature", step=0.1, value=1.0)
456
  top_p = gr.Slider(0.0, 1.0, label="Top P", step=0.05, value=0.2)
457
  presence_penalty = gr.Slider(0.0, 1.0, label="Presence Penalty", step=0.1, value=0.3)
 
471
  with gr.Row():
472
  with gr.Column():
473
  prompt = gr.Textbox(lines=2, label="Prompt", value="怎样写一个在火星上的吸血鬼的有趣故事?")
474
+ token_count = gr.Slider(10, gen_limit_long, label="Max Tokens", step=10, value=gen_limit_long)
475
  temperature = gr.Slider(0.2, 2.0, label="Temperature", step=0.1, value=1.0)
476
  top_p = gr.Slider(0.0, 1.0, label="Top P", step=0.05, value=0.2)
477
  presence_penalty = gr.Slider(0.0, 1.0, label="Presence Penalty", step=0.1, value=0.3)