feat(lora): per LoRA-model configurable weight range#9154
Open
lstein wants to merge 1 commit into
Open
Conversation
Adds optional `weight_min` and `weight_max` to the LoRA model's default settings so slider LoRAs that operate at non-standard scales (e.g. -10..+10) can be tuned without bumping into the previously hard-coded -1..+2 slider range. The model edit panel exposes them alongside the starting weight, and the LoRA card slider in the canvas honors whatever range the user saved on the model. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
weight_minandweight_maxfields toLoraModelDefaultSettings, exposes them in the model edit panel as toggleable spinners (alongside a re-labeled "Starting Weight" spinner), and makes the canvas LoRA card's slider honor whatever range the user saved on the model. The previous -1..+2 hard cap onweightis removed.Setting the min and max weights from within the Model Manager:
The LoRA slider with custom min and max ranges
Changes
invokeai/backend/model_manager/configs/lora.py):LoraModelDefaultSettingsgainsweight_minandweight_max(both optional, defaultNone); a model validator rejectsweight_min >= weight_max. Removed thege=-1, le=2constraint onweight.loraConfig.default_settings.weight_min/max, falling back to the global defaults (-1..+2 slider, -10..+10 number input).zLoRA.weightzod schema from.gte(-10).lte(10)to plainz.number()so persisted values within a user-set wide range aren't rejected on rehydration.services/api/schema.ts; added en locale strings.Test plan
pnpm lint:tsc,pnpm lint:eslint,pnpm lint:prettier,pnpm lint:knip,pnpm lint:dpdmpnpm test:no-watch(1097 passed)pytest tests/app/routers/test_model_manager.py tests/backend/model_manager/configs/(45 passed)🤖 Generated with Claude Code