Compare commits

..

8 Commits

Author SHA1 Message Date
josc146
2c4e9f69eb release v1.3.0 2023-06-28 21:26:23 +08:00
josc146
119204368d update manifest 2023-06-28 20:57:09 +08:00
josc146
87a86042d2 chore 2023-06-28 20:49:41 +08:00
josc146
32c386799d Change chat saving format 2023-06-28 20:48:22 +08:00
josc146
b56a55e81d Completion Regenerate Button 2023-06-28 20:46:21 +08:00
josc146
2fe7a23049 chore 2023-06-28 19:40:55 +08:00
josc146
9ed3547738 rwkv pip 0.8.0 2023-06-28 19:36:15 +08:00
github-actions[bot]
a0522594da release v1.2.9 2023-06-24 16:12:53 +00:00
10 changed files with 91 additions and 32 deletions

View File

@@ -1,8 +1,11 @@
## Changes
- Chat Presets (Experimental)
- display models that have not been fully downloaded in Downloads page, even if the program is restarted
- improve error messages
- upgrade to rwkv 0.8.0
- change i18n
- Completion Regenerate Button
- change chat saving format
- update manifest
- chore
## Install

View File

@@ -12,7 +12,6 @@ from routes import state_cache
END_OF_TEXT = 0
END_OF_LINE = 187
END_OF_LINE_DOUBLE = 535
@@ -39,12 +38,14 @@ class RWKV:
self.penalty_alpha_frequency = 0.4
self.interface = ":"
if "rwkv_vocab" in tokens_path:
if "world" in self.name.lower():
self.user = "Question"
self.bot = "Answer"
self.END_OF_LINE = 11
else:
self.user = "Bob"
self.bot = "Alice"
self.END_OF_LINE = 187
self.AVOID_REPEAT_TOKENS = []
AVOID_REPEAT = ""
@@ -86,8 +87,10 @@ The following is a coherent verbose detailed conversation between a girl named {
# Model only saw '\n\n' as [187, 187] before, but the tokenizer outputs [535] for it at the end
def fix_tokens(self, tokens):
if "world" in self.name.lower():
return tokens
if len(tokens) > 0 and tokens[-1] == END_OF_LINE_DOUBLE:
tokens = tokens[:-1] + [END_OF_LINE, END_OF_LINE]
tokens = tokens[:-1] + [self.END_OF_LINE, self.END_OF_LINE]
return tokens
def run_rnn(self, _tokens: List[str], newline_adj: int = 0):
@@ -101,7 +104,7 @@ The following is a coherent verbose detailed conversation between a girl named {
)
tokens = tokens[self.CHUNK_LEN :]
out[END_OF_LINE] += newline_adj # adjust \n probability
out[self.END_OF_LINE] += newline_adj # adjust \n probability
if self.model_tokens[-1] in self.AVOID_REPEAT_TOKENS:
out[self.model_tokens[-1]] = -999999999
@@ -313,6 +316,8 @@ The following is a coherent verbose detailed conversation between a girl named {
if token == END_OF_TEXT:
yield response, "", prompt_token_len, completion_token_len
break
for xxx in occurrence:
occurrence[xxx] *= 0.996
if token not in occurrence:
occurrence[token] = 1
else:

View File

@@ -70,7 +70,7 @@
"Type your message here": "在此输入消息",
"Copy": "复制",
"Read Aloud": "朗读",
"Hello! I'm RWKV, an open-source and commercially usable large language model.": "你好! 我是RWKV, 一个开源可商用的大语言模型.",
"Hello! I'm RWKV, an open-source and commercially usable large language model.": "你好我是RWKV一个开源可商用的大语言模型",
"This tool's API is compatible with OpenAI API. It can be used with any ChatGPT tool you like. Go to the settings of some ChatGPT tool, replace the 'https://api.openai.com' part in the API address with '": "本工具的API与OpenAI API兼容. 因此可以配合任意你喜欢的ChatGPT工具使用. 打开某个ChatGPT工具的设置, 将API地址中的'https://api.openai.com'部分替换为'",
"New Version Available": "新版本可用",
"Update": "更新",
@@ -117,7 +117,7 @@
"Werewolf": "狼人杀",
"Instruction": "指令",
"Blank": "空白",
"The following is an epic science fiction masterpiece that is immortalized, with delicate descriptions and grand depictions of interstellar civilization wars.\nChapter 1.\n": "以下是不朽的科幻史诗巨著,描写细腻,刻画了宏大的星际文明战争。\n第一章\n",
"The following is an epic science fiction masterpiece that is immortalized, with delicate descriptions and grand depictions of interstellar civilization wars.\nChapter 1.\n": "《背影》\n我与父亲不相见已二年余了我最不能忘记的是他的背影。\n那年冬天祖母死了父亲的差使也交卸了正是祸不单行的日子。我从北京到徐州打算",
"The following is a conversation between a cat girl and her owner. The cat girl is a humanized creature that behaves like a cat but is humanoid. At the end of each sentence in the dialogue, she will add \"Meow~\". In the following content, Bob represents the owner and Alice represents the cat girl.\n\nBob: Hello.\n\nAlice: I'm here, meow~.\n\nBob: Can you tell jokes?": "以下是一位猫娘的主人和猫娘的对话内容,猫娘是一种拟人化的生物,其行为似猫但类人,在每一句对话末尾都会加上\"喵~\"。以下内容中Bob代表主人Alice代表猫娘。\n\nBob: 你好\n\nAlice: 主人我在哦,喵~\n\nBob: 你会讲笑话吗?",
"When response finished, inject this content.": "响应结束时,插入此内容到末尾",
"Inject start text": "起始注入文本",
@@ -188,5 +188,6 @@
"New": "新建",
"user": "用户",
"assistant": "AI",
"system": "系统"
"system": "系统",
"Regenerate": "重新生成"
}

View File

@@ -409,9 +409,16 @@ const ChatPanel: FC = observer(() => {
size={mq ? 'large' : 'small'} shape="circular" appearance="subtle"
onClick={() => {
let savedContent: string = '';
const isWorldModel = commonStore.getCurrentModelConfig().modelParameters.modelName.toLowerCase().includes('world');
const user = isWorldModel ? 'Question' : 'Bob';
const bot = isWorldModel ? 'Answer' : 'Alice';
commonStore.conversationOrder.forEach((uuid) => {
if (uuid === welcomeUuid)
return;
const messageItem = commonStore.conversation[uuid];
savedContent += `**${messageItem.sender}**\n - ${new Date(messageItem.time).toLocaleString()}\n\n${messageItem.content}\n\n`;
if (messageItem.type !== MessageType.Error) {
savedContent += `${messageItem.sender === userName ? user : bot}: ${messageItem.content}\n\n`;
}
});
OpenSaveFileDialog('*.md', 'conversation.md', savedContent).then((path) => {

View File

@@ -11,6 +11,8 @@ import { fetchEventSource } from '@microsoft/fetch-event-source';
import { toast } from 'react-toastify';
import { DialogButton } from '../components/DialogButton';
import { PresetsButton } from './PresetsManager/PresetsButton';
import { ToolTipButton } from '../components/ToolTipButton';
import { ArrowSync20Regular } from '@fluentui/react-icons';
export type CompletionParams = Omit<ApiParameters, 'apiPort'> & {
stop: string,
@@ -150,6 +152,7 @@ const CompletionPanel: FC = observer(() => {
}, []);
const setPreset = (preset: CompletionPreset) => {
commonStore.setCompletionSubmittedPrompt(t(preset.prompt));
commonStore.setCompletionPreset({
...preset,
prompt: t(preset.prompt)
@@ -181,6 +184,8 @@ const CompletionPanel: FC = observer(() => {
};
const onSubmit = (prompt: string) => {
commonStore.setCompletionSubmittedPrompt(prompt);
if (commonStore.status.status === ModelStatus.Offline && !commonStore.settings.apiUrl) {
toast(t('Please click the button in the top right corner to start the model'), { type: 'warning' });
commonStore.setCompletionGenerating(false);
@@ -259,7 +264,10 @@ const CompletionPanel: FC = observer(() => {
ref={inputRef}
className="grow"
value={prompt}
onChange={(e) => setPrompt(e.target.value)}
onChange={(e) => {
commonStore.setCompletionSubmittedPrompt(e.target.value);
setPrompt(e.target.value);
}}
/>
<div className="flex flex-col gap-1 max-h-48 sm:max-w-sm sm:max-h-full">
<div className="flex gap-2">
@@ -368,6 +376,12 @@ const CompletionPanel: FC = observer(() => {
</div>
<div className="grow" />
<div className="flex justify-between gap-2">
<ToolTipButton desc={t('Regenerate')} icon={<ArrowSync20Regular />} onClick={() => {
completionSseController?.abort();
commonStore.setCompletionGenerating(true);
setPrompt(commonStore.completionSubmittedPrompt);
onSubmit(commonStore.completionSubmittedPrompt);
}} />
<DialogButton className="grow" text={t('Reset')} title={t('Reset')}
contentText={t('Are you sure you want to reset this page? It cannot be undone.')}
onConfirm={() => {

View File

@@ -122,7 +122,7 @@ export const MessagesEditor: FC = observer(() => {
}}>
<Option value="user">{t('user')!}</Option>
<Option value="assistant">{t('assistant')!}</Option>
<Option value="system">{t('system')!}</Option>
{/* TODO <Option value="system">{t('system')!}</Option>*/}
</Dropdown>
<Textarea resize="vertical" className="grow" value={item.content}
style={{ minWidth: 0, borderRadius: 0 }}

View File

@@ -248,10 +248,9 @@ export const ChatPresetEditor: FC<{
name: data.value
});
}} />
<ToolTipButton desc={!editingMessages ? t('Edit Messages') : t('Go Back')}
icon={!editingMessages ? <Chat20Regular /> : <Dismiss20Regular />} onClick={() => {
<Button onClick={() => {
setEditingMessages(!editingMessages);
}} />
}}>{!editingMessages ? t('Edit Messages') : t('Go Back')}</Button>
</div>
} />
{

View File

@@ -126,7 +126,7 @@ export const defaultModelConfigsMac: ModelConfig[] = [
frequencyPenalty: 0.4
},
modelParameters: {
modelName: 'RWKV-4-Raven-3B-v12-Eng49%-Chn49%-Jpn1%-Other1%-20230527-ctx4096.pth',
modelName: 'RWKV-4-World-CHNtuned-3B-v1-20230625-ctx4096.pth',
device: 'MPS',
precision: 'fp32',
storedLayers: 41,
@@ -145,7 +145,7 @@ export const defaultModelConfigsMac: ModelConfig[] = [
frequencyPenalty: 0.4
},
modelParameters: {
modelName: 'RWKV-4-World-7B-v1-OnlyForTest_84%_trained-20230618-ctx4096.pth',
modelName: 'RWKV-4-World-7B-v1-20230626-ctx4096.pth',
device: 'MPS',
precision: 'fp32',
storedLayers: 41,
@@ -236,7 +236,7 @@ export const defaultModelConfigsMac: ModelConfig[] = [
frequencyPenalty: 0.4
},
modelParameters: {
modelName: 'RWKV-4-Raven-3B-v12-Eng49%-Chn49%-Jpn1%-Other1%-20230527-ctx4096.pth',
modelName: 'RWKV-4-World-CHNtuned-3B-v1-20230625-ctx4096.pth',
device: 'CPU',
precision: 'fp32',
storedLayers: 41,
@@ -254,7 +254,7 @@ export const defaultModelConfigsMac: ModelConfig[] = [
frequencyPenalty: 0.4
},
modelParameters: {
modelName: 'RWKV-4-World-7B-v1-OnlyForTest_84%_trained-20230618-ctx4096.pth',
modelName: 'RWKV-4-World-7B-v1-20230626-ctx4096.pth',
device: 'CPU',
precision: 'fp32',
storedLayers: 41,
@@ -460,7 +460,7 @@ export const defaultModelConfigs: ModelConfig[] = [
frequencyPenalty: 0.4
},
modelParameters: {
modelName: 'RWKV-4-Raven-3B-v12-Eng49%-Chn49%-Jpn1%-Other1%-20230527-ctx4096.pth',
modelName: 'RWKV-4-World-CHNtuned-3B-v1-20230625-ctx4096.pth',
device: 'CUDA',
precision: 'int8',
storedLayers: 24,
@@ -479,7 +479,7 @@ export const defaultModelConfigs: ModelConfig[] = [
frequencyPenalty: 0.4
},
modelParameters: {
modelName: 'RWKV-4-World-7B-v1-OnlyForTest_84%_trained-20230618-ctx4096.pth',
modelName: 'RWKV-4-World-7B-v1-20230626-ctx4096.pth',
device: 'CUDA',
precision: 'int8',
storedLayers: 8,
@@ -593,7 +593,7 @@ export const defaultModelConfigs: ModelConfig[] = [
frequencyPenalty: 0.4
},
modelParameters: {
modelName: 'RWKV-4-Raven-3B-v12-Eng49%-Chn49%-Jpn1%-Other1%-20230527-ctx4096.pth',
modelName: 'RWKV-4-World-CHNtuned-3B-v1-20230625-ctx4096.pth',
device: 'CUDA',
precision: 'int8',
storedLayers: 41,
@@ -612,7 +612,7 @@ export const defaultModelConfigs: ModelConfig[] = [
frequencyPenalty: 0.4
},
modelParameters: {
modelName: 'RWKV-4-World-7B-v1-OnlyForTest_84%_trained-20230618-ctx4096.pth',
modelName: 'RWKV-4-World-7B-v1-20230626-ctx4096.pth',
device: 'CUDA',
precision: 'int8',
storedLayers: 18,
@@ -725,7 +725,7 @@ export const defaultModelConfigs: ModelConfig[] = [
frequencyPenalty: 0.4
},
modelParameters: {
modelName: 'RWKV-4-Raven-3B-v12-Eng49%-Chn49%-Jpn1%-Other1%-20230527-ctx4096.pth',
modelName: 'RWKV-4-World-CHNtuned-3B-v1-20230625-ctx4096.pth',
device: 'CUDA',
precision: 'fp16',
storedLayers: 41,
@@ -744,7 +744,7 @@ export const defaultModelConfigs: ModelConfig[] = [
frequencyPenalty: 0.4
},
modelParameters: {
modelName: 'RWKV-4-World-7B-v1-OnlyForTest_84%_trained-20230618-ctx4096.pth',
modelName: 'RWKV-4-World-7B-v1-20230626-ctx4096.pth',
device: 'CUDA',
precision: 'int8',
storedLayers: 27,
@@ -801,7 +801,7 @@ export const defaultModelConfigs: ModelConfig[] = [
frequencyPenalty: 0.4
},
modelParameters: {
modelName: 'RWKV-4-World-7B-v1-OnlyForTest_84%_trained-20230618-ctx4096.pth',
modelName: 'RWKV-4-World-7B-v1-20230626-ctx4096.pth',
device: 'CUDA',
precision: 'int8',
storedLayers: 41,
@@ -877,7 +877,7 @@ export const defaultModelConfigs: ModelConfig[] = [
frequencyPenalty: 0.4
},
modelParameters: {
modelName: 'RWKV-4-World-7B-v1-OnlyForTest_84%_trained-20230618-ctx4096.pth',
modelName: 'RWKV-4-World-7B-v1-20230626-ctx4096.pth',
device: 'CUDA',
precision: 'fp16',
storedLayers: 41,
@@ -1063,7 +1063,7 @@ export const defaultModelConfigs: ModelConfig[] = [
frequencyPenalty: 0.4
},
modelParameters: {
modelName: 'RWKV-4-Raven-3B-v12-Eng49%-Chn49%-Jpn1%-Other1%-20230527-ctx4096.pth',
modelName: 'RWKV-4-World-CHNtuned-3B-v1-20230625-ctx4096.pth',
device: 'CPU',
precision: 'fp32',
storedLayers: 41,
@@ -1081,7 +1081,7 @@ export const defaultModelConfigs: ModelConfig[] = [
frequencyPenalty: 0.4
},
modelParameters: {
modelName: 'RWKV-4-World-7B-v1-OnlyForTest_84%_trained-20230618-ctx4096.pth',
modelName: 'RWKV-4-World-7B-v1-20230626-ctx4096.pth',
device: 'CPU',
precision: 'fp32',
storedLayers: 41,

View File

@@ -52,6 +52,7 @@ class CommonStore {
// completion
completionPreset: CompletionPreset | null = null;
completionGenerating: boolean = false;
completionSubmittedPrompt: string = '';
// configs
currentModelConfigIndex: number = 0;
modelConfigs: ModelConfig[] = [];
@@ -221,6 +222,10 @@ class CommonStore {
setActivePreset(value: Preset) {
this.activePreset = value;
}
setCompletionSubmittedPrompt(value: string) {
this.completionSubmittedPrompt = value;
}
}
export default new CommonStore();

View File

@@ -1,5 +1,5 @@
{
"version": "1.2.8",
"version": "1.2.9",
"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).",
"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的优点结合起来 - 高性能、快速推理、节省显存、快速训练、“无限”上下文长度以及免费的语句嵌入(使用最终隐藏状态)。"
@@ -190,6 +190,18 @@
"url": "https://huggingface.co/BlinkDL/rwkv-4-world/blob/main/RWKV-4-World-3B-v1-20230619-ctx4096.pth",
"downloadUrl": "https://huggingface.co/BlinkDL/rwkv-4-world/resolve/main/RWKV-4-World-3B-v1-20230619-ctx4096.pth"
},
{
"name": "RWKV-4-World-CHNtuned-3B-v1-20230625-ctx4096.pth",
"desc": {
"en": "Global Languages 3B v1 Enhanced Chinese",
"zh": "全球语言 3B v1 中文增强"
},
"size": 6125597618,
"SHA256": "7d3b5a4d0e9780a3e3d9ae7c2defbe8564d240bc9a238db4ba70cfb66dc33888",
"lastUpdated": "2023-06-25T14:53:27",
"url": "https://huggingface.co/BlinkDL/rwkv-4-world/blob/main/RWKV-4-World-CHNtuned-3B-v1-20230625-ctx4096.pth",
"downloadUrl": "https://huggingface.co/BlinkDL/rwkv-4-world/resolve/main/RWKV-4-World-CHNtuned-3B-v1-20230625-ctx4096.pth"
},
{
"name": "RWKV-4-World-7B-v1-OnlyForTest_30%_trained-20230529-ctx4096.pth",
"desc": {
@@ -265,7 +277,20 @@
"SHA256": "dfb56e8ba32907cb47df83c8d702e7f350d9ad50a59b71b031da4681637588b3",
"lastUpdated": "2023-06-19T01:28:17",
"url": "https://huggingface.co/BlinkDL/rwkv-4-world/blob/main/RWKV-4-World-7B-v1-OnlyForTest_84%25_trained-20230618-ctx4096.pth",
"downloadUrl": "https://huggingface.co/BlinkDL/rwkv-4-world/resolve/main/RWKV-4-World-7B-v1-OnlyForTest_84%25_trained-20230618-ctx4096.pth"
"downloadUrl": "https://huggingface.co/BlinkDL/rwkv-4-world/resolve/main/RWKV-4-World-7B-v1-OnlyForTest_84%25_trained-20230618-ctx4096.pth",
"hide": true
},
{
"name": "RWKV-4-World-7B-v1-20230626-ctx4096.pth",
"desc": {
"en": "Global Languages 7B v1",
"zh": "全球语言 7B v1"
},
"size": 15035393586,
"SHA256": "db7b011247a0fe4389e1d76e3d6a904185f85d509c8a44ad18bf401094efc293",
"lastUpdated": "2023-06-26T16:40:04",
"url": "https://huggingface.co/BlinkDL/rwkv-4-world/blob/main/RWKV-4-World-7B-v1-20230626-ctx4096.pth",
"downloadUrl": "https://huggingface.co/BlinkDL/rwkv-4-world/resolve/main/RWKV-4-World-7B-v1-20230626-ctx4096.pth"
},
{
"name": "RWKV-4-Novel-7B-v1-ChnEng-ChnPro-20230410-ctx4096.pth",