InvokeAI 4.2.9.dev10__py3-none-any.whl → 4.2.9.dev12__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {InvokeAI-4.2.9.dev10.dist-info → InvokeAI-4.2.9.dev12.dist-info}/METADATA +1 -1
- {InvokeAI-4.2.9.dev10.dist-info → InvokeAI-4.2.9.dev12.dist-info}/RECORD +36 -32
- invokeai/app/api/routers/model_manager.py +91 -0
- invokeai/app/invocations/denoise_latents.py +1 -1
- invokeai/app/invocations/fields.py +1 -1
- invokeai/app/invocations/flux_denoise.py +249 -0
- invokeai/app/invocations/flux_vae_decode.py +60 -0
- invokeai/app/invocations/flux_vae_encode.py +67 -0
- invokeai/app/invocations/mask.py +6 -1
- invokeai/app/services/model_install/model_install_common.py +1 -1
- invokeai/app/services/shared/invocation_context.py +19 -1
- invokeai/app/services/workflow_records/default_workflows/FLUX Image to Image.json +407 -0
- invokeai/app/services/workflow_records/default_workflows/Flux Text to Image.json +171 -105
- invokeai/app/util/step_callback.py +48 -0
- invokeai/backend/flux/denoise.py +56 -0
- invokeai/backend/flux/inpaint_extension.py +35 -0
- invokeai/backend/flux/modules/autoencoder.py +21 -7
- invokeai/backend/flux/sampling_utils.py +135 -0
- invokeai/backend/model_manager/load/load_default.py +3 -2
- invokeai/backend/model_manager/load/model_cache/model_cache_base.py +18 -1
- invokeai/backend/model_manager/load/model_cache/model_cache_default.py +14 -1
- invokeai/backend/model_manager/load/model_loaders/flux.py +5 -0
- invokeai/backend/model_manager/probe.py +57 -9
- invokeai/backend/model_manager/util/model_util.py +26 -0
- invokeai/frontend/web/dist/assets/App-D1Y-WRqk.js +66 -0
- invokeai/frontend/web/dist/assets/{ThemeLocaleProvider-Dc0lAavD.js → ThemeLocaleProvider-CmO3BZJ7.js} +1 -1
- invokeai/frontend/web/dist/assets/index-Ax6e2dHX.js +563 -0
- invokeai/frontend/web/dist/index.html +1 -1
- invokeai/frontend/web/dist/locales/en.json +14 -5
- invokeai/version/invokeai_version.py +1 -1
- invokeai/app/invocations/flux_text_to_image.py +0 -169
- invokeai/backend/flux/sampling.py +0 -167
- invokeai/frontend/web/dist/assets/App-DUFQH-Kw.js +0 -66
- invokeai/frontend/web/dist/assets/images/transparent_bg.png +0 -0
- invokeai/frontend/web/dist/assets/index-DK9y4o4h.js +0 -563
- {InvokeAI-4.2.9.dev10.dist-info → InvokeAI-4.2.9.dev12.dist-info}/LICENSE +0 -0
- {InvokeAI-4.2.9.dev10.dist-info → InvokeAI-4.2.9.dev12.dist-info}/LICENSE-SD1+SD2.txt +0 -0
- {InvokeAI-4.2.9.dev10.dist-info → InvokeAI-4.2.9.dev12.dist-info}/LICENSE-SDXL.txt +0 -0
- {InvokeAI-4.2.9.dev10.dist-info → InvokeAI-4.2.9.dev12.dist-info}/WHEEL +0 -0
- {InvokeAI-4.2.9.dev10.dist-info → InvokeAI-4.2.9.dev12.dist-info}/entry_points.txt +0 -0
- {InvokeAI-4.2.9.dev10.dist-info → InvokeAI-4.2.9.dev12.dist-info}/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: InvokeAI
|
|
3
|
-
Version: 4.2.9.
|
|
3
|
+
Version: 4.2.9.dev12
|
|
4
4
|
Summary: An implementation of Stable Diffusion which provides various new features and options to aid the image generation process
|
|
5
5
|
Author-email: The InvokeAI Project <lincoln.stein@gmail.com>
|
|
6
6
|
License: Apache License
|
|
@@ -9,7 +9,7 @@ invokeai/app/api/routers/board_images.py,sha256=h7MompQAyVzeQtQi63GPGQBhFqthlr2M
|
|
|
9
9
|
invokeai/app/api/routers/boards.py,sha256=7Ju7zqsciivenFhr25IkCVSl5QfAqYQt9VlMgOnlHSY,5567
|
|
10
10
|
invokeai/app/api/routers/download_queue.py,sha256=j7ZPRGkDy6yIZoF5RGpAuAwuGykwUm5fMT83NMtBF8s,3470
|
|
11
11
|
invokeai/app/api/routers/images.py,sha256=jOqIKrz32gsO3YKjxZXK2aq5XK54XofiXXoa3vTWbkA,17035
|
|
12
|
-
invokeai/app/api/routers/model_manager.py,sha256=
|
|
12
|
+
invokeai/app/api/routers/model_manager.py,sha256=8ya9mZvlR-tTc3uZJuP8yFzBushNpe-asAV0g7_0kho,33412
|
|
13
13
|
invokeai/app/api/routers/session_queue.py,sha256=ne8oHKKSPLFDykpSq1eaD1jWIxJz9ZXx_F5C7w9q6v0,8534
|
|
14
14
|
invokeai/app/api/routers/style_presets.py,sha256=oGGQkXr-HOz5e0dbG96oYu04GMqkQWLGhMAXTOVNRd4,10197
|
|
15
15
|
invokeai/app/api/routers/utilities.py,sha256=ohGZhpDzRF4X_3qpUpYUEe0bAB0VFhmcjs1no7f9mlQ,1600
|
|
@@ -26,11 +26,13 @@ invokeai/app/invocations/create_denoise_mask.py,sha256=x-gd4Q204L6diwVz_QRoid1e_
|
|
|
26
26
|
invokeai/app/invocations/create_gradient_mask.py,sha256=fQc2_hOISGLnY79L5IMJzz_ggQXh20Rj4kHMxR1LeNw,6646
|
|
27
27
|
invokeai/app/invocations/crop_latents.py,sha256=frCjcMQeN8G2wweMkZnOUPox79r8ap2rWkc83wMT0gU,2718
|
|
28
28
|
invokeai/app/invocations/cv.py,sha256=xlIWdxA1x-79Fzz8BNT3uZe2gFn-_dyHNjSS8dRWy-c,1623
|
|
29
|
-
invokeai/app/invocations/denoise_latents.py,sha256=
|
|
29
|
+
invokeai/app/invocations/denoise_latents.py,sha256=AfUVkrNBWU9nAHdTrQANNtfC5qNl1wNM8qFFjs63IQI,47726
|
|
30
30
|
invokeai/app/invocations/facetools.py,sha256=wRdN9cxbM5-LhHvoJA0f4wcP9aAf-WPZAfeD6ktWECg,26436
|
|
31
|
-
invokeai/app/invocations/fields.py,sha256=
|
|
31
|
+
invokeai/app/invocations/fields.py,sha256=UwhmRzYsfdB2p-_TBwe1AwybbLBR9OzW-AHW0-9N3M0,25399
|
|
32
|
+
invokeai/app/invocations/flux_denoise.py,sha256=sEi0mb4L3lCAzdecUbsihbCVDleD6y65euhquvnHkBE,9844
|
|
32
33
|
invokeai/app/invocations/flux_text_encoder.py,sha256=eCvL_2tnsTRTgsshUsjFNR6gCRyNWD66Bfecpe3gNqo,3801
|
|
33
|
-
invokeai/app/invocations/
|
|
34
|
+
invokeai/app/invocations/flux_vae_decode.py,sha256=lMRzW19UD9tMih4ZlnGKzyS0Y0LUeSlm6JNV2chXFWo,2124
|
|
35
|
+
invokeai/app/invocations/flux_vae_encode.py,sha256=t0tIzI0mbK_xOpDL-nhKvKfjrSWFsKgU0RyFDVlJbrw,2688
|
|
34
36
|
invokeai/app/invocations/grounding_dino.py,sha256=Mv46FG3mq8X-XK50efdwdbV16B7GI5_kDCedjviXSn4,4560
|
|
35
37
|
invokeai/app/invocations/ideal_size.py,sha256=LyowqAWwv11p9diFQDY5GyUs3jLzj0dgTxBov_WlrLI,2810
|
|
36
38
|
invokeai/app/invocations/image.py,sha256=mURKycFb6V6TNaAkDNNh3fMNwFhHjCjIgVrI6uq4roU,38635
|
|
@@ -38,7 +40,7 @@ invokeai/app/invocations/image_to_latents.py,sha256=YyAnggAf_nCZf7NjwQC9ifvRfxLC
|
|
|
38
40
|
invokeai/app/invocations/infill.py,sha256=asHYTo_pmFyBpn-s4gynIcw1KNjcpoRQnm25mJ9lcD4,7035
|
|
39
41
|
invokeai/app/invocations/ip_adapter.py,sha256=xmbx56inBZuyfUF3jnT3bUvLzJm_MKYBzZREl4rGFqo,7825
|
|
40
42
|
invokeai/app/invocations/latents_to_image.py,sha256=T42-aeT8798ITECx_EvK-JqS09WM6yfqDdcJ8q9IWuc,4932
|
|
41
|
-
invokeai/app/invocations/mask.py,sha256=
|
|
43
|
+
invokeai/app/invocations/mask.py,sha256=yDNifUBMkKLa53Hy-k3wOFpDp3uVEvqDKCW-sFX5aww,5553
|
|
42
44
|
invokeai/app/invocations/math.py,sha256=y00c6frIIowhN2lwTHYDjnuozNAtHGBa8_7FfHcRxLk,10441
|
|
43
45
|
invokeai/app/invocations/metadata.py,sha256=ZrdeeDBpbq03dLqCykhkRc0y8LHN3sA3UQXP86UqQCA,11467
|
|
44
46
|
invokeai/app/invocations/model.py,sha256=swyqakKT_sMQv60-qNJTWuRD8kD0_l8wnLffo5ddKDU,22858
|
|
@@ -119,7 +121,7 @@ invokeai/app/services/model_images/model_images_common.py,sha256=41pMo4QrGEj5jQr
|
|
|
119
121
|
invokeai/app/services/model_images/model_images_default.py,sha256=DguPR-8dqZWto2zTKuTAPqrV5SlTmw3M7MKO1EE_bQs,2739
|
|
120
122
|
invokeai/app/services/model_install/__init__.py,sha256=Ro5jmXL0eSD7iuyFaeN_wMn90NuAzU1Xl8FKq1EtgKs,703
|
|
121
123
|
invokeai/app/services/model_install/model_install_base.py,sha256=qSVPNBXfx2NJnOaQz2N1w624xDeEyhw_2wDQmuJPlGs,10015
|
|
122
|
-
invokeai/app/services/model_install/model_install_common.py,sha256=
|
|
124
|
+
invokeai/app/services/model_install/model_install_common.py,sha256=DyF2YgFk9q8EKNvFLxNOygiHu4EB_IaJwPHr3GXvBv0,8684
|
|
123
125
|
invokeai/app/services/model_install/model_install_default.py,sha256=clc2UIXkHxkWipXsuoj0LqgwWVJcjHEaUFBOy99Otno,41437
|
|
124
126
|
invokeai/app/services/model_load/__init__.py,sha256=qRbpqIvtfHQg08apIc-8YEbBknB6VCS2ESsdB_gq88w,277
|
|
125
127
|
invokeai/app/services/model_load/model_load_base.py,sha256=ieDxiWYl4fYlwSBCAV0iTbDDV5IrVYbQmH9zUyfUwXk,2035
|
|
@@ -149,7 +151,7 @@ invokeai/app/services/session_queue/session_queue_common.py,sha256=u-GO4zZbVRuz4
|
|
|
149
151
|
invokeai/app/services/session_queue/session_queue_sqlite.py,sha256=bvXCqEawZodDPesw0usT00_y3PFw9vcQPodoU2CmzEs,23817
|
|
150
152
|
invokeai/app/services/shared/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
151
153
|
invokeai/app/services/shared/graph.py,sha256=dSQ2u5gvksjm1wV7_5n2w7_gtdhXkbNAKkdgVg9wcUE,45956
|
|
152
|
-
invokeai/app/services/shared/invocation_context.py,sha256=
|
|
154
|
+
invokeai/app/services/shared/invocation_context.py,sha256=4BcumkRyN0f-85oG6Sg1s-_AXcTruBo6rJwQtRrd2-4,24142
|
|
153
155
|
invokeai/app/services/shared/pagination.py,sha256=wub_dZUaOEydHWeB7OKAqDSp0bOM9blkoewgBt1hhsE,1382
|
|
154
156
|
invokeai/app/services/shared/sqlite/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
155
157
|
invokeai/app/services/shared/sqlite/sqlite_common.py,sha256=k116HV8soBRBHzj_rXiziZyzaXlrZoM00M_FssnJOZ0,201
|
|
@@ -209,8 +211,9 @@ invokeai/app/services/workflow_records/workflow_records_base.py,sha256=L-EgeXQbE
|
|
|
209
211
|
invokeai/app/services/workflow_records/workflow_records_common.py,sha256=YsqF3BWCaPX1eMWIiFI-IQrUfYwP7_lz3OmpGFJLXRQ,4135
|
|
210
212
|
invokeai/app/services/workflow_records/workflow_records_sqlite.py,sha256=jmfqNhRE2uHArobgszy7Sk4AIcRqySSYYRIRQ-E9J0Q,8618
|
|
211
213
|
invokeai/app/services/workflow_records/default_workflows/ESRGAN Upscaling with Canny ControlNet.json,sha256=K-blUzhyR6Wi2qxX_4C8yh4fK3bW1MWHKpQ8DbsNGC0,24038
|
|
214
|
+
invokeai/app/services/workflow_records/default_workflows/FLUX Image to Image.json,sha256=ZjxQb7aQVHGRNTk8w8nEMnAJjK9UD40ff-hwsAeu0Lg,12162
|
|
212
215
|
invokeai/app/services/workflow_records/default_workflows/Face Detailer with IP-Adapter & Canny (See Note in Details).json,sha256=Vmd5xOCZWKaAebIdiwSwlDd2hCtIHYXtmG0cXW7a1qk,40964
|
|
213
|
-
invokeai/app/services/workflow_records/default_workflows/Flux Text to Image.json,sha256=
|
|
216
|
+
invokeai/app/services/workflow_records/default_workflows/Flux Text to Image.json,sha256=4zVia14WGHslqYrEiOF1EFwlN_wx5TxhieHn6Ly3Ees,9248
|
|
214
217
|
invokeai/app/services/workflow_records/default_workflows/Multi ControlNet (Canny & Depth).json,sha256=K4KOWTYYnOrOhwxWE_GIjsXKhsAY2YxL40uBBGw-TBw,28538
|
|
215
218
|
invokeai/app/services/workflow_records/default_workflows/MultiDiffusion SD1.5.json,sha256=tz5p5Io3VXafpSCA2WORx4wYex00KqUsxqDJUKWZmXs,39959
|
|
216
219
|
invokeai/app/services/workflow_records/default_workflows/MultiDiffusion SDXL.json,sha256=prbM2KQBN8FEhJeS3Ka3sV66QC7Fba9R-Wl24kMNuH8,46050
|
|
@@ -228,7 +231,7 @@ invokeai/app/util/metaenum.py,sha256=KnfyPbjOErSLJ2unAWVsBQP18drz1NnKCMx9fj__VFc
|
|
|
228
231
|
invokeai/app/util/misc.py,sha256=vbxRgJ1xA_GBQqdfyrqPaLJHckm245poeRwrZfQNxWA,849
|
|
229
232
|
invokeai/app/util/model_exclude_null.py,sha256=LpQCptxLoyNBp75ouk8nXUvrRlHEdAnnsao7UVMPD9I,678
|
|
230
233
|
invokeai/app/util/profiler.py,sha256=uj82a91VkaKUCzJdf47w5Q7M_t1pZwl6ded89b1W204,2201
|
|
231
|
-
invokeai/app/util/step_callback.py,sha256=
|
|
234
|
+
invokeai/app/util/step_callback.py,sha256=ZIO849iFIBr3xm7AOKsIvfDOAcW7bA29EYusyoNL1Eo,5337
|
|
232
235
|
invokeai/app/util/suppress_output.py,sha256=ExA3cTbWY09s7-vgWnhaTJUXoG2d3L9-YXYrGgz1WTU,530
|
|
233
236
|
invokeai/app/util/thumbnails.py,sha256=VKnKfkoB6zsE74Z7dQj6bcY2uu9qPl0Qrm4OpcPL-jY,468
|
|
234
237
|
invokeai/app/util/ti_utils.py,sha256=0WsaQ5RNBvn5woo5Pt74QXdXGzXSlspE2cLEmFLs13k,2069
|
|
@@ -239,11 +242,13 @@ invokeai/backend/model_patcher.py,sha256=A_Y-l-c9oSW5_na_jtgyTfxL6qjkNDYKNn-z32F
|
|
|
239
242
|
invokeai/backend/raw_model.py,sha256=g7RfS65MHixII0uB0bczftXa6XZ2AJrjGes6vBdtWDY,778
|
|
240
243
|
invokeai/backend/spandrel_image_to_image_model.py,sha256=8LEPnxmsq49VdDpJuM8k_sT22owSQU86wzYeyvI8mQc,5237
|
|
241
244
|
invokeai/backend/textual_inversion.py,sha256=ELJpRptFlxZyJSdCxN1-p6BQV_8l9-j6_4VNDSDdtY4,5434
|
|
245
|
+
invokeai/backend/flux/denoise.py,sha256=r9leZD-5kX4cfgtw978fj_E8RnR5d_oeugGIQxa9l7A,1689
|
|
246
|
+
invokeai/backend/flux/inpaint_extension.py,sha256=RYX5DT_WXFB6LYo7FO0Ib5C72ScadyYy5vsHMAyXwRs,1796
|
|
242
247
|
invokeai/backend/flux/math.py,sha256=HUg2_9D8gTWbBCk83Kbj4YtVpbed1jQp-FfFo_zduAQ,1237
|
|
243
248
|
invokeai/backend/flux/model.py,sha256=7_lwJ-U_yvlqoaF9fSr_pp_oZ7-IY76FNNSbKS16ABo,3800
|
|
244
|
-
invokeai/backend/flux/
|
|
249
|
+
invokeai/backend/flux/sampling_utils.py,sha256=orJwo2J-HoKp3qJX5Tnk01zRlvHioWZMb0hNtXJXVTo,4649
|
|
245
250
|
invokeai/backend/flux/util.py,sha256=EhTyFi5D9ZwXBtCa3t5IlfxFFAlRfWzD72SnaJ_iUlY,1537
|
|
246
|
-
invokeai/backend/flux/modules/autoencoder.py,sha256=
|
|
251
|
+
invokeai/backend/flux/modules/autoencoder.py,sha256=Iq9zs-H5fVBt4rWUYfoTsC0KjAb-0s2Y7Yhwjj2Yl7o,11435
|
|
247
252
|
invokeai/backend/flux/modules/conditioner.py,sha256=Qg8LtxBj5vc8F620MoR3-PkZKpn5w-u4JpKlbLlKdZI,1186
|
|
248
253
|
invokeai/backend/flux/modules/layers.py,sha256=bwtnTuYqqwgiSDnoxcEMUbApGdLZ0RvJsrGfgqWIz8Q,9442
|
|
249
254
|
invokeai/backend/image_util/__init__.py,sha256=RobCteLw_1EBJf6auQYQOlQT-uVmSqbNzImQIaSl4eI,395
|
|
@@ -286,23 +291,23 @@ invokeai/backend/model_hash/model_hash.py,sha256=Bh0GsTWDwCRI7lrWdqEsgqLsiAqU3EC
|
|
|
286
291
|
invokeai/backend/model_manager/__init__.py,sha256=Lp4UYH64YM7TrVeFAVswjWSJyuhJCjOzN-aUkTXbHF0,868
|
|
287
292
|
invokeai/backend/model_manager/config.py,sha256=wwa0cIhTwPH9waW-cdcQ71x0ISJwdnPUkiu98-kUolQ,18425
|
|
288
293
|
invokeai/backend/model_manager/merge.py,sha256=Dk6uGfiEDWeHrwmSpSxNKDlQLHGdmnjczJ4KwpVlUsI,7963
|
|
289
|
-
invokeai/backend/model_manager/probe.py,sha256=
|
|
294
|
+
invokeai/backend/model_manager/probe.py,sha256=wLszszR6fSMQLzwQv2bkiTXDRfwFosoFoioeD16ns5g,41711
|
|
290
295
|
invokeai/backend/model_manager/search.py,sha256=OCRBOyvl2G1RH3IVJf4lyiAMGLUG0IhwpN0V99ATt6o,4893
|
|
291
296
|
invokeai/backend/model_manager/starter_models.py,sha256=DaZZ8AAewoIq8Cd_Bi4lt9NRjgUt3z7HKboTu-EXBeE,20903
|
|
292
297
|
invokeai/backend/model_manager/load/__init__.py,sha256=9x2aYphy8NcdyElCqJFTy5WxKqVEtrYmsw0qRDEsxL4,1023
|
|
293
298
|
invokeai/backend/model_manager/load/load_base.py,sha256=YDK1_n1VLjL6q-PgG4OwirKmA-3eD_e9wUvxSYDn6Yw,4784
|
|
294
|
-
invokeai/backend/model_manager/load/load_default.py,sha256=
|
|
299
|
+
invokeai/backend/model_manager/load/load_default.py,sha256=7I8Ji1e1DKhBx3GXFsze8vm94DD6YV0BPVaQCGXfT-k,4151
|
|
295
300
|
invokeai/backend/model_manager/load/memory_snapshot.py,sha256=YChwCTvA804__FJ7BUC2gIvQ9dcEpAlRN3H3N7uNqb0,4079
|
|
296
301
|
invokeai/backend/model_manager/load/model_loader_registry.py,sha256=GS1Q6w1bmUCOmE8aTCQqua6Jq0CEoTfDHZrXWU4U8IE,4014
|
|
297
302
|
invokeai/backend/model_manager/load/model_util.py,sha256=W3JdPA1t-ZVzQYZcHMCtiXW-Yx-hEmrPKxSqPS-OxBY,6129
|
|
298
303
|
invokeai/backend/model_manager/load/optimizations.py,sha256=cwGXg5tBv-w5UGKaO5u2o8x6kuKyWC4cPn-EG5CwllQ,1392
|
|
299
304
|
invokeai/backend/model_manager/load/model_cache/__init__.py,sha256=8vmdxdzgTNQQIrEitdbZL3oA5_zGTdIwcfu4_7FdWCM,217
|
|
300
|
-
invokeai/backend/model_manager/load/model_cache/model_cache_base.py,sha256=
|
|
301
|
-
invokeai/backend/model_manager/load/model_cache/model_cache_default.py,sha256=
|
|
305
|
+
invokeai/backend/model_manager/load/model_cache/model_cache_base.py,sha256=Lbr0wCB2HWaho0QP-pKoWWtbbqpRu-CnCP27C_TDS2o,6442
|
|
306
|
+
invokeai/backend/model_manager/load/model_cache/model_cache_default.py,sha256=N9Re2TmaLaHHdBT9KyX5ofnNvcl2NBD7VdWvme984Yo,18355
|
|
302
307
|
invokeai/backend/model_manager/load/model_cache/model_locker.py,sha256=Nhc80hZ43OGdvYJdufYEMWP9D0k8eTBjYhApEb0Rgc4,2190
|
|
303
308
|
invokeai/backend/model_manager/load/model_loaders/__init__.py,sha256=EDgdUKmYMiisOPDHtaRU2uwbfSlLbU6hoQybJqVgS7k,37
|
|
304
309
|
invokeai/backend/model_manager/load/model_loaders/controlnet.py,sha256=PBvWgeGpgLmE1CovUrN8gDEpssCHmb5orfwAiOYCj3U,1347
|
|
305
|
-
invokeai/backend/model_manager/load/model_loaders/flux.py,sha256=
|
|
310
|
+
invokeai/backend/model_manager/load/model_loaders/flux.py,sha256=tiP0vZ_7kDkBcg-qebi5-SA7LIWESrCAo13InD072aE,9774
|
|
306
311
|
invokeai/backend/model_manager/load/model_loaders/generic_diffusers.py,sha256=9cpb8uo810Rhs831hiZsNd_rq1smm064e_tPdmfah90,4881
|
|
307
312
|
invokeai/backend/model_manager/load/model_loaders/ip_adapter.py,sha256=cveZ8G9uoZLvPgL5gi1TOWUQCOZ45lkYGV3X50tqx9c,1327
|
|
308
313
|
invokeai/backend/model_manager/load/model_loaders/lora.py,sha256=N6JeCddj5iXoTEwL5Gdawn2BSAogxFQTCYqZnMkUayE,2580
|
|
@@ -317,7 +322,7 @@ invokeai/backend/model_manager/metadata/fetch/__init__.py,sha256=4qbbpEPEGbiO6MP
|
|
|
317
322
|
invokeai/backend/model_manager/metadata/fetch/fetch_base.py,sha256=Z1pwtCfK_aJY0k8I7S30Bq21Ex04cbO5_8gZAduTs3s,2283
|
|
318
323
|
invokeai/backend/model_manager/metadata/fetch/huggingface.py,sha256=6WjRYd_8G_gnuaCZ3kUVFT9F-JzxCifpQMMFV3b-Yyw,4862
|
|
319
324
|
invokeai/backend/model_manager/util/libc_util.py,sha256=L6K94lsb2LC8zCf-SX-qHPk1IX7Jkj88-Az7OEinWvQ,3176
|
|
320
|
-
invokeai/backend/model_manager/util/model_util.py,sha256=
|
|
325
|
+
invokeai/backend/model_manager/util/model_util.py,sha256=VWGulcqBmMQ80SV20cVB1rNcwQp0M7GC7vhlPM_WtQ0,6268
|
|
321
326
|
invokeai/backend/model_manager/util/select_hf_files.py,sha256=O4Y-9PuXtiqe2UuRlKnh2Rl-1mxtkZO5DilkLBVKnJE,7731
|
|
322
327
|
invokeai/backend/onnx/onnx_runtime.py,sha256=2x1VY0TD_rOr0EyHL9XnYnL2OrDptLKu-v6ba5xKVHc,9341
|
|
323
328
|
invokeai/backend/quantization/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -391,12 +396,12 @@ invokeai/frontend/cli/arg_parser.py,sha256=6_y2ZB0iDmMvy2b_MJRWSdlqW1hToptmOoFl0
|
|
|
391
396
|
invokeai/frontend/install/__init__.py,sha256=aAlRfyPocCx3Bm7NRB2I3Y_88Ug5omU4M5thFiNaw1A,57
|
|
392
397
|
invokeai/frontend/install/import_images.py,sha256=wddGRowy3HQGEnRHTGAkOA1fhzPz9qT4IbGoZqX9xlc,34417
|
|
393
398
|
invokeai/frontend/web/__init__.py,sha256=H4ye3hqaqVMEuzTnUNGeYBSHDhYLDcUWzS1XOr1zUWw,54
|
|
394
|
-
invokeai/frontend/web/dist/index.html,sha256=
|
|
399
|
+
invokeai/frontend/web/dist/index.html,sha256=iyvzhXSJYroJ9hhSm6lhkB-i9Gx8HGHmiZHyYGj1S1A,682
|
|
400
|
+
invokeai/frontend/web/dist/assets/App-D1Y-WRqk.js,sha256=xAgbZToIwxneQ5cAdeY4cxn40sdiBZFov2Nf8jEzw9k,773590
|
|
395
401
|
invokeai/frontend/web/dist/assets/App-DEu4J2pT.css,sha256=HLO_vKmG5ANNQg2BEeOD8KYUvV8sL3rH0i2S1Cwe4T0,7322
|
|
396
|
-
invokeai/frontend/web/dist/assets/App-DUFQH-Kw.js,sha256=RO5m2WULt0zjE258xDZuBopTBSbIa8x9GfWmP-4arz8,767330
|
|
397
402
|
invokeai/frontend/web/dist/assets/ThemeLocaleProvider-B2NxUfIp.css,sha256=AX2miGfzdvzaNF5JUMZdLSevO2nzgbeG8CvPMIBzQMs,15298
|
|
398
|
-
invokeai/frontend/web/dist/assets/ThemeLocaleProvider-
|
|
399
|
-
invokeai/frontend/web/dist/assets/index-
|
|
403
|
+
invokeai/frontend/web/dist/assets/ThemeLocaleProvider-CmO3BZJ7.js,sha256=oWa_bymtCrpSJ-nl3lwZekhOnRI-wIR1Goz0gx-sPQw,605
|
|
404
|
+
invokeai/frontend/web/dist/assets/index-Ax6e2dHX.js,sha256=XFEuNKsSDiNw-9taNT5bUpEdhfJwrG7sEhowqU_-Eas,2145688
|
|
400
405
|
invokeai/frontend/web/dist/assets/inter-cyrillic-ext-wght-normal-B2xhLi22.woff2,sha256=wpY9x2Wg6ArPJplunuyuJEXzN4PVPGFdwBSovnKqwXA,25888
|
|
401
406
|
invokeai/frontend/web/dist/assets/inter-cyrillic-wght-normal-CMZtQduZ.woff2,sha256=YswB2u9yw-p2olhEU2jS9KuNBakfkcU_0S98QuMyWUI,18740
|
|
402
407
|
invokeai/frontend/web/dist/assets/inter-greek-ext-wght-normal-CGAr0uHJ.woff2,sha256=akF8_kBanIieL9Y6ZyibhaaIaBwPpk8SFedKwUcaNv4,11200
|
|
@@ -426,12 +431,11 @@ invokeai/frontend/web/dist/assets/images/invoke-tag-sml.svg,sha256=I8Ipf11JrS0HD
|
|
|
426
431
|
invokeai/frontend/web/dist/assets/images/invoke-wordmark-charcoal.svg,sha256=oG0MdddDQTt-GdG5h-8rRvAeOWSIke4TkzDv0joqRck,3143
|
|
427
432
|
invokeai/frontend/web/dist/assets/images/invoke-wordmark-white.svg,sha256=RQjDItyugULkBv7elULuJRle0mq3Ie88wxyAWAu-Swo,3131
|
|
428
433
|
invokeai/frontend/web/dist/assets/images/mask.svg,sha256=NJoOH1kug-EfPe0DbLu2F0Qk5hBql47piDoltPhrO6U,3829
|
|
429
|
-
invokeai/frontend/web/dist/assets/images/transparent_bg.png,sha256=5pXRBEomY7QL_qs7lWeJxfnOBgZ3cC2k-Q6Gvz8tVGM,1736
|
|
430
434
|
invokeai/frontend/web/dist/locales/ar.json,sha256=tfE9ecaXVwPjLe6RK1WxypBPJnjiw2oF6-MSSPyEU0M,17917
|
|
431
435
|
invokeai/frontend/web/dist/locales/az.json,sha256=gssN5Q1lHAHJQj4-qvjg6dP3Sh-ZPNb6pb6FLE7xTxk,62
|
|
432
436
|
invokeai/frontend/web/dist/locales/bg.json,sha256=BlR-CNtSfdYBxKpPNry8czGAHryF1kqC64CEft-nk7w,2797
|
|
433
437
|
invokeai/frontend/web/dist/locales/de.json,sha256=I0a4pKjvNYVFBB92rg9_vxhjpLZiBvAffpCNlsNtBdo,53387
|
|
434
|
-
invokeai/frontend/web/dist/locales/en.json,sha256=
|
|
438
|
+
invokeai/frontend/web/dist/locales/en.json,sha256=XilrfewU6gV2kAr90qiPcSNZIk2xATcTZxo6Crsaifo,87394
|
|
435
439
|
invokeai/frontend/web/dist/locales/es.json,sha256=cM0Y11TD3yagTWW-UEWNsl3UJSczQ9sjXtYKYzdAh1Y,28050
|
|
436
440
|
invokeai/frontend/web/dist/locales/fi.json,sha256=m3l-thXyvRoGIeRbo99AziHPhx5nkcpQEiELOHGeqrc,1725
|
|
437
441
|
invokeai/frontend/web/dist/locales/fr.json,sha256=8iUSmE3g44tFPiOw6sjLbK2ZMHksvIaHzU-FXwCorbs,19666
|
|
@@ -457,12 +461,12 @@ invokeai/frontend/web/scripts/clean_translations.py,sha256=-3KLLgb8fvvp0yglxKIkj
|
|
|
457
461
|
invokeai/frontend/web/static/docs/invoke-favicon-docs.svg,sha256=2DfWaNhjgplnQK8V79yXjQ34JDCk94ZPH29CiTk90y8,779
|
|
458
462
|
invokeai/invocation_api/__init__.py,sha256=PJgu7yu-0hukEyAHOm0sfw4kPZ2OvbAnXI6n7NtIt4A,5339
|
|
459
463
|
invokeai/version/__init__.py,sha256=22G4uBmmfLuldDclGKINkVS-rgPfNFQUJH_ag8m_OcM,529
|
|
460
|
-
invokeai/version/invokeai_version.py,sha256=
|
|
461
|
-
InvokeAI-4.2.9.
|
|
462
|
-
InvokeAI-4.2.9.
|
|
463
|
-
InvokeAI-4.2.9.
|
|
464
|
-
InvokeAI-4.2.9.
|
|
465
|
-
InvokeAI-4.2.9.
|
|
466
|
-
InvokeAI-4.2.9.
|
|
467
|
-
InvokeAI-4.2.9.
|
|
468
|
-
InvokeAI-4.2.9.
|
|
464
|
+
invokeai/version/invokeai_version.py,sha256=EefxNOoLhpGmnAVgvxcJWgm_9_Yz8x5L9jU9IyO78NY,28
|
|
465
|
+
InvokeAI-4.2.9.dev12.dist-info/LICENSE,sha256=OTAVifLLp_QCl8faBcfl0WT3BMqpeWZbEXw1MgPJzwM,10146
|
|
466
|
+
InvokeAI-4.2.9.dev12.dist-info/LICENSE-SD1+SD2.txt,sha256=GbsztR5dRQiKsmF33NYkGL-GFJhSc2oG9gQPwzo-7Tg,14555
|
|
467
|
+
InvokeAI-4.2.9.dev12.dist-info/LICENSE-SDXL.txt,sha256=JV_wPIqRG79iLCB8HrwY1J8jBimjUblcUxfnDbUMaqs,14213
|
|
468
|
+
InvokeAI-4.2.9.dev12.dist-info/METADATA,sha256=EDTjuuecck5TJ2E2EzJcuvFlS8N3dBl6Rcqzme71vbc,27029
|
|
469
|
+
InvokeAI-4.2.9.dev12.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
|
|
470
|
+
InvokeAI-4.2.9.dev12.dist-info/entry_points.txt,sha256=MyuHYE_-ewdP-nVIcsITkhCNq7q0HNkavfd49TfNYho,62
|
|
471
|
+
InvokeAI-4.2.9.dev12.dist-info/top_level.txt,sha256=69I61eoKb6LXiuo6Zz2l_6lhY1eRGBCqP8i9SMqp9Gg,9
|
|
472
|
+
InvokeAI-4.2.9.dev12.dist-info/RECORD,,
|
|
@@ -3,8 +3,10 @@
|
|
|
3
3
|
|
|
4
4
|
import io
|
|
5
5
|
import pathlib
|
|
6
|
+
import shutil
|
|
6
7
|
import traceback
|
|
7
8
|
from copy import deepcopy
|
|
9
|
+
from enum import Enum
|
|
8
10
|
from tempfile import TemporaryDirectory
|
|
9
11
|
from typing import List, Optional, Type
|
|
10
12
|
|
|
@@ -17,6 +19,7 @@ from starlette.exceptions import HTTPException
|
|
|
17
19
|
from typing_extensions import Annotated
|
|
18
20
|
|
|
19
21
|
from invokeai.app.api.dependencies import ApiDependencies
|
|
22
|
+
from invokeai.app.services.config import get_config
|
|
20
23
|
from invokeai.app.services.model_images.model_images_common import ModelImageFileNotFoundException
|
|
21
24
|
from invokeai.app.services.model_install.model_install_common import ModelInstallJob
|
|
22
25
|
from invokeai.app.services.model_records import (
|
|
@@ -31,6 +34,7 @@ from invokeai.backend.model_manager.config import (
|
|
|
31
34
|
ModelFormat,
|
|
32
35
|
ModelType,
|
|
33
36
|
)
|
|
37
|
+
from invokeai.backend.model_manager.load.model_cache.model_cache_base import CacheStats
|
|
34
38
|
from invokeai.backend.model_manager.metadata.fetch.huggingface import HuggingFaceMetadataFetch
|
|
35
39
|
from invokeai.backend.model_manager.metadata.metadata_base import ModelMetadataWithFiles, UnknownMetadataException
|
|
36
40
|
from invokeai.backend.model_manager.search import ModelSearch
|
|
@@ -50,6 +54,13 @@ class ModelsList(BaseModel):
|
|
|
50
54
|
model_config = ConfigDict(use_enum_values=True)
|
|
51
55
|
|
|
52
56
|
|
|
57
|
+
class CacheType(str, Enum):
|
|
58
|
+
"""Cache type - one of vram or ram."""
|
|
59
|
+
|
|
60
|
+
RAM = "RAM"
|
|
61
|
+
VRAM = "VRAM"
|
|
62
|
+
|
|
63
|
+
|
|
53
64
|
def add_cover_image_to_model_config(config: AnyModelConfig, dependencies: Type[ApiDependencies]) -> AnyModelConfig:
|
|
54
65
|
"""Add a cover image URL to a model configuration."""
|
|
55
66
|
cover_image = dependencies.invoker.services.model_images.get_url(config.key)
|
|
@@ -797,3 +808,83 @@ async def get_starter_models() -> list[StarterModel]:
|
|
|
797
808
|
model.dependencies = missing_deps
|
|
798
809
|
|
|
799
810
|
return starter_models
|
|
811
|
+
|
|
812
|
+
|
|
813
|
+
@model_manager_router.get(
|
|
814
|
+
"/model_cache",
|
|
815
|
+
operation_id="get_cache_size",
|
|
816
|
+
response_model=float,
|
|
817
|
+
summary="Get maximum size of model manager RAM or VRAM cache.",
|
|
818
|
+
)
|
|
819
|
+
async def get_cache_size(cache_type: CacheType = Query(description="The cache type", default=CacheType.RAM)) -> float:
|
|
820
|
+
"""Return the current RAM or VRAM cache size setting (in GB)."""
|
|
821
|
+
cache = ApiDependencies.invoker.services.model_manager.load.ram_cache
|
|
822
|
+
value = 0.0
|
|
823
|
+
if cache_type == CacheType.RAM:
|
|
824
|
+
value = cache.max_cache_size
|
|
825
|
+
elif cache_type == CacheType.VRAM:
|
|
826
|
+
value = cache.max_vram_cache_size
|
|
827
|
+
return value
|
|
828
|
+
|
|
829
|
+
|
|
830
|
+
@model_manager_router.put(
|
|
831
|
+
"/model_cache",
|
|
832
|
+
operation_id="set_cache_size",
|
|
833
|
+
response_model=float,
|
|
834
|
+
summary="Set maximum size of model manager RAM or VRAM cache, optionally writing new value out to invokeai.yaml config file.",
|
|
835
|
+
)
|
|
836
|
+
async def set_cache_size(
|
|
837
|
+
value: float = Query(description="The new value for the maximum cache size"),
|
|
838
|
+
cache_type: CacheType = Query(description="The cache type", default=CacheType.RAM),
|
|
839
|
+
persist: bool = Query(description="Write new value out to invokeai.yaml", default=False),
|
|
840
|
+
) -> float:
|
|
841
|
+
"""Set the current RAM or VRAM cache size setting (in GB). ."""
|
|
842
|
+
cache = ApiDependencies.invoker.services.model_manager.load.ram_cache
|
|
843
|
+
app_config = get_config()
|
|
844
|
+
# Record initial state.
|
|
845
|
+
vram_old = app_config.vram
|
|
846
|
+
ram_old = app_config.ram
|
|
847
|
+
|
|
848
|
+
# Prepare target state.
|
|
849
|
+
vram_new = vram_old
|
|
850
|
+
ram_new = ram_old
|
|
851
|
+
if cache_type == CacheType.RAM:
|
|
852
|
+
ram_new = value
|
|
853
|
+
elif cache_type == CacheType.VRAM:
|
|
854
|
+
vram_new = value
|
|
855
|
+
else:
|
|
856
|
+
raise ValueError(f"Unexpected {cache_type=}.")
|
|
857
|
+
|
|
858
|
+
config_path = app_config.config_file_path
|
|
859
|
+
new_config_path = config_path.with_suffix(".yaml.new")
|
|
860
|
+
|
|
861
|
+
try:
|
|
862
|
+
# Try to apply the target state.
|
|
863
|
+
cache.max_vram_cache_size = vram_new
|
|
864
|
+
cache.max_cache_size = ram_new
|
|
865
|
+
app_config.ram = ram_new
|
|
866
|
+
app_config.vram = vram_new
|
|
867
|
+
if persist:
|
|
868
|
+
app_config.write_file(new_config_path)
|
|
869
|
+
shutil.move(new_config_path, config_path)
|
|
870
|
+
except Exception as e:
|
|
871
|
+
# If there was a failure, restore the initial state.
|
|
872
|
+
cache.max_cache_size = ram_old
|
|
873
|
+
cache.max_vram_cache_size = vram_old
|
|
874
|
+
app_config.ram = ram_old
|
|
875
|
+
app_config.vram = vram_old
|
|
876
|
+
|
|
877
|
+
raise RuntimeError("Failed to update cache size") from e
|
|
878
|
+
return value
|
|
879
|
+
|
|
880
|
+
|
|
881
|
+
@model_manager_router.get(
|
|
882
|
+
"/stats",
|
|
883
|
+
operation_id="get_stats",
|
|
884
|
+
response_model=Optional[CacheStats],
|
|
885
|
+
summary="Get model manager RAM cache performance statistics.",
|
|
886
|
+
)
|
|
887
|
+
async def get_stats() -> Optional[CacheStats]:
|
|
888
|
+
"""Return performance statistics on the model manager's RAM cache. Will return null if no models have been loaded."""
|
|
889
|
+
|
|
890
|
+
return ApiDependencies.invoker.services.model_manager.load.ram_cache.stats
|
|
@@ -185,7 +185,7 @@ class DenoiseLatentsInvocation(BaseInvocation):
|
|
|
185
185
|
)
|
|
186
186
|
denoise_mask: Optional[DenoiseMaskField] = InputField(
|
|
187
187
|
default=None,
|
|
188
|
-
description=FieldDescriptions.
|
|
188
|
+
description=FieldDescriptions.denoise_mask,
|
|
189
189
|
input=Input.Connection,
|
|
190
190
|
ui_order=8,
|
|
191
191
|
)
|
|
@@ -181,7 +181,7 @@ class FieldDescriptions:
|
|
|
181
181
|
)
|
|
182
182
|
num_1 = "The first number"
|
|
183
183
|
num_2 = "The second number"
|
|
184
|
-
|
|
184
|
+
denoise_mask = "A mask of the region to apply the denoising process to."
|
|
185
185
|
board = "The board to save the image to"
|
|
186
186
|
image = "The image to process"
|
|
187
187
|
tile_size = "Tile size"
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
from typing import Callable, Optional
|
|
2
|
+
|
|
3
|
+
import torch
|
|
4
|
+
import torchvision.transforms as tv_transforms
|
|
5
|
+
from torchvision.transforms.functional import resize as tv_resize
|
|
6
|
+
|
|
7
|
+
from invokeai.app.invocations.baseinvocation import BaseInvocation, Classification, invocation
|
|
8
|
+
from invokeai.app.invocations.fields import (
|
|
9
|
+
DenoiseMaskField,
|
|
10
|
+
FieldDescriptions,
|
|
11
|
+
FluxConditioningField,
|
|
12
|
+
Input,
|
|
13
|
+
InputField,
|
|
14
|
+
LatentsField,
|
|
15
|
+
WithBoard,
|
|
16
|
+
WithMetadata,
|
|
17
|
+
)
|
|
18
|
+
from invokeai.app.invocations.model import TransformerField
|
|
19
|
+
from invokeai.app.invocations.primitives import LatentsOutput
|
|
20
|
+
from invokeai.app.services.shared.invocation_context import InvocationContext
|
|
21
|
+
from invokeai.backend.flux.denoise import denoise
|
|
22
|
+
from invokeai.backend.flux.inpaint_extension import InpaintExtension
|
|
23
|
+
from invokeai.backend.flux.model import Flux
|
|
24
|
+
from invokeai.backend.flux.sampling_utils import (
|
|
25
|
+
clip_timestep_schedule,
|
|
26
|
+
generate_img_ids,
|
|
27
|
+
get_noise,
|
|
28
|
+
get_schedule,
|
|
29
|
+
pack,
|
|
30
|
+
unpack,
|
|
31
|
+
)
|
|
32
|
+
from invokeai.backend.stable_diffusion.diffusers_pipeline import PipelineIntermediateState
|
|
33
|
+
from invokeai.backend.stable_diffusion.diffusion.conditioning_data import FLUXConditioningInfo
|
|
34
|
+
from invokeai.backend.util.devices import TorchDevice
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
@invocation(
|
|
38
|
+
"flux_denoise",
|
|
39
|
+
title="FLUX Denoise",
|
|
40
|
+
tags=["image", "flux"],
|
|
41
|
+
category="image",
|
|
42
|
+
version="1.0.0",
|
|
43
|
+
classification=Classification.Prototype,
|
|
44
|
+
)
|
|
45
|
+
class FluxDenoiseInvocation(BaseInvocation, WithMetadata, WithBoard):
|
|
46
|
+
"""Run denoising process with a FLUX transformer model."""
|
|
47
|
+
|
|
48
|
+
# If latents is provided, this means we are doing image-to-image.
|
|
49
|
+
latents: Optional[LatentsField] = InputField(
|
|
50
|
+
default=None,
|
|
51
|
+
description=FieldDescriptions.latents,
|
|
52
|
+
input=Input.Connection,
|
|
53
|
+
)
|
|
54
|
+
# denoise_mask is used for image-to-image inpainting. Only the masked region is modified.
|
|
55
|
+
denoise_mask: Optional[DenoiseMaskField] = InputField(
|
|
56
|
+
default=None,
|
|
57
|
+
description=FieldDescriptions.denoise_mask,
|
|
58
|
+
input=Input.Connection,
|
|
59
|
+
)
|
|
60
|
+
denoising_start: float = InputField(
|
|
61
|
+
default=0.0,
|
|
62
|
+
ge=0,
|
|
63
|
+
le=1,
|
|
64
|
+
description=FieldDescriptions.denoising_start,
|
|
65
|
+
)
|
|
66
|
+
denoising_end: float = InputField(default=1.0, ge=0, le=1, description=FieldDescriptions.denoising_end)
|
|
67
|
+
transformer: TransformerField = InputField(
|
|
68
|
+
description=FieldDescriptions.flux_model,
|
|
69
|
+
input=Input.Connection,
|
|
70
|
+
title="Transformer",
|
|
71
|
+
)
|
|
72
|
+
positive_text_conditioning: FluxConditioningField = InputField(
|
|
73
|
+
description=FieldDescriptions.positive_cond, input=Input.Connection
|
|
74
|
+
)
|
|
75
|
+
width: int = InputField(default=1024, multiple_of=16, description="Width of the generated image.")
|
|
76
|
+
height: int = InputField(default=1024, multiple_of=16, description="Height of the generated image.")
|
|
77
|
+
num_steps: int = InputField(
|
|
78
|
+
default=4, description="Number of diffusion steps. Recommended values are schnell: 4, dev: 50."
|
|
79
|
+
)
|
|
80
|
+
guidance: float = InputField(
|
|
81
|
+
default=4.0,
|
|
82
|
+
description="The guidance strength. Higher values adhere more strictly to the prompt, and will produce less diverse images. FLUX dev only, ignored for schnell.",
|
|
83
|
+
)
|
|
84
|
+
seed: int = InputField(default=0, description="Randomness seed for reproducibility.")
|
|
85
|
+
|
|
86
|
+
@torch.no_grad()
|
|
87
|
+
def invoke(self, context: InvocationContext) -> LatentsOutput:
|
|
88
|
+
latents = self._run_diffusion(context)
|
|
89
|
+
latents = latents.detach().to("cpu")
|
|
90
|
+
|
|
91
|
+
name = context.tensors.save(tensor=latents)
|
|
92
|
+
return LatentsOutput.build(latents_name=name, latents=latents, seed=None)
|
|
93
|
+
|
|
94
|
+
def _run_diffusion(
|
|
95
|
+
self,
|
|
96
|
+
context: InvocationContext,
|
|
97
|
+
):
|
|
98
|
+
inference_dtype = torch.bfloat16
|
|
99
|
+
|
|
100
|
+
# Load the conditioning data.
|
|
101
|
+
cond_data = context.conditioning.load(self.positive_text_conditioning.conditioning_name)
|
|
102
|
+
assert len(cond_data.conditionings) == 1
|
|
103
|
+
flux_conditioning = cond_data.conditionings[0]
|
|
104
|
+
assert isinstance(flux_conditioning, FLUXConditioningInfo)
|
|
105
|
+
flux_conditioning = flux_conditioning.to(dtype=inference_dtype)
|
|
106
|
+
t5_embeddings = flux_conditioning.t5_embeds
|
|
107
|
+
clip_embeddings = flux_conditioning.clip_embeds
|
|
108
|
+
|
|
109
|
+
# Load the input latents, if provided.
|
|
110
|
+
init_latents = context.tensors.load(self.latents.latents_name) if self.latents else None
|
|
111
|
+
if init_latents is not None:
|
|
112
|
+
init_latents = init_latents.to(device=TorchDevice.choose_torch_device(), dtype=inference_dtype)
|
|
113
|
+
|
|
114
|
+
# Prepare input noise.
|
|
115
|
+
noise = get_noise(
|
|
116
|
+
num_samples=1,
|
|
117
|
+
height=self.height,
|
|
118
|
+
width=self.width,
|
|
119
|
+
device=TorchDevice.choose_torch_device(),
|
|
120
|
+
dtype=inference_dtype,
|
|
121
|
+
seed=self.seed,
|
|
122
|
+
)
|
|
123
|
+
|
|
124
|
+
transformer_info = context.models.load(self.transformer.transformer)
|
|
125
|
+
is_schnell = "schnell" in transformer_info.config.config_path
|
|
126
|
+
|
|
127
|
+
# Calculate the timestep schedule.
|
|
128
|
+
image_seq_len = noise.shape[-1] * noise.shape[-2] // 4
|
|
129
|
+
timesteps = get_schedule(
|
|
130
|
+
num_steps=self.num_steps,
|
|
131
|
+
image_seq_len=image_seq_len,
|
|
132
|
+
shift=not is_schnell,
|
|
133
|
+
)
|
|
134
|
+
|
|
135
|
+
# Clip the timesteps schedule based on denoising_start and denoising_end.
|
|
136
|
+
timesteps = clip_timestep_schedule(timesteps, self.denoising_start, self.denoising_end)
|
|
137
|
+
|
|
138
|
+
# Prepare input latent image.
|
|
139
|
+
if init_latents is not None:
|
|
140
|
+
# If init_latents is provided, we are doing image-to-image.
|
|
141
|
+
|
|
142
|
+
if is_schnell:
|
|
143
|
+
context.logger.warning(
|
|
144
|
+
"Running image-to-image with a FLUX schnell model. This is not recommended. The results are likely "
|
|
145
|
+
"to be poor. Consider using a FLUX dev model instead."
|
|
146
|
+
)
|
|
147
|
+
|
|
148
|
+
# Noise the orig_latents by the appropriate amount for the first timestep.
|
|
149
|
+
t_0 = timesteps[0]
|
|
150
|
+
x = t_0 * noise + (1.0 - t_0) * init_latents
|
|
151
|
+
else:
|
|
152
|
+
# init_latents are not provided, so we are not doing image-to-image (i.e. we are starting from pure noise).
|
|
153
|
+
if self.denoising_start > 1e-5:
|
|
154
|
+
raise ValueError("denoising_start should be 0 when initial latents are not provided.")
|
|
155
|
+
|
|
156
|
+
x = noise
|
|
157
|
+
|
|
158
|
+
# If len(timesteps) == 1, then short-circuit. We are just noising the input latents, but not taking any
|
|
159
|
+
# denoising steps.
|
|
160
|
+
if len(timesteps) <= 1:
|
|
161
|
+
return x
|
|
162
|
+
|
|
163
|
+
inpaint_mask = self._prep_inpaint_mask(context, x)
|
|
164
|
+
|
|
165
|
+
b, _c, h, w = x.shape
|
|
166
|
+
img_ids = generate_img_ids(h=h, w=w, batch_size=b, device=x.device, dtype=x.dtype)
|
|
167
|
+
|
|
168
|
+
bs, t5_seq_len, _ = t5_embeddings.shape
|
|
169
|
+
txt_ids = torch.zeros(bs, t5_seq_len, 3, dtype=inference_dtype, device=TorchDevice.choose_torch_device())
|
|
170
|
+
|
|
171
|
+
# Pack all latent tensors.
|
|
172
|
+
init_latents = pack(init_latents) if init_latents is not None else None
|
|
173
|
+
inpaint_mask = pack(inpaint_mask) if inpaint_mask is not None else None
|
|
174
|
+
noise = pack(noise)
|
|
175
|
+
x = pack(x)
|
|
176
|
+
|
|
177
|
+
# Now that we have 'packed' the latent tensors, verify that we calculated the image_seq_len correctly.
|
|
178
|
+
assert image_seq_len == x.shape[1]
|
|
179
|
+
|
|
180
|
+
# Prepare inpaint extension.
|
|
181
|
+
inpaint_extension: InpaintExtension | None = None
|
|
182
|
+
if inpaint_mask is not None:
|
|
183
|
+
assert init_latents is not None
|
|
184
|
+
inpaint_extension = InpaintExtension(
|
|
185
|
+
init_latents=init_latents,
|
|
186
|
+
inpaint_mask=inpaint_mask,
|
|
187
|
+
noise=noise,
|
|
188
|
+
)
|
|
189
|
+
|
|
190
|
+
with transformer_info as transformer:
|
|
191
|
+
assert isinstance(transformer, Flux)
|
|
192
|
+
|
|
193
|
+
x = denoise(
|
|
194
|
+
model=transformer,
|
|
195
|
+
img=x,
|
|
196
|
+
img_ids=img_ids,
|
|
197
|
+
txt=t5_embeddings,
|
|
198
|
+
txt_ids=txt_ids,
|
|
199
|
+
vec=clip_embeddings,
|
|
200
|
+
timesteps=timesteps,
|
|
201
|
+
step_callback=self._build_step_callback(context),
|
|
202
|
+
guidance=self.guidance,
|
|
203
|
+
inpaint_extension=inpaint_extension,
|
|
204
|
+
)
|
|
205
|
+
|
|
206
|
+
x = unpack(x.float(), self.height, self.width)
|
|
207
|
+
return x
|
|
208
|
+
|
|
209
|
+
def _prep_inpaint_mask(self, context: InvocationContext, latents: torch.Tensor) -> torch.Tensor | None:
|
|
210
|
+
"""Prepare the inpaint mask.
|
|
211
|
+
|
|
212
|
+
- Loads the mask
|
|
213
|
+
- Resizes if necessary
|
|
214
|
+
- Casts to same device/dtype as latents
|
|
215
|
+
- Expands mask to the same shape as latents so that they line up after 'packing'
|
|
216
|
+
|
|
217
|
+
Args:
|
|
218
|
+
context (InvocationContext): The invocation context, for loading the inpaint mask.
|
|
219
|
+
latents (torch.Tensor): A latent image tensor. In 'unpacked' format. Used to determine the target shape,
|
|
220
|
+
device, and dtype for the inpaint mask.
|
|
221
|
+
|
|
222
|
+
Returns:
|
|
223
|
+
torch.Tensor | None: Inpaint mask.
|
|
224
|
+
"""
|
|
225
|
+
if self.denoise_mask is None:
|
|
226
|
+
return None
|
|
227
|
+
|
|
228
|
+
mask = context.tensors.load(self.denoise_mask.mask_name)
|
|
229
|
+
|
|
230
|
+
_, _, latent_height, latent_width = latents.shape
|
|
231
|
+
mask = tv_resize(
|
|
232
|
+
img=mask,
|
|
233
|
+
size=[latent_height, latent_width],
|
|
234
|
+
interpolation=tv_transforms.InterpolationMode.BILINEAR,
|
|
235
|
+
antialias=False,
|
|
236
|
+
)
|
|
237
|
+
|
|
238
|
+
mask = mask.to(device=latents.device, dtype=latents.dtype)
|
|
239
|
+
|
|
240
|
+
# Expand the inpaint mask to the same shape as `latents` so that when we 'pack' `mask` it lines up with
|
|
241
|
+
# `latents`.
|
|
242
|
+
return mask.expand_as(latents)
|
|
243
|
+
|
|
244
|
+
def _build_step_callback(self, context: InvocationContext) -> Callable[[PipelineIntermediateState], None]:
|
|
245
|
+
def step_callback(state: PipelineIntermediateState) -> None:
|
|
246
|
+
state.latents = unpack(state.latents.float(), self.height, self.width).squeeze()
|
|
247
|
+
context.util.flux_step_callback(state)
|
|
248
|
+
|
|
249
|
+
return step_callback
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import torch
|
|
2
|
+
from einops import rearrange
|
|
3
|
+
from PIL import Image
|
|
4
|
+
|
|
5
|
+
from invokeai.app.invocations.baseinvocation import BaseInvocation, invocation
|
|
6
|
+
from invokeai.app.invocations.fields import (
|
|
7
|
+
FieldDescriptions,
|
|
8
|
+
Input,
|
|
9
|
+
InputField,
|
|
10
|
+
LatentsField,
|
|
11
|
+
WithBoard,
|
|
12
|
+
WithMetadata,
|
|
13
|
+
)
|
|
14
|
+
from invokeai.app.invocations.model import VAEField
|
|
15
|
+
from invokeai.app.invocations.primitives import ImageOutput
|
|
16
|
+
from invokeai.app.services.shared.invocation_context import InvocationContext
|
|
17
|
+
from invokeai.backend.flux.modules.autoencoder import AutoEncoder
|
|
18
|
+
from invokeai.backend.model_manager.load.load_base import LoadedModel
|
|
19
|
+
from invokeai.backend.util.devices import TorchDevice
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
@invocation(
|
|
23
|
+
"flux_vae_decode",
|
|
24
|
+
title="FLUX Latents to Image",
|
|
25
|
+
tags=["latents", "image", "vae", "l2i", "flux"],
|
|
26
|
+
category="latents",
|
|
27
|
+
version="1.0.0",
|
|
28
|
+
)
|
|
29
|
+
class FluxVaeDecodeInvocation(BaseInvocation, WithMetadata, WithBoard):
|
|
30
|
+
"""Generates an image from latents."""
|
|
31
|
+
|
|
32
|
+
latents: LatentsField = InputField(
|
|
33
|
+
description=FieldDescriptions.latents,
|
|
34
|
+
input=Input.Connection,
|
|
35
|
+
)
|
|
36
|
+
vae: VAEField = InputField(
|
|
37
|
+
description=FieldDescriptions.vae,
|
|
38
|
+
input=Input.Connection,
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
def _vae_decode(self, vae_info: LoadedModel, latents: torch.Tensor) -> Image.Image:
|
|
42
|
+
with vae_info as vae:
|
|
43
|
+
assert isinstance(vae, AutoEncoder)
|
|
44
|
+
latents = latents.to(device=TorchDevice.choose_torch_device(), dtype=TorchDevice.choose_torch_dtype())
|
|
45
|
+
img = vae.decode(latents)
|
|
46
|
+
|
|
47
|
+
img = img.clamp(-1, 1)
|
|
48
|
+
img = rearrange(img[0], "c h w -> h w c") # noqa: F821
|
|
49
|
+
img_pil = Image.fromarray((127.5 * (img + 1.0)).byte().cpu().numpy())
|
|
50
|
+
return img_pil
|
|
51
|
+
|
|
52
|
+
@torch.no_grad()
|
|
53
|
+
def invoke(self, context: InvocationContext) -> ImageOutput:
|
|
54
|
+
latents = context.tensors.load(self.latents.latents_name)
|
|
55
|
+
vae_info = context.models.load(self.vae.vae)
|
|
56
|
+
image = self._vae_decode(vae_info=vae_info, latents=latents)
|
|
57
|
+
|
|
58
|
+
TorchDevice.empty_cache()
|
|
59
|
+
image_dto = context.images.save(image=image)
|
|
60
|
+
return ImageOutput.build(image_dto)
|