Ryan Dick
3d6f60f63e
Merge branch 'main' into ryan/flux-lora-quantized
2024-09-18 13:22:39 -04:00
maryhipp
8916036ed3
fix progress image for FLUX inpainting
2024-09-17 06:41:32 +03:00
psychedelicious
0fd430fc20
fix(nodes): add thresholding to lineart & lineart anime nodes
...
The lineart model often outputs a lot of almost-black noise. SD1.5 ControlNets seem to be OK with this, but SDXL ControlNets are not - they need a cleaner map. 12 was experimentally determined to be a good threshold, eliminating all the noise while keeping the actual edges. Other approaches to thresholding may be better, for example stretching the contrast or removing noise.
I tried:
- Simple thresholding (as implemented here) - works fine.
- Adaptive thresholding - doesn't work, because the thresholding is done in the context of small blocks, while we want thresholding in the context of the whole image.
- Gamma adjustment - alters the white values too much. Hard to tuen.
- Contrast stretching, with and without pre-simple-thresholding - this allows us to treshold out the noise, then stretch everything above the threshold down to almost-zero. So you have a smoother gradient of lightness near zero. It works but it also stretches contrast near white down a bit, which is probably undesired.
In the end, simple thresholding works fine and is very simple.
2024-09-17 04:04:11 +03:00
Ryan Dick
2934e31620
Fix bug when applying multiple LoRA models via apply_lora_sidecar_patches(), and add unit tests for the stacked LoRA case.
2024-09-16 14:48:39 +00:00
Ryan Dick
e88d3cf2f7
Assume alpha=rank for FLUX diffusers PEFT LoRA models.
2024-09-16 13:57:07 +00:00
Ryan Dick
d51f2c5e00
Add bias to LoRA sidecar layer unit tests.
2024-09-15 04:39:56 +03:00
Ryan Dick
78efed4499
Revert change of make all LoRA layers torch.nn.Module's. While the code is uglier, it turns out that the Module implementation of some ops like .to(...) is noticeably slower.
2024-09-15 04:39:56 +03:00
Ryan Dick
02f27c750a
Add unit tests for LoRAPatcher.apply_lora_sidecar_patches(...) and fixup dtype handling in the sidecar layers.
2024-09-15 04:39:56 +03:00
Ryan Dick
ba3ba3c23a
Add unit tests for LoRALinearSidecarLayer and ConcatenatedLoRALinearSidecarLayer.
2024-09-15 04:39:56 +03:00
Ryan Dick
61d3d566de
Minor cleanup and documentation updates.
2024-09-15 04:39:56 +03:00
Ryan Dick
ae41651346
Remove LoRA conv sidecar layers until they are needed and properly tested.
2024-09-15 04:39:56 +03:00
Ryan Dick
5bb0c79c14
Add links to test models for loha, lokr, ia3.
2024-09-15 04:39:56 +03:00
Ryan Dick
9438ea608c
Update all lycoris layer types to use the new torch.nn.Module base class.
2024-09-15 04:39:56 +03:00
Ryan Dick
81fbaf2b8b
Assume LoRA alpha=8 for FLUX diffusers PEFT LoRAs.
2024-09-15 04:39:56 +03:00
Ryan Dick
10c3c61cb2
Get diffusers FLUX LoRA working as sidecar patch on quantized model.
2024-09-15 04:39:56 +03:00
Ryan Dick
45bc8fcd7f
WIP - Implement sidecar LoRA layers using functional API.
2024-09-15 04:39:56 +03:00
Ryan Dick
f5f894437c
Bug fixes to get LoRA sidecar patching working for the first time.
2024-09-15 04:39:56 +03:00
Ryan Dick
3e12ac9740
WIP - LoRA sidecar layers.
2024-09-15 04:39:56 +03:00
Ryan Dick
049ce1826c
WIP - adding LoRA sidecar layers
2024-09-15 04:39:56 +03:00
Ryan Dick
2ff4dae5ce
Add util functions calc_tensor_size(...) and calc_tensors_size(...).
2024-09-15 04:39:56 +03:00
Ryan Dick
705173b575
Remove unused layer_key property from LoRALayerBase.
2024-09-15 04:39:56 +03:00
Ryan Dick
fef26a5f2f
Consolidate all LoRA patching logic in the LoRAPatcher.
2024-09-15 04:39:56 +03:00
Ryan Dick
ee5d8f6caf
lora_layer_from_state_dict(...) -> any_lora_layer_from_state_dict(...)
2024-09-15 04:39:56 +03:00
Ryan Dick
ddda60c1a2
Rename peft/ -> lora/
2024-09-15 04:39:56 +03:00
Ryan Dick
aac97e105a
Genera cleanup/documentation.
2024-09-15 04:39:56 +03:00
Ryan Dick
552a5b06a4
Add a check that all keys are handled in the FLUX Diffusers LoRA loading code.
2024-09-15 04:39:56 +03:00
Ryan Dick
5800e60b06
Add model probe support for FLUX LoRA models in Diffusers format.
2024-09-15 04:39:56 +03:00
Ryan Dick
31a8757e6b
Add is_state_dict_likely_in_flux_diffusers_format(...) function with unit test.
2024-09-15 04:39:56 +03:00
Ryan Dick
534e938a62
Add unit test for lora_model_from_flux_diffusers_state_dict(...).
2024-09-15 04:39:56 +03:00
Ryan Dick
040cc28f93
First draft of lora_model_from_flux_diffusers_state_dict(...).
2024-09-15 04:39:56 +03:00
Ryan Dick
bb528d916e
Add ConcatenateLoRALayer class.
2024-09-15 04:39:56 +03:00
Ryan Dick
dc09171cdb
WIP on supporting diffusers format FLUX LoRAs.
2024-09-15 04:39:56 +03:00
Ryan Dick
cf9f30cc56
Rename flux_kohya_lora_conversion_utils.py
2024-09-15 04:39:56 +03:00
Ryan Dick
50c9410121
WIP
2024-09-15 04:39:56 +03:00
Ryan Dick
01a15b4d80
WIP - add invocations to support FLUX LORAs.
2024-09-15 04:39:56 +03:00
Ryan Dick
db61ec4322
Get probing of FLUX LoRA kohya models working.
2024-09-15 04:39:56 +03:00
Ryan Dick
00e56863c2
Add utility function for detecting whether a state_dict is in the FLUX kohya LoRA format.
2024-09-15 04:39:56 +03:00
Ryan Dick
7b5befad0d
Update convert_flux_kohya_state_dict_to_invoke_format() to raise an exception if an unexpected key is encountered, and add a corresponding unit test.
2024-09-15 04:39:56 +03:00
Ryan Dick
04b37e64ea
Move the responsibilities of 1) state_dict loading from file, and 2) SDXL lora key conversions, out of LoRAModelRaw and into LoRALoader.
2024-09-15 04:39:56 +03:00
Ryan Dick
8518ae9ccb
Remove unused LoRAModelRaw.name attribute.
2024-09-15 04:39:56 +03:00
Ryan Dick
d0d91eaeec
Fix type errors in sdxl_lora_conversion_utils.py
2024-09-15 04:39:56 +03:00
Ryan Dick
fc380f077f
Start moving SDXL-specific LoRA conversions out of the general-purpose LoRAModelRaw class.
2024-09-15 04:39:56 +03:00
Ryan Dick
ade75b4748
Get convert_flux_kohya_state_dict_to_invoke_format(...) working, with unit tests.
2024-09-15 04:39:56 +03:00
Ryan Dick
c41bd59812
WIP - Initial logic for kohya FLUX LoRA conversion.
2024-09-15 04:39:56 +03:00
Ryan Dick
2b3e4e123d
Split LoRA layer implementations into separate files.
2024-09-12 15:53:30 +00:00
psychedelicious
248e4a81b2
fix(nodes): handle no detected line segments
2024-09-11 08:12:48 -04:00
psychedelicious
b6aba92426
fix(nodes): MLSD needs inputs to be multiples of 64
2024-09-11 08:12:48 -04:00
psychedelicious
4f2fc65257
tidy(nodes): MLSDEdgeDetection -> MLSDDetection
...
It's a line segment detector, not general edge detector.
2024-09-11 08:12:48 -04:00
psychedelicious
ee4c0efbf7
feat(nodes): update pidinet node
...
Human-readable field names.
2024-09-11 08:12:48 -04:00
psychedelicious
a4250e3ff2
feat(nodes): update mlsd node
...
Human-readable field names.
2024-09-11 08:12:48 -04:00