BlinkDL commited on
Commit
caceb4b
1 Parent(s): c8862f4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -3
app.py CHANGED
@@ -21,6 +21,12 @@ device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
21
  ctx_limit = 3500
22
  ########################## text rwkv ################################################################
23
  from rwkv.utils import PIPELINE, PIPELINE_ARGS
 
 
 
 
 
 
24
  title = "RWKV-5-World-1B5-v2-20231025-ctx4096"
25
  model_path = hf_hub_download(repo_id="BlinkDL/rwkv-5-world", filename=f"{title}.pth")
26
  model = RWKV(model=model_path, strategy='cuda fp16')
@@ -65,7 +71,7 @@ def evaluate(
65
  state = None
66
  for i in range(int(token_count)):
67
  input_ids = pipeline.encode(ctx)[-ctx_limit:] if i == 0 else [token]
68
- out, state = model.forward(tokens=input_ids, state=state)
69
  for n in occurrence:
70
  out[n] -= (args.alpha_presence + occurrence[n] * args.alpha_frequency)
71
 
@@ -261,9 +267,9 @@ def chatbot(image, question):
261
 
262
  ##################################################################################################################
263
  with gr.Blocks(title=title) as demo:
264
- gr.HTML(f"<div style=\"text-align: center;\">\n<h1>RWKV-5 World v2 - {title}</h1>\n</div>")
265
  with gr.Tab("Raw Generation"):
266
- 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 have [200+ Github RWKV projects](https://github.com/search?o=desc&p=1&q=rwkv&s=updated&type=Repositories). *** Please try examples first (bottom of page) *** (edit them to use your question). Demo limited to ctxlen {ctx_limit}.")
267
  with gr.Row():
268
  with gr.Column():
269
  prompt = gr.Textbox(lines=2, label="Prompt", value="Assistant: Sure! Here is a very detailed plan to create flying pigs:")
 
21
  ctx_limit = 3500
22
  ########################## text rwkv ################################################################
23
  from rwkv.utils import PIPELINE, PIPELINE_ARGS
24
+
25
+ title_v6 = "RWKV-x060-World-1B6-v2-20240208-ctx4096"
26
+ model_path_v6 = hf_hub_download(repo_id="BlinkDL/rwkv-6-world", filename=f"{title_v6}.pth")
27
+ model_v6 = RWKV(model=model_path_v6, strategy='cuda fp16')
28
+ pipeline_v6 = PIPELINE(model_v6, "rwkv_vocab_v20230424")
29
+
30
  title = "RWKV-5-World-1B5-v2-20231025-ctx4096"
31
  model_path = hf_hub_download(repo_id="BlinkDL/rwkv-5-world", filename=f"{title}.pth")
32
  model = RWKV(model=model_path, strategy='cuda fp16')
 
71
  state = None
72
  for i in range(int(token_count)):
73
  input_ids = pipeline.encode(ctx)[-ctx_limit:] if i == 0 else [token]
74
+ out, state = model_v6.forward(tokens=input_ids, state=state)
75
  for n in occurrence:
76
  out[n] -= (args.alpha_presence + occurrence[n] * args.alpha_frequency)
77
 
 
267
 
268
  ##################################################################################################################
269
  with gr.Blocks(title=title) as demo:
270
+ gr.HTML(f"<div style=\"text-align: center;\">\n<h1>{title_v6}</h1>\n</div>")
271
  with gr.Tab("Raw Generation"):
272
+ gr.Markdown(f"This is [RWKV-6 World v2](https://huggingface.co/BlinkDL/rwkv-6-world) with 1.6B params - a 100% attention-free RNN [RWKV-LM](https://github.com/BlinkDL/RWKV-LM). Supports all 100+ world languages and code. And we have [200+ Github RWKV projects](https://github.com/search?o=desc&p=1&q=rwkv&s=updated&type=Repositories). *** Please try examples first (bottom of page) *** (edit them to use your question). Demo limited to ctxlen {ctx_limit}.")
273
  with gr.Row():
274
  with gr.Column():
275
  prompt = gr.Textbox(lines=2, label="Prompt", value="Assistant: Sure! Here is a very detailed plan to create flying pigs:")