Skip to content

Conversation

@JackBinary
Copy link

Problem

The sd-server ignores <lora:name:weight> tags in prompts sent via the /sdapi/v1/txt2img and /sdapi/v1/img2img API endpoints.

LoRA tags work correctly in the CLI (sd-cli) because it calls extract_and_remove_lora() on every generation. However, the server only calls this function once at startup when parsing command-line arguments. When handling API requests, the server copies default_gen_params, updates the prompt, but never re-parses the new prompt for LoRA tags.

Solution

This patch adds extract_and_remove_lora() to the sdapi_any2img handler function, which services both txt2img and img2img endpoints. The fix clears any pre-existing LoRA data and extracts LoRA tags from the incoming prompt, matching the behavior of the CLI.

Added functionality to extract and process LoRA tags from the prompt.
@wbruna
Copy link
Contributor

wbruna commented Jan 28, 2026

This is unsafe to enable as-is, since it'd allow loading arbitrary server files (see #1156 and #830 ).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants