NeverlandPeter commited on
Commit
e09c7c5
·
1 Parent(s): 3482f79
Files changed (1) hide show
  1. app.py +29 -15
app.py CHANGED
@@ -6,13 +6,13 @@ from pynvml import *
6
  nvmlInit()
7
  gpu_h = nvmlDeviceGetHandleByIndex(0)
8
  ctx_limit = 1024
9
- title = "rwkv-x060-eng_single_round_qa-3B-20240430-ctx1024"
10
 
11
  os.environ["RWKV_JIT_ON"] = '1'
12
  os.environ["RWKV_CUDA_ON"] = '1' # if '1' then use CUDA kernel for seq mode (much faster)
13
 
14
  from rwkv.model import RWKV
15
- model_path = hf_hub_download(repo_id="BlinkDL/temp-latest-training-models", filename=f"{title}.pth")
16
  model = RWKV(model=model_path, strategy='cuda fp16')
17
  from rwkv.utils import PIPELINE, PIPELINE_ARGS
18
  pipeline = PIPELINE(model, "rwkv_vocab_v20230424")
@@ -73,13 +73,27 @@ def evaluate(
73
  yield out_str.strip()
74
 
75
  examples = [
76
- ["How can I craft an engaging story featuring vampires on Mars?", 700, 1, 0.2, 0.3, 0.3],
77
- ["Compare the business models of Apple and Google.", 700, 1, 0.2, 0.3, 0.3],
78
- ["In JSON format, list the top 5 tourist attractions in Paris.", 700, 1, 0.2, 0.3, 0.3],
79
- ["Write an outline for a fantasy novel where dreams can alter reality.", 700, 1, 0.2, 0.3, 0.3],
80
- ["Can fish get thirsty?", 700, 1, 0.2, 0.3, 0.3],
81
- ["Write a Bash script to check disk usage and send alerts if it's too high.", 700, 1, 0.2, 0.3, 0.3],
82
- ["Write a simple website in HTML. When a user clicks the button, it shows a random joke from a list of 4 jokes.", 700, 1, 0.2, 0.3, 0.3],
 
 
 
 
 
 
 
 
 
 
 
 
 
 
83
  ]
84
 
85
  ##########################################################################
@@ -87,15 +101,15 @@ examples = [
87
  with gr.Blocks(title=title) as demo:
88
  gr.HTML(f"<div style=\"text-align: center;\">\n<h1>{title}</h1>\n</div>")
89
  with gr.Tab("Raw Generation"):
90
- gr.Markdown(f"This is [RWKV-6](https://huggingface.co/BlinkDL/temp-latest-training-models) [state-tuned](https://twitter.com/BlinkDL_AI/status/1784496793075744966) on single-round English Q & A. RWKV is a 100% attention-free RNN [RWKV-LM](https://github.com/BlinkDL/RWKV-LM), and we have [300+ Github RWKV projects](https://github.com/search?o=desc&p=1&q=rwkv&s=updated&type=Repositories). Demo limited to ctxlen {ctx_limit}.")
91
  with gr.Row():
92
  with gr.Column():
93
- prompt = gr.Textbox(lines=2, label="Prompt", value="How can I craft an engaging story featuring vampires on Mars?")
94
- token_count = gr.Slider(10, 700, label="Max Tokens", step=10, value=700)
95
  temperature = gr.Slider(0.2, 2.0, label="Temperature", step=0.1, value=1.0)
96
- top_p = gr.Slider(0.0, 1.0, label="Top P", step=0.05, value=0.2)
97
- presence_penalty = gr.Slider(0.0, 1.0, label="Presence Penalty", step=0.1, value=0.3)
98
- count_penalty = gr.Slider(0.0, 1.0, label="Count Penalty", step=0.1, value=0.3)
99
  with gr.Column():
100
  with gr.Row():
101
  submit = gr.Button("Submit", variant="primary")
 
6
  nvmlInit()
7
  gpu_h = nvmlDeviceGetHandleByIndex(0)
8
  ctx_limit = 1024
9
+ title = "RWKV-x060-World-7B-v2.1-20240507-ctx4096"
10
 
11
  os.environ["RWKV_JIT_ON"] = '1'
12
  os.environ["RWKV_CUDA_ON"] = '1' # if '1' then use CUDA kernel for seq mode (much faster)
13
 
14
  from rwkv.model import RWKV
15
+ model_path = hf_hub_download(repo_id="BlinkDL/rwkv-6-world", filename=f"{title}.pth")
16
  model = RWKV(model=model_path, strategy='cuda fp16')
17
  from rwkv.utils import PIPELINE, PIPELINE_ARGS
18
  pipeline = PIPELINE(model, "rwkv_vocab_v20230424")
 
73
  yield out_str.strip()
74
 
75
  examples = [
76
+ ["Assistant: How can we craft an engaging story featuring vampires on Mars? Let's think step by step and provide an expert response.", 500, 1, 0.3, 0, 1],
77
+ ["Assistant: How can we persuade Elon Musk to follow you on Twitter? Let's think step by step and provide an expert response.", 500, 1, 0.3, 0, 1],
78
+ [generate_prompt("東京で訪れるべき素晴らしい場所とその紹介をいくつか挙げてください。"), 500, 1, 0.3, 0, 1],
79
+ [generate_prompt("Write a story using the following information.", "A man named Alex chops a tree down."), 500, 1, 0.3, 0, 1],
80
+ ["A few light taps upon the pane made her turn to the window. It had begun to snow again.", 500, 1, 0.3, 0, 1],
81
+ ['''Edward: I am Edward Elric from Fullmetal Alchemist.
82
+
83
+ User: Hello Edward. What have you been up to recently?
84
+
85
+ Edward:''', 500, 1, 0.3, 0, 1],
86
+ ['''Japanese: 春の初め、桜の花が満開になる頃、小さな町の片隅にある古びた神社の境内は、特別な雰囲気に包まれていた。
87
+
88
+ English:''', 500, 1, 0.3, 0, 1],
89
+ ["En una pequeña aldea escondida entre las montañas de Andalucía, donde las calles aún conservaban el eco de antiguas leyendas, vivía un joven llamado Alejandro.", 500, 1, 0.3, 0, 1],
90
+ ["Dans le cœur battant de Paris, sous le ciel teinté d'un crépuscule d'or et de pourpre, se tenait une petite librairie oubliée par le temps.", 500, 1, 0.3, 0, 1],
91
+ ["في تطور مذهل وغير مسبوق، أعلنت السلطات المحلية في العاصمة عن اكتشاف أثري قد يغير مجرى التاريخ كما نعرفه.", 500, 1, 0.3, 0, 1],
92
+ ['''“当然可以,大宇宙不会因为这五公斤就不坍缩了。”关一帆说,他还有一个没说出来的想法:也许大宇宙真的会因为相差一个原子的质量而由封闭转为开放。大自然的精巧有时超出想象,比如生命的诞生,就需要各项宇宙参数在几亿亿分之一精度上的精确配合。但程心仍然可以留下她的生态球,因为在那无数文明创造的无数小宇宙中,肯定有相当一部分不响应回归运动的号召,所以,大宇宙最终被夺走的质量至少有几亿吨,甚至可能是几亿亿亿吨。
93
+ 但愿大宇宙能够忽略这个误差。
94
+ 程心和关一帆进入了飞船,智子最后也进来了。她早就不再穿那身华丽的和服了,她现在身着迷彩服,再次成为一名轻捷精悍的战士,她的身上佩带着许多武器和生存装备,最引人注目的是那把插在背后的武士刀。
95
+ “放心,我在,你们就在!”智子对两位人类朋友说。
96
+ 聚变发动机启动了,推进器发出幽幽的蓝光,''', 500, 1, 0.3, 0, 1],
97
  ]
98
 
99
  ##########################################################################
 
101
  with gr.Blocks(title=title) as demo:
102
  gr.HTML(f"<div style=\"text-align: center;\">\n<h1>{title}</h1>\n</div>")
103
  with gr.Tab("Raw Generation"):
104
+ gr.Markdown(f"This is [RWKV-6](https://huggingface.co/BlinkDL/rwkv-6-world) base model. Supports 100+ world languages and code. RWKV is a 100% attention-free RNN [RWKV-LM](https://github.com/BlinkDL/RWKV-LM), and we have [300+ Github RWKV projects](https://github.com/search?o=desc&p=1&q=rwkv&s=updated&type=Repositories). Demo limited to ctxlen {ctx_limit}.")
105
  with gr.Row():
106
  with gr.Column():
107
+ prompt = gr.Textbox(lines=2, label="Prompt", value="Assistant: How can we craft an engaging story featuring vampires on Mars? Let's think step by step and provide an expert response.")
108
+ token_count = gr.Slider(10, 500, label="Max Tokens", step=10, value=500)
109
  temperature = gr.Slider(0.2, 2.0, label="Temperature", step=0.1, value=1.0)
110
+ top_p = gr.Slider(0.0, 1.0, label="Top P", step=0.05, value=0.3)
111
+ presence_penalty = gr.Slider(0.0, 1.0, label="Presence Penalty", step=0.1, value=0)
112
+ count_penalty = gr.Slider(0.0, 1.0, label="Count Penalty", step=0.1, value=1)
113
  with gr.Column():
114
  with gr.Row():
115
  submit = gr.Button("Submit", variant="primary")