binary-husky/gpt_academic · critical · RuntimeError

error

Error message

error

What it means

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.

Source

Thrown at request_llms/bridge_jittorllms_rwkv.py:122

        self.threadLock.release()

global rwkv_glm_handle
rwkv_glm_handle = None
#################################################################################
def predict_no_ui_long_connection(inputs:str, llm_kwargs:dict, history:list=[], sys_prompt:str="",
                                  observe_window:list=[], console_silence:bool=False):
    """
        多线程方法
        函数的说明请见 request_llms/bridge_all.py
    """
    global rwkv_glm_handle
    if rwkv_glm_handle is None:
        rwkv_glm_handle = GetGLMHandle()
        if len(observe_window) >= 1: observe_window[0] = load_message + "\n\n" + rwkv_glm_handle.info
        if not rwkv_glm_handle.success:
            error = rwkv_glm_handle.info
            rwkv_glm_handle = None
            raise RuntimeError(error)

    # jittorllms 没有 sys_prompt 接口,因此把prompt加入 history
    history_feedin = []
    for i in range(len(history)//2):
        history_feedin.append([history[2*i], history[2*i+1]] )

    watch_dog_patience = 5 # 看门狗 (watchdog) 的耐心, 设置5秒即可
    response = ""
    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']):
        print(response)
        if len(observe_window) >= 1:  observe_window[0] = response
        if len(observe_window) >= 2:
            if (time.time()-observe_window[1]) > watch_dog_patience:
                raise RuntimeError("程序终止。")
    return response


View on GitHub (pinned to d6bde0fa54)

Solutions

  1. Look at observe_window[0] which received load_message + handle.info before the raise; it holds the loader status.
  2. Reproduce the loader directly (get_model with model='chatrwkv') to get the traceback and fix env/weights/device.
  3. Ensure the child->parent pipe messages ('[Local Message] Call jittorllms fail ...') are consumed so handle.info is populated.
  4. Switch to another LLM backend if chatrwkv cannot be made to load.
Defensive patterns

Strategy: try-catch

Try / catch

try:
    resp = rwkv_predict_no_ui_long_connection(...)
except RuntimeError as e:
    chatbot.append(('system', f'chatrwkv unavailable: {e}'))  # e is handle.info

Prevention

When it happens

Trigger: 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.

Common situations: Broken jittorllms install, missing RWKV checkpoint, CUDA unavailable with device=cuda; user sees an unhelpful message because info did not propagate the loader text.

Related errors


AI-assisted analysis of binary-husky/gpt_academic@d6bde0fa54 (2026-08-14). Data as JSON: /api/errors/ca81f4bc7815812f. Report an issue: GitHub.