{"record":{"id":"19a12c8c20150c9a","repo":"binary-husky/gpt_academic","slug":"jittorllms","errorCode":null,"errorMessage":"不能正常加载jittorllms的参数！","messagePattern":"不能正常加载jittorllms的参数！","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"critical","filePath":"request_llms/bridge_jittorllms_llama.py","lineNumber":65,"sourceCode":"            root_dir_assume = os.path.abspath(os.path.dirname(__file__) +  '/..')\n            os.chdir(root_dir_assume + '/request_llms/jittorllms')\n            sys.path.append(root_dir_assume + '/request_llms/jittorllms')\n        validate_path() # validate path so you can run from base directory\n\n        def load_model():\n            import types\n            try:\n                if self.jittorllms_model is None:\n                    device = get_conf('LOCAL_MODEL_DEVICE')\n                    from .jittorllms.models import get_model\n                    # available_models = [\"chatglm\", \"pangualpha\", \"llama\", \"chatrwkv\"]\n                    args_dict = {'model': 'llama'}\n                    print('self.jittorllms_model = get_model(types.SimpleNamespace(**args_dict))')\n                    self.jittorllms_model = get_model(types.SimpleNamespace(**args_dict))\n                    print('done get model')\n            except:\n                self.child.send('[Local Message] Call jittorllms fail 不能正常加载jittorllms的参数。')\n                raise RuntimeError(\"不能正常加载jittorllms的参数！\")\n        print('load_model')\n        load_model()\n\n        # 进入任务等待状态\n        print('进入任务等待状态')\n        while True:\n            # 进入任务等待状态\n            kwargs = self.child.recv()\n            query = kwargs['query']\n            history = kwargs['history']\n            # 是否重置\n            if len(self.local_history) > 0 and len(history)==0:\n                print('触发重置')\n                self.jittorllms_model.reset()\n            self.local_history.append(query)\n\n            print('收到消息，开始请求')\n            try:","sourceCodeStart":47,"sourceCodeEnd":83,"githubUrl":"https://github.com/binary-husky/gpt_academic/blob/d6bde0fa54373309bd05823a49bda8da019d2c77/request_llms/bridge_jittorllms_llama.py#L47-L83","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["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.","Install the jittorllms requirements (jittor, torch, downloaded checkpoints) as documented in request_llms/jittorllms.","Check LOCAL_MODEL_DEVICE in config matches available hardware; try cpu if GPU init fails.","If JittorLLMs is deprecated for your setup, switch to a maintained local-model bridge (e.g. bridge_chatglon / llama.cpp) instead."],"exampleFix":"// before\nexcept:\n    self.child.send('[Local Message] Call jittorllms fail ...')\n    raise RuntimeError(\"不能正常加载jittorllms的参数！\")\n\n# after\nexcept Exception as e:\n    import traceback; self.child.send('[Local Message] Call jittorllms fail:\\n' + traceback.format_exc())\n    raise RuntimeError(f\"不能正常加载jittorllms的参数！{e}\") from e","handlingStrategy":"validation","validationCode":"def jittorllms_available(model: str) -> bool:\n    try:\n        import jittor  # noqa\n        from request_llms.jittorllms.models import get_model  # noqa\n        return True\n    except Exception:\n        return False\n# only offer the llama entry in the UI when jittorllms_available('llama')","typeGuard":null,"tryCatchPattern":"try:\n    handle = GetGLMHandle()\nexcept RuntimeError as e:\n    if 'jittorllms' in str(e):\n        log.error('JittorLLMs env broken; falling back to API model')\n        switch_to_api_model()","preventionTips":["Smoke-test get_model(model='llama') at app startup before exposing the model","Install jittorllms deps and weights in a dedicated venv","Match LOCAL_MODEL_DEVICE to actual hardware in config"],"tags":["jittorllms","llama","local-model","startup","model-loading"],"backgroundTag":null,"analyzedSha":"d6bde0fa54373309bd05823a49bda8da019d2c77","analyzedAt":"2026-08-14T22:48:35.038Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}