binary-husky/gpt_academic · critical · RuntimeError

不能正常加载jittorllms的参数!

Error message

不能正常加载jittorllms的参数!

What it means

Raised in bridge_jittorllms_llama.py when the local JittorLLMs llama model fails to load inside the loader subprocess: get_model(types.SimpleNamespace(model='llama')) raises (import error, checkpoint download failure, CUDA/Jittor init failure) and the bare except re-raises RuntimeError after sending '[Local Message] Call jittorllms fail' to the parent. The original exception is discarded.

Source

Thrown at request_llms/bridge_jittorllms_llama.py:65

            root_dir_assume = os.path.abspath(os.path.dirname(__file__) +  '/..')
            os.chdir(root_dir_assume + '/request_llms/jittorllms')
            sys.path.append(root_dir_assume + '/request_llms/jittorllms')
        validate_path() # validate path so you can run from base directory

        def load_model():
            import types
            try:
                if self.jittorllms_model is None:
                    device = get_conf('LOCAL_MODEL_DEVICE')
                    from .jittorllms.models import get_model
                    # available_models = ["chatglm", "pangualpha", "llama", "chatrwkv"]
                    args_dict = {'model': 'llama'}
                    print('self.jittorllms_model = get_model(types.SimpleNamespace(**args_dict))')
                    self.jittorllms_model = get_model(types.SimpleNamespace(**args_dict))
                    print('done get model')
            except:
                self.child.send('[Local Message] Call jittorllms fail 不能正常加载jittorllms的参数。')
                raise RuntimeError("不能正常加载jittorllms的参数!")
        print('load_model')
        load_model()

        # 进入任务等待状态
        print('进入任务等待状态')
        while True:
            # 进入任务等待状态
            kwargs = self.child.recv()
            query = kwargs['query']
            history = kwargs['history']
            # 是否重置
            if len(self.local_history) > 0 and len(history)==0:
                print('触发重置')
                self.jittorllms_model.reset()
            self.local_history.append(query)

            print('收到消息,开始请求')
            try:

View on GitHub (pinned to d6bde0fa54)

Solutions

  1. Run `python -c "from request_llms.jittorllms.models import get_model; import types; get_model(types.SimpleNamespace(model='llama'))"` in the repo root to see the real traceback the bare except hides.
  2. Install the jittorllms requirements (jittor, torch, downloaded checkpoints) as documented in request_llms/jittorllms.
  3. Check LOCAL_MODEL_DEVICE in config matches available hardware; try cpu if GPU init fails.
  4. If JittorLLMs is deprecated for your setup, switch to a maintained local-model bridge (e.g. bridge_chatglon / llama.cpp) instead.

Example fix

// before
except:
    self.child.send('[Local Message] Call jittorllms fail ...')
    raise RuntimeError("不能正常加载jittorllms的参数!")

# after
except Exception as e:
    import traceback; self.child.send('[Local Message] Call jittorllms fail:\n' + traceback.format_exc())
    raise RuntimeError(f"不能正常加载jittorllms的参数!{e}") from e
Defensive patterns

Strategy: validation

Validate before calling

def jittorllms_available(model: str) -> bool:
    try:
        import jittor  # noqa
        from request_llms.jittorllms.models import get_model  # noqa
        return True
    except Exception:
        return False
# only offer the llama entry in the UI when jittorllms_available('llama')

Try / catch

try:
    handle = GetGLMHandle()
except RuntimeError as e:
    if 'jittorllms' in str(e):
        log.error('JittorLLMs env broken; falling back to API model')
        switch_to_api_model()

Prevention

When it happens

Trigger: First use of the llama local model when request_llms/jittorllms/models.py get_model raises — missing jittor dependency, missing/failed download of the llama weights, LOCAL_MODEL_DEVICE pointing to an unavailable GPU, or Jittor compiler errors on the host.

Common situations: Fresh clone without running the jittorllms submodule install, no internet to download checkpoints, CUDA driver/Jittor version mismatch, CPU-only machine with LOCAL_MODEL_DEVICE=cuda.

Related errors


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