Skip to content
Python

adde flux klein support

DeepBeepMeep5623deb61aae
diff --git a/README.md b/README.md
index 2669388..7418372 100644
--- a/README.md
+++ b/README.md
@@ -26,12 +26,12 @@ WanGP supports the Wan (and derived models), Hunyuan Video, Flux, Qwen, Z-Image,
## 🔥 Latest Updates :
-### January 17th 2026: WanGP v10.40, The Cost Saver
+### January 17th 2026: WanGP v10.41, The Cost Saver
*GPUs are expensive, RAM is expensive, SSD are expensive, sadly we live now in a GPU & RAM poor.*
WanGP comes again to the rescue:
-- **GGUF support**: as some of you know, I am not a big fan of this format because when used with image / video generative models we don't get any speed boost (matrices multiplications are still done at 16 bits), VRAM savings are small and quality is worse than with int8/fp8. Still gguf has one advantage: it consumes less RAM and hardware space. So enjoy gguf support. I have added ready to use *Kijai gguf finetunes* for *LTX 2*.
+- **GGUF support**: as some of you know, I am not a big fan of this format because when used with image / video generative models we don't get any speed boost (matrices multiplications are still done at 16 bits), VRAM savings are small and quality is worse than with int8/fp8. Still gguf has one advantage: it consumes less RAM and harddrive space. So enjoy gguf support. I have added ready to use *Kijai gguf finetunes* for *LTX 2*.
- **Models Manager PlugIn**: use this *Plugin* to identify how much space is taken by each *model* / *finetune* and delete the ones you no longer use. Try to avoid deleting shared files otherwise they will be downloaded again.
@@ -42,6 +42,10 @@ WanGP comes again to the rescue:
"VAE_URLs": ["https://huggingface.co/DeepBeepMeep/LTX-2/resolve/main/ltx-2-19b_vae_old.safetensors"]
```
+- **Flux 2 Klein 4B & 9B**: try these distilled models as fast as Z_Image if not faster but with out of the box image edition capabiltities
+
+*update 10.41*: added Flux 2 klein
+
### January 15th 2026: WanGP v10.30, The Need for Speed ...
- **LTX Distilled VAE Upgrade**: *Kijai* has observed that the Distilled VAE produces images that were less sharp that the VAE of the Non Distilled model. I have used this as an opportunity to repackage all the LTX 2 checkpoints and reduce their overal HD footprint since they all share around 5GB.
diff --git a/defaults/flux2_klein_4b.json b/defaults/flux2_klein_4b.json
new file mode 100644
index 0000000..726c09e
--- /dev/null
+++ b/defaults/flux2_klein_4b.json
@@ -0,0 +1,18 @@
+{
+ "model": {
+ "name": "Flux 2 Klein 4B",
+ "architecture": "flux2_klein_4b",
+ "description": "FLUX.2 Klein 4B is a compact rectified flow transformer for image generation and editing.",
+ "URLs": [
+ "https://huggingface.co/DeepBeepMeep/Flux2/resolve/main/flux-2-klein-4b_bf16.safetensors",
+ "https://huggingface.co/DeepBeepMeep/Flux2/resolve/main/flux-2-klein-4b_quanto_bf16_int8.safetensors"
+ ],
+ "image_outputs": true,
+ "no_negative_prompt": true
+ },
+ "prompt": "a cozy reading nook with warm sunlight, soft textiles, and a cup of tea on a wooden side table",
+ "resolution": "1024x1024",
+ "batch_size": 1,
+ "embedded_guidance_scale": 1,
+ "num_inference_steps": 4
+}
diff --git a/defaults/flux2_klein_9b.json b/defaults/flux2_klein_9b.json
new file mode 100644
index 0000000..aaa7f19
--- /dev/null
+++ b/defaults/flux2_klein_9b.json
@@ -0,0 +1,18 @@
+{
+ "model": {
+ "name": "Flux 2 Klein 9B",
+ "architecture": "flux2_klein_9b",
+ "description": "FLUX.2 Klein 9B is a balanced rectified flow transformer for image generation and editing.",
+ "URLs": [
+ "https://huggingface.co/DeepBeepMeep/Flux2/resolve/main/flux-2-klein-9b_bf16.safetensors",
+ "https://huggingface.co/DeepBeepMeep/Flux2/resolve/main/flux-2-klein-9b_quanto_bf16_int8.safetensors"
+ ],
+ "image_outputs": true,
+ "no_negative_prompt": true
+ },
+ "prompt": "a glass greenhouse filled with lush tropical plants, misty air, and dappled light",
+ "resolution": "1024x1024",
+ "batch_size": 1,
+ "embedded_guidance_scale": 1,
+ "num_inference_steps": 4
+}
diff --git a/models/flux/flux_handler.py b/models/flux/flux_handler.py
index c883838..7561480 100644
--- a/models/flux/flux_handler.py
+++ b/models/flux/flux_handler.py
@@ -1,10 +1,25 @@
import os
import torch
from PIL import Image
+from shared.utils import files_locator as fl
from shared.utils.hf import build_hf_url
def test_flux2(base_model_type):
- return base_model_type in ["flux2_dev", "pi_flux2"]
+ return base_model_type in ["flux2_dev", "pi_flux2", "flux2_klein_4b", "flux2_klein_9b"]
+
+
+def get_text_encoder_name(base_model_type, text_encoder_quantization):
+ if base_model_type == "flux2_klein_4b":
+ if text_encoder_quantization == "int8":
+ return "qwen3_quanto_bf16_int8.safetensors"
+ return "qwen3_bf16.safetensors"
+ if base_model_type == "flux2_klein_9b":
+ if text_encoder_quantization == "int8":
+ return "qwen3_8b_quanto_bf16_int8.safetensors"
+ return "qwen3_8b_bf16.safetensors"
+ if text_encoder_quantization == "int8":
+ return "mistral3_small_quanto_bf16_int8.safetensors" if test_flux2(base_model_type) else "T5_xxl_1.1_enc_quanto_bf16_int8.safetensors"
+ return "mistral3_small_bf16.safetensors" if test_flux2(base_model_type) else "T5_xxl_1.1_enc_bf16.safetensors"
class family_handler():
@@ -14,6 +29,8 @@ class family_handler():
"flux",
"flux2_dev",
"pi_flux2",
+ "flux2_klein_4b",
+ "flux2_klein_9b",
"flux_chroma",
"flux_chroma_radiance",
"flux_dev_kontext",
@@ -36,16 +53,21 @@ class family_handler():
"flux_dev_kontext_dreamomni2": "flux",
"flux2_dev": "flux",
"pi_flux2": "flux",
+ "flux2_klein_4b": "flux",
+ "flux2_klein_9b": "flux",
}
models_comp_map = {
- "flux": ["flux2_dev", "pi_flux2", "flux_chroma", "flux_chroma_radiance", "flux_dev_kontext", "flux_dev_umo", "flux_dev_uso", "flux_schnell", "flux_dev_kontext_dreamomni2" ]
+ "flux": ["flux2_dev", "pi_flux2", "flux2_klein_4b", "flux2_klein_9b", "flux_chroma", "flux_chroma_radiance", "flux_dev_kontext", "flux_dev_umo", "flux_dev_uso", "flux_schnell", "flux_dev_kontext_dreamomni2" ]
}
return models_eqv_map, models_comp_map
@staticmethod
def query_model_def(base_model_type, model_def):
flux_model = "flux-dev" if base_model_type == "flux" else base_model_type.replace("_", "-")
pi_flux2 = flux_model == "pi-flux2"
+ flux2_klein_4b = base_model_type == "flux2_klein_4b"
+ flux2_klein_9b = base_model_type == "flux2_klein_9b"
+ flux2_klein = flux2_klein_4b or flux2_klein_9b
flux2 = flux_model.startswith("flux2") or pi_flux2
flux_schnell = flux_model == "flux-schnell"
flux_chroma = flux_model == "flux-chroma"
@@ -61,11 +83,30 @@ class family_handler():
"flux-model": flux_model,
}
if flux2:
- text_encoder_folder = "mistral3small"
- extra_model_def["text_encoder_URLs"] = [
- build_hf_url("DeepBeepMeep/Flux2", text_encoder_folder, "mistral3_small_bf16.safetensors"),
- build_hf_url("DeepBeepMeep/Flux2", text_encoder_folder, "mistral3_small_quanto_bf16_int8.safetensors"),
- ]
+ if flux2_klein:
+ if flux2_klein_4b:
+ text_encoder_folder = "Qwen3"
+ text_encoder_repo = "DeepBeepMeep/Z-Image"
+ text_encoder_urls = [
+ build_hf_url(text_encoder_repo, text_encoder_folder, "qwen3_bf16.safetensors"),
+ build_hf_url(text_encoder_repo, text_encoder_folder, "qwen3_quanto_bf16_int8.safetensors"),
+ ]
+ else:
+ text_encoder_folder = "qwen3_8b"
+ text_encoder_repo = "DeepBeepMeep/Flux2"
+ text_encoder_urls = [
+ build_hf_url(text_encoder_repo, text_encoder_folder, "qwen3_8b_bf16.safetensors"),
+ build_hf_url(text_encoder_repo, text_encoder_folder, "qwen3_8b_quanto_bf16_int8.safetensors"),
+ ]
+ extra_model_def["text_encoder_type"] = "qwen3"
+ extra_model_def["text_encoder_URLs"] = text_encoder_urls
+ else:
+ text_encoder_folder = "mistral3small"
+ extra_model_def["text_encoder_URLs"] = [
+ build_hf_url("DeepBeepMeep/Flux2", text_encoder_folder, "mistral3_small_bf16.safetensors"),
+ build_hf_url("DeepBeepMeep/Flux2", text_encoder_folder, "mistral3_small_quanto_bf16_int8.safetensors"),
+ ]
+ extra_model_def["text_encoder_type"] = "mistral3"
extra_model_def["text_encoder_folder"] = text_encoder_folder
else:
text_encoder_folder = "T5_xxl_1.1"
@@ -74,12 +115,15 @@ class family_handler():
build_hf_url("DeepBeepMeep/LTX_Video", text_encoder_folder, "T5_xxl_1.1_enc_quanto_bf16_int8.safetensors"),
]
extra_model_def["text_encoder_folder"] = text_encoder_folder
- extra_model_def["profiles_dir"] = [] if (flux_schnell or flux2) else ["flux"]
+ if flux2_klein:
+ extra_model_def["profiles_dir"] = ["flux2_klein_4b"] if flux2_klein_4b else ["flux2_klein_9b"]
+ else:
+ extra_model_def["profiles_dir"] = [] if (flux_schnell or flux2) else ["flux"]
if flux_chroma or flux_chroma_radiance:
extra_model_def["guidance_max_phases"] = 1
if flux_chroma_radiance:
extra_model_def["radiance"] = True
- elif not flux_schnell:
+ elif not flux_schnell and not flux2_klein:
extra_model_def["embedded_guidance"] = True
if flux_uso :
extra_model_def["any_image_refs_relative_size"] = True
@@ -203,16 +247,59 @@ class family_handler():
default=os.path.join("loras", "flux2"),
help="Path to a directory that contains flux2 images Loras"
)
+ parser.add_argument(
+ "--lora-dir-flux2-klein-4b",
+ type=str,
+ default=os.path.join("loras", "flux2_klein_4b"),
+ help="Path to a directory that contains Flux 2 Klein 4B Loras"
+ )
+ parser.add_argument(
+ "--lora-dir-flux2-klein-9b",
+ type=str,
+ default=os.path.join("loras", "flux2_klein_9b"),
+ help="Path to a directory that contains Flux 2 Klein 9B Loras"
+ )
@staticmethod
def get_lora_dir(base_model_type, args):
+ if base_model_type == "flux2_klein_4b":
+ return args.lora_dir_flux2_klein_4b
+ if base_model_type == "flux2_klein_9b":
+ return args.lora_dir_flux2_klein_9b
if test_flux2(base_model_type):
return args.lora_dir_flux2
return args.lora_dir_flux
@staticmethod
def query_model_files(computeList, base_model_type, model_def=None):
- if test_flux2(base_model_type):
+ if base_model_type in ["flux2_klein_4b", "flux2_klein_9b"]:
+ if base_model_type == "flux2_klein_4b":
+ text_encoder_folder = "Qwen3"
+ text_encoder_repo = "DeepBeepMeep/Z-Image"
+ else:
+ text_encoder_folder = "qwen3_8b"
+ text_encoder_repo = "DeepBeepMeep/Flux2"
+ text_encoder_name = get_text_encoder_name(base_model_type, None)
+
+ tokenizer_files = ["config.json", "generation_config.json", text_encoder_name, "added_tokens.json", "chat_template.jinja", "merges.txt", "special_tokens_map.json", "tokenizer.json", "tokenizer_config.json", "vocab.json"]
+ if base_model_type == "flux2_klein_4b":
+ tokenizer_files.append("qwen3_quanto_bf16_int8.safetensors")
+ if base_model_type == "flux2_klein_9b":
+ tokenizer_files.append("qwen3_8b_quanto_bf16_int8.safetensors")
+
+ ret = [
+ {
+ "repoId": text_encoder_repo,
+ "sourceFolderList": [text_encoder_folder],
+ "fileList": [tokenizer_files],
+ },
+ {
+ "repoId": "DeepBeepMeep/Flux2",
+ "sourceFolderList": [""],
+ "fileList": [["flux2_vae.safetensors"]],
+ },
+ ]
+ elif test_flux2(base_model_type):
ret = [
{
"repoId": "DeepBeepMeep/Flux2",
@@ -223,8 +310,6 @@ class family_handler():
],
}
]
-
-
else:
ret = [
{
@@ -267,6 +352,15 @@ class family_handler():
@staticmethod
def load_model(model_filename, model_type, base_model_type, model_def, quantizeTransformer = False, text_encoder_quantization = None, dtype = torch.bfloat16, VAE_dtype = torch.float32, mixed_precision_transformer = False, save_quantized = False, submodel_no_list = None, text_encoder_filename = None):
from .flux_main import model_factory
+ if not text_encoder_filename:
+ text_encoder_folder = model_def.get("text_encoder_folder")
+ text_encoder_name = get_text_encoder_name(base_model_type, text_encoder_quantization)
+ if base_model_type in ["flux2_klein_4b", "flux2_klein_9b"] and text_encoder_folder:
+ text_encoder_filename = fl.locate_file(os.path.join(text_encoder_folder, text_encoder_name))
+ elif text_encoder_folder:
+ text_encoder_filename = fl.locate_file(os.path.join(text_encoder_folder, text_encoder_name))
+ else:
+ text_encoder_filename = fl.locate_file(text_encoder_name)
flux_model = model_factory(
checkpoint_dir="ckpts",
@@ -321,6 +415,7 @@ class family_handler():
flux_kontext = flux_model == "flux-dev-kontext"
flux_kontext_dreamomni2 = flux_model == "flux-dev-kontext-dreamomni2"
flux2 = flux_model.startswith("flux2")
+ flux2_klein = base_model_type in ["flux2_klein_4b", "flux2_klein_9b"]
ui_defaults.update({
"embedded_guidance_scale": 2.5,
@@ -328,11 +423,13 @@ class family_handler():
if flux2:
ui_defaults.update({
- "embedded_guidance_scale": 4.0,
+ "embedded_guidance_scale": 1.0 if flux2_klein else 4.0,
"denoising_strength": 1.0,
"masking_strength": 0.25,
"remove_background_images_ref" : 0,
})
+ if flux2_klein:
+ ui_defaults["num_inference_steps"] = 4
if flux_kontext or flux_uso or flux_kontext_dreamomni2:
ui_defaults.update({
diff --git a/models/flux/flux_main.py b/models/flux/flux_main.py
index 6dc04f8..e19577a 100644
--- a/models/flux/flux_main.py
+++ b/models/flux/flux_main.py
@@ -105,8 +105,17 @@ class model_factory:
torch_device,
preprocess_sd=preprocess_flux_state_dict,
)
- from .modules.text_encoder_mistral import Mistral3SmallEmbedder
- self.mistral = Mistral3SmallEmbedder( model_spec = text_encoder_filename)
+ text_encoder_type = model_def.get("text_encoder_type", "mistral3")
+ if text_encoder_type == "qwen3":
+ from .modules.text_encoder_qwen3 import Qwen3Embedder
+ tokenizer_path = model_def.get("text_encoder_folder")
+ self.mistral = Qwen3Embedder(
+ model_spec=text_encoder_filename,
+ tokenizer_path=tokenizer_path,
+ )
+ else:
+ from .modules.text_encoder_mistral import Mistral3SmallEmbedder
+ self.mistral = Mistral3SmallEmbedder(model_spec=text_encoder_filename)
with torch.device("meta"):
self.vae = AutoencoderKLFlux2(AutoEncoderParamsFlux2())
diff --git a/models/flux/modules/text_encoder_qwen3.py b/models/flux/modules/text_encoder_qwen3.py
new file mode 100644
index 0000000..b3da3ae
--- /dev/null
+++ b/models/flux/modules/text_encoder_qwen3.py
@@ -0,0 +1,77 @@
+import os
+from typing import List
+
+import torch
+import torch.nn as nn
+from einops import rearrange
+from transformers import AutoTokenizer, Qwen3ForCausalLM
+
+from mmgp import offload
+from shared.utils import files_locator as fl
+
+OUTPUT_LAYERS = [9, 18, 27]
+MAX_LENGTH = 512
+
+
+class Qwen3Embedder(nn.Module):
+ def __init__(
+ self,
+ model_spec: str | None = None,
+ tokenizer_path: str | None = None,
+ torch_dtype: str = "bfloat16",
+ ):
+ super().__init__()
+ file_path = model_spec
+ default_config = os.path.join(os.path.dirname(file_path), "config.json")
+ self.model = offload.fast_load_transformers_model(
+ file_path,
+ writable_tensors=False,
+ modelClass=Qwen3ForCausalLM,
+ defaultConfigPath=default_config,
+ )
+
+ tokenizer_root = tokenizer_path or os.path.dirname(file_path)
+ if tokenizer_root and not os.path.isabs(tokenizer_root):
+ tokenizer_root = fl.locate_folder(tokenizer_root)
+ tokenizer_subdir = os.path.join(tokenizer_root, "tokenizer")
+ if os.path.isdir(tokenizer_subdir):
+ tokenizer_root = tokenizer_subdir
+ self.tokenizer = AutoTokenizer.from_pretrained(tokenizer_root, trust_remote_code=True)
+ self.max_length = MAX_LENGTH
+
+ @torch.no_grad()
+ def forward(self, txt: List[str]):
+ all_input_ids = []
+ all_attention_masks = []
+
+ for prompt in txt:
+ messages = [{"role": "user", "content": prompt}]
+ text = self.tokenizer.apply_chat_template(
+ messages,
+ tokenize=False,
+ add_generation_prompt=True,
+ enable_thinking=False,
+ )
+
+ model_inputs = self.tokenizer(
+ text,
+ return_tensors="pt",
+ padding="max_length",
+ truncation=True,
+ max_length=self.max_length,
+ )
+ all_input_ids.append(model_inputs["input_ids"])
+ all_attention_masks.append(model_inputs["attention_mask"])
+
+ input_ids = torch.cat(all_input_ids, dim=0).to(self.model.device)
+ attention_mask = torch.cat(all_attention_masks, dim=0).to(self.model.device)
+
+ output = self.model(
+ input_ids=input_ids,
+ attention_mask=attention_mask,
+ output_hidden_states=True,
+ use_cache=False,
+ )
+
+ out = torch.stack([output.hidden_states[k] for k in OUTPUT_LAYERS], dim=1)
+ return rearrange(out, "b c l d -> b l (c d)")
diff --git a/models/flux/util.py b/models/flux/util.py
index 68ce78d..ea28895 100644
--- a/models/flux/util.py
+++ b/models/flux/util.py
@@ -331,6 +331,78 @@ configs = {
shift_factor=0.0,
),
),
+ "flux2-klein-4b": ModelSpec(
+ repo_id="",
+ repo_flow="",
+ repo_ae="ckpts/flux2_vae.safetensors",
+ params=FluxParams(
+ in_channels=128,
+ out_channels=128,
+ vec_in_dim=1,
+ context_in_dim=7680,
+ hidden_size=3072,
+ mlp_ratio=3.0,
+ single_linear1_mlp_ratio=6.0,
+ single_mlp_hidden_ratio=3.0,
+ double_mlp_ratio=3.0,
+ double_linear1_mlp_ratio=6.0,
+ num_heads=24,
+ depth=5,
+ depth_single_blocks=20,
+ axes_dim=[32, 32, 32, 32],
+ theta=2000,
+ qkv_bias=False,
+ guidance_embed=False,
+ flux2=True,
+ ),
+ ae_params=AutoEncoderParams(
+ resolution=1024,
+ in_channels=3,
+ ch=128,
+ out_ch=3,
+ ch_mult=[1, 2, 4, 4],
+ num_res_blocks=2,
+ z_channels=32,
+ scale_factor=0.5,
+ shift_factor=0.0,
+ ),
+ ),
+ "flux2-klein-9b": ModelSpec(
+ repo_id="",
+ repo_flow="",
+ repo_ae="ckpts/flux2_vae.safetensors",
+ params=FluxParams(
+ in_channels=128,
+ out_channels=128,
+ vec_in_dim=1,
+ context_in_dim=12288,
+ hidden_size=4096,
+ mlp_ratio=3.0,
+ single_linear1_mlp_ratio=6.0,
+ single_mlp_hidden_ratio=3.0,
+ double_mlp_ratio=3.0,
+ double_linear1_mlp_ratio=6.0,
+ num_heads=32,
+ depth=8,
+ depth_single_blocks=24,
+ axes_dim=[32, 32, 32, 32],
+ theta=2000,
+ qkv_bias=False,
+ guidance_embed=False,
+ flux2=True,
+ ),
+ ae_params=AutoEncoderParams(
+ resolution=1024,
+ in_channels=3,
+ ch=128,
+ out_ch=3,
+ ch_mult=[1, 2, 4, 4],
+ num_res_blocks=2,
+ z_channels=32,
+ scale_factor=0.5,
+ shift_factor=0.0,
+ ),
+ ),
"pi-flux2": ModelSpec(
repo_id="",
repo_flow="",
diff --git a/wgp.py b/wgp.py
index 181a508..c24d273 100644
--- a/wgp.py
+++ b/wgp.py
@@ -85,7 +85,7 @@ AUTOSAVE_TEMPLATE_PATH = AUTOSAVE_FILENAME
CONFIG_FILENAME = "wgp_config.json"
PROMPT_VARS_MAX = 10
target_mmgp_version = "3.6.16"
-WanGP_version = "10.40"
+WanGP_version = "10.41"
settings_version = 2.43
max_source_video_frames = 3000
prompt_enhancer_image_caption_model, prompt_enhancer_image_caption_processor, prompt_enhancer_llm_model, prompt_enhancer_llm_tokenizer = None, None, None, None
@@ -8503,13 +8503,6 @@ custom_resolutions = None
def get_resolution_choices(current_resolution_choice, model_resolutions= None):
global custom_resolutions
- max_pixels_1080p = 1920 * 1088
- def is_above_1080p(resolution_str):
- try:
- width, height = map(int, resolution_str.split("x"))
- except Exception:
- return False
- return width * height > max_pixels_1080p
resolution_file = "resolutions.json"
if model_resolutions is not None:
@@ -8541,23 +8534,25 @@ def get_resolution_choices(current_resolution_choice, model_resolutions= None):
else:
resolution_choices = custom_resolutions
if resolution_choices == None:
- resolution_choices=[
- # 4K
- ("3840x2176 (16:9)", "3840x2176"),
- ("2176x3840 (9:16)", "2176x3840"),
- ("3840x1664 (21:9)", "3840x1664"),
- ("1664x3840 (9:21)", "1664x3840"),
- # 1440p
- ("2560x1440 (16:9)", "2560x1440"),
- ("1440x2560 (9:16)", "1440x2560"),
- ("1920x1440 (4:3)", "1920x1440"),
- ("1440x1920 (3:4)", "1440x1920"),
- ("2160x1440 (3:2)", "2160x1440"),
- ("1440x2160 (2:3)", "1440x2160"),
- ("1440x1440 (1:1)", "1440x1440"),
- ("2688x1152 (21:9)", "2688x1152"),
- ("1152x2688 (9:21)", "1152x2688"),
- # 1080p
+ resolution_choices=[]
+ if server_config.get("enable_4k_resolutions", 0) == 1:
+ resolution_choices=[
+ # 4K
+ ("3840x2176 (16:9)", "3840x2176"),
+ ("2176x3840 (9:16)", "2176x3840"),
+ ("3840x1664 (21:9)", "3840x1664"),
+ ("1664x3840 (9:21)", "1664x3840"),
+ # 1440p
+ ("2560x1440 (16:9)", "2560x1440"),
+ ("1440x2560 (9:16)", "1440x2560"),
+ ("1920x1440 (4:3)", "1920x1440"),
+ ("1440x1920 (3:4)", "1440x1920"),
+ ("2160x1440 (3:2)", "2160x1440"),
+ ("1440x2160 (2:3)", "1440x2160"),
+ ("1440x1440 (1:1)", "1440x1440"),
+ ("2688x1152 (21:9)", "2688x1152"),
+ ("1152x2688 (9:21)", "1152x2688"),]
+ resolution_choices += [# 1080p
("1920x1088 (16:9)", "1920x1088"),
("1088x1920 (9:16)", "1088x1920"),
("1920x832 (21:9)", "1920x832"),
@@ -8583,11 +8578,6 @@ def get_resolution_choices(current_resolution_choice, model_resolutions= None):
("512x512 (1:1)", "512x512"),
]
- allow_4k_resolutions = server_config.get("enable_4k_resolutions", 0) == 1
- if model_resolutions is None and not allow_4k_resolutions:
- filtered_choices = [choice for choice in resolution_choices if not is_above_1080p(choice[1])]
- if filtered_choices:
- resolution_choices = filtered_choices
if current_resolution_choice is not None:
found = False
@@ -8597,10 +8587,7 @@ def get_resolution_choices(current_resolution_choice, model_resolutions= None):
break
if not found:
if model_resolutions is None:
- if allow_4k_resolutions or not is_above_1080p(current_resolution_choice):
- resolution_choices.append( (current_resolution_choice, current_resolution_choice ))
- elif len(resolution_choices) > 0:
- current_resolution_choice = resolution_choices[0][1]
+ resolution_choices.append( (current_resolution_choice, current_resolution_choice ))
else:
if len(resolution_choices) > 0:
current_resolution_choice = resolution_choices[0][1]