Commit
·
4f59140
1
Parent(s):
523de82
Update app.py
Browse files
app.py
CHANGED
@@ -1,13 +1,15 @@
|
|
1 |
import gradio as gr
|
2 |
import gc, copy, re
|
3 |
-
|
4 |
from rwkv.model import RWKV
|
5 |
from rwkv.utils import PIPELINE, PIPELINE_ARGS
|
6 |
|
7 |
ctx_limit = 2048
|
8 |
title = "RWKV-5-World-0.4B-v2-20231113-ctx4096.pth"
|
9 |
|
10 |
-
|
|
|
|
|
11 |
model = RWKV(model=model_path, strategy='cpu bf16')
|
12 |
pipeline = PIPELINE(model, "rwkv_vocab_v20230424")
|
13 |
|
@@ -110,7 +112,7 @@ def alternative(chatbot, history):
|
|
110 |
with gr.Blocks(title=title) as demo:
|
111 |
gr.HTML(f"<div style=\"text-align: center;\">\n<h1>🌍World - {title}</h1>\n</div>")
|
112 |
with gr.Tab("Instruct mode"):
|
113 |
-
gr.Markdown(f"100% RNN RWKV-LM **trained on 100+ world languages**. Demo limited to ctxlen {ctx_limit}. Finetuned on alpaca, gpt4all, codealpaca and more. For best results, ** keep you prompt short and clear
|
114 |
with gr.Row():
|
115 |
with gr.Column():
|
116 |
instruction = gr.Textbox(lines=2, label="Instruction", value='東京で訪れるべき素晴らしい場所とその紹介をいくつか挙げてください。')
|
|
|
1 |
import gradio as gr
|
2 |
import gc, copy, re
|
3 |
+
import urllib.request
|
4 |
from rwkv.model import RWKV
|
5 |
from rwkv.utils import PIPELINE, PIPELINE_ARGS
|
6 |
|
7 |
ctx_limit = 2048
|
8 |
title = "RWKV-5-World-0.4B-v2-20231113-ctx4096.pth"
|
9 |
|
10 |
+
url = f"https://huggingface.co/BlinkDL/rwkv-5-world/resolve/main/{title}"
|
11 |
+
urllib.request.urlretrieve(url, title)
|
12 |
+
|
13 |
model = RWKV(model=model_path, strategy='cpu bf16')
|
14 |
pipeline = PIPELINE(model, "rwkv_vocab_v20230424")
|
15 |
|
|
|
112 |
with gr.Blocks(title=title) as demo:
|
113 |
gr.HTML(f"<div style=\"text-align: center;\">\n<h1>🌍World - {title}</h1>\n</div>")
|
114 |
with gr.Tab("Instruct mode"):
|
115 |
+
gr.Markdown(f"100% RNN RWKV-LM **trained on 100+ world languages**. Demo limited to ctxlen {ctx_limit}. Finetuned on alpaca, gpt4all, codealpaca and more. For best results, ** keep you prompt short and clear **.")
|
116 |
with gr.Row():
|
117 |
with gr.Column():
|
118 |
instruction = gr.Textbox(lines=2, label="Instruction", value='東京で訪れるべき素晴らしい場所とその紹介をいくつか挙げてください。')
|