{"record":{"id":"baa156e866c701b4","repo":"mudler/LocalAI","slug":"warning-lora-model-directory-not-set-loras-in-pr","errorCode":null,"errorMessage":"WARNING: LoRA model directory not set. LoRAs in prompts will not be loaded.\\n","messagePattern":"WARNING: LoRA model directory not set\\. LoRAs in prompts will not be loaded\\.\\\\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"info","filePath":"backend/go/stablediffusion-ggml/cpp/gosd.cpp","lineNumber":610,"sourceCode":"    ctx_params.clip_vision_path = clip_vision_path;\n    ctx_params.t5xxl_path = t5xxl_path;\n    ctx_params.llm_path = llm_path;\n    ctx_params.llm_vision_path = llm_vision_path;\n    ctx_params.diffusion_model_path = diffusion_model_path;\n    ctx_params.high_noise_diffusion_model_path = high_noise_diffusion_model_path;\n    ctx_params.uncond_diffusion_model_path = uncond_diffusion_model_path;\n    ctx_params.vae_path = vae_path;\n    ctx_params.audio_vae_path = audio_vae_path;\n    ctx_params.embeddings_connectors_path = embeddings_connectors_path;\n    ctx_params.taesd_path = taesd_path;\n    ctx_params.control_net_path = control_net_path;\n    if (lora_dir && strlen(lora_dir) > 0) {\n        lora_dir_path = std::string(lora_dir);\n        fprintf(stderr, \"LoRA model directory set to: %s\\n\", lora_dir);\n        // Discover LoRAs at load time for logging\n        discover_lora_files(lora_dir);\n    } else {\n        fprintf(stderr, \"WARNING: LoRA model directory not set. LoRAs in prompts will not be loaded.\\n\");\n    }\n    // Set embeddings array and count\n    ctx_params.embeddings = embedding_vec.empty() ? NULL : embedding_vec.data();\n    ctx_params.embedding_count = static_cast<uint32_t>(embedding_vec.size());\n    ctx_params.photo_maker_path = photo_maker_path;\n    if (strlen(pulid_weights_path) > 0) ctx_params.pulid_weights_path = pulid_weights_path;\n    ctx_params.tensor_type_rules = tensor_type_rules;\n    ctx_params.n_threads = n_threads;\n    ctx_params.rng_type = rng_type;\n    if (wtype != SD_TYPE_COUNT) ctx_params.wtype = wtype;\n    if (sampler_rng_type != RNG_TYPE_COUNT) ctx_params.sampler_rng_type = sampler_rng_type;\n    if (prediction != PREDICTION_COUNT) ctx_params.prediction = prediction;\n    if (lora_apply_mode != LORA_APPLY_MODE_COUNT) ctx_params.lora_apply_mode = lora_apply_mode;\n    // Backend / parameter placement specs. Upstream replaced the boolean\n    // CPU-offload knobs (offload_params_to_cpu, keep_clip_on_cpu, keep_vae_on_cpu,\n    // keep_control_net_on_cpu) with these specs. Seed from the explicit\n    // backend/params_backend options, then prepend the legacy boolean-derived\n    // assignments, mirroring prepare_backend_assignments() in the upstream CLI.","sourceCodeStart":592,"sourceCodeEnd":628,"githubUrl":"https://github.com/mudler/LocalAI/blob/44413a9d06bf5bc52ce088ba8ca74e5a2e8bee26/backend/go/stablediffusion-ggml/cpp/gosd.cpp#L592-L628","documentation":"Informational warning at model load: no lora_dir option was provided, so lora_dir_path stays empty and any <lora:...> tags found in prompts at generation time cannot be loaded (they will be stripped with the 'LoRA directory not set' warning). Model load itself is unaffected.","triggerScenarios":"Loading a stablediffusion-ggml model without a lora_dir key=value in the options string, while later prompts may contain LoRA tags.","commonSituations":"Minimal or default model gallery configs that only set model/vae paths; users unaware that LoRA support must be enabled by pointing at a directory.","solutions":["Add lora_dir=<path> to the model options if you plan to use LoRA tags in prompts","If LoRAs are not used, ignore the warning","Pre-download LoRA files into that directory so name-based tag lookup works"],"exampleFix":"# before\noptions: \"model=/models/sd.safetensors,vae=/models/vae.safetensors\"\n\n# after\noptions: \"model=/models/sd.safetensors,vae=/models/vae.safetensors,lora_dir=/models/loras\"","handlingStrategy":"validation","validationCode":"// Go caller: require lora_dir when prompts may contain LoRA tags\nif promptMayContainLoras && opts.LoraDir == \"\" {\n    return fmt.Errorf(\"lora_dir not configured; LoRA tags in prompts would be ignored\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Decide at deploy time whether LoRA support is needed and configure lora_dir accordingly","Treat this startup warning as a signal to either add the directory or strip LoRA tags from prompts upstream"],"tags":["stablediffusion","lora","config","startup"],"backgroundTag":null,"analyzedSha":"44413a9d06bf5bc52ce088ba8ca74e5a2e8bee26","analyzedAt":"2026-08-15T10:13:50.291Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}