Skip to content

Conversation

csehatt741
Copy link

Summary

A new feature was implemented to specify LoRA default weight per model

  • LoraModelDefaultSettings was created in config.py to represent LoRA related default settings
  • a new instance variable, default_settings, was added to LoRAConfigBase to persist LoRA related default settings in every kind of LoRA model instance
  • a new function, get_default_settings_lora, was added to legacy_probe.py to populate default settings extracted from models
  • LoraModelDefaultSettings was added as another option to ModelRecordChanges.default_settings in order to persist LoRA related default settings
  • API model re-generated into schema.ts to make latest changes in backend API available in the frontend
  • a new field, lora.weight, was added to the zAppConfig schema to store LoRA weight UI elements related default settings
  • a new selector, selectLoRAWeightConfig, was added to configSlice.ts to retrieve LoRA weight UI elements related default settings
  • defaultLoRAConfig is created per request and was moved into loraAdded reducer to set LoRA weight based on default settings
  • useLoRAModelDefaultSettings custom hook was created to merge model and UI related default settings
  • DefaultWeight component was created to represent and set the LoRA weight default setting
  • LoRAModelDefaultSettings component was created to manage LoRA default settings
  • LoRAModelDefaultSettings component was added to ModelView to be able to separately manage main models and LoRA models default settings
  • default settings are queried to configure child components in LoRACard component
  • new tanslation, lora.weight, was added to en.json

Related Issues / Discussions

https://discord.com/channels/1020123559063990373/1408129778996740167

Checklist

  • The PR has a short but descriptive title, suitable for a changelog
  • Tests added / updated (if applicable)
  • Documentation added / updated (if applicable)
  • Updated What's New copy (if doing a release after this PR)

@github-actions github-actions bot added python PRs that change python files backend PRs that change backend files services PRs that change app services frontend PRs that change frontend files labels Aug 26, 2025
@csehatt741
Copy link
Author

I wonder where to create the constant for LoRA weight: 0.75 to replace literals in invokeai.ts and lorasSlice.ts

@csehatt741
Copy link
Author

Is it possible to extract the weight setting from LoRA models in get_default_settings_lora?

@csehatt741 csehatt741 force-pushed the feat/lora-default-settings-weight branch from 4a9f535 to ad6b853 Compare August 29, 2025 08:26
@psychedelicious
Copy link
Collaborator

Sorry, I didn't see your questions in the PR until now!

I wonder where to create the constant for LoRA weight: 0.75 to replace literals in invokeai.ts and lorasSlice.ts

Suggest to revert the configSlice changes and instead export the default LoRA state as a const. Then we can have defaultValue={loraConfig.defaultSettings?.weight ?? DEFAULT_LORA_STATE.weight} in the component. A bit simpler.

Some context - we added parameter constraints to configSlice so the commercial app could override them via props. For example, the commercial app sets the max number of steps to a much lower number than OSS to prevent footguns.

In hindsight, this ends up being tech debt, as the commercial app only overrides a few constraints. Having parameter constraints in configSlice is probably overly complex - we'd be fine to just have constants local to the component for most things, and explicit overrides for the things that need it. LoRA weight isn't one of those things.

Is it possible to extract the weight setting from LoRA models in get_default_settings_lora?

I don't think so as it's not a property of the LoRA model weights. We have some logic to extract parameters from LoRA metadata JSON sidecar files, but I don't think those specify weight.

Copy link
Collaborator

@psychedelicious psychedelicious left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, thanks! Could small changes requested - great QoL improvement here.

@csehatt741 csehatt741 force-pushed the feat/lora-default-settings-weight branch 3 times, most recently from 6f94fac to 04454cd Compare September 2, 2025 07:55
Copy link
Collaborator

@psychedelicious psychedelicious left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@psychedelicious psychedelicious enabled auto-merge (rebase) September 2, 2025 09:18
@psychedelicious psychedelicious force-pushed the feat/lora-default-settings-weight branch from 04454cd to 63228a5 Compare September 2, 2025 09:18
@psychedelicious psychedelicious merged commit 6f70a6b into invoke-ai:main Sep 2, 2025
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend PRs that change backend files frontend PRs that change frontend files python PRs that change python files services PRs that change app services
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants