mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
15b33ad501
Add support for FreeU. See: - https://huggingface.co/docs/diffusers/main/en/using-diffusers/freeu - https://github.com/ChenyangSi/FreeU Implementation: - `ModelPatcher.apply_freeu()` handles the enabling freeu (which is very simple with diffusers). - `FreeUConfig` model added to hold the hyperparameters. - `freeu_config` added as optional sub-field on `UNetField`. - `FreeUInvocation` added, works like LoRA - chain it to add the FreeU config to the UNet - No support for model-dependent presets, this will be a future workflow editor enhancement Closes #4845
17 lines
623 B
Python
17 lines
623 B
Python
from pydantic import BaseModel, Field
|
|
|
|
from invokeai.app.invocations.baseinvocation import FieldDescriptions
|
|
|
|
|
|
class FreeUConfig(BaseModel):
|
|
"""
|
|
Configuration for the FreeU hyperparameters.
|
|
- https://huggingface.co/docs/diffusers/main/en/using-diffusers/freeu
|
|
- https://github.com/ChenyangSi/FreeU
|
|
"""
|
|
|
|
s1: float = Field(ge=-1, le=3, description=FieldDescriptions.freeu_s1)
|
|
s2: float = Field(ge=-1, le=3, description=FieldDescriptions.freeu_s2)
|
|
b1: float = Field(ge=-1, le=3, description=FieldDescriptions.freeu_b1)
|
|
b2: float = Field(ge=-1, le=3, description=FieldDescriptions.freeu_b2)
|