BlinkDL commited on
Commit
d93e535
1 Parent(s): 4643bb5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -10
app.py CHANGED
@@ -84,24 +84,24 @@ def evaluate(
84
  yield out_str.strip()
85
 
86
  examples = [
87
- [generate_prompt("Tell me about ravens."), 500, 1, 0.5, 0.4, 0.4],
88
- [generate_prompt("Write a python function to mine 1 BTC."), 500, 1, 0.5, 0.4, 0.4],
89
- [generate_prompt("Write a song about ravens."), 500, 1, 0.5, 0.4, 0.4],
90
- [generate_prompt("Write a story using the following information", "A man named Alex chops a tree down"), 500, 1, 0.5, 0.4, 0.4],
91
- [generate_prompt("Generate a list of adjectives that describe a person as brave."), 500, 1, 0.5, 0.4, 0.4],
92
- [generate_prompt("You have $100, and your goal is to turn that into as much money as possible with AI and Machine Learning. Please respond with detailed plan."), 500, 1, 0.5, 0.4, 0.4],
93
  ]
94
 
95
  ##########################################################################
96
 
97
  with gr.Blocks(title=title) as demo:
98
  gr.HTML(f"<div style=\"text-align: center;\">\n<h1>RWKV-5 World v2 - {title}</h1>\n</div>")
99
- with gr.Tab("Free Generation"):
100
- gr.Markdown(f"This is a *** 1.5B *** [RWKV-5 World v2](https://huggingface.co/BlinkDL/rwkv-5-world), which is 100% RNN [RWKV-LM](https://github.com/BlinkDL/RWKV-LM) and attention-free. *** Please try examples first (bottom of page) *** (edit them to use your question). Demo limited to ctxlen {ctx_limit}. For best results, *** keep you prompt short and clear ***.")
101
  with gr.Row():
102
  with gr.Column():
103
  prompt = gr.Textbox(lines=2, label="Prompt", value=generate_prompt("Tell me about ravens."))
104
- token_count = gr.Slider(10, 500, label="Max Tokens", step=10, value=500)
105
  temperature = gr.Slider(0.2, 2.0, label="Temperature", step=0.1, value=1.0)
106
  top_p = gr.Slider(0.0, 1.0, label="Top P", step=0.05, value=0.5)
107
  presence_penalty = gr.Slider(0.0, 1.0, label="Presence Penalty", step=0.1, value=0.4)
@@ -110,7 +110,7 @@ with gr.Blocks(title=title) as demo:
110
  with gr.Row():
111
  submit = gr.Button("Submit", variant="primary")
112
  clear = gr.Button("Clear", variant="secondary")
113
- output = gr.Textbox(label="Output", lines=20)
114
  data = gr.Dataset(components=[prompt, token_count, temperature, top_p, presence_penalty, count_penalty], samples=examples, label="Example Instructions", headers=["Prompt", "Max Tokens", "Temperature", "Top P", "Presence Penalty", "Count Penalty"])
115
  submit.click(evaluate, [prompt, token_count, temperature, top_p, presence_penalty, count_penalty], [output])
116
  clear.click(lambda: None, [], [output])
 
84
  yield out_str.strip()
85
 
86
  examples = [
87
+ [generate_prompt("Tell me about ravens."), 400, 1, 0.5, 0.4, 0.4],
88
+ [generate_prompt("Écrivez un programme Python pour miner 1 Bitcoin."), 400, 1, 0.5, 0.4, 0.4],
89
+ [generate_prompt("東京で訪れるべき素晴らしい場所とその紹介をいくつか挙げてください。"), 400, 1, 0.5, 0.4, 0.4],
90
+ [generate_prompt("Write a story using the following information", "A man named Alex chops a tree down"), 400, 1, 0.5, 0.4, 0.4],
91
+ [generate_prompt("Generate a list of adjectives that describe a person as brave."), 400, 1, 0.5, 0.4, 0.4],
92
+ [generate_prompt("You have $100, and your goal is to turn that into as much money as possible with AI and Machine Learning. Please respond with detailed plan."), 400, 1, 0.5, 0.4, 0.4],
93
  ]
94
 
95
  ##########################################################################
96
 
97
  with gr.Blocks(title=title) as demo:
98
  gr.HTML(f"<div style=\"text-align: center;\">\n<h1>RWKV-5 World v2 - {title}</h1>\n</div>")
99
+ with gr.Tab("Raw Generation"):
100
+ 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). *** Please try examples first (bottom of page) *** (edit them to use your question). Demo limited to ctxlen {ctx_limit}.")
101
  with gr.Row():
102
  with gr.Column():
103
  prompt = gr.Textbox(lines=2, label="Prompt", value=generate_prompt("Tell me about ravens."))
104
+ token_count = gr.Slider(10, 400, label="Max Tokens", step=10, value=400)
105
  temperature = gr.Slider(0.2, 2.0, label="Temperature", step=0.1, value=1.0)
106
  top_p = gr.Slider(0.0, 1.0, label="Top P", step=0.05, value=0.5)
107
  presence_penalty = gr.Slider(0.0, 1.0, label="Presence Penalty", step=0.1, value=0.4)
 
110
  with gr.Row():
111
  submit = gr.Button("Submit", variant="primary")
112
  clear = gr.Button("Clear", variant="secondary")
113
+ output = gr.Textbox(label="Output", lines=23)
114
  data = gr.Dataset(components=[prompt, token_count, temperature, top_p, presence_penalty, count_penalty], samples=examples, label="Example Instructions", headers=["Prompt", "Max Tokens", "Temperature", "Top P", "Presence Penalty", "Count Penalty"])
115
  submit.click(evaluate, [prompt, token_count, temperature, top_p, presence_penalty, count_penalty], [output])
116
  clear.click(lambda: None, [], [output])