{"record":{"id":"ca81f4bc7815812f","repo":"binary-husky/gpt_academic","slug":"error-ca81f4","errorCode":null,"errorMessage":"error","messagePattern":"error","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"critical","filePath":"request_llms/bridge_jittorllms_rwkv.py","lineNumber":122,"sourceCode":"        self.threadLock.release()\n\nglobal rwkv_glm_handle\nrwkv_glm_handle = None\n#################################################################################\ndef predict_no_ui_long_connection(inputs:str, llm_kwargs:dict, history:list=[], sys_prompt:str=\"\",\n                                  observe_window:list=[], console_silence:bool=False):\n    \"\"\"\n        多线程方法\n        函数的说明请见 request_llms/bridge_all.py\n    \"\"\"\n    global rwkv_glm_handle\n    if rwkv_glm_handle is None:\n        rwkv_glm_handle = GetGLMHandle()\n        if len(observe_window) >= 1: observe_window[0] = load_message + \"\\n\\n\" + rwkv_glm_handle.info\n        if not rwkv_glm_handle.success:\n            error = rwkv_glm_handle.info\n            rwkv_glm_handle = None\n            raise RuntimeError(error)\n\n    # jittorllms 没有 sys_prompt 接口，因此把prompt加入 history\n    history_feedin = []\n    for i in range(len(history)//2):\n        history_feedin.append([history[2*i], history[2*i+1]] )\n\n    watch_dog_patience = 5 # 看门狗 (watchdog) 的耐心, 设置5秒即可\n    response = \"\"\n    for response in rwkv_glm_handle.stream_chat(query=inputs, history=history_feedin, system_prompt=sys_prompt, max_length=llm_kwargs['max_length'], top_p=llm_kwargs['top_p'], temperature=llm_kwargs['temperature']):\n        print(response)\n        if len(observe_window) >= 1:  observe_window[0] = response\n        if len(observe_window) >= 2:\n            if (time.time()-observe_window[1]) > watch_dog_patience:\n                raise RuntimeError(\"程序终止。\")\n    return response\n\n\n","sourceCodeStart":104,"sourceCodeEnd":140,"githubUrl":"https://github.com/binary-husky/gpt_academic/blob/d6bde0fa54373309bd05823a49bda8da019d2c77/request_llms/bridge_jittorllms_rwkv.py#L104-L140","documentation":"In rwkv_predict_no_ui_long_connection: on first use, if the rwkv_glm_handle loader subprocess failed (handle.success False), the code captures handle.info as `error`, nulls the global handle, and raises RuntimeError(error). The literal 'error' message means handle.info was empty or generic at raise time — the real loader failure is what set success=False.","triggerScenarios":"First call to the RWKV streaming predict in a process while the JittorLLMs chatrwkv loader failed (deps/weights/device), so rwkv_glm_handle.success is False.","commonSituations":"Broken jittorllms install, missing RWKV checkpoint, CUDA unavailable with device=cuda; user sees an unhelpful message because info did not propagate the loader text.","solutions":["Look at observe_window[0] which received load_message + handle.info before the raise; it holds the loader status.","Reproduce the loader directly (get_model with model='chatrwkv') to get the traceback and fix env/weights/device.","Ensure the child->parent pipe messages ('[Local Message] Call jittorllms fail ...') are consumed so handle.info is populated.","Switch to another LLM backend if chatrwkv cannot be made to load."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    resp = rwkv_predict_no_ui_long_connection(...)\nexcept RuntimeError as e:\n    chatbot.append(('system', f'chatrwkv unavailable: {e}'))  # e is handle.info","preventionTips":["Check observe_window[0] for the real loader message","Validate loader at startup","Reset handle to None on failure so retries are possible"],"tags":["jittorllms","rwkv","local-model","model-loading","error-propagation"],"backgroundTag":null,"analyzedSha":"d6bde0fa54373309bd05823a49bda8da019d2c77","analyzedAt":"2026-08-14T22:48:35.038Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}