{"record":{"id":"ad13c7ebccd375ca","repo":"Fosowl/agenticSeek","slug":"failed-to-load-the-routing-model-please-run-the-d","errorCode":null,"errorMessage":"Failed to load the routing model. Please run the dl_safetensors.sh script inside llm_router/ directory to download the model.","messagePattern":"Failed to load the routing model\\. Please run the dl_safetensors\\.sh script inside llm_router/ directory to download the model\\.","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"critical","filePath":"sources/router.py","lineNumber":58,"sourceCode":"        animate_thinking(\"Loading zero-shot pipeline...\", color=\"status\")\n        return {\n            \"bart\": pipeline(\"zero-shot-classification\", model=\"facebook/bart-large-mnli\")\n        }\n\n    def load_llm_router(self) -> AdaptiveClassifier:\n        \"\"\"\n        Load the LLM router model.\n        returns:\n            AdaptiveClassifier: The loaded model\n        exceptions:\n            Exception: If the safetensors fails to load\n        \"\"\"\n        path = \"../llm_router\" if __name__ == \"__main__\" else \"./llm_router\"\n        try:\n            animate_thinking(\"Loading LLM router model...\", color=\"status\")\n            talk_classifier = AdaptiveClassifier.from_pretrained(path)\n        except Exception as e:\n            raise Exception(\"Failed to load the routing model. Please run the dl_safetensors.sh script inside llm_router/ directory to download the model.\")\n        return talk_classifier\n\n    def get_device(self) -> str:\n        if torch.backends.mps.is_available():\n            return \"mps\"\n        elif torch.cuda.is_available():\n            return \"cuda:0\"\n        else:\n            return \"cpu\"\n    \n    def learn_few_shots_complexity(self) -> None:\n        \"\"\"\n        Few shot learning for complexity estimation.\n        Use the build in add_examples method of the Adaptive_classifier.\n        \"\"\"\n        few_shots = [\n            (\"hi\", \"LOW\"),\n            (\"How it's going ?\", \"LOW\"),","sourceCodeStart":40,"sourceCodeEnd":76,"githubUrl":"https://github.com/Fosowl/agenticSeek/blob/ae57a2357745a9706cb12d0fd76d954c84d166fa/sources/router.py#L40-L76","documentation":"load_llm_router loads the AdaptiveClassifier safetensors model from ./llm_router (relative to CWD). If loading fails for any reason it raises a single Exception instructing the developer to run dl_safetensors.sh inside llm_router/ to download the model weights. The original exception is swallowed, so the message always points at the most common cause: missing weights.","triggerScenarios":"Instantiating the router (Router.__init__ -> load_llm_router) when AdaptiveClassifier.from_pretrained('./llm_router') fails — directory absent, weights never downloaded, partial/corrupt download, or CWD is not the repo root so the relative path resolves wrong.","commonSituations":"Fresh clone without running dl_safetensors.sh; launching the app from a different working directory (the path is CWD-relative, not file-relative); interrupted download leaving corrupt safetensors; missing config.json alongside weights.","solutions":["Run `bash dl_safetensors.sh` inside the llm_router/ directory to download the model","Launch the app from the repository root so ./llm_router resolves correctly (or fix the relative path in router.py:53 to be __file__-based)","Verify llm_router/ contains config.json and the .safetensors files; re-download if corrupt","Check disk space and HuggingFace connectivity if the download script itself fails"],"exampleFix":"// before\npath = \"../llm_router\" if __name__ == \"__main__\" else \"./llm_router\"\n// after\nimport os\nbase = os.path.dirname(os.path.abspath(__file__))\npath = os.path.join(os.path.dirname(base), \"llm_router\") if __name__ == \"__main__\" else os.path.join(base, \"llm_router\")","handlingStrategy":"validation","validationCode":"import os\npath = './llm_router'\nweights = [f for f in (os.listdir(path) if os.path.isdir(path) else []) if f.endswith('.safetensors')]\nif not weights:\n    raise SystemExit('Model weights missing. Run: bash llm_router/dl_safetensors.sh')","typeGuard":null,"tryCatchPattern":"try:\n    router = Router()\nexcept Exception as e:\n    if 'dl_safetensors.sh' in str(e):\n        import subprocess\n        subprocess.run(['bash', 'llm_router/dl_safetensors.sh'], check=True)\n        router = Router()\n    else:\n        raise","preventionTips":["Run dl_safetensors.sh as part of repo setup/CI bootstrap","Always launch the app from the repository root (paths are CWD-relative)","Verify downloaded weights (config.json + safetensors present, non-zero size) after setup","Consider making the path in router.py absolute via __file__ to avoid CWD issues"],"tags":["missing-model","safetensors","file-not-found","path-resolution","setup"],"backgroundTag":"model-weights-missing","analyzedSha":"ae57a2357745a9706cb12d0fd76d954c84d166fa","analyzedAt":"2026-08-30T02:49:05.834Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}