代码拉取完成,页面将自动刷新
window.onload = async () => {
console.log("-----test web rwkv-----");
await wasm_bindgen("./web_rwkv_realweb_bg.wasm");
await wasm_bindgen.InitWGPU();
await wasm_bindgen.testcallback((t:string)=>
{
console.log("from callback:"+t);
})
var req = await fetch("assets/rwkv_vocab_v20230424.json");
var txt = await req.text();
await wasm_bindgen.LoadTokenizer(txt);
//console.log("get tokenlizer=" + txt);
var reqm = await fetch("assets/models/RWKV-4-World-0.4B-v1-20230529-ctx4096.st");
var bin = await reqm.arrayBuffer();
console.log("get model len=" + bin.byteLength);
await wasm_bindgen.LoadModel(new Uint8Array( bin),(info:string)=>
{
console.log("[加载模型log]:"+info);
});
var txt = await wasm_bindgen.ChatOnce("hello.",(type:string ,word:string)=>
{
console.log("[Chatlog]:"+type +" === "+ word);
});
console.log("get chat=" + txt);
var txt2 = await wasm_bindgen.ChatOnce("what is your name.",(type:string ,word:string)=>
{
console.log("[Chatlog]:"+type +" === "+ word);
});
console.log("get chat2=" + txt2);
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。