Commit graph

121 commits

Author SHA1 Message Date
Cédric Deltheil 11b0ff6f8c ddim: remove unused attribute 2023-12-12 17:26:14 +01:00
limiteinductive 7992258dd2 add before/after init callback to trainer 2023-12-12 10:22:55 +01:00
Pierre Chapuis 42a0fc4aa0 fix circular imports 2023-12-11 15:27:11 +01:00
Cédric Deltheil 792a0fc3d9 run lint rules using latest isort settings 2023-12-11 11:58:43 +01:00
Cédric Deltheil 4fc5e427b8 training_utils: fix extra detection
Requirements could be, e.g.:

    wandb (>=0.15.7,<0.16.0) ; extra == "training"

Or:

    wandb>=0.16.0; extra == 'training'

Follow up of 86c5497
2023-12-08 19:09:16 +01:00
limiteinductive 86c54977b9 replace poetry by rye for python dependency management
Co-authored-by: Cédric Deltheil <cedric@deltheil.me>
Co-authored-by: Pierre Chapuis <git@catwell.info>
2023-12-08 17:40:10 +01:00
limiteinductive 807ef5551c refactor fl.Parameter basic layer
Co-authored-by: Cédric Deltheil <cedric@deltheil.me>
2023-12-08 10:20:34 +01:00
Cédric Deltheil 46b4b4b462 training_utils: fix naming issue timestep->step 2023-12-05 10:05:34 +01:00
limiteinductive 1075ea4a62 fix ddpm and ddim __init__ 2023-12-04 15:27:06 +01:00
limiteinductive ad8f02e555 add karras sampling to the Scheduler abstract class, default is quadratic 2023-12-04 15:27:06 +01:00
Pierre Chapuis f22f969d65 remove Black preview mode
also fix multiline logs in training
2023-12-04 14:15:56 +01:00
Bryce 4176868e79 feature: add sliced-attention for memory efficiency
This allowed me to produce HD images on M1 32gb and 7000x5000 on Nvidia 4090

I saw no visual difference in images generated.

Some datapoints on slice_size
# 4096 max needed for SD 1.5 512x512
# 9216 max needed for SD 1.5 768x768
# 16384 max needed for SD 1.5 1024x1024
# 32400 max needed for SD 1.5 1920x1080 (HD)
# 129600 max needed for SD 1.5 3840x2160 (4k)
# 234375 max needed for SD 1.5 5000x3000
2023-12-01 15:30:23 +01:00
Benjamin Trom 2d4c4774f4 add maxpool to refiners layer 2023-11-20 10:58:53 +01:00
Bryce f666bc82f5 feature: support self-attention guidance with SD1 inpainting model 2023-11-20 10:17:15 +01:00
Cédric Deltheil ab0915d052 add tests for FreeU 2023-11-18 16:15:44 +01:00
Benjamin Trom 6eeb01137d Add Adapter in refiners.fluxion.adapters init 2023-11-18 13:54:40 +01:00
isamu-isozaki 770879a6df Free U 2023-11-17 17:22:20 +01:00
Cédric Deltheil fc71e900a0 black 2023-10-21 13:51:06 +02:00
Benjamin Trom ea44262a39 unnest Residual subchain by modifying its forward
And replaced the remaining Sum-Identity layers by Residual.

The tolerance used to compare SAM's ViT models has been tweaked: for
some reasons there is a small difference (in float32) in the neck layer
(first conv2D)

Co-authored-by: Cédric Deltheil <cedric@deltheil.me>
2023-10-19 10:34:51 +02:00
Benjamin Trom 6ddd901767 improve image_to_tensor and tensor_to_image utils 2023-10-17 18:08:58 +02:00
limiteinductive 585c7ad55a improve consistency of the dpm scheduler 2023-10-12 15:48:43 +02:00
limiteinductive 7a62049d54 implement Restart method for latent diffusion 2023-10-12 15:48:43 +02:00
Cédric Deltheil ac631bfb2e make self attention guidance idempotent
Follow up of d3365d6
2023-10-11 10:47:22 +02:00
Benjamin Trom 0024191c58 improve debug print for chains 2023-10-10 15:25:09 +02:00
Benjamin Trom a663375dc7 prevent setattr pytorch module to register on the Chain class 2023-10-10 14:46:15 +02:00
Cédric Deltheil 455be5a4be remove TODO related to older pyright version 2023-10-10 14:19:47 +02:00
Cédric Deltheil b80769939d add support for self-attention guidance
See https://arxiv.org/abs/2210.00939
2023-10-09 17:33:15 +02:00
Cédric Deltheil 05126c8f4d make gaussian_blur work with float16 2023-10-07 21:48:38 +02:00
Cédric Deltheil 7d2abf6fbc scheduler: add remove noise
aka original sample prediction (or predict x0)

E.g. useful for methods like self-attention guidance (see equation (2)
in https://arxiv.org/pdf/2210.00939.pdf)
2023-10-05 17:05:15 +02:00
Cédric Deltheil 0dfa23fa53 fluxion: add gaussian_blur to utils 2023-10-05 16:30:27 +02:00
Cédric Deltheil f4298f87d2 pad: add optional padding mode 2023-10-05 11:10:37 +02:00
Cédric Deltheil 9b1e25e682 t2i_adapter: minor type annotation fix 2023-10-04 16:28:18 +02:00
Cédric Deltheil 9fbe86fbc9 make set_scale for T2I-Adapter really dynamic
Before this change, `set_scale` had only an impact on the condition
encoder. So calling `set_scale` after `set_condition_features` had no
effect at runtime.
2023-10-04 11:30:09 +02:00
Cédric Deltheil 694661ee10 ip-adapter add set_scale 2023-10-02 11:49:12 +02:00
Cédric Deltheil 5fc6767a4a add IP-Adapter plus (aka fine-grained features) 2023-09-29 15:23:43 +02:00
Cédric Deltheil 88e454f1cb Distribute: improve sanity check error message
E.g.:

    AssertionError: Number of positional arguments (1) must match number of sub-modules (2).
2023-09-28 14:06:06 +02:00
Cédric Deltheil 14864857b1 add T2I-Adapter to foundationals/latent_diffusion 2023-09-25 13:54:26 +02:00
Cédric Deltheil d72e1d3478 chain: add insert_before_type 2023-09-25 13:54:26 +02:00
Cédric Deltheil 4352e78483 add pixel unshuffle to fluxion's layers 2023-09-25 13:54:26 +02:00
Doryan Kaced 251277a0a8 Fix module registration in IP-Adapter 2023-09-22 17:34:55 +02:00
Pierre Chapuis 72854de669 fix device in DDPM / DDIM timesteps 2023-09-21 17:42:49 +02:00
Pierre Chapuis fad4f371ea correctly initialize context in structural_copy
fixes a regression introduced in 1cb798e8ae
2023-09-21 12:02:37 +02:00
Pierre Chapuis cd1fdb5585 fix scheduler device choice 2023-09-21 12:00:19 +02:00
Benjamin Trom 282578ddc0 add Segment Anything (SAM) to foundational models
Note: dense prompts (i.e. masks) support is still partial (see MaskEncoder)

Co-authored-by: Cédric Deltheil <cedric@deltheil.me>
2023-09-21 11:44:30 +02:00
Cédric Deltheil 2faff9f57a ldm: properly resize non-square init image 2023-09-20 10:27:22 +02:00
Benjamin Trom 85095418aa implement multi_diffusion for SD1 and SDXL 2023-09-19 15:30:50 +02:00
Benjamin Trom b86521da2f implement abstract MultiDiffusion class 2023-09-19 15:30:50 +02:00
Cédric Deltheil e319f13d05 utils: remove inplace opt-in from normalize 2023-09-18 18:07:20 +02:00
Cédric Deltheil bce3910383 utils: simplify normalize a bit 2023-09-18 18:07:20 +02:00
Cédric Deltheil d6046e1fbf move image tensor normalize under fluxion's utils 2023-09-18 18:07:20 +02:00