Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -8,12 +8,12 @@ from pynvml import *
|
|
8 |
HAS_GPU = False
|
9 |
|
10 |
# Model title and context size limit
|
11 |
-
ctx_limit =
|
12 |
-
|
13 |
-
|
14 |
|
15 |
-
title = "RWKV-4-World"
|
16 |
-
model_file = "RWKV-4-World-1.5B-v1-fixed-20230612-ctx4096"
|
17 |
|
18 |
# Get the GPU count
|
19 |
try:
|
@@ -87,7 +87,7 @@ Answer:"""
|
|
87 |
def evaluate(
|
88 |
instruction,
|
89 |
input=None,
|
90 |
-
token_count=
|
91 |
temperature=1.0,
|
92 |
top_p=0.7,
|
93 |
presencePenalty = 0.1,
|
@@ -143,25 +143,27 @@ def evaluate(
|
|
143 |
|
144 |
# Examples and gradio blocks
|
145 |
examples = [
|
146 |
-
["
|
147 |
-
["
|
148 |
-
[
|
149 |
-
[
|
150 |
-
[generate_prompt("
|
151 |
-
[generate_prompt("
|
152 |
-
["
|
153 |
-
[
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
|
|
|
|
165 |
]
|
166 |
|
167 |
##########################################################################
|
@@ -170,12 +172,12 @@ Edward:''', 333, 1, 0.3, 0, 1],
|
|
170 |
with gr.Blocks(title=title) as demo:
|
171 |
gr.HTML(f"<div style=\"text-align: center;\">\n<h1>RWKV-5 World v2 - {title}</h1>\n</div>")
|
172 |
with gr.Tab("Raw Generation"):
|
173 |
-
gr.Markdown(f"This is [RWKV-5 World v2](https://huggingface.co/BlinkDL/rwkv-5-world) with 1.5B params - a 100% attention-free RNN [RWKV-LM](https://github.com/BlinkDL/RWKV-LM). Supports all 100+ world languages and code. And we
|
174 |
with gr.Row():
|
175 |
with gr.Column():
|
176 |
#prompt = gr.Textbox(lines=2, label="Prompt", value="Assistant: Sure! Here is a very detailed plan to create flying pigs:")
|
177 |
|
178 |
-
instruction = gr.Textbox(lines=2, label="Instruction", value='
|
179 |
input = gr.Textbox(lines=2, label="Input", placeholder="none")
|
180 |
|
181 |
token_count = gr.Slider(10, 333, label="Max Tokens", step=10, value=333)
|
@@ -200,5 +202,5 @@ with gr.Blocks(title=title) as demo:
|
|
200 |
data.click(lambda x: x, [data], [instruction, input, token_count, temperature, top_p, presence_penalty, count_penalty])
|
201 |
|
202 |
# Gradio launch
|
203 |
-
demo.queue(concurrency_count=1, max_size=
|
204 |
demo.launch(share=False)
|
|
|
8 |
HAS_GPU = False
|
9 |
|
10 |
# Model title and context size limit
|
11 |
+
ctx_limit = 4000
|
12 |
+
title = "RWKV-5-World-1B5-v2-20231025-ctx4096"
|
13 |
+
model_file = "RWKV-5-World-1B5-v2-20231025-ctx4096"
|
14 |
|
15 |
+
#title = "RWKV-4-World"
|
16 |
+
#model_file = "RWKV-4-World-1.5B-v1-fixed-20230612-ctx4096"
|
17 |
|
18 |
# Get the GPU count
|
19 |
try:
|
|
|
87 |
def evaluate(
|
88 |
instruction,
|
89 |
input=None,
|
90 |
+
token_count=800,
|
91 |
temperature=1.0,
|
92 |
top_p=0.7,
|
93 |
presencePenalty = 0.1,
|
|
|
143 |
|
144 |
# Examples and gradio blocks
|
145 |
examples = [
|
146 |
+
["Write a song about flowers.", "", 300, 1.2, 0.5, 0.4, 0.4],
|
147 |
+
["寫一篇關於交通工程的車流理論模型之論文,需要詳細全面。", 300, 1.2, 0.5, 0.4, 0.4]
|
148 |
+
#["Assistant: Sure! Here is a very detailed plan to create flying pigs:", 333, 1, 0.3, 0, 1],
|
149 |
+
#["Assistant: Sure! Here are some ideas for FTL drive:", 333, 1, 0.3, 0, 1],
|
150 |
+
#[generate_prompt("Tell me about ravens."), 333, 1, 0.3, 0, 1],
|
151 |
+
#[generate_prompt("Écrivez un programme Python pour miner 1 Bitcoin, avec des commentaires."), 333, 1, 0.3, 0, 1],
|
152 |
+
#[generate_prompt("東京で訪れるべき素晴らしい場所とその紹介をいくつか挙げてください。"), 333, 1, 0.3, 0, 1],
|
153 |
+
#[generate_prompt("Write a story using the following information.", "A man named Alex chops a tree down."), 333, 1, 0.3, 0, 1],
|
154 |
+
#["Assistant: Here is a very detailed plan to kill all mosquitoes:", 333, 1, 0.3, 0, 1],
|
155 |
+
#['''Edward: I am Edward Elric from fullmetal alchemist. I am in the world of full metal alchemist and know nothing of the real world.
|
156 |
+
|
157 |
+
#User: Hello Edward. What have you been up to recently?
|
158 |
+
|
159 |
+
#Edward:''', 333, 1, 0.3, 0, 1],
|
160 |
+
#[generate_prompt("写一篇关于水利工程的流体力学模型的论文,需要详细全面。"), 333, 1, 0.3, 0, 1],
|
161 |
+
#['''“当然可以,大宇宙不会因为这五公斤就不坍缩了。”关一帆说,他还有一个没说出来的想法:也许大宇宙真的会因为相差一个原子的质量而由封闭转为开放。大自然的精巧有时超出想象,比如生命的诞生���就需要各项宇宙参数在几亿亿分之一精度上的精确配合。但程心仍然可以留下她的生态球,因为在那无数文明创造的无数小宇宙中,肯定有相当一部分不响应回归运动的号召,所以,大宇宙最终被夺走的质量至少有几亿吨,甚至可能是几亿亿亿吨。
|
162 |
+
#但愿大宇宙能够忽略这个误差。
|
163 |
+
#程心和关一帆进入了飞船,智子最后也进来了。她早就不再穿那身华丽的和服了,她现在身着迷彩服,再次成为一名轻捷精悍的战士,她的身上佩带着许多武器和生存装备,最引人注目的是那把插在背后的武士刀。
|
164 |
+
#“放心,我在,你们就在!”智子对两位人类朋友说。
|
165 |
+
#聚变发动机启动了,推进器发出幽幽的蓝光,飞船缓缓地穿过了宇宙之门。
|
166 |
+
#小宇宙中只剩下漂流瓶和生态球。漂流瓶隐没于黑暗里,在一千米见方的宇宙中,只有生态球里的小太阳发出一点光芒。在这个小小的生命世界中,几只清澈的水球在零重力环境中静静地飘浮着,有一条小鱼从一只水球中蹦出,跃入另一只水球,轻盈地穿游于绿藻之间。在一小块陆地上的草丛中,有一滴露珠从一片草叶上脱离,旋转着飘起,向太空中折射出一缕晶莹的阳光。''', 333, 1, 0.3, 0, 1],
|
167 |
]
|
168 |
|
169 |
##########################################################################
|
|
|
172 |
with gr.Blocks(title=title) as demo:
|
173 |
gr.HTML(f"<div style=\"text-align: center;\">\n<h1>RWKV-5 World v2 - {title}</h1>\n</div>")
|
174 |
with gr.Tab("Raw Generation"):
|
175 |
+
gr.Markdown(f"This is [RWKV-5 World v2](https://huggingface.co/BlinkDL/rwkv-5-world) with 1.5B params - a 100% attention-free RNN [RWKV-LM](https://github.com/BlinkDL/RWKV-LM). Supports all 100+ world languages and code. And we hav Demo limited to ctxlen {ctx_limit}.")
|
176 |
with gr.Row():
|
177 |
with gr.Column():
|
178 |
#prompt = gr.Textbox(lines=2, label="Prompt", value="Assistant: Sure! Here is a very detailed plan to create flying pigs:")
|
179 |
|
180 |
+
instruction = gr.Textbox(lines=2, label="Instruction", value='請寫一首詩。')
|
181 |
input = gr.Textbox(lines=2, label="Input", placeholder="none")
|
182 |
|
183 |
token_count = gr.Slider(10, 333, label="Max Tokens", step=10, value=333)
|
|
|
202 |
data.click(lambda x: x, [data], [instruction, input, token_count, temperature, top_p, presence_penalty, count_penalty])
|
203 |
|
204 |
# Gradio launch
|
205 |
+
demo.queue(concurrency_count=1, max_size=2)
|
206 |
demo.launch(share=False)
|