diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1915b626e..794c0c9f2 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -3,11 +3,18 @@
## Update for 2025-06-26
- **Models**
+ - [Models Wiki page](https://vladmandic.github.io/sdnext-docs/Models/) is updated will all new models
- [nVidia Cosmos-Predict2 T2I](https://research.nvidia.com/labs/dir/cosmos-predict2/) *2B and 14B*
- - new foundational model from Nvidia in two variants: small 2B and large 14B
+ - Cosmos-Predict2 T2I is a new foundational model from Nvidia in two variants: small 2B and large 14B
- available via *networks -> models -> reference*
+ - *note*: 14B variant is a very large model at 36GB
- *note*: this is a gated model, you need to [accept terms](https://huggingface.co/nvidia/Cosmos-Predict2-2B-Text2Image) and set your [huggingface token](https://vladmandic.github.io/sdnext-docs/Gated/)
- - [Chroma](https://huggingface.co/lodestones/Chroma)
+ - [Black Forest Labs FLUX.1 Kontext I2I](https://bfl.ai/announcements/flux-1-kontext-dev) *Dev* variant
+ - FLUX.1-Kontext is a 12B model billion parameter capable of editing images based on text instructions
+ - requirements are similar to regular FLUX.1 although 2x slower
+ - available via *networks -> models -> reference*
+ - *note*: this is a gated model, you need to [accept terms](https://huggingface.co/black-forest-labs/FLUX.1-Kontext-dev) and set your [huggingface token](https://vladmandic.github.io/sdnext-docs/Gated/)
+ - [lodestones Chroma](https://huggingface.co/lodestones/Chroma)
- Chroma is a 8.9B parameter model based on *FLUX.1-schnell* and fully Apache 2.0 licensed
- available via *networks -> models -> reference*
- *note*: model is still in training so future updates will trigger re-download
diff --git a/html/reference.json b/html/reference.json
index 22fa4daba..599ad1c5b 100644
--- a/html/reference.json
+++ b/html/reference.json
@@ -158,24 +158,10 @@
"skip": true,
"extras": "sampler: Default, cfg_scale: 3.5"
},
- "Black Forest Labs FLUX.1 Dev qint8": {
- "path": "Disty0/FLUX.1-dev-qint8",
- "preview": "black-forest-labs--FLUX.1-dev.jpg",
- "desc": "FLUX.1 models are based on a hybrid architecture of multimodal and parallel diffusion transformer blocks, scaled to 12B parameters and builing on flow matching",
- "skip": true,
- "extras": "sampler: Default, cfg_scale: 3.5"
- },
- "Black Forest Labs FLUX.1 Dev qint4": {
- "path": "Disty0/FLUX.1-dev-qint4",
- "preview": "black-forest-labs--FLUX.1-dev.jpg",
- "desc": "FLUX.1 models are based on a hybrid architecture of multimodal and parallel diffusion transformer blocks, scaled to 12B parameters and builing on flow matching",
- "skip": true,
- "extras": "sampler: Default, cfg_scale: 3.5"
- },
- "Black Forest Labs FLUX.1 Dev nf4": {
- "path": "sayakpaul/flux.1-dev-nf4",
- "preview": "black-forest-labs--FLUX.1-dev.jpg",
- "desc": "FLUX.1 models are based on a hybrid architecture of multimodal and parallel diffusion transformer blocks, scaled to 12B parameters and builing on flow matching",
+ "Black Forest Labs FLUX.1 Kontext Dev": {
+ "path": "black-forest-labs/FLUX.1-Kontext-dev",
+ "preview": "black-forest-labs--FLUX.1-Kontext-dev.jpg",
+ "desc": "FLUX.1 Kontext [dev] is a 12 billion parameter rectified flow transformer capable of editing images based on text instructions.",
"skip": true,
"extras": "sampler: Default, cfg_scale: 3.5"
},
diff --git a/models/Reference/black-forest-labs--FLUX.1-Kontext-dev.jpg b/models/Reference/black-forest-labs--FLUX.1-Kontext-dev.jpg
new file mode 100644
index 000000000..04521fdd2
Binary files /dev/null and b/models/Reference/black-forest-labs--FLUX.1-Kontext-dev.jpg differ
diff --git a/modules/model_flux.py b/modules/model_flux.py
index b5f482f2b..636daff65 100644
--- a/modules/model_flux.py
+++ b/modules/model_flux.py
@@ -317,6 +317,13 @@ def load_flux(checkpoint_info, diffusers_load_config): # triggered by opts.sd_ch
cls = diffusers.FluxControlPipeline
elif 'Depth' in repo_id:
cls = diffusers.FluxControlPipeline
+ elif 'Kontext' in repo_id:
+ cls = diffusers.FluxKontextPipeline
+ from diffusers import pipelines
+ pipelines.auto_pipeline.AUTO_TEXT2IMAGE_PIPELINES_MAPPING["flux1kontext"] = diffusers.FluxKontextPipeline
+ pipelines.auto_pipeline.AUTO_IMAGE2IMAGE_PIPELINES_MAPPING["flux1kontext"] = diffusers.FluxKontextPipeline
+ pipelines.auto_pipeline.AUTO_INPAINT_PIPELINES_MAPPING["flux1kontext"] = diffusers.FluxKontextPipeline
+
else:
cls = diffusers.FluxPipeline
shared.log.debug(f'Load model: type=FLUX cls={cls.__name__} preloaded={list(kwargs)} revision={diffusers_load_config.get("revision", None)}')
diff --git a/modules/processing_args.py b/modules/processing_args.py
index bb09cc0a4..154f5e272 100644
--- a/modules/processing_args.py
+++ b/modules/processing_args.py
@@ -48,17 +48,21 @@ def task_specific_kwargs(p, model):
'image': p.init_images,
'strength': p.denoising_strength,
}
- if model.__class__.__name__ == 'FluxImg2ImgPipeline': # needs explicit width/height
+ if model.__class__.__name__ == 'FluxImg2ImgPipeline' or model.__class__.__name__ == 'FluxKontextPipeline': # needs explicit width/height
if torch.is_tensor(p.init_images[0]):
- p.width = p.init_images[0].shape[-1] * 16
- p.height = p.init_images[0].shape[-2] * 16
+ p.width, p.height = p.init_images[0].shape[-1] * 16, p.init_images[0].shape[-2] * 16
else:
- p.width = 8 * math.ceil(p.init_images[0].width / 8)
- p.height = 8 * math.ceil(p.init_images[0].height / 8)
+ p.width, p.height = 8 * math.ceil(p.init_images[0].width / 8), 8 * math.ceil(p.init_images[0].height / 8)
+ if model.__class__.__name__ == 'FluxKontextPipeline':
+ aspect_ratio = p.width / p.height
+ vae_scale_factor = 16
+ max_area = max(p.width, p.height)**2
+ p.width, p.height = round((max_area * aspect_ratio) ** 0.5), round((max_area / aspect_ratio) ** 0.5)
+ p.width, p.height = p.width // vae_scale_factor * vae_scale_factor, p.height // vae_scale_factor * vae_scale_factor
+ task_args['max_area'] = max_area
task_args['width'], task_args['height'] = p.width, p.height
if model.__class__.__name__ == 'OmniGenPipeline':
- p.width = 16 * math.ceil(p.init_images[0].width / 16)
- p.height = 16 * math.ceil(p.init_images[0].height / 16)
+ p.width, p.height = 16 * math.ceil(p.init_images[0].width / 16), 16 * math.ceil(p.init_images[0].height / 16)
task_args = {
'width': p.width,
'height': p.height,
diff --git a/modules/processing_helpers.py b/modules/processing_helpers.py
index 013b32109..7d536999a 100644
--- a/modules/processing_helpers.py
+++ b/modules/processing_helpers.py
@@ -466,9 +466,7 @@ def calculate_base_steps(p, use_denoise_start, use_refiner_start):
cls = shared.sd_model.__class__.__name__
if cls in sd_models.i2i_pipes:
steps = p.steps
- elif 'Flex' in cls:
- steps = p.steps
- elif 'HiDreamImageEditingPipeline' in cls:
+ elif 'Flex' in cls or 'HiDreamImageEditingPipeline' in cls or 'Kontext' in cls:
steps = p.steps
elif use_denoise_start and (shared.sd_model_type == 'sdxl'):
steps = p.steps // (1 - p.refiner_start)
diff --git a/modules/ui_models.py b/modules/ui_models.py
index 704399158..82ed79298 100644
--- a/modules/ui_models.py
+++ b/modules/ui_models.py
@@ -37,7 +37,14 @@ def create_ui():
model = modelstats.analyze()
desc = f"Model: {model.name}
Type: {model.type}
Class: {model.cls}
Size: {model.size} bytes
Modified: {model.mtime}
"
meta = model.meta
- components = [(m.name, m.cls, m.device, m.dtype, m.params, m.modules, str(m.config)) for m in model.modules]
+ components = []
+ for m in model.modules:
+ try:
+ component = (m.name, m.cls, str(m.device), str(m.dtype), m.params, m.modules, str(m.config))
+ components.append(component)
+ except Exception:
+ component = (m.name, m.cls, str(m.device), str(m.dtype), m.params, m.modules, '')
+ components.append(component)
return [desc, components, meta]
with gr.Row():