picocreator commited on
Commit
166a74e
·
verified ·
1 Parent(s): 908e93e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -9
app.py CHANGED
@@ -6,13 +6,13 @@ from pynvml import *
6
  nvmlInit()
7
  gpu_h = nvmlDeviceGetHandleByIndex(0)
8
  ctx_limit = 3000
9
- title = "RWKV-5-World-7B-v2-20240128-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-5-world", filename=f"{title}.pth")
16
  model = RWKV(model=model_path, strategy='cuda fp16i8 *8 -> cuda fp16')
17
  from rwkv.utils import PIPELINE, PIPELINE_ARGS
18
  pipeline = PIPELINE(model, "rwkv_vocab_v20230424")
@@ -21,19 +21,19 @@ def generate_prompt(instruction, input=""):
21
  instruction = instruction.strip().replace('\r\n','\n').replace('\n\n','\n')
22
  input = input.strip().replace('\r\n','\n').replace('\n\n','\n')
23
  if input:
24
- return f"""Instruction: {instruction}
25
 
26
- Input: {input}
27
 
28
- Response:"""
29
  else:
30
- return f"""User: hi
31
 
32
- Assistant: Hi. I am your assistant and I will provide expert full response in full details. Please feel free to ask any question and I will always answer it.
33
 
34
- User: {instruction}
35
 
36
- Assistant:"""
37
 
38
  def evaluate(
39
  ctx,
 
6
  nvmlInit()
7
  gpu_h = nvmlDeviceGetHandleByIndex(0)
8
  ctx_limit = 3000
9
+ title = "RWKV-v5-Eagle-World-7B-v2-20240128-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="RWKV/v5-Eagle-7B", filename=f"{title}.pth")
16
  model = RWKV(model=model_path, strategy='cuda fp16i8 *8 -> cuda fp16')
17
  from rwkv.utils import PIPELINE, PIPELINE_ARGS
18
  pipeline = PIPELINE(model, "rwkv_vocab_v20230424")
 
21
  instruction = instruction.strip().replace('\r\n','\n').replace('\n\n','\n')
22
  input = input.strip().replace('\r\n','\n').replace('\n\n','\n')
23
  if input:
24
+ return f"""### Instruction: {instruction}
25
 
26
+ ### Input: {input}
27
 
28
+ ### Response:"""
29
  else:
30
+ return f"""### User: hi
31
 
32
+ ### Assistant: Hi. I am your assistant and I will provide expert full response in full details. Please feel free to ask any question and I will always answer it.
33
 
34
+ ### User: {instruction}
35
 
36
+ ### Assistant:"""
37
 
38
  def evaluate(
39
  ctx,