binary-husky/gpt_academic · critical · RuntimeError

error

Error message

error

What it means

In pangu_predict_no_ui_long_connection, when pangu_glm_handle is first created its loader subprocess runs; if loading failed, GetGLMHandle().success is False and handle.info holds the loader's status text (e.g. '[Local Message] Call jittorllms fail ...'). The code resets the global handle to None and re-raises that info as RuntimeError(error), so the message 'error' is just whatever info contained.

Source

Thrown at request_llms/bridge_jittorllms_pangualpha.py:122

        self.threadLock.release()

global pangu_glm_handle
pangu_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 pangu_glm_handle
    if pangu_glm_handle is None:
        pangu_glm_handle = GetGLMHandle()
        if len(observe_window) >= 1: observe_window[0] = load_message + "\n\n" + pangu_glm_handle.info
        if not pangu_glm_handle.success:
            error = pangu_glm_handle.info
            pangu_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 pangu_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. Inspect newbing/pangu handle.info printed into observe_window[0] (load_message + handle.info) — it carries the actual loader message.
  2. Run the loader manually (from request_llms.jittorllms.models import get_model) to get the true traceback and fix it.
  3. Verify deps, weights, LOCAL_MODEL_DEVICE, and GPU memory.
  4. If the model is unusable in your environment, select a different LLM in the UI instead of the pangualpha entry.
Defensive patterns

Strategy: try-catch

Try / catch

try:
    resp = pangu_predict_no_ui_long_connection(...)
except RuntimeError as e:
    # e.args[0] is handle.info from the failed loader; log and surface to chatbot
    chatbot.append(('system', f'pangualpha unavailable: {e}'))

Prevention

When it happens

Trigger: Calling pangu_predict_no_ui_long_connection for the first time in a process while the JittorLLMs PanGu-Alpha loader fails (bad deps, weights, device) — handle.success stays False and handle.info is re-raised verbatim.

Common situations: Same root causes as the loader failure: missing jittorllms environment, failed checkpoint download, CUDA issue; the user sees an opaque message because info was empty/generic at that point.

Related errors


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