059b6cee6d
1、修复服务器ip配置,配置页没替换问题; 2、修复开启状态偶尔没对齐问题; 3、修复关闭时关闭按钮停留在关闭中问题; 4、修复星座读取错误问题; 5、修复刷新重复提醒开启问题; 6、新增是否进行语音合成的选择; 7、文字沟通接口加入“观察描述”; 8、聊天记录时间改为毫秒级; 9、补充数字人和远程音频的连接状态显示; 10、修复备注填写无法保存问题。
29 lines
930 B
Python
29 lines
930 B
Python
import torch
|
|
from ringrwkv.configuration_rwkv_world import RwkvConfig
|
|
from ringrwkv.rwkv_tokenizer import TRIE_TOKENIZER
|
|
from ringrwkv.modehf_world import RwkvForCausalLM
|
|
|
|
model = RwkvForCausalLM.from_pretrained("RWKV-4-World-1.5B")
|
|
#model = RwkvForCausalLM.from_pretrained("RWKV-4-World-3B")
|
|
#model = RwkvForCausalLM.from_pretrained("RWKV-4-World-0.4B")
|
|
tokenizer = TRIE_TOKENIZER('./ringrwkv/rwkv_vocab_v20230424.txt')
|
|
|
|
data = ""
|
|
def question(cont, uid=0, observation=""):
|
|
global data
|
|
prompt = data + f'Question: {cont.strip()}\n\nAnswer:'
|
|
input_ids = tokenizer.encode(prompt)
|
|
input_ids = torch.tensor(input_ids).unsqueeze(0)
|
|
out = model.generate(input_ids,max_new_tokens=20)
|
|
|
|
outlist = out[0].tolist()
|
|
for i in outlist:
|
|
if i==0:
|
|
outlist.remove(i)
|
|
answer = tokenizer.decode(outlist)
|
|
# data = answer + "\n\n"
|
|
answer = answer.replace(prompt, "", 1)
|
|
return answer
|
|
|
|
|