{"record":{"id":"e6ca5d2dba921431","repo":"unslothai/unsloth","slug":"the-stable-diffusion-cpp-binary-was-replaced-by-an","errorCode":null,"errorMessage":"The stable-diffusion.cpp binary was replaced by an install for a different accelerator while this model was loading. Try the load again.","messagePattern":"The stable-diffusion\\.cpp binary was replaced by an install for a different accelerator while this model was loading\\. Try the load again\\.","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"studio/backend/core/inference/sd_cpp_backend.py","lineNumber":1591,"sourceCode":"                        # download, inside the claim, and holding it to the pre-download answer\n                        # would refuse the fallback on an install this load already lived through.\n                        engine_accelerator = _installed_accelerator_of(\n                            getattr(fallback, \"binary\", None)\n                        )\n                        mode = \"oneshot\"\n                    finally:\n                        if not started_ok:\n                            with self._lock:\n                                if self._pending_server is started:\n                                    self._pending_server = None\n                if mode == \"oneshot\" and (\n                    _installed_accelerator_of(getattr(engine, \"binary\", None)) != engine_accelerator\n                ):\n                    # Runnable, at the same path, and still not the build this load vetted -- the\n                    # one-shot half of the check the server path makes just above. Refused at load\n                    # rather than recorded, because recording the replacement is what makes the\n                    # per-generation comparison agree with it forever after.\n                    raise RuntimeError(\n                        \"The stable-diffusion.cpp binary was replaced by an install for a \"\n                        \"different accelerator while this model was loading. Try the load again.\"\n                    )\n                state = _SdState(\n                    repo_id = repo_id,\n                    base_repo = base,\n                    family = fam,\n                    device = device,\n                    files = files,\n                    vae_format = fam.sd_cpp_vae_format,\n                    native_speed = native_speed,\n                    # Pinned against the binary this load COMMITTED to, which a deferred install or\n                    # a one-shot fallback may have changed since the policy was built.\n                    offload_flags = tuple(\n                        _offload_with_device_pin_impl(\n                            offload,\n                            server_binary if mode == \"server\" else getattr(engine, \"binary\", None),\n                            gpu_ordinal,","sourceCodeStart":1573,"sourceCodeEnd":1609,"githubUrl":"https://github.com/unslothai/unsloth/blob/203007d19051dcd2ae33876786d117c99f6b0368/studio/backend/core/inference/sd_cpp_backend.py#L1573-L1609","documentation":"The one-shot counterpart of the server swap check: after the load's downloads, _installed_accelerator_of(engine.binary) differs from the accelerator pinned when the CLI was vetted. The refusal happens at load rather than being recorded in state, because recording the replacement would make every later per-generation comparison agree with the wrong build forever.","triggerScenarios":"One-shot mode load whose sd-cli binary is replaced in place by an install for another accelerator during the asset download window.","commonSituations":"Concurrent loads with different device targets; auto-install of a CPU fallback bundle while a GPU one-shot load is pulling assets.","solutions":["Retry the load; it re-resolves device, accelerator and install from scratch.","Serialize model loads to prevent install/load interleaving.","Avoid triggering CPU-fallback loads concurrently with GPU loads (or pre-install the accelerator you intend to use)."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    backend.begin_load(repo_id=r, gguf_filename=f)\nexcept RuntimeError as e:\n    if 'replaced by an install for a different accelerator' in str(e):\n        backend.begin_load(repo_id=r, gguf_filename=f)\n    else:\n        raise","preventionTips":["Avoid concurrent loads with different accelerator targets on one backend.","Pre-install the accelerator build you intend to use before starting long downloads."],"tags":["concurrency","race-condition","retryable","accelerator","sd-cpp"],"backgroundTag":null,"analyzedSha":"203007d19051dcd2ae33876786d117c99f6b0368","analyzedAt":"2026-08-15T02:48:39.846Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}