{"record":{"id":"935d82bbb3ed1e56","repo":"odysseus-dev/odysseus","slug":"could-not-load-model-from-model-path-check-diff","errorCode":null,"errorMessage":"Could not load model from {model_path}. Check diffusers version and model format.","messagePattern":"Could not load model from (.+?)\\. Check diffusers version and model format\\.","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"scripts/diffusion_server.py","lineNumber":638,"sourceCode":"                            kwargs[\"config\"] = local_config\n                            logger.info(f\"Trying {cls_name}.from_single_file with config={config}\")\n                        _pipe = cls.from_single_file(single_file, **kwargs)\n                        _fix_meta_tensors(_pipe, torch_dtype)\n                        if use_offload and _can_cpu_offload(target_device):\n                            _pipe.enable_model_cpu_offload()\n                            logger.info(f\"Loaded as {cls_name} (single file, config={config}) with CPU offload\")\n                        else:\n                            _pipe = _pipe.to(target_device)\n                            logger.info(f\"Loaded as {cls_name} (single file, config={config}) on {target_device}\")\n                        loaded = True\n                        break\n                    except Exception as e:\n                        logger.warning(f\"{cls_name}.from_single_file (config={config}) failed: {e}\")\n                        _pipe = None\n                        _cleanup()\n\n    if not loaded:\n        raise RuntimeError(f\"Could not load model from {model_path}. Check diffusers version and model format.\")\n\n    # Memory optimizations\n    if _args.attention_slicing:\n        try:\n            _pipe.enable_attention_slicing()\n            logger.info(\"Attention slicing enabled\")\n        except Exception:\n            pass\n    if _args.vae_slicing:\n        try:\n            _pipe.enable_vae_slicing()\n            logger.info(\"VAE slicing enabled\")\n        except Exception:\n            pass\n\n    logger.info(f\"Model loaded: {_model_id}\")\n\n    # Load LoRA weights if specified","sourceCodeStart":620,"sourceCodeEnd":656,"githubUrl":"https://github.com/odysseus-dev/odysseus/blob/f9235ebbf13f693a6fd29ce70b097f6ec83705bf/scripts/diffusion_server.py#L620-L656","documentation":"RuntimeError from scripts/diffusion_server.py: every loader strategy for the requested model failed — the pipeline loop over diffusers classes (from_pretrained / from_single_file with config variants) raised, leaving loaded=False, so the server aborts with 'Could not load model from {model_path}. Check diffusers version and model format.' Preceding WARN lines ('<Cls>.from_single_file (config=...) failed: ...') carry the real per-strategy causes.","triggerScenarios":"Loading a single-file checkpoint (.safetensors/.ckpt) with a diffusers version lacking or breaking from_single_file support for that class; a model directory in an unexpected format (missing model_index.json); corrupted weights; wrong pipeline class guesses for the architecture; out-of-memory during .to(device) after load attempts.","commonSituations":"diffusers major-version upgrades changing from_single_file kwargs/behavior; SDXL/Flux checkpoints needing newer diffusers than pinned; downloading only part of a repo (interrupted snapshot); mixing safetensors-only expectations with pickle checkpoints.","solutions":["Read the WARNING lines just above the traceback — they name each class/config attempt and its exception; fix that root cause first","Upgrade/align the diffusers version to one supporting the model's pipeline class (check the model card's required version)","For single-file checkpoints, pass an explicit config (e.g. config='./configs/sdxl' style argument the script supports) or convert to a diffusers repo layout","Verify the download: re-run with a clean cache / check file sizes against the source repo","Confirm the path is a directory containing model_index.json when using repo-format models"],"exampleFix":"# before\npip install diffusers==0.24.0\npython scripts/diffusion_server.py --model ./flux1-dev.safetensors\n# RuntimeError: Could not load model ...\n\n# after: use a diffusers release that supports the architecture\npip install -U diffusers transformers accelerate safetensors\npython scripts/diffusion_server.py --model ./flux1-dev.safetensors","handlingStrategy":"fallback","validationCode":"import importlib.metadata as md\nfrom packaging.version import Version\n\nrequired = {\"FLuxPipeline\": \"0.30.0\", \"StableDiffusionXLPipeline\": \"0.24.0\"}  # per model card\nassert Version(md.version(\"diffusers\")) >= Version(required[cls]), \"upgrade diffusers\"\nassert Path(model_path).exists() and (Path(model_path)/'model_index.json').exists() or model_path.endswith(('.safetensors','.ckpt'))","typeGuard":"def is_supported_checkpoint(path: str) -> bool:\n    p = Path(path)\n    return (p.is_dir() and (p / 'model_index.json').exists()) or p.suffix in {'.safetensors', '.ckpt'}","tryCatchPattern":"try:\n    serve_model(model_path)\nexcept RuntimeError as e:\n    if 'Could not load model' in str(e):\n        # read the preceding '<Cls>.from_single_file ... failed' warnings for the real cause\n        align_diffusers_version(); verify_download_integrity(model_path)","preventionTips":["Pin a diffusers version matching the model card before starting the server","Verify checkpoint file sizes/hashes after download; retry interrupted snapshots","Prefer diffusers repo-layout models (model_index.json) over raw single-file checkpoints","Always read the per-strategy WARNING logs before debugging the final RuntimeError"],"tags":["diffusers","model-loading","stable-diffusion","runtime-error"],"backgroundTag":null,"analyzedSha":"f9235ebbf13f693a6fd29ce70b097f6ec83705bf","analyzedAt":"2026-08-14T21:47:48.359Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}