Commit Graph

223 Commits

Author SHA1 Message Date
Anthony Wu
98d7ef5751 update: do not require model arg, add controlnet_save_canny, fix bugs, add tests 2024-10-26 20:22:32 -07:00
Anthony Wu
ffaf562a8c fix type hint in test file 2024-10-26 10:29:33 -07:00
Anthony Wu
351cc8bbf1 support metadata files as CLI arg supplier 2024-10-20 09:18:49 -07:00
filipstrand
2ed0628e58 Light refactoring: Move latent creation to separate class 2024-10-20 11:49:43 +02:00
filipstrand
f08c667e1a Remove vae type alias from runtime_config.py 2024-10-20 11:05:45 +02:00
Anthony Wu
1160d4e8b2 controlnet files: revert the refactoring done in #77 2024-10-20 01:06:02 -07:00
Anthony Wu
6201a93d4a tests and fixes for image to image 2024-10-20 00:48:45 -07:00
Anthony Wu
f963b7a9b2 image to image implementation 2024-10-12 10:46:20 -07:00
filipstrand
9c7e857082 Add type hinting to CommandLineParser 2024-10-12 14:35:11 +02:00
Anthony Wu
796e9e8305 refactor argparser 2024-10-11 15:03:52 -07:00
Anthony Wu
9b6cd01171 introduce ruff isort 2024-10-10 11:56:14 -07:00
Filip Strand
faaf905667
Merge pull request #71 from anthonywu/typos-check
introduce pre-commit typos check
2024-10-10 20:31:21 +02:00
filipstrand
8ec5410a56 Mark stepwise feature as experimental for now 2024-10-10 07:43:19 +02:00
Anthony Wu
19867d5bb7 introduce pre-commit typos check 2024-10-09 14:20:49 -07:00
filipstrand
e908c1cede Add stepwise handler 2024-10-09 22:29:36 +02:00
Anthony Wu
5de208d1ba PR review 2024-10-06 14:59:15 -10:00
Anthony Wu
fcc9b21d19 option to save stepwise and composite images, add interruptibility 2024-09-23 15:20:25 -07:00
filipstrand
a942ca8d67 Rename controlnet path arg 2024-09-23 20:22:47 +02:00
filipstrand
ec8b42e521 Rename save arg 2024-09-23 20:22:30 +02:00
filipstrand
ebff19b48a Use None instead of empty string for image metadata 2024-09-23 20:13:35 +02:00
filipstrand
dfdd543227 Add controlnet example 2024-09-23 20:13:35 +02:00
filipstrand
91b0c466fb Avoid circular dep. issue (maybe better way to do this) 2024-09-23 20:13:35 +02:00
filipstrand
15ecaa7370 Rename util method 'save' to 'save_image' 2024-09-23 20:13:35 +02:00
filipstrand
3af6bcbfe1 Add ability to save the canny controlnet image early on in the generation
(useful for inspecting if edge detection is as expected)
2024-09-23 20:13:35 +02:00
filipstrand
7b4aab9c1b Move actual image saving logic to ImageUtil 2024-09-23 20:13:35 +02:00
filipstrand
d799a924c4 Light refactor of controlnet class 2024-09-23 20:13:35 +02:00
filipstrand
5737b27164 Save controlnet_image and mflux version in metadata 2024-09-23 20:13:35 +02:00
filipstrand
cda698df8d Move controlnet specific weight handling to separate class 2024-09-23 20:13:35 +02:00
filipstrand
8678102321 Fix controlnet input arg name and group controlnet arguments 2024-09-23 19:18:11 +02:00
filipstrand
56f0c8361d Add TOC and some emojis for the README and new controlnet section 2024-09-23 19:18:11 +02:00
filipstrand
3ac54a9f42 Add ability to save model with applied LoRA 2024-09-22 11:20:31 +02:00
Anthony Wu
8b47492f1b more qol suggestions 2024-09-21 15:03:35 -07:00
filipstrand
6ef9ceb259 Fix linting issues 2024-09-21 19:59:12 +02:00
filipstrand
9e6ace4cc3 Apply ruff formating (minor manual modifications to some files which are subsequently excluded) 2024-09-21 19:59:12 +02:00
filipstrand
abd7893612 Fix hidden_states in single_transformer_blocks for controlnet transformer 2024-09-21 14:38:33 +02:00
filipstrand
c170e89977 remove unnecessary imports 2024-09-21 10:39:01 +02:00
filipstrand
5a7157e7e8 Simplify import paths for controlnet file 2024-09-21 10:34:35 +02:00
filipstrand
e007402cfa Merge remote-tracking branch 'refs/remotes/mflux/main' into easy-import-dx 2024-09-21 10:33:36 +02:00
filipstrand
38c747b680 Extract model saving logic to separate class 2024-09-17 07:35:42 +02:00
filipstrand
a30dc4d5cc Rename image.py to generated_image.py 2024-09-17 07:35:42 +02:00
filipstrand
bce18747ff Fix formatting 2024-09-17 07:35:42 +02:00
filipstrand
fc8099e908 Move new controlnet module to its own file 2024-09-17 07:35:42 +02:00
filipstrand
ad6f4ca8af Create util class for controlnet 2024-09-17 07:35:42 +02:00
filipstrand
78bbf3d8fb Fix formatting and some warnings 2024-09-17 07:35:41 +02:00
filipstrand
25e375d45d Small additions and refactoring 2024-09-17 06:35:06 +02:00
Anthony Wu
43618154d3 remove apparently unnecessary import of the src/mflux directory 2024-09-16 15:04:30 -07:00
Anthony Wu
0812d6252c simplify import paths of frequently used items in scripts and demos 2024-09-16 10:27:04 -07:00
Fabio
a2900c3b13 update generated image annotations 2024-09-15 21:54:17 +02:00
Fabio
dee452b3bb fixes from review 2024-09-15 21:37:29 +02:00
Fabio
a04d139ff5 further cleanup 2024-09-14 20:04:08 +02:00
Fabio
2a2a3fff63 delete egg-info 2024-09-14 20:01:33 +02:00
Fabio
12a6386fca Merge branch 'main' into feature/add_controlnet 2024-09-14 19:58:51 +02:00
Fabio
369bfc0b53 add cli, controlnet config and tidy up 2024-09-14 19:58:12 +02:00
Fabio
3dba1e38e1 controlnet - first working version 2024-09-14 14:37:30 +02:00
filipstrand
db3e495be6 Remove restriction on lora weights 2024-09-13 21:50:48 +02:00
filipstrand
d10e6f4019 Add support for converting between LoRA formats 2024-09-13 20:37:56 +02:00
Fabio
1b9c645503 WIP controlnet 2024-09-13 00:28:43 +02:00
filipstrand
7d27f1c4c1 Adjust FF block only if it exists 2024-09-12 21:18:01 +02:00
filipstrand
1567a01745 Rename run to generate 2024-09-06 22:27:24 +02:00
filipstrand
c0d419777e Add quantize option to from_alias initializer 2024-09-06 22:11:00 +02:00
filipstrand
af73966f11 Fix system paths 2024-09-06 21:45:02 +02:00
filipstrand
b9ff93ea3f Fix imports 2024-09-06 21:15:46 +02:00
filipstrand
23e44c768b Rename main.py to run.py 2024-09-06 21:09:50 +02:00
filipstrand
b8102f2a2f Move main.py and save.py one level down 2024-09-06 21:09:44 +02:00
filipstrand
915f3c2950 Move flux.py to separate package 2024-09-06 21:09:26 +02:00
filipstrand
d2b38011ad Rename flux_1 to mflux 2024-09-06 21:09:16 +02:00
filipstrand
6fb51170de Also save LoRA metadata 2024-09-06 20:09:27 +02:00
filipstrand
6d05f5b27e Fix saving bug 2024-09-06 20:09:17 +02:00
filipstrand
fab10cc046 Add proper image class and save metadata 2024-09-06 19:38:34 +02:00
Filip Strand
97dc64436e
Merge pull request #31 from Xuzzo/fix/width_height_mixup
Fix width and height in config
2024-09-06 10:02:46 +02:00
filipstrand
1d8714d3b1 Add some example runs 2024-09-05 23:21:48 +02:00
filipstrand
a0ee9a7a8a Rename apply-lora arg 2024-09-05 21:50:31 +02:00
Fabio
0a2f21af5a fix widht <-> height bug 2024-09-05 20:06:59 +02:00
filipstrand
96848e320f Add support for multiple LoRAs again 2024-09-05 19:54:46 +02:00
filipstrand
ff9f998638 Small fixes 2024-09-04 23:16:02 +02:00
Filip Strand
d5f5f9607e
Fix type
Co-authored-by: Fabio Peruzzo <39661245+Xuzzo@users.noreply.github.com>
2024-09-04 23:14:38 +02:00
filipstrand
f28fffe0cf Point out the .safetensors file again 2024-09-04 22:44:11 +02:00
filipstrand
a3567bddd7 Start supporting only single LoRA (and some other simplifications) 2024-09-04 22:15:03 +02:00
filipstrand
6d35db5e9a Use mx.load instead of safe_open 2024-09-04 21:05:19 +02:00
filipstrand
5ad5352481 Introduce weight util for shared methods 2024-09-04 20:20:27 +02:00
filipstrand
af41b08d90 Move LoRA related things to a LoraUtil (have to think about where to best place this later...) 2024-09-04 20:10:45 +02:00
filipstrand
8983070728 Code style improvements and some restructuring 2024-09-04 20:10:45 +02:00
Filip Strand
b4c27a6fab
raise error if layer cannot be loaded
Co-authored-by: Fabio Peruzzo <39661245+Xuzzo@users.noreply.github.com>
2024-09-04 19:43:32 +02:00
elitexp
0fd03c7552
@Xuzzo - Weight Adjustment as Original Transformer
Co-authored-by: Fabio Peruzzo <39661245+Xuzzo@users.noreply.github.com>
2024-09-04 21:52:51 +05:45
Sujip Maharjan
8d8812675e feat: --apply-lora a.safetensors b.safetensors c.safetensor --lora-scales 0.5 1.0 0.5 2024-09-03 19:36:15 +05:45
Sujip Maharjan
03b929e732 feat: Add --lora-scale parameter to adjust the scaling of LoRA weights 2024-09-03 18:39:01 +05:45
elitexp
4dfb3aa892
Clean up weight handler
@xuzzo Cleanup code

Co-authored-by: Fabio Peruzzo <39661245+Xuzzo@users.noreply.github.com>
2024-09-03 18:19:21 +05:45
Sujip Maharjan
f82caa3298 Icrecream dependency removed, not required -- error 2024-09-03 13:16:35 +05:45
Sujip Maharjan
cd54ad137c Apply lora with --apply-lora <path-to-safetensors> 2024-09-03 07:38:04 +05:45
filipstrand
fdc4cb9892 Rewrite weight handling and add quantization support 2024-08-30 22:13:36 +02:00
filipstrand
1f54b94175 Simplify: Remove latent creator class and inline logic 2024-08-21 00:48:08 +02:00
filipstrand
45104ebf48 Fix width property 2024-08-20 23:22:25 +02:00
filipstrand
d0970162a5 Fix images in readme 2024-08-20 22:56:57 +02:00
filipstrand
7a277fc326 Rename flux_1_schnell folder to flux_1 2024-08-20 22:37:32 +02:00
filipstrand
4d613c7390 Move num_train_steps to ModelConfig 2024-08-20 11:45:36 +02:00
filipstrand
7795d47cd3 Add a separate runtime config 2024-08-20 10:59:28 +02:00
filipstrand
4b42e50257 Add separate model config and other small updates 2024-08-20 09:44:09 +02:00
Fabio
3710f101e5 small fix and update readme 2024-08-19 21:09:41 +02:00
Fabio
e60cd79f0c make config static and freeze after initialisation 2024-08-19 20:41:11 +02:00
Fabio
16ee26c2e9 fix merge conflicts 2024-08-18 23:33:22 +02:00
Fabio
68cbaab816 fix type and add main_dev 2024-08-18 23:31:54 +02:00
filipstrand
c50a1fb3d4 Fix height and width argument names 2024-08-18 21:49:41 +02:00
Fabio
d14f49f758 revert changes to config 2024-08-18 21:23:52 +02:00
filipstrand
5669d26274 Never override previously generated images 2024-08-18 20:46:11 +02:00
Fabio
acfc448f0c fix guidance scale 2024-08-18 17:56:31 +02:00
Fabio
6977e92061 fix sigmas shift 2024-08-18 17:15:58 +02:00
Fabio
571608b4dd fix conflicts 2024-08-18 13:32:02 +02:00
Fabio
40b40b5541 add shift to schedule 2024-08-18 13:30:19 +02:00
Fabio
14c5b2bd0e fix architecture for dev 2024-08-18 01:01:01 +02:00
Fabio
e76bb3d284 change naming 2024-08-17 22:50:35 +02:00
Fabio
65c479b091 fix height <-> width and other minor corrections 2024-08-17 22:39:52 +02:00
Fabio
7b1eba235d WIP include flux1 dev 2024-08-17 22:33:11 +02:00
Fabio Peruzzo
7661622839 allow different image resolutions 2024-08-16 16:45:49 +02:00
filipstrand
65e0232cab Move flux.py up one level 2024-08-15 21:17:33 +02:00
filipstrand
5af0763cc4 Rearrange attributes 2024-08-15 21:08:27 +02:00
filipstrand
0fae839053 Do text encoding directly and remove TextEncoder class 2024-08-15 20:55:56 +02:00
filipstrand
f0b02257e3 Update README with installation guide 2024-08-15 00:18:48 +02:00
filipstrand
e3a85df133 Automatically download models from huggingface or used cache ones 2024-08-15 00:17:30 +02:00
filipstrand
97028713e1 Update default prompt 2024-08-14 11:12:30 +02:00
filipstrand
37a6632259 Return mlx arrays directly from tokenizer call 2024-08-14 11:02:04 +02:00
filipstrand
5023437e89 Remove loop from main script 2024-08-13 23:14:15 +02:00
filipstrand
1cecc60e5e Add progress bar 2024-08-12 21:37:41 +02:00
filipstrand
83850ddbf1 Initial release 2024-08-12 20:34:17 +02:00