InvokeAI 6.10.0rc1__py3-none-any.whl → 6.11.0__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.
Files changed (83) hide show
  1. invokeai/app/api/routers/model_manager.py +43 -1
  2. invokeai/app/invocations/fields.py +1 -1
  3. invokeai/app/invocations/flux2_denoise.py +499 -0
  4. invokeai/app/invocations/flux2_klein_model_loader.py +222 -0
  5. invokeai/app/invocations/flux2_klein_text_encoder.py +222 -0
  6. invokeai/app/invocations/flux2_vae_decode.py +106 -0
  7. invokeai/app/invocations/flux2_vae_encode.py +88 -0
  8. invokeai/app/invocations/flux_denoise.py +77 -3
  9. invokeai/app/invocations/flux_lora_loader.py +1 -1
  10. invokeai/app/invocations/flux_model_loader.py +2 -5
  11. invokeai/app/invocations/ideal_size.py +6 -1
  12. invokeai/app/invocations/metadata.py +4 -0
  13. invokeai/app/invocations/metadata_linked.py +47 -0
  14. invokeai/app/invocations/model.py +1 -0
  15. invokeai/app/invocations/pbr_maps.py +59 -0
  16. invokeai/app/invocations/z_image_denoise.py +244 -84
  17. invokeai/app/invocations/z_image_image_to_latents.py +9 -1
  18. invokeai/app/invocations/z_image_latents_to_image.py +9 -1
  19. invokeai/app/invocations/z_image_seed_variance_enhancer.py +110 -0
  20. invokeai/app/services/config/config_default.py +3 -1
  21. invokeai/app/services/invocation_stats/invocation_stats_common.py +6 -6
  22. invokeai/app/services/invocation_stats/invocation_stats_default.py +9 -4
  23. invokeai/app/services/model_manager/model_manager_default.py +7 -0
  24. invokeai/app/services/model_records/model_records_base.py +4 -2
  25. invokeai/app/services/shared/invocation_context.py +15 -0
  26. invokeai/app/services/shared/sqlite/sqlite_util.py +2 -0
  27. invokeai/app/services/shared/sqlite_migrator/migrations/migration_25.py +61 -0
  28. invokeai/app/util/step_callback.py +58 -2
  29. invokeai/backend/flux/denoise.py +338 -118
  30. invokeai/backend/flux/dype/__init__.py +31 -0
  31. invokeai/backend/flux/dype/base.py +260 -0
  32. invokeai/backend/flux/dype/embed.py +116 -0
  33. invokeai/backend/flux/dype/presets.py +148 -0
  34. invokeai/backend/flux/dype/rope.py +110 -0
  35. invokeai/backend/flux/extensions/dype_extension.py +91 -0
  36. invokeai/backend/flux/schedulers.py +62 -0
  37. invokeai/backend/flux/util.py +35 -1
  38. invokeai/backend/flux2/__init__.py +4 -0
  39. invokeai/backend/flux2/denoise.py +280 -0
  40. invokeai/backend/flux2/ref_image_extension.py +294 -0
  41. invokeai/backend/flux2/sampling_utils.py +209 -0
  42. invokeai/backend/image_util/pbr_maps/architecture/block.py +367 -0
  43. invokeai/backend/image_util/pbr_maps/architecture/pbr_rrdb_net.py +70 -0
  44. invokeai/backend/image_util/pbr_maps/pbr_maps.py +141 -0
  45. invokeai/backend/image_util/pbr_maps/utils/image_ops.py +93 -0
  46. invokeai/backend/model_manager/configs/factory.py +19 -1
  47. invokeai/backend/model_manager/configs/lora.py +36 -0
  48. invokeai/backend/model_manager/configs/main.py +395 -3
  49. invokeai/backend/model_manager/configs/qwen3_encoder.py +116 -7
  50. invokeai/backend/model_manager/configs/vae.py +104 -2
  51. invokeai/backend/model_manager/load/model_cache/model_cache.py +107 -2
  52. invokeai/backend/model_manager/load/model_loaders/cogview4.py +2 -1
  53. invokeai/backend/model_manager/load/model_loaders/flux.py +1020 -8
  54. invokeai/backend/model_manager/load/model_loaders/generic_diffusers.py +4 -2
  55. invokeai/backend/model_manager/load/model_loaders/onnx.py +1 -0
  56. invokeai/backend/model_manager/load/model_loaders/stable_diffusion.py +2 -1
  57. invokeai/backend/model_manager/load/model_loaders/z_image.py +158 -31
  58. invokeai/backend/model_manager/starter_models.py +141 -4
  59. invokeai/backend/model_manager/taxonomy.py +31 -4
  60. invokeai/backend/model_manager/util/select_hf_files.py +3 -2
  61. invokeai/backend/patches/lora_conversions/z_image_lora_conversion_utils.py +39 -5
  62. invokeai/backend/quantization/gguf/ggml_tensor.py +15 -4
  63. invokeai/backend/util/vae_working_memory.py +0 -2
  64. invokeai/backend/z_image/extensions/regional_prompting_extension.py +10 -12
  65. invokeai/frontend/web/dist/assets/App-D13dX7be.js +161 -0
  66. invokeai/frontend/web/dist/assets/{browser-ponyfill-DHZxq1nk.js → browser-ponyfill-u_ZjhQTI.js} +1 -1
  67. invokeai/frontend/web/dist/assets/index-BB0nHmDe.js +530 -0
  68. invokeai/frontend/web/dist/index.html +1 -1
  69. invokeai/frontend/web/dist/locales/en-GB.json +1 -0
  70. invokeai/frontend/web/dist/locales/en.json +85 -6
  71. invokeai/frontend/web/dist/locales/it.json +135 -15
  72. invokeai/frontend/web/dist/locales/ru.json +11 -11
  73. invokeai/version/invokeai_version.py +1 -1
  74. {invokeai-6.10.0rc1.dist-info → invokeai-6.11.0.dist-info}/METADATA +8 -2
  75. {invokeai-6.10.0rc1.dist-info → invokeai-6.11.0.dist-info}/RECORD +81 -57
  76. {invokeai-6.10.0rc1.dist-info → invokeai-6.11.0.dist-info}/WHEEL +1 -1
  77. invokeai/frontend/web/dist/assets/App-CYhlZO3Q.js +0 -161
  78. invokeai/frontend/web/dist/assets/index-dgSJAY--.js +0 -530
  79. {invokeai-6.10.0rc1.dist-info → invokeai-6.11.0.dist-info}/entry_points.txt +0 -0
  80. {invokeai-6.10.0rc1.dist-info → invokeai-6.11.0.dist-info}/licenses/LICENSE +0 -0
  81. {invokeai-6.10.0rc1.dist-info → invokeai-6.11.0.dist-info}/licenses/LICENSE-SD1+SD2.txt +0 -0
  82. {invokeai-6.10.0rc1.dist-info → invokeai-6.11.0.dist-info}/licenses/LICENSE-SDXL.txt +0 -0
  83. {invokeai-6.10.0rc1.dist-info → invokeai-6.11.0.dist-info}/top_level.txt +0 -0
@@ -17,21 +17,32 @@ def dequantize_and_run(func, args, kwargs):
17
17
  Also casts other floating point tensors to match the compute_dtype of GGMLTensors
18
18
  to avoid dtype mismatches in matrix operations.
19
19
  """
20
- # Find the compute_dtype from any GGMLTensor in the args
20
+ # Find the compute_dtype and target_device from any GGMLTensor in the args
21
21
  compute_dtype = None
22
+ target_device = None
22
23
  for a in args:
23
24
  if hasattr(a, "compute_dtype"):
24
25
  compute_dtype = a.compute_dtype
26
+ if isinstance(a, torch.Tensor) and target_device is None:
27
+ target_device = a.device
28
+ if compute_dtype is not None and target_device is not None:
25
29
  break
26
- if compute_dtype is None:
30
+ if compute_dtype is None or target_device is None:
27
31
  for v in kwargs.values():
28
- if hasattr(v, "compute_dtype"):
32
+ if hasattr(v, "compute_dtype") and compute_dtype is None:
29
33
  compute_dtype = v.compute_dtype
34
+ if isinstance(v, torch.Tensor) and target_device is None:
35
+ target_device = v.device
36
+ if compute_dtype is not None and target_device is not None:
30
37
  break
31
38
 
32
39
  def process_tensor(t):
33
40
  if hasattr(t, "get_dequantized_tensor"):
34
- return t.get_dequantized_tensor()
41
+ result = t.get_dequantized_tensor()
42
+ # Ensure the dequantized tensor is on the target device
43
+ if target_device is not None and result.device != target_device:
44
+ result = result.to(target_device)
45
+ return result
35
46
  elif isinstance(t, torch.Tensor) and compute_dtype is not None and t.is_floating_point():
36
47
  # Cast other floating point tensors to match the GGUF compute_dtype
37
48
  return t.to(compute_dtype)
@@ -47,8 +47,6 @@ def estimate_vae_working_memory_sd15_sdxl(
47
47
  # If we are running in FP32, then we should account for the likely increase in model size (~250MB).
48
48
  working_memory += 250 * 2**20
49
49
 
50
- print(f"estimate_vae_working_memory_sd15_sdxl: {int(working_memory)}")
51
-
52
50
  return int(working_memory)
53
51
 
54
52
 
@@ -66,12 +66,16 @@ class ZImageRegionalPromptingExtension:
66
66
  ) -> torch.Tensor | None:
67
67
  """Prepare a regional attention mask for Z-Image.
68
68
 
69
- The mask controls which tokens can attend to each other:
70
- - Image tokens within a region attend only to each other
69
+ This uses an 'unrestricted' image self-attention approach (similar to FLUX):
70
+ - Image tokens can attend to ALL other image tokens (unrestricted self-attention)
71
71
  - Image tokens attend only to their corresponding regional text
72
72
  - Text tokens attend only to their corresponding regional image
73
73
  - Text tokens attend to themselves
74
74
 
75
+ The unrestricted image self-attention allows the model to maintain global
76
+ coherence across regions, preventing the generation of separate/disconnected
77
+ images for each region.
78
+
75
79
  Z-Image sequence order: [img_tokens, txt_tokens]
76
80
 
77
81
  Args:
@@ -129,12 +133,6 @@ class ZImageRegionalPromptingExtension:
129
133
  # 3. txt attends to corresponding regional img
130
134
  # Reshape mask to (1, img_seq_len) for broadcasting
131
135
  regional_attention_mask[txt_start:txt_end, :img_seq_len] = mask_flat.view(1, img_seq_len)
132
-
133
- # 4. img self-attention within region
134
- # mask @ mask.T creates pairwise attention within the masked region
135
- regional_attention_mask[:img_seq_len, :img_seq_len] += mask_flat.view(img_seq_len, 1) @ mask_flat.view(
136
- 1, img_seq_len
137
- )
138
136
  else:
139
137
  # Global prompt: allow attention to/from background regions only
140
138
  if background_region_mask is not None:
@@ -152,10 +150,10 @@ class ZImageRegionalPromptingExtension:
152
150
  regional_attention_mask[:img_seq_len, txt_start:txt_end] = 1.0
153
151
  regional_attention_mask[txt_start:txt_end, :img_seq_len] = 1.0
154
152
 
155
- # Allow background regions to attend to themselves
156
- if background_region_mask is not None:
157
- bg_mask = background_region_mask.view(img_seq_len, 1)
158
- regional_attention_mask[:img_seq_len, :img_seq_len] += bg_mask @ bg_mask.T
153
+ # 4. Allow unrestricted image self-attention
154
+ # This is the key difference from the restricted approach - all image tokens
155
+ # can attend to each other, which helps maintain global coherence across regions
156
+ regional_attention_mask[:img_seq_len, :img_seq_len] = 1.0
159
157
 
160
158
  # Convert to boolean mask
161
159
  regional_attention_mask = regional_attention_mask > 0.5