Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add scale map to apply_max_norm_regularization #1873

Draft
wants to merge 1 commit into
base: sd3
Choose a base branch
from

Conversation

rockerBOO
Copy link
Contributor

Allows setting the scale_weight_norms via

  • --scale_weight_norms_map "{'proj': 100.0}"
  • toml scale_weight_norms_map = { proj = 100.0 }

Set --scale_weight_norms 5.0 to some value for the other values and the map would set those values for matching module keys.

This is is just an idea to allow us to scale the weight norms differently for different modules. The implementation details are up in the air because I'm not sure what would be best here.

Could be that we want to use regex for the module name matching. Or make the map work exclusively to scale_weight_norms.

See https://github.com/rockerBOO/sd-ext/blob/main/scale_norms.py which emulates the same behavior but on the static weights. You can try different strategies with the map.

@recris
Copy link

recris commented Jan 12, 2025

This is something I wanted to implement for some time.

Maybe match the names using fnmatch style patterns? Slightly simpler than regex.

@rockerBOO
Copy link
Contributor Author

Yeah fnmatch seems to be a good fit. I will give it a try.

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