{"record":{"id":"01e2c24edcef0a43","repo":"sgl-project/sglang","slug":"native-diffusion-lora-loading-requires-a-safetenso","errorCode":null,"errorMessage":"Native diffusion LoRA loading requires a safetensors file, got {selected_file!r}","messagePattern":"Native diffusion LoRA loading requires a safetensors file, got (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/multimodal_gen/runtime/utils/hf_diffusers_utils.py","lineNumber":653,"sourceCode":"        if weight_name is not None:\n            target = os.path.join(local_path, weight_name)\n            if not os.path.isfile(target):\n                raise FileNotFoundError(\n                    f\"Specified lora_weight_name '{weight_name}' not found in \"\n                    f\"{local_path}\"\n                )\n            return target\n        guessed = _best_guess_weight_name(local_path, file_extension=\".safetensors\")\n        if guessed is None and current_platform.is_rocm():\n            guessed = _best_guess_weight_name(\n                model_name_or_path, file_extension=\".safetensors\"\n            )\n        return os.path.join(local_path, guessed)\n\n    resolved_weight = resolve_weight(model_name_or_path, weight_name=weight_name)\n    selected_file = resolved_weight.selected_file\n    if not selected_file.endswith(\".safetensors\"):\n        raise ValueError(\n            \"Native diffusion LoRA loading requires a safetensors file, got \"\n            f\"{selected_file!r}\"\n        )\n\n    source = resolved_weight.inventory.source\n    if source.kind == \"local\":\n        assert source.local_path is not None\n        if os.path.isfile(source.local_path):\n            return source.local_path\n        return os.path.join(source.local_path, selected_file)\n\n    assert source.repo_id is not None\n    allow_patterns = [\"*.json\", selected_file]\n    selected_parent = os.path.dirname(selected_file)\n    if selected_parent:\n        allow_patterns.insert(1, f\"{selected_parent}/*.json\")\n    local_path = maybe_download_model(\n        source.repo_id,","sourceCodeStart":635,"sourceCodeEnd":671,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/utils/hf_diffusers_utils.py#L635-L671","documentation":"After resolving a LoRA weight (local or remote inventory), maybe_download_lora enforces that the selected file is a .safetensors file because the native diffusion LoRA loader only parses safetensors. Any other extension (.bin, .ckpt, .pt) raises ValueError.","triggerScenarios":"Calling load_lora_adapter where resolve_weight picks a .bin/.ckpt/.pt file — either because weight_name pointed at one, or the best-guess fell through to a non-safetensors file (also seen with ROCm fallback paths).","commonSituations":"Old diffusers LoRAs shipped as pytorch_lora_weights.bin; checkpoints from civitai in .ckpt format; ROCm envs where safetensors guess fails and a .bin is chosen.","solutions":["Convert the LoRA to safetensors (e.g. diffusers' script or safetensors conversion tools) and specify the new weight name","Download/use the safetensors variant of the same LoRA if the repo offers one"],"exampleFix":"# before\nload_lora_adapter(repo, weight_name=\"pytorch_lora_weights.bin\")\n# after\n# convert first: python convert_lora_to_safetensors ...\nload_lora_adapter(repo, weight_name=\"pytorch_lora_weights.safetensors\")","handlingStrategy":"validation","validationCode":"assert selected.endswith('.safetensors'), f'need safetensors, got {selected}'","typeGuard":null,"tryCatchPattern":"try:\n    load_lora_adapter(...)\nexcept ValueError as e:\n    if 'requires a safetensors file' in str(e):\n        convert_to_safetensors(selected_file)","preventionTips":["Convert .bin/.ckpt LoRAs to safetensors during asset onboarding","Only publish/keep safetensors LoRAs"],"tags":["lora","safetensors","unsupported-format"],"backgroundTag":"unsupported-weight-format","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}