Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ac1fa09604 | ||
|
|
43bc08648d | ||
|
|
e93c77394d | ||
|
|
4b2509e643 | ||
|
|
14fbb437ff | ||
|
|
8963543159 | ||
|
|
377f71b16b | ||
|
|
d32351c130 | ||
|
|
967be6f88f | ||
|
|
fcdda71b46 | ||
|
|
138251932c |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -13,6 +13,7 @@ __pycache__
|
|||||||
/py310
|
/py310
|
||||||
*.zip
|
*.zip
|
||||||
/cmd-helper.bat
|
/cmd-helper.bat
|
||||||
|
/install-py-dep.bat
|
||||||
/backend-python/wkv_cuda
|
/backend-python/wkv_cuda
|
||||||
*.exe
|
*.exe
|
||||||
*.old
|
*.old
|
||||||
|
|||||||
@@ -1,11 +1,9 @@
|
|||||||
## Changes
|
## Changes
|
||||||
|
|
||||||
- improve api docs
|
- add usage and exact model name to API
|
||||||
- improve error messages
|
- embeddings API compatible with openai api and langchain (sdk)
|
||||||
- fix the state cache crash caused by bad prompts
|
- update manifest
|
||||||
- clear confirm for chat page
|
- refactor and chore
|
||||||
- save conversation button
|
|
||||||
- chore
|
|
||||||
|
|
||||||
## Install
|
## Install
|
||||||
|
|
||||||
|
|||||||
39
README.md
39
README.md
@@ -87,6 +87,45 @@ body.json:
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Embeddings API Example
|
||||||
|
|
||||||
|
If you are using langchain, just use `OpenAIEmbeddings(openai_api_base="http://127.0.0.1:8000", openai_api_key="sk-")`
|
||||||
|
|
||||||
|
```python
|
||||||
|
import numpy as np
|
||||||
|
import requests
|
||||||
|
|
||||||
|
|
||||||
|
def cosine_similarity(a, b):
|
||||||
|
return np.dot(a, b) / (np.linalg.norm(a) * np.linalg.norm(b))
|
||||||
|
|
||||||
|
|
||||||
|
values = [
|
||||||
|
"I am a girl",
|
||||||
|
"我是个女孩",
|
||||||
|
"私は女の子です",
|
||||||
|
"广东人爱吃福建人",
|
||||||
|
"我是个人类",
|
||||||
|
"I am a human",
|
||||||
|
"that dog is so cute",
|
||||||
|
"私はねこむすめです、にゃん♪",
|
||||||
|
"宇宙级特大事件!号外号外!"
|
||||||
|
]
|
||||||
|
|
||||||
|
embeddings = []
|
||||||
|
for v in values:
|
||||||
|
r = requests.post("http://127.0.0.1:8000/embeddings", json={"input": v})
|
||||||
|
embedding = r.json()["data"][0]["embedding"]
|
||||||
|
embeddings.append(embedding)
|
||||||
|
|
||||||
|
compared_embedding = embeddings[0]
|
||||||
|
|
||||||
|
embeddings_cos_sim = [cosine_similarity(compared_embedding, e) for e in embeddings]
|
||||||
|
|
||||||
|
for i in np.argsort(embeddings_cos_sim)[::-1]:
|
||||||
|
print(f"{embeddings_cos_sim[i]:.10f} - {values[i]}")
|
||||||
|
```
|
||||||
|
|
||||||
## Todo
|
## Todo
|
||||||
|
|
||||||
- [ ] Model training functionality
|
- [ ] Model training functionality
|
||||||
|
|||||||
39
README_ZH.md
39
README_ZH.md
@@ -87,6 +87,45 @@ body.json:
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Embeddings API 示例
|
||||||
|
|
||||||
|
如果你在用langchain, 直接使用 `OpenAIEmbeddings(openai_api_base="http://127.0.0.1:8000", openai_api_key="sk-")`
|
||||||
|
|
||||||
|
```python
|
||||||
|
import numpy as np
|
||||||
|
import requests
|
||||||
|
|
||||||
|
|
||||||
|
def cosine_similarity(a, b):
|
||||||
|
return np.dot(a, b) / (np.linalg.norm(a) * np.linalg.norm(b))
|
||||||
|
|
||||||
|
|
||||||
|
values = [
|
||||||
|
"I am a girl",
|
||||||
|
"我是个女孩",
|
||||||
|
"私は女の子です",
|
||||||
|
"广东人爱吃福建人",
|
||||||
|
"我是个人类",
|
||||||
|
"I am a human",
|
||||||
|
"that dog is so cute",
|
||||||
|
"私はねこむすめです、にゃん♪",
|
||||||
|
"宇宙级特大事件!号外号外!"
|
||||||
|
]
|
||||||
|
|
||||||
|
embeddings = []
|
||||||
|
for v in values:
|
||||||
|
r = requests.post("http://127.0.0.1:8000/embeddings", json={"input": v})
|
||||||
|
embedding = r.json()["data"][0]["embedding"]
|
||||||
|
embeddings.append(embedding)
|
||||||
|
|
||||||
|
compared_embedding = embeddings[0]
|
||||||
|
|
||||||
|
embeddings_cos_sim = [cosine_similarity(compared_embedding, e) for e in embeddings]
|
||||||
|
|
||||||
|
for i in np.argsort(embeddings_cos_sim)[::-1]:
|
||||||
|
print(f"{embeddings_cos_sim[i]:.10f} - {values[i]}")
|
||||||
|
```
|
||||||
|
|
||||||
## Todo
|
## Todo
|
||||||
|
|
||||||
- [ ] 模型训练功能
|
- [ ] 模型训练功能
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
|
import tiktoken
|
||||||
import GPUtil
|
import GPUtil
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
import rwkv
|
import rwkv
|
||||||
import fastapi
|
import fastapi
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -2,10 +2,13 @@ import asyncio
|
|||||||
import json
|
import json
|
||||||
from threading import Lock
|
from threading import Lock
|
||||||
from typing import List
|
from typing import List
|
||||||
|
import base64
|
||||||
|
|
||||||
from fastapi import APIRouter, Request, status, HTTPException
|
from fastapi import APIRouter, Request, status, HTTPException
|
||||||
from sse_starlette.sse import EventSourceResponse
|
from sse_starlette.sse import EventSourceResponse
|
||||||
from pydantic import BaseModel
|
from pydantic import BaseModel
|
||||||
|
import numpy as np
|
||||||
|
import tiktoken
|
||||||
from utils.rwkv import *
|
from utils.rwkv import *
|
||||||
from utils.log import quick_log
|
from utils.log import quick_log
|
||||||
import global_var
|
import global_var
|
||||||
@@ -40,11 +43,171 @@ class ChatCompletionBody(ModelConfigBody):
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class CompletionBody(ModelConfigBody):
|
||||||
|
prompt: str
|
||||||
|
model: str = "rwkv"
|
||||||
|
stream: bool = False
|
||||||
|
stop: str = None
|
||||||
|
|
||||||
|
class Config:
|
||||||
|
schema_extra = {
|
||||||
|
"example": {
|
||||||
|
"prompt": "The following is an epic science fiction masterpiece that is immortalized, "
|
||||||
|
+ "with delicate descriptions and grand depictions of interstellar civilization wars.\nChapter 1.\n",
|
||||||
|
"model": "rwkv",
|
||||||
|
"stream": False,
|
||||||
|
"stop": None,
|
||||||
|
"max_tokens": 100,
|
||||||
|
"temperature": 1.2,
|
||||||
|
"top_p": 0.5,
|
||||||
|
"presence_penalty": 0.4,
|
||||||
|
"frequency_penalty": 0.4,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
completion_lock = Lock()
|
completion_lock = Lock()
|
||||||
|
|
||||||
requests_num = 0
|
requests_num = 0
|
||||||
|
|
||||||
|
|
||||||
|
async def eval_rwkv(
|
||||||
|
model: RWKV,
|
||||||
|
request: Request,
|
||||||
|
body: ModelConfigBody,
|
||||||
|
prompt: str,
|
||||||
|
stream: bool,
|
||||||
|
stop: str,
|
||||||
|
chat_mode: bool,
|
||||||
|
):
|
||||||
|
global requests_num
|
||||||
|
requests_num = requests_num + 1
|
||||||
|
quick_log(request, None, "Start Waiting. RequestsNum: " + str(requests_num))
|
||||||
|
while completion_lock.locked():
|
||||||
|
if await request.is_disconnected():
|
||||||
|
requests_num = requests_num - 1
|
||||||
|
print(f"{request.client} Stop Waiting (Lock)")
|
||||||
|
quick_log(
|
||||||
|
request,
|
||||||
|
None,
|
||||||
|
"Stop Waiting (Lock). RequestsNum: " + str(requests_num),
|
||||||
|
)
|
||||||
|
return
|
||||||
|
await asyncio.sleep(0.1)
|
||||||
|
else:
|
||||||
|
completion_lock.acquire()
|
||||||
|
if await request.is_disconnected():
|
||||||
|
completion_lock.release()
|
||||||
|
requests_num = requests_num - 1
|
||||||
|
print(f"{request.client} Stop Waiting (Lock)")
|
||||||
|
quick_log(
|
||||||
|
request,
|
||||||
|
None,
|
||||||
|
"Stop Waiting (Lock). RequestsNum: " + str(requests_num),
|
||||||
|
)
|
||||||
|
return
|
||||||
|
set_rwkv_config(model, global_var.get(global_var.Model_Config))
|
||||||
|
set_rwkv_config(model, body)
|
||||||
|
|
||||||
|
response, prompt_tokens, completion_tokens = "", 0, 0
|
||||||
|
for response, delta, prompt_tokens, completion_tokens in model.generate(
|
||||||
|
prompt,
|
||||||
|
stop=stop,
|
||||||
|
):
|
||||||
|
if await request.is_disconnected():
|
||||||
|
break
|
||||||
|
if stream:
|
||||||
|
yield json.dumps(
|
||||||
|
{
|
||||||
|
"object": "chat.completion.chunk"
|
||||||
|
if chat_mode
|
||||||
|
else "text_completion",
|
||||||
|
"response": response,
|
||||||
|
"model": model.name,
|
||||||
|
"choices": [
|
||||||
|
{
|
||||||
|
"delta": {"content": delta},
|
||||||
|
"index": 0,
|
||||||
|
"finish_reason": None,
|
||||||
|
}
|
||||||
|
if chat_mode
|
||||||
|
else {
|
||||||
|
"text": delta,
|
||||||
|
"index": 0,
|
||||||
|
"finish_reason": None,
|
||||||
|
}
|
||||||
|
],
|
||||||
|
}
|
||||||
|
)
|
||||||
|
# torch_gc()
|
||||||
|
requests_num = requests_num - 1
|
||||||
|
completion_lock.release()
|
||||||
|
if await request.is_disconnected():
|
||||||
|
print(f"{request.client} Stop Waiting")
|
||||||
|
quick_log(
|
||||||
|
request,
|
||||||
|
body,
|
||||||
|
response + "\nStop Waiting. RequestsNum: " + str(requests_num),
|
||||||
|
)
|
||||||
|
return
|
||||||
|
quick_log(
|
||||||
|
request,
|
||||||
|
body,
|
||||||
|
response + "\nFinished. RequestsNum: " + str(requests_num),
|
||||||
|
)
|
||||||
|
if stream:
|
||||||
|
yield json.dumps(
|
||||||
|
{
|
||||||
|
"object": "chat.completion.chunk"
|
||||||
|
if chat_mode
|
||||||
|
else "text_completion",
|
||||||
|
"response": response,
|
||||||
|
"model": model.name,
|
||||||
|
"choices": [
|
||||||
|
{
|
||||||
|
"delta": {},
|
||||||
|
"index": 0,
|
||||||
|
"finish_reason": "stop",
|
||||||
|
}
|
||||||
|
if chat_mode
|
||||||
|
else {
|
||||||
|
"text": "",
|
||||||
|
"index": 0,
|
||||||
|
"finish_reason": "stop",
|
||||||
|
}
|
||||||
|
],
|
||||||
|
}
|
||||||
|
)
|
||||||
|
yield "[DONE]"
|
||||||
|
else:
|
||||||
|
yield {
|
||||||
|
"object": "chat.completion" if chat_mode else "text_completion",
|
||||||
|
"response": response,
|
||||||
|
"model": model.name,
|
||||||
|
"usage": {
|
||||||
|
"prompt_tokens": prompt_tokens,
|
||||||
|
"completion_tokens": completion_tokens,
|
||||||
|
"total_tokens": prompt_tokens + completion_tokens,
|
||||||
|
},
|
||||||
|
"choices": [
|
||||||
|
{
|
||||||
|
"message": {
|
||||||
|
"role": "assistant",
|
||||||
|
"content": response,
|
||||||
|
},
|
||||||
|
"index": 0,
|
||||||
|
"finish_reason": "stop",
|
||||||
|
}
|
||||||
|
if chat_mode
|
||||||
|
else {
|
||||||
|
"text": response,
|
||||||
|
"index": 0,
|
||||||
|
"finish_reason": "stop",
|
||||||
|
}
|
||||||
|
],
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@router.post("/v1/chat/completions")
|
@router.post("/v1/chat/completions")
|
||||||
@router.post("/chat/completions")
|
@router.post("/chat/completions")
|
||||||
async def chat_completions(body: ChatCompletionBody, request: Request):
|
async def chat_completions(body: ChatCompletionBody, request: Request):
|
||||||
@@ -77,7 +240,8 @@ The following is a coherent verbose detailed conversation between a girl named {
|
|||||||
{bot} usually gives {user} kind, helpful and informative advices.\n
|
{bot} usually gives {user} kind, helpful and informative advices.\n
|
||||||
"""
|
"""
|
||||||
if user == "Bob"
|
if user == "Bob"
|
||||||
else f"{user}{interface} hi\n\n{bot}{interface} 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.\n\n"
|
else f"{user}{interface} hi\n\n{bot}{interface} 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.\n\n"
|
||||||
)
|
)
|
||||||
for message in body.messages:
|
for message in body.messages:
|
||||||
if message.role == "system":
|
if message.role == "system":
|
||||||
@@ -123,156 +287,20 @@ The following is a coherent verbose detailed conversation between a girl named {
|
|||||||
)
|
)
|
||||||
completion_text += f"{bot}{interface}"
|
completion_text += f"{bot}{interface}"
|
||||||
|
|
||||||
async def eval_rwkv():
|
stop = f"\n\n{user}" if body.stop is None else body.stop
|
||||||
global requests_num
|
|
||||||
requests_num = requests_num + 1
|
|
||||||
quick_log(request, None, "Start Waiting. RequestsNum: " + str(requests_num))
|
|
||||||
while completion_lock.locked():
|
|
||||||
if await request.is_disconnected():
|
|
||||||
requests_num = requests_num - 1
|
|
||||||
print(f"{request.client} Stop Waiting (Lock)")
|
|
||||||
quick_log(
|
|
||||||
request,
|
|
||||||
None,
|
|
||||||
"Stop Waiting (Lock). RequestsNum: " + str(requests_num),
|
|
||||||
)
|
|
||||||
return
|
|
||||||
await asyncio.sleep(0.1)
|
|
||||||
else:
|
|
||||||
completion_lock.acquire()
|
|
||||||
if await request.is_disconnected():
|
|
||||||
completion_lock.release()
|
|
||||||
requests_num = requests_num - 1
|
|
||||||
print(f"{request.client} Stop Waiting (Lock)")
|
|
||||||
quick_log(
|
|
||||||
request,
|
|
||||||
None,
|
|
||||||
"Stop Waiting (Lock). RequestsNum: " + str(requests_num),
|
|
||||||
)
|
|
||||||
return
|
|
||||||
set_rwkv_config(model, global_var.get(global_var.Model_Config))
|
|
||||||
set_rwkv_config(model, body)
|
|
||||||
if body.stream:
|
if body.stream:
|
||||||
response = ""
|
return EventSourceResponse(
|
||||||
for response, delta in model.generate(
|
eval_rwkv(model, request, body, completion_text, body.stream, stop, True)
|
||||||
completion_text,
|
|
||||||
stop=f"\n\n{user}" if body.stop is None else body.stop,
|
|
||||||
):
|
|
||||||
if await request.is_disconnected():
|
|
||||||
break
|
|
||||||
yield json.dumps(
|
|
||||||
{
|
|
||||||
"response": response,
|
|
||||||
"model": "rwkv",
|
|
||||||
"choices": [
|
|
||||||
{
|
|
||||||
"delta": {"content": delta},
|
|
||||||
"index": 0,
|
|
||||||
"finish_reason": None,
|
|
||||||
}
|
|
||||||
],
|
|
||||||
}
|
|
||||||
)
|
)
|
||||||
# torch_gc()
|
|
||||||
requests_num = requests_num - 1
|
|
||||||
completion_lock.release()
|
|
||||||
if await request.is_disconnected():
|
|
||||||
print(f"{request.client} Stop Waiting")
|
|
||||||
quick_log(
|
|
||||||
request,
|
|
||||||
body,
|
|
||||||
response + "\nStop Waiting. RequestsNum: " + str(requests_num),
|
|
||||||
)
|
|
||||||
return
|
|
||||||
quick_log(
|
|
||||||
request,
|
|
||||||
body,
|
|
||||||
response + "\nFinished. RequestsNum: " + str(requests_num),
|
|
||||||
)
|
|
||||||
yield json.dumps(
|
|
||||||
{
|
|
||||||
"response": response,
|
|
||||||
"model": "rwkv",
|
|
||||||
"choices": [
|
|
||||||
{
|
|
||||||
"delta": {},
|
|
||||||
"index": 0,
|
|
||||||
"finish_reason": "stop",
|
|
||||||
}
|
|
||||||
],
|
|
||||||
}
|
|
||||||
)
|
|
||||||
yield "[DONE]"
|
|
||||||
else:
|
|
||||||
response = ""
|
|
||||||
for response, delta in model.generate(
|
|
||||||
completion_text,
|
|
||||||
stop=f"\n\n{user}" if body.stop is None else body.stop,
|
|
||||||
):
|
|
||||||
if await request.is_disconnected():
|
|
||||||
break
|
|
||||||
# torch_gc()
|
|
||||||
requests_num = requests_num - 1
|
|
||||||
completion_lock.release()
|
|
||||||
if await request.is_disconnected():
|
|
||||||
print(f"{request.client} Stop Waiting")
|
|
||||||
quick_log(
|
|
||||||
request,
|
|
||||||
body,
|
|
||||||
response + "\nStop Waiting. RequestsNum: " + str(requests_num),
|
|
||||||
)
|
|
||||||
return
|
|
||||||
quick_log(
|
|
||||||
request,
|
|
||||||
body,
|
|
||||||
response + "\nFinished. RequestsNum: " + str(requests_num),
|
|
||||||
)
|
|
||||||
yield {
|
|
||||||
"response": response,
|
|
||||||
"model": "rwkv",
|
|
||||||
"choices": [
|
|
||||||
{
|
|
||||||
"message": {
|
|
||||||
"role": "assistant",
|
|
||||||
"content": response,
|
|
||||||
},
|
|
||||||
"index": 0,
|
|
||||||
"finish_reason": "stop",
|
|
||||||
}
|
|
||||||
],
|
|
||||||
}
|
|
||||||
|
|
||||||
if body.stream:
|
|
||||||
return EventSourceResponse(eval_rwkv())
|
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
return await eval_rwkv().__anext__()
|
return await eval_rwkv(
|
||||||
|
model, request, body, completion_text, body.stream, stop, True
|
||||||
|
).__anext__()
|
||||||
except StopAsyncIteration:
|
except StopAsyncIteration:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
class CompletionBody(ModelConfigBody):
|
|
||||||
prompt: str
|
|
||||||
model: str = "rwkv"
|
|
||||||
stream: bool = False
|
|
||||||
stop: str = None
|
|
||||||
|
|
||||||
class Config:
|
|
||||||
schema_extra = {
|
|
||||||
"example": {
|
|
||||||
"prompt": "The following is an epic science fiction masterpiece that is immortalized, with delicate descriptions and grand depictions of interstellar civilization wars.\nChapter 1.\n",
|
|
||||||
"model": "rwkv",
|
|
||||||
"stream": False,
|
|
||||||
"stop": None,
|
|
||||||
"max_tokens": 100,
|
|
||||||
"temperature": 1.2,
|
|
||||||
"top_p": 0.5,
|
|
||||||
"presence_penalty": 0.4,
|
|
||||||
"frequency_penalty": 0.4,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@router.post("/v1/completions")
|
@router.post("/v1/completions")
|
||||||
@router.post("/completions")
|
@router.post("/completions")
|
||||||
async def completions(body: CompletionBody, request: Request):
|
async def completions(body: CompletionBody, request: Request):
|
||||||
@@ -283,7 +311,52 @@ async def completions(body: CompletionBody, request: Request):
|
|||||||
if body.prompt is None or body.prompt == "":
|
if body.prompt is None or body.prompt == "":
|
||||||
raise HTTPException(status.HTTP_400_BAD_REQUEST, "prompt not found")
|
raise HTTPException(status.HTTP_400_BAD_REQUEST, "prompt not found")
|
||||||
|
|
||||||
async def eval_rwkv():
|
if body.stream:
|
||||||
|
return EventSourceResponse(
|
||||||
|
eval_rwkv(model, request, body, body.prompt, body.stream, body.stop, False)
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
try:
|
||||||
|
return await eval_rwkv(
|
||||||
|
model, request, body, body.prompt, body.stream, body.stop, False
|
||||||
|
).__anext__()
|
||||||
|
except StopAsyncIteration:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
class EmbeddingsBody(BaseModel):
|
||||||
|
input: str | List[str] | List[List[int]]
|
||||||
|
model: str = "rwkv"
|
||||||
|
encoding_format: str = None
|
||||||
|
fast_mode: bool = False
|
||||||
|
|
||||||
|
class Config:
|
||||||
|
schema_extra = {
|
||||||
|
"example": {
|
||||||
|
"input": "a big apple",
|
||||||
|
"model": "rwkv",
|
||||||
|
"encoding_format": None,
|
||||||
|
"fast_mode": False,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def embedding_base64(embedding: List[float]) -> str:
|
||||||
|
return base64.b64encode(np.array(embedding).astype(np.float32)).decode("utf-8")
|
||||||
|
|
||||||
|
|
||||||
|
@router.post("/v1/embeddings")
|
||||||
|
@router.post("/embeddings")
|
||||||
|
@router.post("/v1/engines/text-embedding-ada-002/embeddings")
|
||||||
|
@router.post("/engines/text-embedding-ada-002/embeddings")
|
||||||
|
async def embeddings(body: EmbeddingsBody, request: Request):
|
||||||
|
model: RWKV = global_var.get(global_var.Model)
|
||||||
|
if model is None:
|
||||||
|
raise HTTPException(status.HTTP_400_BAD_REQUEST, "model not loaded")
|
||||||
|
|
||||||
|
if body.input is None or body.input == "" or body.input == [] or body.input == [[]]:
|
||||||
|
raise HTTPException(status.HTTP_400_BAD_REQUEST, "input not found")
|
||||||
|
|
||||||
global requests_num
|
global requests_num
|
||||||
requests_num = requests_num + 1
|
requests_num = requests_num + 1
|
||||||
quick_log(request, None, "Start Waiting. RequestsNum: " + str(requests_num))
|
quick_log(request, None, "Start Waiting. RequestsNum: " + str(requests_num))
|
||||||
@@ -310,93 +383,70 @@ async def completions(body: CompletionBody, request: Request):
|
|||||||
"Stop Waiting (Lock). RequestsNum: " + str(requests_num),
|
"Stop Waiting (Lock). RequestsNum: " + str(requests_num),
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
set_rwkv_config(model, global_var.get(global_var.Model_Config))
|
|
||||||
set_rwkv_config(model, body)
|
|
||||||
if body.stream:
|
|
||||||
response = ""
|
|
||||||
for response, delta in model.generate(body.prompt, stop=body.stop):
|
|
||||||
if await request.is_disconnected():
|
|
||||||
break
|
|
||||||
yield json.dumps(
|
|
||||||
{
|
|
||||||
"response": response,
|
|
||||||
"model": "rwkv",
|
|
||||||
"choices": [
|
|
||||||
{
|
|
||||||
"text": delta,
|
|
||||||
"index": 0,
|
|
||||||
"finish_reason": None,
|
|
||||||
}
|
|
||||||
],
|
|
||||||
}
|
|
||||||
)
|
|
||||||
# torch_gc()
|
|
||||||
requests_num = requests_num - 1
|
|
||||||
completion_lock.release()
|
|
||||||
if await request.is_disconnected():
|
|
||||||
print(f"{request.client} Stop Waiting")
|
|
||||||
quick_log(
|
|
||||||
request,
|
|
||||||
body,
|
|
||||||
response + "\nStop Waiting. RequestsNum: " + str(requests_num),
|
|
||||||
)
|
|
||||||
return
|
|
||||||
quick_log(
|
|
||||||
request,
|
|
||||||
body,
|
|
||||||
response + "\nFinished. RequestsNum: " + str(requests_num),
|
|
||||||
)
|
|
||||||
yield json.dumps(
|
|
||||||
{
|
|
||||||
"response": response,
|
|
||||||
"model": "rwkv",
|
|
||||||
"choices": [
|
|
||||||
{
|
|
||||||
"text": "",
|
|
||||||
"index": 0,
|
|
||||||
"finish_reason": "stop",
|
|
||||||
}
|
|
||||||
],
|
|
||||||
}
|
|
||||||
)
|
|
||||||
yield "[DONE]"
|
|
||||||
else:
|
|
||||||
response = ""
|
|
||||||
for response, delta in model.generate(body.prompt, stop=body.stop):
|
|
||||||
if await request.is_disconnected():
|
|
||||||
break
|
|
||||||
# torch_gc()
|
|
||||||
requests_num = requests_num - 1
|
|
||||||
completion_lock.release()
|
|
||||||
if await request.is_disconnected():
|
|
||||||
print(f"{request.client} Stop Waiting")
|
|
||||||
quick_log(
|
|
||||||
request,
|
|
||||||
body,
|
|
||||||
response + "\nStop Waiting. RequestsNum: " + str(requests_num),
|
|
||||||
)
|
|
||||||
return
|
|
||||||
quick_log(
|
|
||||||
request,
|
|
||||||
body,
|
|
||||||
response + "\nFinished. RequestsNum: " + str(requests_num),
|
|
||||||
)
|
|
||||||
yield {
|
|
||||||
"response": response,
|
|
||||||
"model": "rwkv",
|
|
||||||
"choices": [
|
|
||||||
{
|
|
||||||
"text": response,
|
|
||||||
"index": 0,
|
|
||||||
"finish_reason": "stop",
|
|
||||||
}
|
|
||||||
],
|
|
||||||
}
|
|
||||||
|
|
||||||
if body.stream:
|
base64_format = False
|
||||||
return EventSourceResponse(eval_rwkv())
|
if body.encoding_format == "base64":
|
||||||
|
base64_format = True
|
||||||
|
|
||||||
|
embeddings = []
|
||||||
|
prompt_tokens = 0
|
||||||
|
if type(body.input) == list:
|
||||||
|
if type(body.input[0]) == list:
|
||||||
|
encoding = tiktoken.model.encoding_for_model("text-embedding-ada-002")
|
||||||
|
for i in range(len(body.input)):
|
||||||
|
if await request.is_disconnected():
|
||||||
|
break
|
||||||
|
input = encoding.decode(body.input[i])
|
||||||
|
embedding, token_len = model.get_embedding(input, body.fast_mode)
|
||||||
|
prompt_tokens = prompt_tokens + token_len
|
||||||
|
if base64_format:
|
||||||
|
embedding = embedding_base64(embedding)
|
||||||
|
embeddings.append(embedding)
|
||||||
else:
|
else:
|
||||||
try:
|
for i in range(len(body.input)):
|
||||||
return await eval_rwkv().__anext__()
|
if await request.is_disconnected():
|
||||||
except StopAsyncIteration:
|
break
|
||||||
return None
|
embedding, token_len = model.get_embedding(
|
||||||
|
body.input[i], body.fast_mode
|
||||||
|
)
|
||||||
|
prompt_tokens = prompt_tokens + token_len
|
||||||
|
if base64_format:
|
||||||
|
embedding = embedding_base64(embedding)
|
||||||
|
embeddings.append(embedding)
|
||||||
|
else:
|
||||||
|
embedding, prompt_tokens = model.get_embedding(body.input, body.fast_mode)
|
||||||
|
if base64_format:
|
||||||
|
embedding = embedding_base64(embedding)
|
||||||
|
embeddings.append(embedding)
|
||||||
|
|
||||||
|
requests_num = requests_num - 1
|
||||||
|
completion_lock.release()
|
||||||
|
if await request.is_disconnected():
|
||||||
|
print(f"{request.client} Stop Waiting")
|
||||||
|
quick_log(
|
||||||
|
request,
|
||||||
|
None,
|
||||||
|
"Stop Waiting. RequestsNum: " + str(requests_num),
|
||||||
|
)
|
||||||
|
return
|
||||||
|
quick_log(
|
||||||
|
request,
|
||||||
|
None,
|
||||||
|
"Finished. RequestsNum: " + str(requests_num),
|
||||||
|
)
|
||||||
|
|
||||||
|
ret_data = [
|
||||||
|
{
|
||||||
|
"object": "embedding",
|
||||||
|
"index": i,
|
||||||
|
"embedding": embedding,
|
||||||
|
}
|
||||||
|
for i, embedding in enumerate(embeddings)
|
||||||
|
]
|
||||||
|
|
||||||
|
return {
|
||||||
|
"object": "list",
|
||||||
|
"data": ret_data,
|
||||||
|
"model": model.name,
|
||||||
|
"usage": {"prompt_tokens": prompt_tokens, "total_tokens": prompt_tokens},
|
||||||
|
}
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ class SwitchModelBody(BaseModel):
|
|||||||
class Config:
|
class Config:
|
||||||
schema_extra = {
|
schema_extra = {
|
||||||
"example": {
|
"example": {
|
||||||
"model": "models/RWKV-4-World-3B-v1-OnlyForTest_80%_trained-20230612-ctx4096.pth",
|
"model": "models/RWKV-4-World-3B-v1-20230619-ctx4096.pth",
|
||||||
"strategy": "cuda fp16",
|
"strategy": "cuda fp16",
|
||||||
"customCuda": False,
|
"customCuda": False,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,8 +48,8 @@ def add_state(body: AddStateBody):
|
|||||||
raise HTTPException(status.HTTP_400_BAD_REQUEST, "trie not loaded")
|
raise HTTPException(status.HTTP_400_BAD_REQUEST, "trie not loaded")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
id = trie.insert(body.prompt)
|
id: int = trie.insert(body.prompt)
|
||||||
device = body.state[0].device
|
device: torch.device = body.state[0].device
|
||||||
dtrie[id] = {
|
dtrie[id] = {
|
||||||
"tokens": copy.deepcopy(body.tokens),
|
"tokens": copy.deepcopy(body.tokens),
|
||||||
"state": [tensor.cpu() for tensor in body.state]
|
"state": [tensor.cpu() for tensor in body.state]
|
||||||
@@ -110,7 +110,7 @@ def _get_a_dtrie_buff_size(dtrie_v):
|
|||||||
# print(dtrie_v["logits"][0].element_size())
|
# print(dtrie_v["logits"][0].element_size())
|
||||||
# print(dtrie_v["logits"].nelement())
|
# print(dtrie_v["logits"].nelement())
|
||||||
# print(dtrie_v["logits"][0].element_size() * dtrie_v["logits"].nelement())
|
# print(dtrie_v["logits"][0].element_size() * dtrie_v["logits"].nelement())
|
||||||
return 54 * len(dtrie_v["tokens"]) + 491520 + 262144 + 28
|
return 54 * len(dtrie_v["tokens"]) + 491520 + 262144 + 28 # TODO
|
||||||
|
|
||||||
|
|
||||||
@router.post("/longest-prefix-state")
|
@router.post("/longest-prefix-state")
|
||||||
@@ -127,8 +127,9 @@ def longest_prefix_state(body: LongestPrefixStateBody, request: Request):
|
|||||||
pass
|
pass
|
||||||
if id != -1:
|
if id != -1:
|
||||||
v = dtrie[id]
|
v = dtrie[id]
|
||||||
device = v["device"]
|
device: torch.device = v["device"]
|
||||||
prompt = trie[id]
|
prompt: str = trie[id]
|
||||||
|
|
||||||
quick_log(request, body, "Hit:\n" + prompt)
|
quick_log(request, body, "Hit:\n" + prompt)
|
||||||
return {
|
return {
|
||||||
"prompt": prompt,
|
"prompt": prompt,
|
||||||
@@ -137,7 +138,7 @@ def longest_prefix_state(body: LongestPrefixStateBody, request: Request):
|
|||||||
if device != torch.device("cpu")
|
if device != torch.device("cpu")
|
||||||
else v["state"],
|
else v["state"],
|
||||||
"logits": v["logits"],
|
"logits": v["logits"],
|
||||||
"device": device,
|
"device": device.type,
|
||||||
}
|
}
|
||||||
else:
|
else:
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
import os
|
import os
|
||||||
import pathlib
|
import pathlib
|
||||||
import copy
|
import copy
|
||||||
from typing import Dict, List
|
from typing import Dict, List, Tuple
|
||||||
from utils.log import quick_log
|
from utils.log import quick_log
|
||||||
from fastapi import HTTPException
|
from fastapi import HTTPException
|
||||||
from pydantic import BaseModel, Field
|
from pydantic import BaseModel, Field
|
||||||
|
import torch
|
||||||
|
import numpy as np
|
||||||
from rwkv_pip.utils import PIPELINE
|
from rwkv_pip.utils import PIPELINE
|
||||||
from routes import state_cache
|
from routes import state_cache
|
||||||
|
|
||||||
@@ -21,6 +23,8 @@ class RWKV:
|
|||||||
def __init__(self, model: str, strategy: str, tokens_path: str) -> None:
|
def __init__(self, model: str, strategy: str, tokens_path: str) -> None:
|
||||||
from rwkv.model import RWKV as Model # dynamic import to make RWKV_CUDA_ON work
|
from rwkv.model import RWKV as Model # dynamic import to make RWKV_CUDA_ON work
|
||||||
|
|
||||||
|
filename, _ = os.path.splitext(os.path.basename(model))
|
||||||
|
self.name = filename
|
||||||
self.model = Model(model, strategy)
|
self.model = Model(model, strategy)
|
||||||
self.pipeline = PIPELINE(self.model, tokens_path)
|
self.pipeline = PIPELINE(self.model, tokens_path)
|
||||||
self.model_state = None
|
self.model_state = None
|
||||||
@@ -64,9 +68,10 @@ The following is a coherent verbose detailed conversation between a girl named {
|
|||||||
{bot} usually gives {user} kind, helpful and informative advices.\n
|
{bot} usually gives {user} kind, helpful and informative advices.\n
|
||||||
"""
|
"""
|
||||||
if self.user == "Bob"
|
if self.user == "Bob"
|
||||||
else f"{user}{interface} hi\n\n{bot}{interface} 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.\n\n"
|
else f"{user}{interface} hi\n\n{bot}{interface} 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.\n\n"
|
||||||
)
|
)
|
||||||
logits = self.run_rnn(self.fix_tokens(self.pipeline.encode(preset_system)))
|
logits, _ = self.run_rnn(self.fix_tokens(self.pipeline.encode(preset_system)))
|
||||||
try:
|
try:
|
||||||
state_cache.add_state(
|
state_cache.add_state(
|
||||||
state_cache.AddStateBody(
|
state_cache.AddStateBody(
|
||||||
@@ -87,6 +92,7 @@ The following is a coherent verbose detailed conversation between a girl named {
|
|||||||
|
|
||||||
def run_rnn(self, _tokens: List[str], newline_adj: int = 0):
|
def run_rnn(self, _tokens: List[str], newline_adj: int = 0):
|
||||||
tokens = [int(x) for x in _tokens]
|
tokens = [int(x) for x in _tokens]
|
||||||
|
token_len = len(tokens)
|
||||||
self.model_tokens += tokens
|
self.model_tokens += tokens
|
||||||
|
|
||||||
while len(tokens) > 0:
|
while len(tokens) > 0:
|
||||||
@@ -99,7 +105,157 @@ The following is a coherent verbose detailed conversation between a girl named {
|
|||||||
|
|
||||||
if self.model_tokens[-1] in self.AVOID_REPEAT_TOKENS:
|
if self.model_tokens[-1] in self.AVOID_REPEAT_TOKENS:
|
||||||
out[self.model_tokens[-1]] = -999999999
|
out[self.model_tokens[-1]] = -999999999
|
||||||
return out
|
return out, token_len
|
||||||
|
|
||||||
|
def get_embedding(self, input: str, fast_mode: bool) -> Tuple[List[float], int]:
|
||||||
|
if fast_mode:
|
||||||
|
embedding, token_len = self.fast_embedding(
|
||||||
|
self.fix_tokens(self.pipeline.encode(input)), None
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
self.model_state = None
|
||||||
|
self.model_tokens = []
|
||||||
|
_, token_len = self.run_rnn(self.fix_tokens(self.pipeline.encode(input)))
|
||||||
|
embedding = self.model_state[-5].tolist()
|
||||||
|
embedding = (embedding / np.linalg.norm(embedding)).tolist()
|
||||||
|
return embedding, token_len
|
||||||
|
|
||||||
|
def fast_embedding(self, tokens: List[str], state):
|
||||||
|
tokens = [int(x) for x in tokens]
|
||||||
|
token_len = len(tokens)
|
||||||
|
self = self.model
|
||||||
|
|
||||||
|
with torch.no_grad():
|
||||||
|
w = self.w
|
||||||
|
args = self.args
|
||||||
|
|
||||||
|
if state == None:
|
||||||
|
state = [None] * args.n_layer * 5
|
||||||
|
for i in range(
|
||||||
|
args.n_layer
|
||||||
|
): # state: 0=att_xx 1=att_aa 2=att_bb 3=att_pp 4=ffn_xx
|
||||||
|
dd = self.strategy[i]
|
||||||
|
dev = dd.device
|
||||||
|
atype = dd.atype
|
||||||
|
state[i * 5 + 0] = torch.zeros(
|
||||||
|
args.n_embd, dtype=atype, requires_grad=False, device=dev
|
||||||
|
).contiguous()
|
||||||
|
state[i * 5 + 1] = torch.zeros(
|
||||||
|
args.n_embd, dtype=torch.float, requires_grad=False, device=dev
|
||||||
|
).contiguous()
|
||||||
|
state[i * 5 + 2] = torch.zeros(
|
||||||
|
args.n_embd, dtype=torch.float, requires_grad=False, device=dev
|
||||||
|
).contiguous()
|
||||||
|
state[i * 5 + 3] = (
|
||||||
|
torch.zeros(
|
||||||
|
args.n_embd,
|
||||||
|
dtype=torch.float,
|
||||||
|
requires_grad=False,
|
||||||
|
device=dev,
|
||||||
|
).contiguous()
|
||||||
|
- 1e30
|
||||||
|
)
|
||||||
|
state[i * 5 + 4] = torch.zeros(
|
||||||
|
args.n_embd, dtype=atype, requires_grad=False, device=dev
|
||||||
|
).contiguous()
|
||||||
|
|
||||||
|
break
|
||||||
|
|
||||||
|
seq_mode = len(tokens) > 1
|
||||||
|
|
||||||
|
x = w["emb.weight"][tokens if seq_mode else tokens[0]]
|
||||||
|
|
||||||
|
for i in range(args.n_layer):
|
||||||
|
bbb = f"blocks.{i}."
|
||||||
|
att = f"blocks.{i}.att."
|
||||||
|
ffn = f"blocks.{i}.ffn."
|
||||||
|
dd = self.strategy[i]
|
||||||
|
dev = dd.device
|
||||||
|
atype = dd.atype
|
||||||
|
wtype = dd.wtype
|
||||||
|
if seq_mode:
|
||||||
|
if "cuda" in str(dev) and os.environ["RWKV_CUDA_ON"] == "1":
|
||||||
|
ATT = (
|
||||||
|
self.cuda_att_seq
|
||||||
|
if wtype != torch.uint8
|
||||||
|
else self.cuda_att_seq_i8
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
ATT = self.att_seq if wtype != torch.uint8 else self.att_seq_i8
|
||||||
|
FFN = self.ffn_seq if wtype != torch.uint8 else self.ffn_seq_i8
|
||||||
|
else:
|
||||||
|
ATT = self.att_one if wtype != torch.uint8 else self.att_one_i8
|
||||||
|
FFN = self.ffn_one if wtype != torch.uint8 else self.ffn_one_i8
|
||||||
|
|
||||||
|
x = x.to(dtype=atype, device=dev)
|
||||||
|
|
||||||
|
kw = w[f"{att}key.weight"]
|
||||||
|
vw = w[f"{att}value.weight"]
|
||||||
|
rw = w[f"{att}receptance.weight"]
|
||||||
|
ow = w[f"{att}output.weight"]
|
||||||
|
if dd.stream:
|
||||||
|
kw = kw.to(device=dev, non_blocking=True)
|
||||||
|
vw = vw.to(device=dev, non_blocking=True)
|
||||||
|
rw = rw.to(device=dev, non_blocking=True)
|
||||||
|
ow = ow.to(device=dev, non_blocking=True)
|
||||||
|
kmx = w[f"{att}key.weight_mx"] if wtype == torch.uint8 else x
|
||||||
|
krx = w[f"{att}key.weight_rx"] if wtype == torch.uint8 else x
|
||||||
|
kmy = w[f"{att}key.weight_my"] if wtype == torch.uint8 else x
|
||||||
|
kry = w[f"{att}key.weight_ry"] if wtype == torch.uint8 else x
|
||||||
|
vmx = w[f"{att}value.weight_mx"] if wtype == torch.uint8 else x
|
||||||
|
vrx = w[f"{att}value.weight_rx"] if wtype == torch.uint8 else x
|
||||||
|
vmy = w[f"{att}value.weight_my"] if wtype == torch.uint8 else x
|
||||||
|
vry = w[f"{att}value.weight_ry"] if wtype == torch.uint8 else x
|
||||||
|
rmx = w[f"{att}receptance.weight_mx"] if wtype == torch.uint8 else x
|
||||||
|
rrx = w[f"{att}receptance.weight_rx"] if wtype == torch.uint8 else x
|
||||||
|
rmy = w[f"{att}receptance.weight_my"] if wtype == torch.uint8 else x
|
||||||
|
rry = w[f"{att}receptance.weight_ry"] if wtype == torch.uint8 else x
|
||||||
|
omx = w[f"{att}output.weight_mx"] if wtype == torch.uint8 else x
|
||||||
|
orx = w[f"{att}output.weight_rx"] if wtype == torch.uint8 else x
|
||||||
|
omy = w[f"{att}output.weight_my"] if wtype == torch.uint8 else x
|
||||||
|
ory = w[f"{att}output.weight_ry"] if wtype == torch.uint8 else x
|
||||||
|
(
|
||||||
|
x,
|
||||||
|
state[i * 5 + 0],
|
||||||
|
state[i * 5 + 1],
|
||||||
|
state[i * 5 + 2],
|
||||||
|
state[i * 5 + 3],
|
||||||
|
) = ATT(
|
||||||
|
x,
|
||||||
|
state[i * 5 + 0],
|
||||||
|
state[i * 5 + 1],
|
||||||
|
state[i * 5 + 2],
|
||||||
|
state[i * 5 + 3],
|
||||||
|
w[f"{bbb}ln1.weight"],
|
||||||
|
w[f"{bbb}ln1.bias"],
|
||||||
|
w[f"{att}time_mix_k"],
|
||||||
|
w[f"{att}time_mix_v"],
|
||||||
|
w[f"{att}time_mix_r"],
|
||||||
|
w[f"{att}time_decay"],
|
||||||
|
w[f"{att}time_first"],
|
||||||
|
kw,
|
||||||
|
vw,
|
||||||
|
rw,
|
||||||
|
ow,
|
||||||
|
kmx,
|
||||||
|
krx,
|
||||||
|
kmy,
|
||||||
|
kry,
|
||||||
|
vmx,
|
||||||
|
vrx,
|
||||||
|
vmy,
|
||||||
|
vry,
|
||||||
|
rmx,
|
||||||
|
rrx,
|
||||||
|
rmy,
|
||||||
|
rry,
|
||||||
|
omx,
|
||||||
|
orx,
|
||||||
|
omy,
|
||||||
|
ory,
|
||||||
|
)
|
||||||
|
|
||||||
|
return state[0].tolist(), token_len
|
||||||
|
|
||||||
def generate(self, prompt: str, stop: str = None):
|
def generate(self, prompt: str, stop: str = None):
|
||||||
quick_log(None, None, "Generation Prompt:\n" + prompt)
|
quick_log(None, None, "Generation Prompt:\n" + prompt)
|
||||||
@@ -120,8 +276,11 @@ The following is a coherent verbose detailed conversation between a girl named {
|
|||||||
self.model_tokens = copy.deepcopy(cache["tokens"])
|
self.model_tokens = copy.deepcopy(cache["tokens"])
|
||||||
logits = copy.deepcopy(cache["logits"])
|
logits = copy.deepcopy(cache["logits"])
|
||||||
|
|
||||||
|
prompt_token_len = 0
|
||||||
if delta_prompt != "":
|
if delta_prompt != "":
|
||||||
logits = self.run_rnn(self.fix_tokens(self.pipeline.encode(delta_prompt)))
|
logits, prompt_token_len = self.run_rnn(
|
||||||
|
self.fix_tokens(self.pipeline.encode(delta_prompt))
|
||||||
|
)
|
||||||
try:
|
try:
|
||||||
state_cache.add_state(
|
state_cache.add_state(
|
||||||
state_cache.AddStateBody(
|
state_cache.AddStateBody(
|
||||||
@@ -139,6 +298,7 @@ The following is a coherent verbose detailed conversation between a girl named {
|
|||||||
|
|
||||||
occurrence: Dict = {}
|
occurrence: Dict = {}
|
||||||
|
|
||||||
|
completion_token_len = 0
|
||||||
response = ""
|
response = ""
|
||||||
for i in range(self.max_tokens_per_generation):
|
for i in range(self.max_tokens_per_generation):
|
||||||
for n in occurrence:
|
for n in occurrence:
|
||||||
@@ -151,14 +311,15 @@ The following is a coherent verbose detailed conversation between a girl named {
|
|||||||
)
|
)
|
||||||
|
|
||||||
if token == END_OF_TEXT:
|
if token == END_OF_TEXT:
|
||||||
yield response, ""
|
yield response, "", prompt_token_len, completion_token_len
|
||||||
break
|
break
|
||||||
if token not in occurrence:
|
if token not in occurrence:
|
||||||
occurrence[token] = 1
|
occurrence[token] = 1
|
||||||
else:
|
else:
|
||||||
occurrence[token] += 1
|
occurrence[token] += 1
|
||||||
|
|
||||||
logits = self.run_rnn([token])
|
logits, _ = self.run_rnn([token])
|
||||||
|
completion_token_len = completion_token_len + 1
|
||||||
delta: str = self.pipeline.decode(self.model_tokens[out_last:])
|
delta: str = self.pipeline.decode(self.model_tokens[out_last:])
|
||||||
if "\ufffd" not in delta: # avoid utf-8 display issues
|
if "\ufffd" not in delta: # avoid utf-8 display issues
|
||||||
response += delta
|
response += delta
|
||||||
@@ -176,7 +337,7 @@ The following is a coherent verbose detailed conversation between a girl named {
|
|||||||
)
|
)
|
||||||
except HTTPException:
|
except HTTPException:
|
||||||
pass
|
pass
|
||||||
yield response, ""
|
yield response, "", prompt_token_len, completion_token_len
|
||||||
break
|
break
|
||||||
out_last = begin + i + 1
|
out_last = begin + i + 1
|
||||||
if i == self.max_tokens_per_generation - 1:
|
if i == self.max_tokens_per_generation - 1:
|
||||||
@@ -191,7 +352,7 @@ The following is a coherent verbose detailed conversation between a girl named {
|
|||||||
)
|
)
|
||||||
except HTTPException:
|
except HTTPException:
|
||||||
pass
|
pass
|
||||||
yield response, delta
|
yield response, delta, prompt_token_len, completion_token_len
|
||||||
|
|
||||||
|
|
||||||
class ModelConfigBody(BaseModel):
|
class ModelConfigBody(BaseModel):
|
||||||
|
|||||||
@@ -70,7 +70,7 @@
|
|||||||
"Type your message here": "在此输入消息",
|
"Type your message here": "在此输入消息",
|
||||||
"Copy": "复制",
|
"Copy": "复制",
|
||||||
"Read Aloud": "朗读",
|
"Read Aloud": "朗读",
|
||||||
"Hello! I'm RWKV, an open-source and commercially available 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'部分替换为'",
|
"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": "新版本可用",
|
"New Version Available": "新版本可用",
|
||||||
"Update": "更新",
|
"Update": "更新",
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ const ChatPanel: FC = observer(() => {
|
|||||||
color: 'colorful',
|
color: 'colorful',
|
||||||
avatarImg: logo,
|
avatarImg: logo,
|
||||||
time: new Date().toISOString(),
|
time: new Date().toISOString(),
|
||||||
content: t('Hello! I\'m RWKV, an open-source and commercially available large language model.'),
|
content: t('Hello! I\'m RWKV, an open-source and commercially usable large language model.'),
|
||||||
side: 'left',
|
side: 'left',
|
||||||
done: true
|
done: true
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ export const defaultModelConfigsMac: ModelConfig[] = [
|
|||||||
frequencyPenalty: 0.4
|
frequencyPenalty: 0.4
|
||||||
},
|
},
|
||||||
modelParameters: {
|
modelParameters: {
|
||||||
modelName: 'RWKV-4-World-3B-v1-OnlyForTest_80%_trained-20230612-ctx4096.pth',
|
modelName: 'RWKV-4-World-3B-v1-20230619-ctx4096.pth',
|
||||||
device: 'MPS',
|
device: 'MPS',
|
||||||
precision: 'fp32',
|
precision: 'fp32',
|
||||||
storedLayers: 41,
|
storedLayers: 41,
|
||||||
@@ -145,7 +145,7 @@ export const defaultModelConfigsMac: ModelConfig[] = [
|
|||||||
frequencyPenalty: 0.4
|
frequencyPenalty: 0.4
|
||||||
},
|
},
|
||||||
modelParameters: {
|
modelParameters: {
|
||||||
modelName: 'RWKV-4-World-7B-v1-OnlyForTest_75%_trained-20230615-ctx4096.pth',
|
modelName: 'RWKV-4-World-7B-v1-OnlyForTest_84%_trained-20230618-ctx4096.pth',
|
||||||
device: 'MPS',
|
device: 'MPS',
|
||||||
precision: 'fp32',
|
precision: 'fp32',
|
||||||
storedLayers: 41,
|
storedLayers: 41,
|
||||||
@@ -200,7 +200,7 @@ export const defaultModelConfigsMac: ModelConfig[] = [
|
|||||||
frequencyPenalty: 0.4
|
frequencyPenalty: 0.4
|
||||||
},
|
},
|
||||||
modelParameters: {
|
modelParameters: {
|
||||||
modelName: 'RWKV-4-World-3B-v1-OnlyForTest_80%_trained-20230612-ctx4096.pth',
|
modelName: 'RWKV-4-World-3B-v1-20230619-ctx4096.pth',
|
||||||
device: 'CPU',
|
device: 'CPU',
|
||||||
precision: 'fp32',
|
precision: 'fp32',
|
||||||
storedLayers: 41,
|
storedLayers: 41,
|
||||||
@@ -254,7 +254,7 @@ export const defaultModelConfigsMac: ModelConfig[] = [
|
|||||||
frequencyPenalty: 0.4
|
frequencyPenalty: 0.4
|
||||||
},
|
},
|
||||||
modelParameters: {
|
modelParameters: {
|
||||||
modelName: 'RWKV-4-World-7B-v1-OnlyForTest_75%_trained-20230615-ctx4096.pth',
|
modelName: 'RWKV-4-World-7B-v1-OnlyForTest_84%_trained-20230618-ctx4096.pth',
|
||||||
device: 'CPU',
|
device: 'CPU',
|
||||||
precision: 'fp32',
|
precision: 'fp32',
|
||||||
storedLayers: 41,
|
storedLayers: 41,
|
||||||
@@ -311,7 +311,7 @@ export const defaultModelConfigs: ModelConfig[] = [
|
|||||||
frequencyPenalty: 0.4
|
frequencyPenalty: 0.4
|
||||||
},
|
},
|
||||||
modelParameters: {
|
modelParameters: {
|
||||||
modelName: 'RWKV-4-World-3B-v1-OnlyForTest_80%_trained-20230612-ctx4096.pth',
|
modelName: 'RWKV-4-World-3B-v1-20230619-ctx4096.pth',
|
||||||
device: 'CUDA',
|
device: 'CUDA',
|
||||||
precision: 'int8',
|
precision: 'int8',
|
||||||
storedLayers: 6,
|
storedLayers: 6,
|
||||||
@@ -422,7 +422,7 @@ export const defaultModelConfigs: ModelConfig[] = [
|
|||||||
frequencyPenalty: 0.4
|
frequencyPenalty: 0.4
|
||||||
},
|
},
|
||||||
modelParameters: {
|
modelParameters: {
|
||||||
modelName: 'RWKV-4-World-3B-v1-OnlyForTest_80%_trained-20230612-ctx4096.pth',
|
modelName: 'RWKV-4-World-3B-v1-20230619-ctx4096.pth',
|
||||||
device: 'CUDA',
|
device: 'CUDA',
|
||||||
precision: 'int8',
|
precision: 'int8',
|
||||||
storedLayers: 24,
|
storedLayers: 24,
|
||||||
@@ -479,7 +479,7 @@ export const defaultModelConfigs: ModelConfig[] = [
|
|||||||
frequencyPenalty: 0.4
|
frequencyPenalty: 0.4
|
||||||
},
|
},
|
||||||
modelParameters: {
|
modelParameters: {
|
||||||
modelName: 'RWKV-4-World-7B-v1-OnlyForTest_75%_trained-20230615-ctx4096.pth',
|
modelName: 'RWKV-4-World-7B-v1-OnlyForTest_84%_trained-20230618-ctx4096.pth',
|
||||||
device: 'CUDA',
|
device: 'CUDA',
|
||||||
precision: 'int8',
|
precision: 'int8',
|
||||||
storedLayers: 8,
|
storedLayers: 8,
|
||||||
@@ -555,7 +555,7 @@ export const defaultModelConfigs: ModelConfig[] = [
|
|||||||
frequencyPenalty: 0.4
|
frequencyPenalty: 0.4
|
||||||
},
|
},
|
||||||
modelParameters: {
|
modelParameters: {
|
||||||
modelName: 'RWKV-4-World-3B-v1-OnlyForTest_80%_trained-20230612-ctx4096.pth',
|
modelName: 'RWKV-4-World-3B-v1-20230619-ctx4096.pth',
|
||||||
device: 'CUDA',
|
device: 'CUDA',
|
||||||
precision: 'int8',
|
precision: 'int8',
|
||||||
storedLayers: 41,
|
storedLayers: 41,
|
||||||
@@ -612,7 +612,7 @@ export const defaultModelConfigs: ModelConfig[] = [
|
|||||||
frequencyPenalty: 0.4
|
frequencyPenalty: 0.4
|
||||||
},
|
},
|
||||||
modelParameters: {
|
modelParameters: {
|
||||||
modelName: 'RWKV-4-World-7B-v1-OnlyForTest_75%_trained-20230615-ctx4096.pth',
|
modelName: 'RWKV-4-World-7B-v1-OnlyForTest_84%_trained-20230618-ctx4096.pth',
|
||||||
device: 'CUDA',
|
device: 'CUDA',
|
||||||
precision: 'int8',
|
precision: 'int8',
|
||||||
storedLayers: 18,
|
storedLayers: 18,
|
||||||
@@ -687,7 +687,7 @@ export const defaultModelConfigs: ModelConfig[] = [
|
|||||||
frequencyPenalty: 0.4
|
frequencyPenalty: 0.4
|
||||||
},
|
},
|
||||||
modelParameters: {
|
modelParameters: {
|
||||||
modelName: 'RWKV-4-World-3B-v1-OnlyForTest_80%_trained-20230612-ctx4096.pth',
|
modelName: 'RWKV-4-World-3B-v1-20230619-ctx4096.pth',
|
||||||
device: 'CUDA',
|
device: 'CUDA',
|
||||||
precision: 'fp16',
|
precision: 'fp16',
|
||||||
storedLayers: 41,
|
storedLayers: 41,
|
||||||
@@ -744,7 +744,7 @@ export const defaultModelConfigs: ModelConfig[] = [
|
|||||||
frequencyPenalty: 0.4
|
frequencyPenalty: 0.4
|
||||||
},
|
},
|
||||||
modelParameters: {
|
modelParameters: {
|
||||||
modelName: 'RWKV-4-World-7B-v1-OnlyForTest_75%_trained-20230615-ctx4096.pth',
|
modelName: 'RWKV-4-World-7B-v1-OnlyForTest_84%_trained-20230618-ctx4096.pth',
|
||||||
device: 'CUDA',
|
device: 'CUDA',
|
||||||
precision: 'int8',
|
precision: 'int8',
|
||||||
storedLayers: 27,
|
storedLayers: 27,
|
||||||
@@ -801,7 +801,7 @@ export const defaultModelConfigs: ModelConfig[] = [
|
|||||||
frequencyPenalty: 0.4
|
frequencyPenalty: 0.4
|
||||||
},
|
},
|
||||||
modelParameters: {
|
modelParameters: {
|
||||||
modelName: 'RWKV-4-World-7B-v1-OnlyForTest_75%_trained-20230615-ctx4096.pth',
|
modelName: 'RWKV-4-World-7B-v1-OnlyForTest_84%_trained-20230618-ctx4096.pth',
|
||||||
device: 'CUDA',
|
device: 'CUDA',
|
||||||
precision: 'int8',
|
precision: 'int8',
|
||||||
storedLayers: 41,
|
storedLayers: 41,
|
||||||
@@ -877,7 +877,7 @@ export const defaultModelConfigs: ModelConfig[] = [
|
|||||||
frequencyPenalty: 0.4
|
frequencyPenalty: 0.4
|
||||||
},
|
},
|
||||||
modelParameters: {
|
modelParameters: {
|
||||||
modelName: 'RWKV-4-World-7B-v1-OnlyForTest_75%_trained-20230615-ctx4096.pth',
|
modelName: 'RWKV-4-World-7B-v1-OnlyForTest_84%_trained-20230618-ctx4096.pth',
|
||||||
device: 'CUDA',
|
device: 'CUDA',
|
||||||
precision: 'fp16',
|
precision: 'fp16',
|
||||||
storedLayers: 41,
|
storedLayers: 41,
|
||||||
@@ -1027,7 +1027,7 @@ export const defaultModelConfigs: ModelConfig[] = [
|
|||||||
frequencyPenalty: 0.4
|
frequencyPenalty: 0.4
|
||||||
},
|
},
|
||||||
modelParameters: {
|
modelParameters: {
|
||||||
modelName: 'RWKV-4-World-3B-v1-OnlyForTest_80%_trained-20230612-ctx4096.pth',
|
modelName: 'RWKV-4-World-3B-v1-20230619-ctx4096.pth',
|
||||||
device: 'CPU',
|
device: 'CPU',
|
||||||
precision: 'fp32',
|
precision: 'fp32',
|
||||||
storedLayers: 41,
|
storedLayers: 41,
|
||||||
@@ -1081,7 +1081,7 @@ export const defaultModelConfigs: ModelConfig[] = [
|
|||||||
frequencyPenalty: 0.4
|
frequencyPenalty: 0.4
|
||||||
},
|
},
|
||||||
modelParameters: {
|
modelParameters: {
|
||||||
modelName: 'RWKV-4-World-7B-v1-OnlyForTest_75%_trained-20230615-ctx4096.pth',
|
modelName: 'RWKV-4-World-7B-v1-OnlyForTest_84%_trained-20230618-ctx4096.pth',
|
||||||
device: 'CPU',
|
device: 'CPU',
|
||||||
precision: 'fp32',
|
precision: 'fp32',
|
||||||
storedLayers: 41,
|
storedLayers: 41,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"version": "1.2.3",
|
"version": "1.2.4",
|
||||||
"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,18 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"models": [
|
"models": [
|
||||||
|
{
|
||||||
|
"name": "RWKV-4-World-CHNtuned-0.1B-v1-20230617-ctx4096.pth",
|
||||||
|
"desc": {
|
||||||
|
"en": "100+ Languages 0.1B v1 Enhanced Chinese",
|
||||||
|
"zh": "100+ 语言 0.1B v1 中文增强"
|
||||||
|
},
|
||||||
|
"size": 385594610,
|
||||||
|
"SHA256": "a3888f9958d378ee6d4976ae1c02edb698f4382e426086febafb4a69417b9080",
|
||||||
|
"lastUpdated": "2023-06-17T18:35:26",
|
||||||
|
"url": "https://huggingface.co/BlinkDL/rwkv-4-world/blob/main/RWKV-4-World-CHNtuned-0.1B-v1-20230617-ctx4096.pth",
|
||||||
|
"downloadUrl": "https://huggingface.co/BlinkDL/rwkv-4-world/resolve/main/RWKV-4-World-CHNtuned-0.1B-v1-20230617-ctx4096.pth"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "RWKV-4-World-0.1B-v1-20230520-ctx4096.pth",
|
"name": "RWKV-4-World-0.1B-v1-20230520-ctx4096.pth",
|
||||||
"desc": {
|
"desc": {
|
||||||
@@ -27,6 +39,18 @@
|
|||||||
"url": "https://huggingface.co/BlinkDL/rwkv-4-world/blob/main/RWKV-4-World-0.1B-v1-20230520-ctx4096.pth",
|
"url": "https://huggingface.co/BlinkDL/rwkv-4-world/blob/main/RWKV-4-World-0.1B-v1-20230520-ctx4096.pth",
|
||||||
"downloadUrl": "https://huggingface.co/BlinkDL/rwkv-4-world/resolve/main/RWKV-4-World-0.1B-v1-20230520-ctx4096.pth"
|
"downloadUrl": "https://huggingface.co/BlinkDL/rwkv-4-world/resolve/main/RWKV-4-World-0.1B-v1-20230520-ctx4096.pth"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "RWKV-4-World-CHNtuned-0.4B-v1-20230618-ctx4096.pth",
|
||||||
|
"desc": {
|
||||||
|
"en": "100+ Languages 0.4B v1 Enhanced Chinese",
|
||||||
|
"zh": "100+ 语言 0.4B v1 中文增强"
|
||||||
|
},
|
||||||
|
"size": 923362866,
|
||||||
|
"SHA256": "dbd5302cbee596bbc900f97eb10b2af3001a7f2c7e4d8643bf8683b2cdbdd324",
|
||||||
|
"lastUpdated": "2023-06-18T10:46:50",
|
||||||
|
"url": "https://huggingface.co/BlinkDL/rwkv-4-world/blob/main/RWKV-4-World-CHNtuned-0.4B-v1-20230618-ctx4096.pth",
|
||||||
|
"downloadUrl": "https://huggingface.co/BlinkDL/rwkv-4-world/resolve/main/RWKV-4-World-CHNtuned-0.4B-v1-20230618-ctx4096.pth"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "RWKV-4-World-0.4B-v1-20230529-ctx4096.pth",
|
"name": "RWKV-4-World-0.4B-v1-20230529-ctx4096.pth",
|
||||||
"desc": {
|
"desc": {
|
||||||
@@ -39,6 +63,18 @@
|
|||||||
"url": "https://huggingface.co/BlinkDL/rwkv-4-world/blob/main/RWKV-4-World-0.4B-v1-20230529-ctx4096.pth",
|
"url": "https://huggingface.co/BlinkDL/rwkv-4-world/blob/main/RWKV-4-World-0.4B-v1-20230529-ctx4096.pth",
|
||||||
"downloadUrl": "https://huggingface.co/BlinkDL/rwkv-4-world/resolve/main/RWKV-4-World-0.4B-v1-20230529-ctx4096.pth"
|
"downloadUrl": "https://huggingface.co/BlinkDL/rwkv-4-world/resolve/main/RWKV-4-World-0.4B-v1-20230529-ctx4096.pth"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "RWKV-4-World-CHNtuned-1.5B-v1-20230620-ctx4096.pth",
|
||||||
|
"desc": {
|
||||||
|
"en": "100+ Languages 1.5B v1 Enhanced Chinese",
|
||||||
|
"zh": "100+ 语言 1.5B v1 中文增强"
|
||||||
|
},
|
||||||
|
"size": 3155281586,
|
||||||
|
"SHA256": "9f31f2ed5fe52dcf2d50208eb2efd764b9674dba2adb1baeff61997b4390a26b",
|
||||||
|
"lastUpdated": "2023-06-20T06:35:37",
|
||||||
|
"url": "https://huggingface.co/BlinkDL/rwkv-4-world/blob/main/RWKV-4-World-CHNtuned-1.5B-v1-20230620-ctx4096.pth",
|
||||||
|
"downloadUrl": "https://huggingface.co/BlinkDL/rwkv-4-world/resolve/main/RWKV-4-World-CHNtuned-1.5B-v1-20230620-ctx4096.pth"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "RWKV-4-World-1.5B-v1-OnlyForTest_57%_trained-20230529-ctx4096.pth",
|
"name": "RWKV-4-World-1.5B-v1-OnlyForTest_57%_trained-20230529-ctx4096.pth",
|
||||||
"desc": {
|
"desc": {
|
||||||
@@ -139,7 +175,20 @@
|
|||||||
"SHA256": "3bb10caf3017871435d83f39facc8a729fd774020390153470f004eb3ef645bd",
|
"SHA256": "3bb10caf3017871435d83f39facc8a729fd774020390153470f004eb3ef645bd",
|
||||||
"lastUpdated": "2023-06-12T06:31:32",
|
"lastUpdated": "2023-06-12T06:31:32",
|
||||||
"url": "https://huggingface.co/BlinkDL/rwkv-4-world/blob/main/RWKV-4-World-3B-v1-OnlyForTest_80%25_trained-20230612-ctx4096.pth",
|
"url": "https://huggingface.co/BlinkDL/rwkv-4-world/blob/main/RWKV-4-World-3B-v1-OnlyForTest_80%25_trained-20230612-ctx4096.pth",
|
||||||
"downloadUrl": "https://huggingface.co/BlinkDL/rwkv-4-world/resolve/main/RWKV-4-World-3B-v1-OnlyForTest_80%25_trained-20230612-ctx4096.pth"
|
"downloadUrl": "https://huggingface.co/BlinkDL/rwkv-4-world/resolve/main/RWKV-4-World-3B-v1-OnlyForTest_80%25_trained-20230612-ctx4096.pth",
|
||||||
|
"hide": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "RWKV-4-World-3B-v1-20230619-ctx4096.pth",
|
||||||
|
"desc": {
|
||||||
|
"en": "100+ Languages 3B v1",
|
||||||
|
"zh": "100+ 语言 3B v1"
|
||||||
|
},
|
||||||
|
"size": 6125597618,
|
||||||
|
"SHA256": "1b227af317fa25b6939ab3c7cd321226ca48b8fe4bbbd2df3db669f1482c54ba",
|
||||||
|
"lastUpdated": "2023-06-20T03:00:51",
|
||||||
|
"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-7B-v1-OnlyForTest_30%_trained-20230529-ctx4096.pth",
|
"name": "RWKV-4-World-7B-v1-OnlyForTest_30%_trained-20230529-ctx4096.pth",
|
||||||
@@ -203,7 +252,20 @@
|
|||||||
"SHA256": "a5f4246a18698a350a49988de7a8a01cbd765f8d11ee6427cabb93bf659f2d0d",
|
"SHA256": "a5f4246a18698a350a49988de7a8a01cbd765f8d11ee6427cabb93bf659f2d0d",
|
||||||
"lastUpdated": "2023-06-15T15:09:11",
|
"lastUpdated": "2023-06-15T15:09:11",
|
||||||
"url": "https://huggingface.co/BlinkDL/rwkv-4-world/blob/main/RWKV-4-World-7B-v1-OnlyForTest_75%25_trained-20230615-ctx4096.pth",
|
"url": "https://huggingface.co/BlinkDL/rwkv-4-world/blob/main/RWKV-4-World-7B-v1-OnlyForTest_75%25_trained-20230615-ctx4096.pth",
|
||||||
"downloadUrl": "https://huggingface.co/BlinkDL/rwkv-4-world/resolve/main/RWKV-4-World-7B-v1-OnlyForTest_75%25_trained-20230615-ctx4096.pth"
|
"downloadUrl": "https://huggingface.co/BlinkDL/rwkv-4-world/resolve/main/RWKV-4-World-7B-v1-OnlyForTest_75%25_trained-20230615-ctx4096.pth",
|
||||||
|
"hide": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "RWKV-4-World-7B-v1-OnlyForTest_84%_trained-20230618-ctx4096.pth",
|
||||||
|
"desc": {
|
||||||
|
"en": "100+ Languages 7B v1 Test",
|
||||||
|
"zh": "100+ 语言 7B v1 测试"
|
||||||
|
},
|
||||||
|
"size": 15035393581,
|
||||||
|
"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"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "RWKV-4-Novel-7B-v1-ChnEng-ChnPro-20230410-ctx4096.pth",
|
"name": "RWKV-4-Novel-7B-v1-ChnEng-ChnPro-20230410-ctx4096.pth",
|
||||||
|
|||||||
Reference in New Issue
Block a user