Compare commits

..

29 Commits

Author SHA1 Message Date
josc146
14acfc1d81 release v1.7.2 2024-03-02 19:47:53 +08:00
josc146
2947162cc4 update defaultModelConfigs 2024-03-02 19:45:14 +08:00
josc146
4f14074a75 expose global_penalty 2024-03-02 17:50:41 +08:00
josc146
53a5574080 improve parameters controllable range 2024-03-02 16:52:53 +08:00
josc146
d91c3c004d allow setting tokenChunkSize of WebGPU mode 2024-03-02 16:41:29 +08:00
github-actions[bot]
c90cefc453 release v1.7.1 2024-03-01 08:03:52 +00:00
josc146
b8abd2fef3 release v1.7.1 2024-03-01 16:03:22 +08:00
josc146
887ba06bd6 allow setting quantizedLayers of WebGPU mode; chore 2024-03-01 14:23:05 +08:00
josc146
c9513822c9 fix the issue where state cache could be modified leading to inconsistent hit results 2024-03-01 13:35:16 +08:00
josc146
e3baa0da86 improve occurrence[token] condition 2024-03-01 13:18:03 +08:00
josc146
ba9aab920e hide MPS and CUDA-Beta Options 2024-03-01 13:09:09 +08:00
josc146
b0f2ef65d9 improve occurrence[token] condition 2024-02-29 17:54:33 +08:00
josc146
c13b28561d update manifest 2024-02-29 17:21:07 +08:00
josc146
5c88ccd9e6 update manifest 2024-02-28 23:48:17 +08:00
josc146
e0a6a279b3 add python3-dev to lora fine-tune dependencies 2024-02-28 23:34:49 +08:00
josc146
9bb3a90977 enable useHfMirror by default for chinese users 2024-02-28 23:28:31 +08:00
josc146
02bbd18acf fix convert_safetensors.py for rwkv6 2024-02-28 23:25:46 +08:00
josc146
18ab8b141f disable AVOID_PENALTY_TOKENS 2024-02-28 23:12:58 +08:00
github-actions[bot]
225abc5202 release v1.7.0 2024-02-21 16:10:31 +00:00
josc146
d33dff7723 release v1.7.0 2024-02-22 01:10:01 +09:00
josc146
771027211a chore 2024-02-22 01:05:52 +09:00
josc146
94fe71b49c change AVOID_PENALTY to \n only 2024-02-22 01:04:05 +09:00
josc146
fafd9f7f6e upgrade to rwkv 0.8.25 2024-02-21 23:50:05 +08:00
josc146
85b10993ec update manifest.json 2024-02-12 14:30:36 +08:00
Guillermo Marcus
11f1d66383 fix typo in requirements.txt 2024-02-06 19:59:50 +08:00
josc146
38e89aec18 update README 2024-02-06 12:21:05 +08:00
josc146
3e336830a3 chore 2024-02-06 12:19:12 +08:00
josc146
a1ae71d221 fix /update-config can make the default value of unclearly specified fields invalid by passing in None fields 2024-02-05 22:27:02 +08:00
github-actions[bot]
0703993bfd release v1.6.9 2024-02-05 04:44:24 +00:00
34 changed files with 2696 additions and 210 deletions

1
.gitignore vendored
View File

@@ -19,7 +19,6 @@ __pycache__
/cmd-helper.bat /cmd-helper.bat
/install-py-dep.bat /install-py-dep.bat
/backend-python/wkv_cuda /backend-python/wkv_cuda
/backend-python/rwkv*
*.exe *.exe
*.old *.old
.DS_Store .DS_Store

View File

@@ -1,42 +1,17 @@
## Changes ## Changes
### Upgrades
- web-rwkv-py 0.1.2 (Support V4, V5 and V6) https://github.com/cryscan/web-rwkv-py
- webgpu 0.3.13 https://github.com/cgisky1980/ai00_rwkv_server
### Features ### Features
- add markdown renderer switch - allow setting tokenChunkSize of WebGPU mode
- allow loading conversation - expose global_penalty
- allow setting history message number
- expose penalty_decay, top_k
- add AVOID_PENALTY_TOKENS
- add [parse_api_log.py](https://github.com/josStorer/RWKV-Runner/blob/master/parse_api_log.py), this script can extract
formatted data from api.log
### Improvements ### Improvements
- improve macos experience - improve parameters controllable range
- improve fine-tune performance
- add better custom tokenizer support and tokenizer-midipiano.json
- improve path processing
- add EOS state cache point
- reduce package size
### Fixes
- fix WSL2 WindowsOptionalFeature: Microsoft-Windows-Subsystem-Linux -> VirtualMachinePlatform
- fix finetune errorsMap ($modelInfo)
### Chores ### Chores
- update defaultPresets
- update defaultModelConfigs - update defaultModelConfigs
- rename manifest tag "Main" -> "Official"
- update manifest.json
- update Related Repositories
- other minor changes
## Install ## Install

View File

@@ -12,6 +12,7 @@ compatible with the OpenAI API, which means that every ChatGPT client is an RWKV
[![license][license-image]][license-url] [![license][license-image]][license-url]
[![release][release-image]][release-url] [![release][release-image]][release-url]
[![py-version][py-version-image]][py-version-url]
English | [简体中文](README_ZH.md) | [日本語](README_JA.md) English | [简体中文](README_ZH.md) | [日本語](README_JA.md)
@@ -31,6 +32,10 @@ English | [简体中文](README_ZH.md) | [日本語](README_JA.md)
[release-url]: https://github.com/josStorer/RWKV-Runner/releases/latest [release-url]: https://github.com/josStorer/RWKV-Runner/releases/latest
[py-version-image]: https://img.shields.io/pypi/pyversions/fastapi.svg
[py-version-url]: https://github.com/josStorer/RWKV-Runner/tree/master/backend-python
[download-url]: https://github.com/josStorer/RWKV-Runner/releases [download-url]: https://github.com/josStorer/RWKV-Runner/releases
[Windows-image]: https://img.shields.io/badge/-Windows-blue?logo=windows [Windows-image]: https://img.shields.io/badge/-Windows-blue?logo=windows

View File

@@ -12,6 +12,7 @@
[![license][license-image]][license-url] [![license][license-image]][license-url]
[![release][release-image]][release-url] [![release][release-image]][release-url]
[![py-version][py-version-image]][py-version-url]
[English](README.md) | [简体中文](README_ZH.md) | 日本語 [English](README.md) | [简体中文](README_ZH.md) | 日本語
@@ -31,6 +32,10 @@
[release-url]: https://github.com/josStorer/RWKV-Runner/releases/latest [release-url]: https://github.com/josStorer/RWKV-Runner/releases/latest
[py-version-image]: https://img.shields.io/pypi/pyversions/fastapi.svg
[py-version-url]: https://github.com/josStorer/RWKV-Runner/tree/master/backend-python
[download-url]: https://github.com/josStorer/RWKV-Runner/releases [download-url]: https://github.com/josStorer/RWKV-Runner/releases
[Windows-image]: https://img.shields.io/badge/-Windows-blue?logo=windows [Windows-image]: https://img.shields.io/badge/-Windows-blue?logo=windows

View File

@@ -11,6 +11,7 @@ API兼容的接口这意味着一切ChatGPT客户端都是RWKV客户端。
[![license][license-image]][license-url] [![license][license-image]][license-url]
[![release][release-image]][release-url] [![release][release-image]][release-url]
[![py-version][py-version-image]][py-version-url]
[English](README.md) | 简体中文 | [日本語](README_JA.md) [English](README.md) | 简体中文 | [日本語](README_JA.md)
@@ -30,6 +31,10 @@ API兼容的接口这意味着一切ChatGPT客户端都是RWKV客户端。
[release-url]: https://github.com/josStorer/RWKV-Runner/releases/latest [release-url]: https://github.com/josStorer/RWKV-Runner/releases/latest
[py-version-image]: https://img.shields.io/pypi/pyversions/fastapi.svg
[py-version-url]: https://github.com/josStorer/RWKV-Runner/tree/master/backend-python
[download-url]: https://github.com/josStorer/RWKV-Runner/releases [download-url]: https://github.com/josStorer/RWKV-Runner/releases
[Windows-image]: https://img.shields.io/badge/-Windows-blue?logo=windows [Windows-image]: https://img.shields.io/badge/-Windows-blue?logo=windows

View File

@@ -54,19 +54,21 @@ def convert_file(pt_filename: str, sf_filename: str, rename={}, transpose_names=
loaded[k].unsqueeze(1).repeat(1, n_emb // loaded[k].shape[0]) loaded[k].unsqueeze(1).repeat(1, n_emb // loaded[k].shape[0])
) )
for k in kk: with torch.no_grad():
new_k = rename_key(rename, k).lower() for k in kk:
v = loaded[k].half() new_k = rename_key(rename, k).lower()
del loaded[k] v = loaded[k].half()
for transpose_name in transpose_names: del loaded[k]
if transpose_name in k: for transpose_name in transpose_names:
v = v.transpose(0, 1) if transpose_name in new_k:
print(f"{new_k}\t{v.shape}\t{v.dtype}") dims = len(v.shape)
loaded[new_k] = { v = v.transpose(dims - 2, dims - 1)
"dtype": str(v.dtype).split(".")[-1], print(f"{new_k}\t{v.shape}\t{v.dtype}")
"shape": v.shape, loaded[new_k] = {
"data": v.numpy().tobytes(), "dtype": str(v.dtype).split(".")[-1],
} "shape": v.shape,
"data": v.numpy().tobytes(),
}
dirname = os.path.dirname(sf_filename) dirname = os.path.dirname(sf_filename)
os.makedirs(dirname, exist_ok=True) os.makedirs(dirname, exist_ok=True)

View File

@@ -1,7 +1,7 @@
torch torch
torchvision torchvision
torchaudio torchaudio
rwkv==0.8.22 rwkv==0.8.25
langchain==0.0.322 langchain==0.0.322
fastapi==0.104.0 fastapi==0.104.0
uvicorn==0.23.2 uvicorn==0.23.2
@@ -22,4 +22,4 @@ PyMuPDF==1.23.5
python-multipart==0.0.6 python-multipart==0.0.6
Cython==3.0.4 Cython==3.0.4
cyac==1.9 cyac==1.9
torch_directml==0.1.13.1.dev230413 torch-directml==0.1.13.1.dev230413

View File

@@ -1,7 +1,7 @@
torch torch
torchvision torchvision
torchaudio torchaudio
rwkv==0.8.22 rwkv==0.8.25
langchain==0.0.322 langchain==0.0.322
fastapi==0.104.0 fastapi==0.104.0
uvicorn==0.23.2 uvicorn==0.23.2

View File

@@ -144,6 +144,7 @@ async def eval_rwkv(
return return
set_rwkv_config(model, global_var.get(global_var.Model_Config)) set_rwkv_config(model, global_var.get(global_var.Model_Config))
set_rwkv_config(model, body) set_rwkv_config(model, body)
print(get_rwkv_config(model))
response, prompt_tokens, completion_tokens = "", 0, 0 response, prompt_tokens, completion_tokens = "", 0, 0
for response, delta, prompt_tokens, completion_tokens in model.generate( for response, delta, prompt_tokens, completion_tokens in model.generate(
@@ -155,23 +156,27 @@ async def eval_rwkv(
if stream: if stream:
yield json.dumps( yield json.dumps(
{ {
"object": "chat.completion.chunk" "object": (
if chat_mode "chat.completion.chunk"
else "text_completion", if chat_mode
else "text_completion"
),
# "response": response, # "response": response,
"model": model.name, "model": model.name,
"choices": [ "choices": [
{ (
"delta": {"content": delta}, {
"index": 0, "delta": {"content": delta},
"finish_reason": None, "index": 0,
} "finish_reason": None,
if chat_mode }
else { if chat_mode
"text": delta, else {
"index": 0, "text": delta,
"finish_reason": None, "index": 0,
} "finish_reason": None,
}
)
], ],
} }
) )
@@ -193,23 +198,25 @@ async def eval_rwkv(
if stream: if stream:
yield json.dumps( yield json.dumps(
{ {
"object": "chat.completion.chunk" "object": (
if chat_mode "chat.completion.chunk" if chat_mode else "text_completion"
else "text_completion", ),
# "response": response, # "response": response,
"model": model.name, "model": model.name,
"choices": [ "choices": [
{ (
"delta": {}, {
"index": 0, "delta": {},
"finish_reason": "stop", "index": 0,
} "finish_reason": "stop",
if chat_mode }
else { if chat_mode
"text": "", else {
"index": 0, "text": "",
"finish_reason": "stop", "index": 0,
} "finish_reason": "stop",
}
)
], ],
} }
) )
@@ -225,20 +232,22 @@ async def eval_rwkv(
"total_tokens": prompt_tokens + completion_tokens, "total_tokens": prompt_tokens + completion_tokens,
}, },
"choices": [ "choices": [
{ (
"message": { {
"role": Role.Assistant.value, "message": {
"content": response, "role": Role.Assistant.value,
}, "content": response,
"index": 0, },
"finish_reason": "stop", "index": 0,
} "finish_reason": "stop",
if chat_mode }
else { if chat_mode
"text": response, else {
"index": 0, "text": response,
"finish_reason": "stop", "index": 0,
} "finish_reason": "stop",
}
)
], ],
} }

View File

@@ -86,23 +86,41 @@ def switch_model(body: SwitchModelBody, response: Response, request: Request):
if body.deploy: if body.deploy:
global_var.set(global_var.Deploy_Mode, True) global_var.set(global_var.Deploy_Mode, True)
if global_var.get(global_var.Model_Config) is None:
global_var.set( saved_model_config = global_var.get(global_var.Model_Config)
global_var.Model_Config, get_rwkv_config(global_var.get(global_var.Model)) init_model_config = get_rwkv_config(global_var.get(global_var.Model))
) if saved_model_config is not None:
merge_model(init_model_config, saved_model_config)
global_var.set(global_var.Model_Config, init_model_config)
global_var.set(global_var.Model_Status, global_var.ModelStatus.Working) global_var.set(global_var.Model_Status, global_var.ModelStatus.Working)
return "success" return "success"
def merge_model(to_model: BaseModel, from_model: BaseModel):
from_model_fields = [x for x in from_model.dict().keys()]
to_model_fields = [x for x in to_model.dict().keys()]
for field_name in from_model_fields:
if field_name in to_model_fields:
from_value = getattr(from_model, field_name)
if from_value is not None:
setattr(to_model, field_name, from_value)
@router.post("/update-config", tags=["Configs"]) @router.post("/update-config", tags=["Configs"])
def update_config(body: ModelConfigBody): def update_config(body: ModelConfigBody):
""" """
Will not update the model config immediately, but set it when completion called to avoid modifications during generation Will not update the model config immediately, but set it when completion called to avoid modifications during generation
""" """
print(body) model_config = global_var.get(global_var.Model_Config)
global_var.set(global_var.Model_Config, body) if model_config is None:
model_config = ModelConfigBody()
global_var.set(global_var.Model_Config, model_config)
merge_model(model_config, body)
print("Updated Model Config:", model_config)
return "success" return "success"

View File

@@ -76,6 +76,31 @@ class AddStateBody(BaseModel):
logits: Any logits: Any
def copy_tensor_to_cpu(tensors):
import torch
import numpy as np
devices: List[torch.device] = []
copied: Union[Any, None] = None
tensors_type = type(tensors)
if tensors_type == list:
if hasattr(tensors[0], "device"): # torch state
devices = [tensor.device for tensor in tensors]
copied = [tensor.cpu() for tensor in tensors]
else: # WebGPU logits
copied = tensors
elif tensors_type == torch.Tensor: # torch logits
devices = [tensors.device]
copied = tensors.cpu()
elif tensors_type == np.ndarray: # rwkv.cpp
copied = tensors
else: # WebGPU state
copied = tensors.back()
return copied, devices
# @router.post("/add-state", tags=["State Cache"]) # @router.post("/add-state", tags=["State Cache"])
def add_state(body: AddStateBody): def add_state(body: AddStateBody):
global trie, dtrie, loop_del_trie_id global trie, dtrie, loop_del_trie_id
@@ -91,23 +116,24 @@ def add_state(body: AddStateBody):
try: try:
devices: List[torch.device] = [] devices: List[torch.device] = []
logits_device: Union[torch.device, None] = None
state: Union[Any, None] = None state: Union[Any, None] = None
logits: Union[Any, None] = None
if body.state is not None: if body.state is not None:
if type(body.state) == list and hasattr(body.state[0], "device"): # torch state, devices = copy_tensor_to_cpu(body.state)
devices = [tensor.device for tensor in body.state] if body.logits is not None:
state = [tensor.cpu() for tensor in body.state] logits, logits_devices = copy_tensor_to_cpu(body.logits)
elif type(body.state) == np.ndarray: # rwkv.cpp if len(logits_devices) > 0:
state = body.state logits_device = logits_devices[0]
else: # WebGPU
state = body.state.back()
id: int = trie.insert(body.prompt) id: int = trie.insert(body.prompt)
dtrie[id] = { dtrie[id] = {
"tokens": body.tokens, "tokens": body.tokens,
"state": state, "state": state,
"logits": body.logits, "logits": logits,
"devices": devices, "devices": devices,
"logits_device": logits_device,
} }
if len(trie) >= max_trie_len: if len(trie) >= max_trie_len:
@@ -125,6 +151,7 @@ def add_state(body: AddStateBody):
) )
return "success" return "success"
except Exception as e: except Exception as e:
print(e) # should not happen
raise HTTPException( raise HTTPException(
status.HTTP_400_BAD_REQUEST, f"insert failed, bad prompt.\n{e}" status.HTTP_400_BAD_REQUEST, f"insert failed, bad prompt.\n{e}"
) )
@@ -192,18 +219,33 @@ def longest_prefix_state(body: LongestPrefixStateBody, request: Request):
if id != -1: if id != -1:
prompt: str = trie[id] prompt: str = trie[id]
v = dtrie[id] v = dtrie[id]
tokens: List[Union[str, int]] = copy.deepcopy(v["tokens"])
devices: List[torch.device] = v["devices"] devices: List[torch.device] = v["devices"]
logits_device: Union[torch.device, None] = v["logits_device"]
state: Union[Any, None] = v["state"] state: Union[Any, None] = v["state"]
logits: Union[Any, None] = v["logits"]
if type(state) == list and hasattr(state[0], "device"): # torch if type(state) == list and hasattr(state[0], "device"): # torch
state = [tensor.to(devices[i]) for i, tensor in enumerate(state)] state = [
tensor.to(devices[i])
if devices[i] != torch.device("cpu")
else tensor.clone()
for i, tensor in enumerate(state)
]
logits = (
logits.to(logits_device)
if logits_device != torch.device("cpu")
else logits.clone()
)
else: # rwkv.cpp, WebGPU
logits = np.copy(logits)
quick_log(request, body, "Hit:\n" + prompt) quick_log(request, body, "Hit:\n" + prompt)
return { return {
"prompt": prompt, "prompt": prompt,
"tokens": v["tokens"], "tokens": tokens,
"state": state, "state": state,
"logits": v["logits"], "logits": logits,
} }
else: else:
return {"prompt": "", "tokens": [], "state": None, "logits": None} return {"prompt": "", "tokens": [], "state": None, "logits": None}

View File

@@ -552,7 +552,12 @@ class RWKV(MyModule):
elif ".ln_x" in x: # need fp32 for group_norm elif ".ln_x" in x: # need fp32 for group_norm
w[x] = w[x].float() w[x] = w[x].float()
else: else:
if (len(w[x].shape) == 2) and ("emb" not in x): if (
(len(w[x].shape) == 2)
and ("emb" not in x)
and ("_w1" not in x)
and ("_w2" not in x)
):
if WTYPE != torch.uint8: if WTYPE != torch.uint8:
w[x] = w[x].to(dtype=WTYPE) w[x] = w[x].to(dtype=WTYPE)
else: else:

File diff suppressed because it is too large Load Diff

View File

@@ -171,10 +171,17 @@ class PIPELINE:
all_tokens += [token] all_tokens += [token]
for xxx in occurrence: for xxx in occurrence:
occurrence[xxx] *= args.alpha_decay occurrence[xxx] *= args.alpha_decay
ttt = self.decode([token])
www = 1
if ttt in " \t0123456789":
www = 0
# elif ttt in '\r\n,.;?!"\':+-*/=#@$%^&_`~|<>\\()[]{},。;“”:?!()【】':
# www = 0.5
if token not in occurrence: if token not in occurrence:
occurrence[token] = 1 occurrence[token] = www
else: else:
occurrence[token] += 1 occurrence[token] += www
# print(occurrence) # debug # print(occurrence) # debug
# output # output

View File

@@ -19,12 +19,26 @@ class RWKV:
self.version = str(self.info.version).lower() self.version = str(self.info.version).lower()
self.wrp = getattr(wrp, self.version) self.wrp = getattr(wrp, self.version)
layer = (
int(s.lstrip("layer"))
for s in strategy.split()
for s in s.split(",")
if s.startswith("layer")
)
chunk_size = (
int(s.lstrip("chunk"))
for s in strategy.split()
for s in s.split(",")
if s.startswith("chunk")
)
args = { args = {
"file": model_path, "file": model_path,
"turbo": True, "turbo": True,
"quant": 32 if "i8" in strategy else 0, "quant": next(layer, 31) if "i8" in strategy else 0,
"quant_nf4": 26 if "i4" in strategy else 0, "quant_nf4": next(layer, 26) if "i4" in strategy else 0,
"token_chunk_size": 32, "token_chunk_size": next(chunk_size, 32),
"lora": None, "lora": None,
} }
self.model = self.wrp.Model(**args) self.model = self.wrp.Model(**args)

View File

@@ -40,6 +40,7 @@ class AbstractRWKV(ABC):
self.penalty_alpha_presence = 0 self.penalty_alpha_presence = 0
self.penalty_alpha_frequency = 1 self.penalty_alpha_frequency = 1
self.penalty_decay = 0.996 self.penalty_decay = 0.996
self.global_penalty = False
@abstractmethod @abstractmethod
def adjust_occurrence(self, occurrence: Dict, token: int): def adjust_occurrence(self, occurrence: Dict, token: int):
@@ -372,18 +373,18 @@ class TextRWKV(AbstractRWKV):
self.bot = "Assistant" self.bot = "Assistant"
self.END_OF_LINE = 11 self.END_OF_LINE = 11
self.AVOID_REPEAT_TOKENS = [] self.AVOID_REPEAT_TOKENS = set()
AVOID_REPEAT = "" AVOID_REPEAT = ""
for i in AVOID_REPEAT: for i in AVOID_REPEAT:
dd = self.pipeline.encode(i) dd = self.pipeline.encode(i)
assert len(dd) == 1 assert len(dd) == 1
self.AVOID_REPEAT_TOKENS += dd self.AVOID_REPEAT_TOKENS.add(dd[0])
self.AVOID_PENALTY_TOKENS = [] self.AVOID_PENALTY_TOKENS = set()
AVOID_PENALTY = "\n,.:,。:<>[]{}()/\\|;" # \n,.:?!,。:?!"“”<>[]{}/\\|;~`@#$%^&*()_+-=0123456789 AVOID_PENALTY = '\n,.:?!,。:?!"“”<>[]{}/\\|;~`@#$%^&*()_+-=0123456789 '
for i in AVOID_PENALTY: for i in AVOID_PENALTY:
dd = self.pipeline.encode(i) dd = self.pipeline.encode(i)
assert len(dd) == 1 if len(dd) == 1:
self.AVOID_PENALTY_TOKENS += dd self.AVOID_PENALTY_TOKENS.add(dd[0])
self.__preload() self.__preload()
@@ -397,21 +398,18 @@ class TextRWKV(AbstractRWKV):
def adjust_forward_logits(self, logits: List[float], occurrence: Dict, i: int): def adjust_forward_logits(self, logits: List[float], occurrence: Dict, i: int):
for n in occurrence: for n in occurrence:
if n not in self.AVOID_PENALTY_TOKENS: # if n not in self.AVOID_PENALTY_TOKENS:
logits[n] -= ( logits[n] -= (
self.penalty_alpha_presence self.penalty_alpha_presence
+ occurrence[n] * self.penalty_alpha_frequency + occurrence[n] * self.penalty_alpha_frequency
) )
if i == 0: # set global_penalty to False to get the same generated results as the official RWKV Gradio
if self.global_penalty and i == 0:
for token in self.model_tokens: for token in self.model_tokens:
token = int(token) token = int(token)
for xxx in occurrence: if token not in self.AVOID_PENALTY_TOKENS:
occurrence[xxx] *= self.penalty_decay self.adjust_occurrence(occurrence, token)
if token not in occurrence:
occurrence[token] = 1
else:
occurrence[token] += 1
# Model only saw '\n\n' as [187, 187] before, but the tokenizer outputs [535] for it at the end # Model only saw '\n\n' as [187, 187] before, but the tokenizer outputs [535] for it at the end
def fix_tokens(self, tokens) -> List[int]: def fix_tokens(self, tokens) -> List[int]:
@@ -670,12 +668,13 @@ def RWKV(model: str, strategy: str, tokenizer: Union[str, None]) -> AbstractRWKV
class ModelConfigBody(BaseModel): class ModelConfigBody(BaseModel):
max_tokens: int = Field(default=None, gt=0, le=102400) max_tokens: int = Field(default=None, gt=0, le=102400)
temperature: float = Field(default=None, ge=0, le=2) temperature: float = Field(default=None, ge=0, le=3)
top_p: float = Field(default=None, ge=0, le=1) top_p: float = Field(default=None, ge=0, le=1)
presence_penalty: float = Field(default=None, ge=-2, le=2) presence_penalty: float = Field(default=None, ge=-2, le=2)
frequency_penalty: float = Field(default=None, ge=-2, le=2) frequency_penalty: float = Field(default=None, ge=-2, le=2)
penalty_decay: float = Field(default=None, ge=0.99, le=0.999) penalty_decay: float = Field(default=None, ge=0.99, le=0.999)
top_k: int = Field(default=None, ge=0, le=25) top_k: int = Field(default=None, ge=0, le=25)
global_penalty: bool = Field(default=None)
model_config = { model_config = {
"json_schema_extra": { "json_schema_extra": {
@@ -686,6 +685,7 @@ class ModelConfigBody(BaseModel):
"presence_penalty": 0, "presence_penalty": 0,
"frequency_penalty": 1, "frequency_penalty": 1,
"penalty_decay": 0.996, "penalty_decay": 0.996,
"global_penalty": False,
} }
} }
} }
@@ -709,6 +709,8 @@ def set_rwkv_config(model: AbstractRWKV, body: ModelConfigBody):
model.penalty_decay = body.penalty_decay model.penalty_decay = body.penalty_decay
if body.top_k is not None: if body.top_k is not None:
model.top_k = body.top_k model.top_k = body.top_k
if body.global_penalty is not None:
model.global_penalty = body.global_penalty
def get_rwkv_config(model: AbstractRWKV) -> ModelConfigBody: def get_rwkv_config(model: AbstractRWKV) -> ModelConfigBody:
@@ -720,4 +722,5 @@ def get_rwkv_config(model: AbstractRWKV) -> ModelConfigBody:
frequency_penalty=model.penalty_alpha_frequency, frequency_penalty=model.penalty_alpha_frequency,
penalty_decay=model.penalty_decay, penalty_decay=model.penalty_decay,
top_k=model.top_k, top_k=model.top_k,
global_penalty=model.global_penalty,
) )

View File

@@ -22,6 +22,12 @@ else
sudo apt -y install python3-pip sudo apt -y install python3-pip
fi fi
if dpkg -s "python3-dev" >/dev/null 2>&1; then
echo "python3-dev installed"
else
sudo apt -y install python3-dev
fi
if dpkg -s "ninja-build" >/dev/null 2>&1; then if dpkg -s "ninja-build" >/dev/null 2>&1; then
echo "ninja installed" echo "ninja installed"
else else

View File

@@ -6430,7 +6430,7 @@
}, },
"node_modules/typescript": { "node_modules/typescript": {
"version": "5.0.4", "version": "5.0.4",
"resolved": "https://registry.npmmirror.com/typescript/-/typescript-5.0.4.tgz", "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.0.4.tgz",
"integrity": "sha512-cW9T5W9xY37cc+jfEnaUvX91foxtHkza3Nw3wkoF4sSlKn0MONdkdEndig/qPBWXNkmplh3NzayQzCiHM4/hqw==", "integrity": "sha512-cW9T5W9xY37cc+jfEnaUvX91foxtHkza3Nw3wkoF4sSlKn0MONdkdEndig/qPBWXNkmplh3NzayQzCiHM4/hqw==",
"dev": true, "dev": true,
"bin": { "bin": {

View File

@@ -341,5 +341,11 @@
"Load Conversation": "会話を読み込む", "Load Conversation": "会話を読み込む",
"The latest X messages will be sent to the server. If you are using the RWKV-Runner server, please use the default value because RWKV-Runner has built-in state cache management which only calculates increments. Sending all messages will have lower cost. If you are using ChatGPT, adjust this value according to your needs to reduce ChatGPT expenses.": "最新のX件のメッセージがサーバーに送信されます。RWKV-Runnerサーバーを使用している場合は、デフォルト値を使用してください。RWKV-Runnerには組み込みの状態キャッシュ管理があり、増分のみを計算します。すべてのメッセージを送信すると、コストが低くなります。ChatGPTを使用している場合は、ChatGPTの費用を削減するために必要に応じてこの値を調整してください。", "The latest X messages will be sent to the server. If you are using the RWKV-Runner server, please use the default value because RWKV-Runner has built-in state cache management which only calculates increments. Sending all messages will have lower cost. If you are using ChatGPT, adjust this value according to your needs to reduce ChatGPT expenses.": "最新のX件のメッセージがサーバーに送信されます。RWKV-Runnerサーバーを使用している場合は、デフォルト値を使用してください。RWKV-Runnerには組み込みの状態キャッシュ管理があり、増分のみを計算します。すべてのメッセージを送信すると、コストが低くなります。ChatGPTを使用している場合は、ChatGPTの費用を削減するために必要に応じてこの値を調整してください。",
"History Message Number": "履歴メッセージ数", "History Message Number": "履歴メッセージ数",
"Send All Message": "すべてのメッセージを送信" "Send All Message": "すべてのメッセージを送信",
"Quantized Layers": "量子化されたレイヤー",
"Number of the neural network layers quantized with current precision, the more you quantize, the lower the VRAM usage, but the quality correspondingly decreases.": "現在の精度で量子化されたニューラルネットワークのレイヤーの数、量子化するほどVRAMの使用量が低くなりますが、品質も相応に低下します。",
"Parallel Token Chunk Size": "並列トークンチャンクサイズ",
"Maximum tokens to be processed in parallel at once. For high end GPUs, this could be 64 or 128 (faster).": "一度に並列で処理される最大トークン数。高性能なGPUの場合、64または128になります高速。",
"Global Penalty": "グローバルペナルティ",
"When generating a response, whether to include the submitted prompt as a penalty factor. By turning this off, you will get the same generated results as official RWKV Gradio. If you find duplicate results in the generated results, turning this on can help avoid generating duplicates.": "レスポンスを生成する際、提出されたプロンプトをペナルティ要因として含めるかどうか。これをオフにすると、公式RWKV Gradioと同じ生成結果を得ることができます。生成された結果に重複がある場合、これをオンにすることで重複の生成を回避するのに役立ちます。"
} }

View File

@@ -341,5 +341,11 @@
"Load Conversation": "读取对话", "Load Conversation": "读取对话",
"The latest X messages will be sent to the server. If you are using the RWKV-Runner server, please use the default value because RWKV-Runner has built-in state cache management which only calculates increments. Sending all messages will have lower cost. If you are using ChatGPT, adjust this value according to your needs to reduce ChatGPT expenses.": "最近的X条消息会发送至服务器. 如果你正在使用RWKV-Runner服务器, 请使用默认值, 因为RWKV-Runner内置了state缓存管理, 只计算增量, 发送所有消息将具有更低的成本. 如果你正在使用ChatGPT, 则根据你的需要调整此值, 这可以降低ChatGPT的费用", "The latest X messages will be sent to the server. If you are using the RWKV-Runner server, please use the default value because RWKV-Runner has built-in state cache management which only calculates increments. Sending all messages will have lower cost. If you are using ChatGPT, adjust this value according to your needs to reduce ChatGPT expenses.": "最近的X条消息会发送至服务器. 如果你正在使用RWKV-Runner服务器, 请使用默认值, 因为RWKV-Runner内置了state缓存管理, 只计算增量, 发送所有消息将具有更低的成本. 如果你正在使用ChatGPT, 则根据你的需要调整此值, 这可以降低ChatGPT的费用",
"History Message Number": "历史消息数量", "History Message Number": "历史消息数量",
"Send All Message": "发送所有消息" "Send All Message": "发送所有消息",
"Quantized Layers": "量化层数",
"Number of the neural network layers quantized with current precision, the more you quantize, the lower the VRAM usage, but the quality correspondingly decreases.": "神经网络以当前精度量化的层数, 量化越多, 占用显存越低, 但质量相应下降",
"Parallel Token Chunk Size": "并行Token块大小",
"Maximum tokens to be processed in parallel at once. For high end GPUs, this could be 64 or 128 (faster).": "一次最多可以并行处理的token数量. 对于高端显卡, 这可以是64或128 (更快)",
"Global Penalty": "全局惩罚",
"When generating a response, whether to include the submitted prompt as a penalty factor. By turning this off, you will get the same generated results as official RWKV Gradio. If you find duplicate results in the generated results, turning this on can help avoid generating duplicates.": "生成响应时, 是否将提交的prompt也纳入到惩罚项. 关闭此项将得到与RWKV官方Gradio完全一致的生成结果. 如果你发现生成结果出现重复, 那么开启此项有助于避免生成重复"
} }

View File

@@ -10,9 +10,10 @@ export const NumberInput: FC<{
onChange?: (ev: React.ChangeEvent<HTMLInputElement>, data: SliderOnChangeData) => void onChange?: (ev: React.ChangeEvent<HTMLInputElement>, data: SliderOnChangeData) => void
style?: CSSProperties, style?: CSSProperties,
toFixed?: number toFixed?: number
}> = ({ value, min, max, step, onChange, style, toFixed = 2 }) => { disabled?: boolean
}> = ({ value, min, max, step, onChange, style, toFixed = 2, disabled }) => {
return ( return (
<Input type="number" style={style} value={value.toString()} min={min} max={max} step={step} <Input type="number" style={style} value={value.toString()} min={min} max={max} step={step} disabled={disabled}
onChange={(e, data) => { onChange={(e, data) => {
onChange?.(e, { value: Number(data.value) }); onChange?.(e, { value: Number(data.value) });
}} }}

View File

@@ -11,7 +11,8 @@ export const ValuedSlider: FC<{
input?: boolean input?: boolean
onChange?: (ev: React.ChangeEvent<HTMLInputElement>, data: SliderOnChangeData) => void, onChange?: (ev: React.ChangeEvent<HTMLInputElement>, data: SliderOnChangeData) => void,
toFixed?: number toFixed?: number
}> = ({ value, min, max, step, input, onChange, toFixed }) => { disabled?: boolean
}> = ({ value, min, max, step, input, onChange, toFixed, disabled }) => {
const sliderRef = useRef<HTMLInputElement>(null); const sliderRef = useRef<HTMLInputElement>(null);
useEffect(() => { useEffect(() => {
if (step && sliderRef.current && sliderRef.current.parentElement) { if (step && sliderRef.current && sliderRef.current.parentElement) {
@@ -24,10 +25,10 @@ export const ValuedSlider: FC<{
<div className="flex items-center"> <div className="flex items-center">
<Slider ref={sliderRef} className="grow" style={{ minWidth: '50%' }} value={value} min={min} <Slider ref={sliderRef} className="grow" style={{ minWidth: '50%' }} value={value} min={min}
max={max} step={step} max={max} step={step}
onChange={onChange} /> onChange={onChange} disabled={disabled} />
{input {input
? <NumberInput style={{ minWidth: 0 }} value={value} min={min} max={max} step={step} onChange={onChange} ? <NumberInput style={{ minWidth: 0 }} value={value} min={min} max={max} step={step} onChange={onChange}
toFixed={toFixed} /> toFixed={toFixed} disabled={disabled} />
: <Text>{value}</Text>} : <Text>{value}</Text>}
</div> </div>
); );

View File

@@ -247,7 +247,7 @@ const SidePanel: FC = observer(() => {
<Labeled flex breakline label={t('Temperature')} <Labeled flex breakline label={t('Temperature')}
desc={t('Sampling temperature, it\'s like giving alcohol to a model, the higher the stronger the randomness and creativity, while the lower, the more focused and deterministic it will be.')} desc={t('Sampling temperature, it\'s like giving alcohol to a model, the higher the stronger the randomness and creativity, while the lower, the more focused and deterministic it will be.')}
content={ content={
<ValuedSlider value={params.temperature} min={0} max={2} step={0.1} <ValuedSlider value={params.temperature} min={0} max={3} step={0.1}
input input
onChange={(e, data) => { onChange={(e, data) => {
commonStore.setChatParams({ commonStore.setChatParams({
@@ -258,7 +258,7 @@ const SidePanel: FC = observer(() => {
<Labeled flex breakline label={t('Top_P')} <Labeled flex breakline label={t('Top_P')}
desc={t('Just like feeding sedatives to the model. Consider the results of the top n% probability mass, 0.1 considers the top 10%, with higher quality but more conservative, 1 considers all results, with lower quality but more diverse.')} desc={t('Just like feeding sedatives to the model. Consider the results of the top n% probability mass, 0.1 considers the top 10%, with higher quality but more conservative, 1 considers all results, with lower quality but more diverse.')}
content={ content={
<ValuedSlider value={params.topP} min={0} max={1} step={0.1} input <ValuedSlider value={params.topP} min={0} max={1} step={0.05} input
onChange={(e, data) => { onChange={(e, data) => {
commonStore.setChatParams({ commonStore.setChatParams({
topP: data.value topP: data.value

View File

@@ -188,7 +188,7 @@ const CompletionPanel: FC = observer(() => {
<Labeled flex breakline label={t('Temperature')} <Labeled flex breakline label={t('Temperature')}
desc={t('Sampling temperature, it\'s like giving alcohol to a model, the higher the stronger the randomness and creativity, while the lower, the more focused and deterministic it will be.')} desc={t('Sampling temperature, it\'s like giving alcohol to a model, the higher the stronger the randomness and creativity, while the lower, the more focused and deterministic it will be.')}
content={ content={
<ValuedSlider value={params.temperature} min={0} max={2} step={0.1} <ValuedSlider value={params.temperature} min={0} max={3} step={0.1}
input input
onChange={(e, data) => { onChange={(e, data) => {
setParams({ setParams({
@@ -199,7 +199,7 @@ const CompletionPanel: FC = observer(() => {
<Labeled flex breakline label={t('Top_P')} <Labeled flex breakline label={t('Top_P')}
desc={t('Just like feeding sedatives to the model. Consider the results of the top n% probability mass, 0.1 considers the top 10%, with higher quality but more conservative, 1 considers all results, with lower quality but more diverse.')} desc={t('Just like feeding sedatives to the model. Consider the results of the top n% probability mass, 0.1 considers the top 10%, with higher quality but more conservative, 1 considers all results, with lower quality but more diverse.')}
content={ content={
<ValuedSlider value={params.topP} min={0} max={1} step={0.1} input <ValuedSlider value={params.topP} min={0} max={1} step={0.05} input
onChange={(e, data) => { onChange={(e, data) => {
setParams({ setParams({
topP: data.value topP: data.value

View File

@@ -275,7 +275,7 @@ const CompositionPanel: FC = observer(() => {
<Labeled flex breakline label={t('Temperature')} <Labeled flex breakline label={t('Temperature')}
desc={t('Sampling temperature, it\'s like giving alcohol to a model, the higher the stronger the randomness and creativity, while the lower, the more focused and deterministic it will be.')} desc={t('Sampling temperature, it\'s like giving alcohol to a model, the higher the stronger the randomness and creativity, while the lower, the more focused and deterministic it will be.')}
content={ content={
<ValuedSlider value={params.temperature} min={0} max={2} step={0.1} <ValuedSlider value={params.temperature} min={0} max={3} step={0.1}
input input
onChange={(e, data) => { onChange={(e, data) => {
setParams({ setParams({
@@ -286,7 +286,7 @@ const CompositionPanel: FC = observer(() => {
<Labeled flex breakline label={t('Top_P')} <Labeled flex breakline label={t('Top_P')}
desc={t('Just like feeding sedatives to the model. Consider the results of the top n% probability mass, 0.1 considers the top 10%, with higher quality but more conservative, 1 considers all results, with lower quality but more diverse.')} desc={t('Just like feeding sedatives to the model. Consider the results of the top n% probability mass, 0.1 considers the top 10%, with higher quality but more conservative, 1 considers all results, with lower quality but more diverse.')}
content={ content={
<ValuedSlider value={params.topP} min={0} max={1} step={0.1} input <ValuedSlider value={params.topP} min={0} max={1} step={0.05} input
onChange={(e, data) => { onChange={(e, data) => {
setParams({ setParams({
topP: data.value topP: data.value

View File

@@ -35,6 +35,7 @@ import { ResetConfigsButton } from '../components/ResetConfigsButton';
import { useMediaQuery } from 'usehooks-ts'; import { useMediaQuery } from 'usehooks-ts';
import { ApiParameters, Device, ModelParameters, Precision } from '../types/configs'; import { ApiParameters, Device, ModelParameters, Precision } from '../types/configs';
import { convertModel, convertToGGML, convertToSt } from '../utils/convert-model'; import { convertModel, convertToGGML, convertToSt } from '../utils/convert-model';
import { defaultPenaltyDecay } from './defaultConfigs';
const ConfigSelector: FC<{ const ConfigSelector: FC<{
selectedIndex: number, selectedIndex: number,
@@ -66,14 +67,17 @@ const Configs: FC = observer(() => {
const [selectedIndex, setSelectedIndex] = React.useState(commonStore.currentModelConfigIndex); const [selectedIndex, setSelectedIndex] = React.useState(commonStore.currentModelConfigIndex);
const [selectedConfig, setSelectedConfig] = React.useState(commonStore.modelConfigs[selectedIndex]); const [selectedConfig, setSelectedConfig] = React.useState(commonStore.modelConfigs[selectedIndex]);
const [displayStrategyImg, setDisplayStrategyImg] = React.useState(false); const [displayStrategyImg, setDisplayStrategyImg] = React.useState(false);
const advancedHeaderRef = useRef<HTMLDivElement>(null); const advancedHeaderRef1 = useRef<HTMLDivElement>(null);
const advancedHeaderRef2 = useRef<HTMLDivElement>(null);
const mq = useMediaQuery('(min-width: 640px)'); const mq = useMediaQuery('(min-width: 640px)');
const navigate = useNavigate(); const navigate = useNavigate();
const port = selectedConfig.apiParameters.apiPort; const port = selectedConfig.apiParameters.apiPort;
useEffect(() => { useEffect(() => {
if (advancedHeaderRef.current) if (advancedHeaderRef1.current)
(advancedHeaderRef.current.firstElementChild as HTMLElement).style.padding = '0'; (advancedHeaderRef1.current.firstElementChild as HTMLElement).style.padding = '0';
if (advancedHeaderRef2.current)
(advancedHeaderRef2.current.firstElementChild as HTMLElement).style.padding = '0';
}, []); }, []);
const updateSelectedIndex = useCallback((newIndex: number) => { const updateSelectedIndex = useCallback((newIndex: number) => {
@@ -113,7 +117,9 @@ const Configs: FC = observer(() => {
temperature: selectedConfig.apiParameters.temperature, temperature: selectedConfig.apiParameters.temperature,
top_p: selectedConfig.apiParameters.topP, top_p: selectedConfig.apiParameters.topP,
presence_penalty: selectedConfig.apiParameters.presencePenalty, presence_penalty: selectedConfig.apiParameters.presencePenalty,
frequency_penalty: selectedConfig.apiParameters.frequencyPenalty frequency_penalty: selectedConfig.apiParameters.frequencyPenalty,
penalty_decay: selectedConfig.apiParameters.penaltyDecay,
global_penalty: selectedConfig.apiParameters.globalPenalty
}); });
toast(t('Config Saved'), { autoClose: 300, type: 'success' }); toast(t('Config Saved'), { autoClose: 300, type: 'success' });
}; };
@@ -176,7 +182,7 @@ const Configs: FC = observer(() => {
<Labeled label={t('Temperature') + ' *'} <Labeled label={t('Temperature') + ' *'}
desc={t('Sampling temperature, it\'s like giving alcohol to a model, the higher the stronger the randomness and creativity, while the lower, the more focused and deterministic it will be.')} desc={t('Sampling temperature, it\'s like giving alcohol to a model, the higher the stronger the randomness and creativity, while the lower, the more focused and deterministic it will be.')}
content={ content={
<ValuedSlider value={selectedConfig.apiParameters.temperature} min={0} max={2} step={0.1} <ValuedSlider value={selectedConfig.apiParameters.temperature} min={0} max={3} step={0.1}
input input
onChange={(e, data) => { onChange={(e, data) => {
setSelectedConfigApiParams({ setSelectedConfigApiParams({
@@ -187,35 +193,74 @@ const Configs: FC = observer(() => {
<Labeled label={t('Top_P') + ' *'} <Labeled label={t('Top_P') + ' *'}
desc={t('Just like feeding sedatives to the model. Consider the results of the top n% probability mass, 0.1 considers the top 10%, with higher quality but more conservative, 1 considers all results, with lower quality but more diverse.')} desc={t('Just like feeding sedatives to the model. Consider the results of the top n% probability mass, 0.1 considers the top 10%, with higher quality but more conservative, 1 considers all results, with lower quality but more diverse.')}
content={ content={
<ValuedSlider value={selectedConfig.apiParameters.topP} min={0} max={1} step={0.1} input <ValuedSlider value={selectedConfig.apiParameters.topP} min={0} max={1} step={0.05} input
onChange={(e, data) => { onChange={(e, data) => {
setSelectedConfigApiParams({ setSelectedConfigApiParams({
topP: data.value topP: data.value
}); });
}} /> }} />
} /> } />
<Labeled label={t('Presence Penalty') + ' *'} <Accordion className="sm:col-span-2" collapsible
desc={t('Positive values penalize new tokens based on whether they appear in the text so far, increasing the model\'s likelihood to talk about new topics.')} openItems={!commonStore.apiParamsCollapsed && 'advanced'}
content={ onToggle={(e, data) => {
<ValuedSlider value={selectedConfig.apiParameters.presencePenalty} min={-2} max={2} if (data.value === 'advanced')
step={0.1} input commonStore.setApiParamsCollapsed(!commonStore.apiParamsCollapsed);
onChange={(e, data) => { }}>
setSelectedConfigApiParams({ <AccordionItem value="advanced">
presencePenalty: data.value <AccordionHeader ref={advancedHeaderRef1} size="small">{t('Advanced')}</AccordionHeader>
}); <AccordionPanel>
}} /> <div className="grid grid-cols-1 sm:grid-cols-2 gap-2">
} /> <Labeled label={t('Presence Penalty') + ' *'}
<Labeled label={t('Frequency Penalty') + ' *'} desc={t('Positive values penalize new tokens based on whether they appear in the text so far, increasing the model\'s likelihood to talk about new topics.')}
desc={t('Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model\'s likelihood to repeat the same line verbatim.')} content={
content={ <ValuedSlider value={selectedConfig.apiParameters.presencePenalty} min={-2} max={2}
<ValuedSlider value={selectedConfig.apiParameters.frequencyPenalty} min={-2} max={2} step={0.1} input
step={0.1} input onChange={(e, data) => {
onChange={(e, data) => { setSelectedConfigApiParams({
setSelectedConfigApiParams({ presencePenalty: data.value
frequencyPenalty: data.value });
}); }} />
}} /> } />
} /> <Labeled label={t('Frequency Penalty') + ' *'}
desc={t('Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model\'s likelihood to repeat the same line verbatim.')}
content={
<ValuedSlider value={selectedConfig.apiParameters.frequencyPenalty} min={-2} max={2}
step={0.1} input
onChange={(e, data) => {
setSelectedConfigApiParams({
frequencyPenalty: data.value
});
}} />
} />
<Labeled
label={t('Penalty Decay')
+ ((!selectedConfig.apiParameters.penaltyDecay || selectedConfig.apiParameters.penaltyDecay === defaultPenaltyDecay)
? ` (${t('Default')})` : '')
+ ' *'}
desc={t('If you don\'t know what it is, keep it default.')}
content={
<ValuedSlider value={selectedConfig.apiParameters.penaltyDecay || defaultPenaltyDecay}
min={0.99} max={0.999} step={0.001} toFixed={3} input
onChange={(e, data) => {
setSelectedConfigApiParams({
penaltyDecay: data.value
});
}} />
} />
<Labeled label={t('Global Penalty') + ' *'}
desc={t('When generating a response, whether to include the submitted prompt as a penalty factor. By turning this off, you will get the same generated results as official RWKV Gradio. If you find duplicate results in the generated results, turning this on can help avoid generating duplicates.')}
content={
<Switch checked={selectedConfig.apiParameters.globalPenalty}
onChange={(e, data) => {
setSelectedConfigApiParams({
globalPenalty: data.checked
});
}} />
} />
</div>
</AccordionPanel>
</AccordionItem>
</Accordion>
</div> </div>
} }
/> />
@@ -279,9 +324,9 @@ const Configs: FC = observer(() => {
}}> }}>
<Option value="CPU">CPU</Option> <Option value="CPU">CPU</Option>
<Option value="CPU (rwkv.cpp)">{t('CPU (rwkv.cpp, Faster)')!}</Option> <Option value="CPU (rwkv.cpp)">{t('CPU (rwkv.cpp, Faster)')!}</Option>
{commonStore.platform === 'darwin' && <Option value="MPS">MPS</Option>} {/*{commonStore.platform === 'darwin' && <Option value="MPS">MPS</Option>}*/}
<Option value="CUDA">CUDA</Option> <Option value="CUDA">CUDA</Option>
<Option value="CUDA-Beta">{t('CUDA (Beta, Faster)')!}</Option> {/*<Option value="CUDA-Beta">{t('CUDA (Beta, Faster)')!}</Option>*/}
<Option value="WebGPU">WebGPU</Option> <Option value="WebGPU">WebGPU</Option>
<Option value="WebGPU (Python)">WebGPU (Python)</Option> <Option value="WebGPU (Python)">WebGPU (Python)</Option>
<Option value="Custom">{t('Custom')!}</Option> <Option value="Custom">{t('Custom')!}</Option>
@@ -331,6 +376,40 @@ const Configs: FC = observer(() => {
}} /> }} />
} /> } />
} }
{
selectedConfig.modelParameters.device.startsWith('WebGPU') &&
<Labeled label={t('Parallel Token Chunk Size')}
desc={t('Maximum tokens to be processed in parallel at once. For high end GPUs, this could be 64 or 128 (faster).')}
content={
<ValuedSlider
value={selectedConfig.modelParameters.tokenChunkSize || 32}
min={16} max={256} step={16} input
onChange={(e, data) => {
setSelectedConfigModelParams({
tokenChunkSize: data.value
});
}} />
} />
}
{
selectedConfig.modelParameters.device.startsWith('WebGPU') &&
<Labeled label={t('Quantized Layers')}
desc={t('Number of the neural network layers quantized with current precision, the more you quantize, the lower the VRAM usage, but the quality correspondingly decreases.')}
content={
<ValuedSlider
disabled={selectedConfig.modelParameters.precision !== 'int8' && selectedConfig.modelParameters.precision !== 'nf4'}
value={selectedConfig.modelParameters.precision === 'int8' ? (selectedConfig.modelParameters.quantizedLayers || 31) :
selectedConfig.modelParameters.precision === 'nf4' ? (selectedConfig.modelParameters.quantizedLayers || 26) :
selectedConfig.modelParameters.maxStoredLayers
} min={0}
max={selectedConfig.modelParameters.maxStoredLayers} step={1} input
onChange={(e, data) => {
setSelectedConfigModelParams({
quantizedLayers: data.value
});
}} />
} />
}
{selectedConfig.modelParameters.device.startsWith('CUDA') && <div />} {selectedConfig.modelParameters.device.startsWith('CUDA') && <div />}
{ {
displayStrategyImg && displayStrategyImg &&
@@ -376,7 +455,7 @@ const Configs: FC = observer(() => {
commonStore.setModelParamsCollapsed(!commonStore.modelParamsCollapsed); commonStore.setModelParamsCollapsed(!commonStore.modelParamsCollapsed);
}}> }}>
<AccordionItem value="advanced"> <AccordionItem value="advanced">
<AccordionHeader ref={advancedHeaderRef} size="small">{t('Advanced')}</AccordionHeader> <AccordionHeader ref={advancedHeaderRef2} size="small">{t('Advanced')}</AccordionHeader>
<AccordionPanel> <AccordionPanel>
<div className="flex flex-col"> <div className="flex flex-col">
<div className="flex grow"> <div className="flex grow">

View File

@@ -155,7 +155,7 @@ const columns: TableColumnDefinition<ModelSourceItem>[] = [
const getTags = () => { const getTags = () => {
return Array.from(new Set( return Array.from(new Set(
['Recommended', ['Recommended', 'Official',
...commonStore.modelSourceList.map(item => item.tags || []).flat() ...commonStore.modelSourceList.map(item => item.tags || []).flat()
.filter(i => !i.includes('Other') && !i.includes('Local')) .filter(i => !i.includes('Other') && !i.includes('Local'))
, 'Other', 'Local'])); , 'Other', 'Local']));

View File

@@ -207,7 +207,7 @@ export const defaultModelConfigsMac: ModelConfig[] = [
frequencyPenalty: 1 frequencyPenalty: 1
}, },
modelParameters: { modelParameters: {
modelName: 'RWKV-5-World-1B5-v2-20231025-ctx4096.pth', modelName: 'RWKV-x060-World-1B6-v2-20240208-ctx4096.pth',
device: 'WebGPU', device: 'WebGPU',
precision: 'nf4', precision: 'nf4',
storedLayers: 41, storedLayers: 41,
@@ -225,7 +225,7 @@ export const defaultModelConfigsMac: ModelConfig[] = [
frequencyPenalty: 1 frequencyPenalty: 1
}, },
modelParameters: { modelParameters: {
modelName: 'RWKV-5-World-3B-v2-20231118-ctx16k.pth', modelName: 'RWKV-x060-World-3B-v2-20240228-ctx4096.pth',
device: 'WebGPU', device: 'WebGPU',
precision: 'nf4', precision: 'nf4',
storedLayers: 41, storedLayers: 41,
@@ -243,7 +243,7 @@ export const defaultModelConfigsMac: ModelConfig[] = [
frequencyPenalty: 1 frequencyPenalty: 1
}, },
modelParameters: { modelParameters: {
modelName: 'RWKV-4-World-CHNtuned-3B-v1-20230625-ctx4096.pth', modelName: 'RWKV-x060-World-3B-v2-20240228-ctx4096.pth',
device: 'WebGPU', device: 'WebGPU',
precision: 'nf4', precision: 'nf4',
storedLayers: 41, storedLayers: 41,
@@ -333,7 +333,7 @@ export const defaultModelConfigsMac: ModelConfig[] = [
frequencyPenalty: 1 frequencyPenalty: 1
}, },
modelParameters: { modelParameters: {
modelName: 'RWKV-5-World-1B5-v2-20231025-ctx4096.pth', modelName: 'RWKV-x060-World-1B6-v2-20240208-ctx4096.pth',
device: 'MPS', device: 'MPS',
precision: 'fp32', precision: 'fp32',
storedLayers: 41, storedLayers: 41,
@@ -352,7 +352,7 @@ export const defaultModelConfigsMac: ModelConfig[] = [
frequencyPenalty: 1 frequencyPenalty: 1
}, },
modelParameters: { modelParameters: {
modelName: 'RWKV-5-World-3B-v2-20231118-ctx16k.pth', modelName: 'RWKV-x060-World-3B-v2-20240228-ctx4096.pth',
device: 'MPS', device: 'MPS',
precision: 'fp32', precision: 'fp32',
storedLayers: 41, storedLayers: 41,
@@ -371,7 +371,7 @@ export const defaultModelConfigsMac: ModelConfig[] = [
frequencyPenalty: 1 frequencyPenalty: 1
}, },
modelParameters: { modelParameters: {
modelName: 'RWKV-4-World-CHNtuned-3B-v1-20230625-ctx4096.pth', modelName: 'RWKV-x060-World-3B-v2-20240228-ctx4096.pth',
device: 'MPS', device: 'MPS',
precision: 'fp32', precision: 'fp32',
storedLayers: 41, storedLayers: 41,
@@ -412,7 +412,7 @@ export const defaultModelConfigs: ModelConfig[] = [
frequencyPenalty: 1 frequencyPenalty: 1
}, },
modelParameters: { modelParameters: {
modelName: 'RWKV-5-World-1B5-v2-20231025-ctx4096.pth', modelName: 'RWKV-x060-World-1B6-v2-20240208-ctx4096.pth',
device: 'CUDA', device: 'CUDA',
precision: 'int8', precision: 'int8',
storedLayers: 41, storedLayers: 41,
@@ -431,7 +431,7 @@ export const defaultModelConfigs: ModelConfig[] = [
frequencyPenalty: 1 frequencyPenalty: 1
}, },
modelParameters: { modelParameters: {
modelName: 'RWKV-5-World-3B-v2-20231118-ctx16k.pth', modelName: 'RWKV-x060-World-3B-v2-20240228-ctx4096.pth',
device: 'CUDA', device: 'CUDA',
precision: 'int8', precision: 'int8',
storedLayers: 6, storedLayers: 6,
@@ -450,7 +450,7 @@ export const defaultModelConfigs: ModelConfig[] = [
frequencyPenalty: 1 frequencyPenalty: 1
}, },
modelParameters: { modelParameters: {
modelName: 'RWKV-5-World-1B5-v2-20231025-ctx4096.pth', modelName: 'RWKV-x060-World-1B6-v2-20240208-ctx4096.pth',
device: 'CUDA', device: 'CUDA',
precision: 'fp16', precision: 'fp16',
storedLayers: 41, storedLayers: 41,
@@ -469,7 +469,7 @@ export const defaultModelConfigs: ModelConfig[] = [
frequencyPenalty: 1 frequencyPenalty: 1
}, },
modelParameters: { modelParameters: {
modelName: 'RWKV-5-World-3B-v2-20231118-ctx16k.pth', modelName: 'RWKV-x060-World-3B-v2-20240228-ctx4096.pth',
device: 'CUDA', device: 'CUDA',
precision: 'int8', precision: 'int8',
storedLayers: 24, storedLayers: 24,
@@ -488,7 +488,7 @@ export const defaultModelConfigs: ModelConfig[] = [
frequencyPenalty: 1 frequencyPenalty: 1
}, },
modelParameters: { modelParameters: {
modelName: 'RWKV-4-World-CHNtuned-3B-v1-20230625-ctx4096.pth', modelName: 'RWKV-x060-World-3B-v2-20240228-ctx4096.pth',
device: 'CUDA', device: 'CUDA',
precision: 'int8', precision: 'int8',
storedLayers: 24, storedLayers: 24,
@@ -545,7 +545,7 @@ export const defaultModelConfigs: ModelConfig[] = [
frequencyPenalty: 1 frequencyPenalty: 1
}, },
modelParameters: { modelParameters: {
modelName: 'RWKV-5-World-3B-v2-20231118-ctx16k.pth', modelName: 'RWKV-x060-World-3B-v2-20240228-ctx4096.pth',
device: 'CUDA', device: 'CUDA',
precision: 'int8', precision: 'int8',
storedLayers: 41, storedLayers: 41,
@@ -564,7 +564,7 @@ export const defaultModelConfigs: ModelConfig[] = [
frequencyPenalty: 1 frequencyPenalty: 1
}, },
modelParameters: { modelParameters: {
modelName: 'RWKV-4-World-CHNtuned-3B-v1-20230625-ctx4096.pth', modelName: 'RWKV-x060-World-3B-v2-20240228-ctx4096.pth',
device: 'CUDA', device: 'CUDA',
precision: 'int8', precision: 'int8',
storedLayers: 41, storedLayers: 41,
@@ -621,7 +621,7 @@ export const defaultModelConfigs: ModelConfig[] = [
frequencyPenalty: 1 frequencyPenalty: 1
}, },
modelParameters: { modelParameters: {
modelName: 'RWKV-5-World-3B-v2-20231118-ctx16k.pth', modelName: 'RWKV-x060-World-3B-v2-20240228-ctx4096.pth',
device: 'CUDA', device: 'CUDA',
precision: 'fp16', precision: 'fp16',
storedLayers: 41, storedLayers: 41,
@@ -640,7 +640,7 @@ export const defaultModelConfigs: ModelConfig[] = [
frequencyPenalty: 1 frequencyPenalty: 1
}, },
modelParameters: { modelParameters: {
modelName: 'RWKV-4-World-CHNtuned-3B-v1-20230625-ctx4096.pth', modelName: 'RWKV-x060-World-3B-v2-20240228-ctx4096.pth',
device: 'CUDA', device: 'CUDA',
precision: 'fp16', precision: 'fp16',
storedLayers: 41, storedLayers: 41,
@@ -809,7 +809,7 @@ export const defaultModelConfigs: ModelConfig[] = [
frequencyPenalty: 1 frequencyPenalty: 1
}, },
modelParameters: { modelParameters: {
modelName: 'RWKV-5-World-1B5-v2-20231025-ctx4096.pth', modelName: 'RWKV-x060-World-1B6-v2-20240208-ctx4096.pth',
device: 'WebGPU', device: 'WebGPU',
precision: 'nf4', precision: 'nf4',
storedLayers: 41, storedLayers: 41,
@@ -827,7 +827,7 @@ export const defaultModelConfigs: ModelConfig[] = [
frequencyPenalty: 1 frequencyPenalty: 1
}, },
modelParameters: { modelParameters: {
modelName: 'RWKV-5-World-3B-v2-20231118-ctx16k.pth', modelName: 'RWKV-x060-World-3B-v2-20240228-ctx4096.pth',
device: 'WebGPU', device: 'WebGPU',
precision: 'nf4', precision: 'nf4',
storedLayers: 41, storedLayers: 41,
@@ -845,7 +845,7 @@ export const defaultModelConfigs: ModelConfig[] = [
frequencyPenalty: 1 frequencyPenalty: 1
}, },
modelParameters: { modelParameters: {
modelName: 'RWKV-4-World-CHNtuned-3B-v1-20230625-ctx4096.pth', modelName: 'RWKV-x060-World-3B-v2-20240228-ctx4096.pth',
device: 'WebGPU', device: 'WebGPU',
precision: 'nf4', precision: 'nf4',
storedLayers: 41, storedLayers: 41,

View File

@@ -127,6 +127,7 @@ class CommonStore {
// configs // configs
currentModelConfigIndex: number = 0; currentModelConfigIndex: number = 0;
modelConfigs: ModelConfig[] = []; modelConfigs: ModelConfig[] = [];
apiParamsCollapsed: boolean = true;
modelParamsCollapsed: boolean = true; modelParamsCollapsed: boolean = true;
// models // models
activeModelListTags: string[] = []; activeModelListTags: string[] = [];
@@ -177,7 +178,7 @@ class CommonStore {
autoUpdatesCheck: true, autoUpdatesCheck: true,
giteeUpdatesSource: getUserLanguage() === 'zh', giteeUpdatesSource: getUserLanguage() === 'zh',
cnMirror: getUserLanguage() === 'zh', cnMirror: getUserLanguage() === 'zh',
useHfMirror: false, useHfMirror: getUserLanguage() === 'zh',
host: '127.0.0.1', host: '127.0.0.1',
dpiScaling: 100, dpiScaling: 100,
customModelsPath: './models', customModelsPath: './models',
@@ -324,6 +325,10 @@ class CommonStore {
this.advancedCollapsed = value; this.advancedCollapsed = value;
} }
setApiParamsCollapsed(value: boolean) {
this.apiParamsCollapsed = value;
}
setModelParamsCollapsed(value: boolean) { setModelParamsCollapsed(value: boolean) {
this.modelParamsCollapsed = value; this.modelParamsCollapsed = value;
} }

View File

@@ -6,6 +6,7 @@ export type ApiParameters = {
presencePenalty: number; presencePenalty: number;
frequencyPenalty: number; frequencyPenalty: number;
penaltyDecay?: number; penaltyDecay?: number;
globalPenalty?: boolean;
} }
export type Device = 'CPU' | 'CPU (rwkv.cpp)' | 'CUDA' | 'CUDA-Beta' | 'WebGPU' | 'WebGPU (Python)' | 'MPS' | 'Custom'; export type Device = 'CPU' | 'CPU (rwkv.cpp)' | 'CUDA' | 'CUDA-Beta' | 'WebGPU' | 'WebGPU (Python)' | 'MPS' | 'Custom';
export type Precision = 'fp16' | 'int8' | 'fp32' | 'nf4' | 'Q5_1'; export type Precision = 'fp16' | 'int8' | 'fp32' | 'nf4' | 'Q5_1';
@@ -16,6 +17,8 @@ export type ModelParameters = {
precision: Precision; precision: Precision;
storedLayers: number; storedLayers: number;
maxStoredLayers: number; maxStoredLayers: number;
quantizedLayers?: number;
tokenChunkSize?: number;
useCustomCuda?: boolean; useCustomCuda?: boolean;
customStrategy?: string; customStrategy?: string;
useCustomTokenizer?: boolean; useCustomTokenizer?: boolean;

View File

@@ -194,6 +194,10 @@ export const getStrategy = (modelConfig: ModelConfig | undefined = undefined) =>
case 'WebGPU': case 'WebGPU':
case 'WebGPU (Python)': case 'WebGPU (Python)':
strategy += params.precision === 'nf4' ? 'fp16i4' : params.precision === 'int8' ? 'fp16i8' : 'fp16'; strategy += params.precision === 'nf4' ? 'fp16i4' : params.precision === 'int8' ? 'fp16i8' : 'fp16';
if (params.quantizedLayers)
strategy += ` layer${params.quantizedLayers}`;
if (params.tokenChunkSize)
strategy += ` chunk${params.tokenChunkSize}`;
break; break;
case 'CUDA': case 'CUDA':
case 'CUDA-Beta': case 'CUDA-Beta':

10
go.mod
View File

@@ -9,7 +9,7 @@ require (
github.com/minio/selfupdate v0.6.0 github.com/minio/selfupdate v0.6.0
github.com/nyaosorg/go-windows-su v0.2.1 github.com/nyaosorg/go-windows-su v0.2.1
github.com/ubuntu/gowsl v0.0.0-20230615094051-94945650cc1e github.com/ubuntu/gowsl v0.0.0-20230615094051-94945650cc1e
github.com/wailsapp/wails/v2 v2.7.1 github.com/wailsapp/wails/v2 v2.8.0
) )
require ( require (
@@ -38,9 +38,9 @@ require (
github.com/valyala/fasttemplate v1.2.2 // indirect github.com/valyala/fasttemplate v1.2.2 // indirect
github.com/wailsapp/go-webview2 v1.0.10 // indirect github.com/wailsapp/go-webview2 v1.0.10 // indirect
github.com/wailsapp/mimetype v1.4.1 // indirect github.com/wailsapp/mimetype v1.4.1 // indirect
golang.org/x/crypto v0.14.0 // indirect golang.org/x/crypto v0.18.0 // indirect
golang.org/x/exp v0.0.0-20230522175609-2e198f4a06a1 // indirect golang.org/x/exp v0.0.0-20230522175609-2e198f4a06a1 // indirect
golang.org/x/net v0.17.0 // indirect golang.org/x/net v0.20.0 // indirect
golang.org/x/sys v0.13.0 // indirect golang.org/x/sys v0.16.0 // indirect
golang.org/x/text v0.13.0 // indirect golang.org/x/text v0.14.0 // indirect
) )

20
go.sum
View File

@@ -79,20 +79,20 @@ github.com/wailsapp/go-webview2 v1.0.10 h1:PP5Hug6pnQEAhfRzLCoOh2jJaPdrqeRgJKZhy
github.com/wailsapp/go-webview2 v1.0.10/go.mod h1:Uk2BePfCRzttBBjFrBmqKGJd41P6QIHeV9kTgIeOZNo= github.com/wailsapp/go-webview2 v1.0.10/go.mod h1:Uk2BePfCRzttBBjFrBmqKGJd41P6QIHeV9kTgIeOZNo=
github.com/wailsapp/mimetype v1.4.1 h1:pQN9ycO7uo4vsUUuPeHEYoUkLVkaRntMnHJxVwYhwHs= github.com/wailsapp/mimetype v1.4.1 h1:pQN9ycO7uo4vsUUuPeHEYoUkLVkaRntMnHJxVwYhwHs=
github.com/wailsapp/mimetype v1.4.1/go.mod h1:9aV5k31bBOv5z6u+QP8TltzvNGJPmNJD4XlAL3U+j3o= github.com/wailsapp/mimetype v1.4.1/go.mod h1:9aV5k31bBOv5z6u+QP8TltzvNGJPmNJD4XlAL3U+j3o=
github.com/wailsapp/wails/v2 v2.7.1 h1:HAzp2c5ODOzsLC6ZMDVtNOB72ozM7/SJecJPB2Ur+UU= github.com/wailsapp/wails/v2 v2.8.0 h1:b2NNn99uGPiN6P5bDsnPwOJZWtAOUhNLv7Vl+YxMTr4=
github.com/wailsapp/wails/v2 v2.7.1/go.mod h1:oIJVwwso5fdOgprBYWXBBqtx6PaSvxg8/KTQHNGkadc= github.com/wailsapp/wails/v2 v2.8.0/go.mod h1:EFUGWkUX3KofO4fmKR/GmsLy3HhPH7NbyOEaMt8lBF0=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=
golang.org/x/crypto v0.0.0-20211209193657-4570a0811e8b/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20211209193657-4570a0811e8b/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc= golang.org/x/crypto v0.18.0 h1:PGVlW0xEltQnzFZ55hkuX5+KLyrMYhHld1YHO4AKcdc=
golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg=
golang.org/x/exp v0.0.0-20230522175609-2e198f4a06a1 h1:k/i9J1pBpvlfR+9QsetwPyERsqu1GIbi967PQMq3Ivc= golang.org/x/exp v0.0.0-20230522175609-2e198f4a06a1 h1:k/i9J1pBpvlfR+9QsetwPyERsqu1GIbi967PQMq3Ivc=
golang.org/x/exp v0.0.0-20230522175609-2e198f4a06a1/go.mod h1:V1LtkGg67GoY2N1AnLN78QLrzxkLyJw7RJb1gzOOz9w= golang.org/x/exp v0.0.0-20230522175609-2e198f4a06a1/go.mod h1:V1LtkGg67GoY2N1AnLN78QLrzxkLyJw7RJb1gzOOz9w=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20210505024714-0287a6fb4125/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210505024714-0287a6fb4125/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= golang.org/x/net v0.20.0 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo=
golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
@@ -109,14 +109,14 @@ golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU=
golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

View File

@@ -1,5 +1,5 @@
{ {
"version": "1.6.8", "version": "1.7.1",
"introduction": { "introduction": {
"en": "RWKV is an open-source, commercially usable large language model with high flexibility and great potential for development.\n### About This Tool\nThis tool aims to lower the barrier of entry for using large language models, making it accessible to everyone. It provides fully automated dependency and model management. You simply need to click and run, following the instructions, to deploy a local large language model. The tool itself is very compact and only requires a single executable file for one-click deployment.\nAdditionally, this tool offers an interface that is fully compatible with the OpenAI API. This means you can use any ChatGPT client as a client for RWKV, enabling capability expansion beyond just chat functionality.\n### Preset Configuration Rules at the Bottom\nThis tool comes with a series of preset configurations to reduce complexity. The naming rules for each configuration represent the following in order: device - required VRAM/memory - model size - model language.\nFor example, \"GPU-8G-3B-EN\" indicates that this configuration is for a graphics card with 8GB of VRAM, a model size of 3 billion parameters, and it uses an English language model.\nLarger model sizes have higher performance and VRAM requirements. Among configurations with the same model size, those with higher VRAM usage will have faster runtime.\nFor example, if you have 12GB of VRAM but running the \"GPU-12G-7B-EN\" configuration is slow, you can downgrade to \"GPU-8G-3B-EN\" for a significant speed improvement.\n### About RWKV\nRWKV is an RNN with Transformer-level LLM performance, which can also be directly trained like a GPT transformer (parallelizable). And it's 100% attention-free. You only need the hidden state at position t to compute the state at position t+1. You can use the \"GPT\" mode to quickly compute the hidden state for the \"RNN\" mode.<br/>So it's combining the best of RNN and transformer - great performance, fast inference, saves VRAM, fast training, \"infinite\" ctx_len, and free sentence embedding (using the final hidden state).", "en": "RWKV is an open-source, commercially usable large language model with high flexibility and great potential for development.\n### About This Tool\nThis tool aims to lower the barrier of entry for using large language models, making it accessible to everyone. It provides fully automated dependency and model management. You simply need to click and run, following the instructions, to deploy a local large language model. The tool itself is very compact and only requires a single executable file for one-click deployment.\nAdditionally, this tool offers an interface that is fully compatible with the OpenAI API. This means you can use any ChatGPT client as a client for RWKV, enabling capability expansion beyond just chat functionality.\n### Preset Configuration Rules at the Bottom\nThis tool comes with a series of preset configurations to reduce complexity. The naming rules for each configuration represent the following in order: device - required VRAM/memory - model size - model language.\nFor example, \"GPU-8G-3B-EN\" indicates that this configuration is for a graphics card with 8GB of VRAM, a model size of 3 billion parameters, and it uses an English language model.\nLarger model sizes have higher performance and VRAM requirements. Among configurations with the same model size, those with higher VRAM usage will have faster runtime.\nFor example, if you have 12GB of VRAM but running the \"GPU-12G-7B-EN\" configuration is slow, you can downgrade to \"GPU-8G-3B-EN\" for a significant speed improvement.\n### About RWKV\nRWKV is an RNN with Transformer-level LLM performance, which can also be directly trained like a GPT transformer (parallelizable). And it's 100% attention-free. You only need the hidden state at position t to compute the state at position t+1. You can use the \"GPT\" mode to quickly compute the hidden state for the \"RNN\" mode.<br/>So it's combining the best of RNN and transformer - great performance, fast inference, saves VRAM, fast training, \"infinite\" ctx_len, and free sentence embedding (using the final hidden state).",
"zh": "RWKV是一个开源且允许商用的大语言模型灵活性很高且极具发展潜力。\n### 关于本工具\n本工具旨在降低大语言模型的使用门槛做到人人可用本工具提供了全自动化的依赖和模型管理你只需要直接点击运行跟随引导即可完成本地大语言模型的部署工具本身体积极小只需要一个exe即可完成一键部署。\n此外本工具提供了与OpenAI API完全兼容的接口这意味着你可以把任意ChatGPT客户端用作RWKV的客户端实现能力拓展而不局限于聊天。\n### 底部的预设配置规则\n本工具内置了一系列预设配置以降低使用难度每个配置名的规则依次代表着设备-所需显存/内存-模型规模-模型语言。\n例如GPU-8G-3B-CN表示该配置用于显卡需要8G显存模型规模为30亿参数使用的是中文模型。\n模型规模越大性能要求越高显存要求也越高而同样模型规模的配置中显存占用越高的运行速度越快。\n例如当你有12G显存但运行GPU-12G-7B-CN配置速度比较慢可降级成GPU-8G-3B-CN将会大幅提速。\n### 关于RWKV\nRWKV是具有Transformer级别LLM性能的RNN也可以像GPT Transformer一样直接进行训练可并行化。而且它是100% attention-free的。你只需在位置t处获得隐藏状态即可计算位置t + 1处的状态。你可以使用“GPT”模式快速计算用于“RNN”模式的隐藏状态。\n因此它将RNN和Transformer的优点结合起来 - 高性能、快速推理、节省显存、快速训练、“无限”上下文长度以及免费的语句嵌入(使用最终隐藏状态)。" "zh": "RWKV是一个开源且允许商用的大语言模型灵活性很高且极具发展潜力。\n### 关于本工具\n本工具旨在降低大语言模型的使用门槛做到人人可用本工具提供了全自动化的依赖和模型管理你只需要直接点击运行跟随引导即可完成本地大语言模型的部署工具本身体积极小只需要一个exe即可完成一键部署。\n此外本工具提供了与OpenAI API完全兼容的接口这意味着你可以把任意ChatGPT客户端用作RWKV的客户端实现能力拓展而不局限于聊天。\n### 底部的预设配置规则\n本工具内置了一系列预设配置以降低使用难度每个配置名的规则依次代表着设备-所需显存/内存-模型规模-模型语言。\n例如GPU-8G-3B-CN表示该配置用于显卡需要8G显存模型规模为30亿参数使用的是中文模型。\n模型规模越大性能要求越高显存要求也越高而同样模型规模的配置中显存占用越高的运行速度越快。\n例如当你有12G显存但运行GPU-12G-7B-CN配置速度比较慢可降级成GPU-8G-3B-CN将会大幅提速。\n### 关于RWKV\nRWKV是具有Transformer级别LLM性能的RNN也可以像GPT Transformer一样直接进行训练可并行化。而且它是100% attention-free的。你只需在位置t处获得隐藏状态即可计算位置t + 1处的状态。你可以使用“GPT”模式快速计算用于“RNN”模式的隐藏状态。\n因此它将RNN和Transformer的优点结合起来 - 高性能、快速推理、节省显存、快速训练、“无限”上下文长度以及免费的语句嵌入(使用最终隐藏状态)。"
@@ -15,6 +15,47 @@
} }
], ],
"models": [ "models": [
{
"name": "RWKV-x060-World-1B6-v2-20240208-ctx4096.pth",
"desc": {
"en": "RWKV-6 Global Languages 1.6B v2",
"zh": "RWKV-6 全球语言 1.6B v2",
"ja": "RWKV-6 グローバル言語 1.6B v2"
},
"size": 3199845663,
"SHA256": "5c9c877fb60a65cab269af175328b6aaf16d02b8b09738923254f9986e5dc440",
"lastUpdated": "2024-02-08T17:56:51",
"url": "https://huggingface.co/BlinkDL/rwkv-6-world/blob/main/RWKV-x060-World-1B6-v2-20240208-ctx4096.pth",
"downloadUrl": "https://huggingface.co/BlinkDL/rwkv-6-world/resolve/main/RWKV-x060-World-1B6-v2-20240208-ctx4096.pth",
"tags": [
"Official",
"RWKV-6",
"Global",
"CN",
"JP"
]
},
{
"name": "RWKV-x060-World-3B-v2-20240228-ctx4096.pth",
"desc": {
"en": "RWKV-6 Global Languages 3B v2",
"zh": "RWKV-6 全球语言 3B v2",
"ja": "RWKV-6 グローバル言語 3B v2"
},
"size": 6199859158,
"SHA256": "f1235079a07084472de86996846a6533e41e3964b153cdc1e8462cc138d8521d",
"lastUpdated": "2024-02-29T03:53:53",
"url": "https://huggingface.co/BlinkDL/rwkv-6-world/blob/main/RWKV-x060-World-3B-v2-20240228-ctx4096.pth",
"downloadUrl": "https://huggingface.co/BlinkDL/rwkv-6-world/resolve/main/RWKV-x060-World-3B-v2-20240228-ctx4096.pth",
"tags": [
"Official",
"RWKV-6",
"Global",
"Recommended",
"CN",
"JP"
]
},
{ {
"name": "RWKV-5-World-0.1B-v1-20230803-ctx4096.pth", "name": "RWKV-5-World-0.1B-v1-20230803-ctx4096.pth",
"desc": { "desc": {
@@ -252,6 +293,27 @@
], ],
"customTokenizer": "backend-python/rwkv_pip/rwkv_vocab_v20230424_special_token.txt" "customTokenizer": "backend-python/rwkv_pip/rwkv_vocab_v20230424_special_token.txt"
}, },
{
"name": "Mobius-r5-chat-12b-128k.pth",
"desc": {
"en": "RWKV-5 Mobius 12B Ctx128k",
"zh": "RWKV-5 Mobius 12B 128k上下文",
"ja": "RWKV-5 Mobius 12B 128kコンテキスト"
},
"size": 23157427004,
"SHA256": "2190d59e130f8d9b580e5531874f34f7eaeb7b7b6d04fb1439b7f5c5d7dbaafe",
"lastUpdated": "2024-02-24T01:33:27",
"url": "https://huggingface.co/TimeMobius/Mobius-Chat-12B-128k/blob/main/Mobius-r5-chat-12b-128k.pth",
"downloadUrl": "https://huggingface.co/TimeMobius/Mobius-Chat-12B-128k/resolve/main/Mobius-r5-chat-12b-128k.pth",
"tags": [
"Finetuned",
"RWKV-5",
"Global",
"Recommended",
"CN",
"JP"
]
},
{ {
"name": "RWKV-4-World-CHNtuned-0.1B-v1-20230617-ctx4096.pth", "name": "RWKV-4-World-CHNtuned-0.1B-v1-20230617-ctx4096.pth",
"desc": { "desc": {