sgl-project/sglang · error · FileNotFoundError
Specified lora_weight_name '{weight_name}' not found in {loc
Error message
Specified lora_weight_name '{weight_name}' not found in {local_path} What it means
When a LoRA is loaded from a local directory with an explicit lora_weight_name, maybe_download_lora verifies that <local_path>/<weight_name> exists as a file. If not, FileNotFoundError.
Source
Thrown at python/sglang/multimodal_gen/runtime/utils/hf_diffusers_utils.py:638
if envs.SGLANG_USE_MODELSCOPE.get():
allow_patterns = (
["*.json", weight_name, f"**/{weight_name}"]
if weight_name is not None
else ["*.json", "*.safetensors", "*.bin"]
)
local_path = maybe_download_model(
model_name_or_path,
local_dir,
download,
is_lora=True,
allow_patterns=allow_patterns,
)
if os.path.isfile(local_path):
return local_path
if weight_name is not None:
target = os.path.join(local_path, weight_name)
if not os.path.isfile(target):
raise FileNotFoundError(
f"Specified lora_weight_name '{weight_name}' not found in "
f"{local_path}"
)
return target
guessed = _best_guess_weight_name(local_path, file_extension=".safetensors")
if guessed is None and current_platform.is_rocm():
guessed = _best_guess_weight_name(
model_name_or_path, file_extension=".safetensors"
)
return os.path.join(local_path, guessed)
resolved_weight = resolve_weight(model_name_or_path, weight_name=weight_name)
selected_file = resolved_weight.selected_file
if not selected_file.endswith(".safetensors"):
raise ValueError(
"Native diffusion LoRA loading requires a safetensors file, got "
f"{selected_file!r}"
)View on GitHub (pinned to 0132848349)
Solutions
- List the directory contents and use the exact filename: ls <local_path>
- Fix the extension (.safetensors is required for native loading)
- If the file is in a subfolder, point lora_path at the folder containing it or omit weight_name to trigger best-guess
Example fix
# before
load_lora_adapter("/loras/sxzl", weight_name="pytorch_lora_weights.bin")
# after
load_lora_adapter("/loras/sxzl", weight_name="pytorch_lora_weights.safetensors") Defensive patterns
Strategy: validation
Validate before calling
import os
target = os.path.join(local_path, weight_name)
assert os.path.isfile(target), f'{weight_name} not in {local_path}: {os.listdir(local_path)}' Try / catch
try:
load_lora_adapter(path, weight_name=w)
except FileNotFoundError:
w = pick_safetensors(os.listdir(path)) # fallback pick
load_lora_adapter(path, weight_name=w) Prevention
- List the LoRA directory and copy exact filenames
- Prefer safetensors variants when choosing weight names
When it happens
Trigger: Calling load_lora_adapter with a local lora_path plus a lora_weight_name that does not exist in that directory (typo, wrong extension like .bin vs .safetensors, or the file lives in a subfolder).
Common situations: Typos in weight names; copying only some files from a LoRA repo; expecting .bin when only .safetensors was published.
Related errors
- metal shader source not found: {metal_src}
- LoRA batch_info must provide max_len or seg_lens.
- LoRA batch_info must provide max_len or seg_lens.
- lora_nickname cannot be empty
- Failed to set LoRA adapter: {str(e)}
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/aefb5edfd2bcdac5.
Report an issue: GitHub.