Python
added root lora config, promtp enhancer config, zimage base support
DeepBeepMeepe47f0e2e441b
diff --git a/README.md b/README.mdindex 8399c47..6720739 100644--- a/README.md+++ b/README.md@@ -26,7 +26,7 @@ WanGP supports the Wan (and derived models), Hunyuan Video, Flux, Qwen, Z-Image,## 🔥 Latest Updates :-### January 26th 2026: WanGP v10.53, Music for your Hearts+### January 27th 2026: WanGP v10.54, Music for your HeartsWanGP Special *TTS* (Text To Speech) Release:@@ -40,14 +40,19 @@ WanGP Special *TTS* (Text To Speech) Release:- **Custom Output folder for Audio Gens**: you can now choose a different folder for the *Audio Outputs*- **Default Memory Profile for Audio Models**: TTS models can get very slow if you use profile 4 (being autoregressive models, they will need to load all the layers one per one to generate one single audio token then rinse & repeat). On the other hand, they dont't need as much VRAM, so you can now define a more agressive profile (3+ for instance)+- **Z Image Base**: try it if you are into the *Z Image* hype but it will be probably useless for you unless you are a researcher and / or want to build a finetune out of it. This model requires from 35 to 50 steps (4x to 6x slower than *Z Image turbo*) and cfg > 1 (an additional 2x slower) and there is no *Reinforcement Learning* so Output Images wont be as good. The plus side is a higher diversity and *Native Negative Prompt* (versus Z Image virtual Negative Prompt using *NAG*)+- **Various Improvements**:- Video /Audio Galleries now support deletions of gens done outside WanGP- added *MP3 support* for audio outputs- *Check for Updates* button for *Plugins* to see in a glance if any of your plugin can be updated+ - *Prompt Enhancer generates* a different enhanced prompt each timee you click on it. You can define in the config tab its gen parameters (top k, temperature)+ - New *Root Loras* folder can be defined in the config Tab. Useful if you have multiple WanGP instances or want to store easily all your loras in a different hard drive*update 10.51*: new Heart Mula Finetune better at following instructions, Extra settings (cfg, top k) for TTS models, Rife v4\*update 10.52*: updated plugin list and added version tracking\-*update 10.53*: video/audio galleries now support deletions+*update 10.53*: video/audio galleries now support deletions\+*update 10.54*: added Z Image Omnibase, prompt enhancers improvements, configurable loras root folder### January 20th 2026: WanGP v10.43, The Cost Saver*GPUs are expensive, RAM is expensive, SSD are expensive, sadly we live now in a GPU & RAM poor.*diff --git a/defaults/i2v_2_2_Enhanced_Lightning_v2.json b/defaults/i2v_2_2_Enhanced_Lightning_v2.jsonindex d27d045..c484c32 100644--- a/defaults/i2v_2_2_Enhanced_Lightning_v2.json+++ b/defaults/i2v_2_2_Enhanced_Lightning_v2.json@@ -12,7 +12,7 @@],"author": "https://civitai.com/models/2053259","profile_dirs": [""],- "video_prompt_enhancer_instructions": "You are an AI vision model. Analyze the provided image and the user's goal.\nProduce a second-by-second description of how the scene evolves over time.\n\nOutput rules:\nEach line must begin with \"(at X seconds:\" where X is the second number.\nAfter the timestamp, provide a dense, comma-separated visual description.\nKeep everything inside a single set of parentheses per line.\nMaintain a consistent cinematic style: shot type, lighting, subject details, camera movement, and actions.\nDo not include commentary, explanations, or meta-text.\nOnly describe visual, physical, or camera changes.\nStay consistent with the input image while expanding logically to meet the goal.\n\nOutput Format Example:\n(at 0 seconds: 4K, realistic, close-up shot, clean single subject, daylight, natural lighting, bedroom near a small window with light coming in from the left, a young college aged woman with blonde hair, blue eyes dressed in a blue pajama top, sitting up, she looks to be annoyed, the camera pushes-in on the character's face, she pulls the blanket off of her)\n\n(at 1 seconds: [next description])\n\n(at 2 seconds: [next description])\n\nContinue until the goal is fully represented."+ "video_prompt_enhancer_instructions": "You are an AI vision model. Analyze the provided image and the user's goal.\nProduce a second-by-second description of how the scene evolves over time.\nOutput rules:\nEach line must begin with \"(at X seconds:\" where X is the second number.\nAfter the timestamp, provide a dense, comma-separated visual description.\nKeep everything inside a single set of parentheses per line.\nMaintain a consistent cinematic style: shot type, lighting, subject details, camera movement, and actions.\nDo not include commentary, explanations, or meta-text.\nOnly describe visual, physical, or camera changes.\nStay consistent with the input image while expanding logically to meet the goal.\nOutput Format Example:\n(at 0 seconds: 4K, realistic, close-up shot, clean single subject, daylight, natural lighting, bedroom near a small window with light coming in from the left, a young college aged woman with blonde hair, blue eyes dressed in a blue pajama top, sitting up, she looks to be annoyed, the camera pushes-in on the character's face, she pulls the blanket off of her)\n(at 1 seconds: [next description])\n(at 2 seconds: [next description])\nContinue until the goal is fully represented."},"guidance_phases": 2,"switch_threshold" : 900,diff --git a/defaults/i2v_2_2_Enhanced_Lightning_v2_svi2pro.json b/defaults/i2v_2_2_Enhanced_Lightning_v2_svi2pro.jsonindex fc407b6..9e7de37 100644--- a/defaults/i2v_2_2_Enhanced_Lightning_v2_svi2pro.json+++ b/defaults/i2v_2_2_Enhanced_Lightning_v2_svi2pro.json@@ -15,7 +15,7 @@"loras": "i2v_2_2_svi2pro","loras_multipliers": "i2v_2_2_svi2pro","profile_dirs": [""],- "video_prompt_enhancer_instructions": "You are an AI vision model. Analyze the provided image and the user's goal.\nProduce a second-by-second description of how the scene evolves over time.\n\nOutput rules:\nEach line must begin with \"(at X seconds:\" where X is the second number.\nAfter the timestamp, provide a dense, comma-separated visual description.\nKeep everything inside a single set of parentheses per line.\nMaintain a consistent cinematic style: shot type, lighting, subject details, camera movement, and actions.\nDo not include commentary, explanations, or meta-text.\nOnly describe visual, physical, or camera changes.\nStay consistent with the input image while expanding logically to meet the goal.\n\nOutput Format Example:\n(at 0 seconds: 4K, realistic, close-up shot, clean single subject, daylight, natural lighting, bedroom near a small window with light coming in from the left, a young college aged woman with blonde hair, blue eyes dressed in a blue pajama top, sitting up, she looks to be annoyed, the camera pushes-in on the character's face, she pulls the blanket off of her)\n\n(at 1 seconds: [next description])\n\n(at 2 seconds: [next description])\n\nContinue until the goal is fully represented."+ "video_prompt_enhancer_instructions": "You are an AI vision model. Analyze the provided image and the user's goal.\nProduce a second-by-second description of how the scene evolves over time.\nOutput rules:\nEach line must begin with \"(at X seconds:\" where X is the second number.\nAfter the timestamp, provide a dense, comma-separated visual description.\nKeep everything inside a single set of parentheses per line.\nMaintain a consistent cinematic style: shot type, lighting, subject details, camera movement, and actions.\nDo not include commentary, explanations, or meta-text.\nOnly describe visual, physical, or camera changes.\nStay consistent with the input image while expanding logically to meet the goal.\nOutput Format Example:\n(at 0 seconds: 4K, realistic, close-up shot, clean single subject, daylight, natural lighting, bedroom near a small window with light coming in from the left, a young college aged woman with blonde hair, blue eyes dressed in a blue pajama top, sitting up, she looks to be annoyed, the camera pushes-in on the character's face, she pulls the blanket off of her)\n(at 1 seconds: [next description])\n(at 2 seconds: [next description])\nContinue until the goal is fully represented."},"guidance_phases": 2,"switch_threshold" : 900,diff --git a/defaults/ltx2_distilled.json b/defaults/ltx2_distilled.jsonindex 3984a17..f21f9c9 100644--- a/defaults/ltx2_distilled.json+++ b/defaults/ltx2_distilled.json@@ -12,6 +12,5 @@},"prompt": "A warm sunny backyard. The camera starts in a tight cinematic close-up of a woman and a man in their 30s, facing each other with serious expressions. The woman, emotional and dramatic, says softly, \"That's it... Dad's lost it. And we've lost Dad.\"The man exhales, slightly annoyed: \"Stop being so dramatic, Jess.\"A beat. He glances aside, then mutters defensively, \"He's just having fun.\"The camera slowly pans right, revealing the grandfather in the garden wearing enormous butterfly wings, waving his arms in the air like he's trying to take off.He shouts, \"Wheeeew!\" as he flaps his wings with full commitment.The woman covers her face, on the verge of tears. The tone is deadpan, absurd, and quietly tragic.","num_inference_steps": 8,- "video_length": 241,- "guidance_scale": 4.0+ "video_length": 241}diff --git a/defaults/ltx2_distilled_gguf_q4_k_m.json b/defaults/ltx2_distilled_gguf_q4_k_m.jsonindex 3f6b86f..ab2b2cb 100644--- a/defaults/ltx2_distilled_gguf_q4_k_m.json+++ b/defaults/ltx2_distilled_gguf_q4_k_m.json@@ -11,6 +11,5 @@},"prompt": "A warm sunny backyard. The camera starts in a tight cinematic close-up of a woman and a man in their 30s, facing each other with serious expressions. The woman, emotional and dramatic, says softly, \"That's it... Dad's lost it. And we've lost Dad.\"The man exhales, slightly annoyed: \"Stop being so dramatic, Jess.\"A beat. He glances aside, then mutters defensively, \"He's just having fun.\"The camera slowly pans right, revealing the grandfather in the garden wearing enormous butterfly wings, waving his arms in the air like he's trying to take off.He shouts, \"Wheeeew!\" as he flaps his wings with full commitment.The woman covers her face, on the verge of tears. The tone is deadpan, absurd, and quietly tragic.","num_inference_steps": 8,- "video_length": 241,- "guidance_scale": 4.0+ "video_length": 241}diff --git a/defaults/ltx2_distilled_gguf_q6_k.json b/defaults/ltx2_distilled_gguf_q6_k.jsonindex 55c24d2..979ad5d 100644--- a/defaults/ltx2_distilled_gguf_q6_k.json+++ b/defaults/ltx2_distilled_gguf_q6_k.json@@ -11,6 +11,5 @@},"prompt": "A warm sunny backyard. The camera starts in a tight cinematic close-up of a woman and a man in their 30s, facing each other with serious expressions. The woman, emotional and dramatic, says softly, \"That's it... Dad's lost it. And we've lost Dad.\"The man exhales, slightly annoyed: \"Stop being so dramatic, Jess.\"A beat. He glances aside, then mutters defensively, \"He's just having fun.\"The camera slowly pans right, revealing the grandfather in the garden wearing enormous butterfly wings, waving his arms in the air like he's trying to take off.He shouts, \"Wheeeew!\" as he flaps his wings with full commitment.The woman covers her face, on the verge of tears. The tone is deadpan, absurd, and quietly tragic.","num_inference_steps": 8,- "video_length": 241,- "guidance_scale": 4.0+ "video_length": 241}diff --git a/defaults/ltx2_distilled_gguf_q8_0.json b/defaults/ltx2_distilled_gguf_q8_0.jsonindex 708c67e..21edbba 100644--- a/defaults/ltx2_distilled_gguf_q8_0.json+++ b/defaults/ltx2_distilled_gguf_q8_0.json@@ -11,6 +11,5 @@},"prompt": "A warm sunny backyard. The camera starts in a tight cinematic close-up of a woman and a man in their 30s, facing each other with serious expressions. The woman, emotional and dramatic, says softly, \"That's it... Dad's lost it. And we've lost Dad.\"The man exhales, slightly annoyed: \"Stop being so dramatic, Jess.\"A beat. He glances aside, then mutters defensively, \"He's just having fun.\"The camera slowly pans right, revealing the grandfather in the garden wearing enormous butterfly wings, waving his arms in the air like he's trying to take off.He shouts, \"Wheeeew!\" as he flaps his wings with full commitment.The woman covers her face, on the verge of tears. The tone is deadpan, absurd, and quietly tragic.","num_inference_steps": 8,- "video_length": 241,- "guidance_scale": 4.0+ "video_length": 241}diff --git a/defaults/z_image.json b/defaults/z_image.jsonindex 555c679..52294ae 100644--- a/defaults/z_image.json+++ b/defaults/z_image.json@@ -2,7 +2,7 @@"model": {"name": "Z-Image Turbo 6B","architecture": "z_image",- "description": "Z-Image Turbo text-to-image model.",+ "description": "Z-Image is a powerful and highly efficient image generation model with 6B parameters. Z Image Turbe is a distilled version of Z-Image that matches or exceeds leading competitors with only 8 NFEs.","URLs": ["https://huggingface.co/DeepBeepMeep/Z-Image/resolve/main/ZImageTurbo_bf16.safetensors","https://huggingface.co/DeepBeepMeep/Z-Image/resolve/main/ZImageTurbo_quanto_bf16_int8.safetensors"diff --git a/defaults/z_image_base.json b/defaults/z_image_base.jsonnew file mode 100644index 0000000..7c2e00f--- /dev/null+++ b/defaults/z_image_base.json@@ -0,0 +1,14 @@+{+ "model": {+ "name": "Z-Image Base 6B",+ "architecture": "z_image_base",+ "description": "The foundation model behind Z-Image-Turbo. Z-Image focuses on high-quality generation, rich aesthetics, strong diversity, and controllability, well-suited for creative generation, fine-tuning, and downstream development. It supports a wide range of artistic styles, effective negative prompting, and high diversity across identities, poses, compositions, and layouts.",+ "URLs": [+ "https://huggingface.co/DeepBeepMeep/Z-Image/resolve/main/ZImageBase_bf16.safetensors",+ "https://huggingface.co/DeepBeepMeep/Z-Image/resolve/main/ZImageBase_quanto_bf16_int8.safetensors"+ ]+ },+ "resolution": "1024x1024",+ "batch_size": 1,+ "num_inference_steps": 30+}diff --git a/defaults/z_image_nunchaku_r128_fp4.json b/defaults/z_image_nunchaku_r128_fp4.jsonindex 1cc062d..d6778cd 100644--- a/defaults/z_image_nunchaku_r128_fp4.json+++ b/defaults/z_image_nunchaku_r128_fp4.json@@ -1,6 +1,6 @@{"model": {- "name": "Z-Image Turbo Nunchaku FP4 (r128)",+ "name": "Z-Image Turbo Nunchaku FP4 (r128) 6B","architecture": "z_image","description": "Nunchaku SVDQ FP4 weights for Z-Image Turbo. For full speed, a sm120+ GPU is needed (RTX 50xx) and the nunchaku kernels must be installed.","URLs": [diff --git a/defaults/z_image_nunchaku_r256_int4.json b/defaults/z_image_nunchaku_r256_int4.jsonindex 435dbf8..929cd2a 100644--- a/defaults/z_image_nunchaku_r256_int4.json+++ b/defaults/z_image_nunchaku_r256_int4.json@@ -1,6 +1,6 @@{"model": {- "name": "Z-Image Turbo Nunchaku INT4 (r256)",+ "name": "Z-Image Turbo Nunchaku INT4 (r256) 6B","architecture": "z_image","description": "Nunchaku SVDQ INT4 weights for Z-Image Turbo. For full speed, the nunchaku kernels must be installed.","URLs": [diff --git a/defaults/z_image_twinflow_turbo.json b/defaults/z_image_twinflow_turbo.jsonindex 2a209da..056f5b8 100644--- a/defaults/z_image_twinflow_turbo.json+++ b/defaults/z_image_twinflow_turbo.json@@ -1,6 +1,6 @@{"model": {- "name": "TwinFlow Z-Image Turbo",+ "name": "TwinFlow Z-Image Turbo 6B","architecture": "z_image","description": "TwinFlow is a distilled Z-Image Turbo Finetune optimized for 1 to 4 steps Image Generations.","unified_solver": true,diff --git a/docs/CLI.md b/docs/CLI.mdindex b582fdb..5d7f71a 100644--- a/docs/CLI.md+++ b/docs/CLI.md@@ -124,6 +124,7 @@ python wgp.py --process queue.zip --output-dir ./out --attention sage2## Lora Configuration```bash+--loras PATH # Root folder for all LoRA subfolders (default: loras)--lora-dir PATH # Path to Wan t2v loras directory--lora-dir-i2v PATH # Path to Wan i2v loras directory--lora-dir-hunyuan PATH # Path to Hunyuan t2v loras directory@@ -134,6 +135,10 @@ python wgp.py --process queue.zip --output-dir ./out --attention sage2--check-loras # Filter incompatible loras (slower startup)```+Notes:+- `--loras` sets the root folder used by all LoRA subfolders (e.g. `loras/wan`, `loras/flux`, etc.).+- Specific `--lora-dir-*` flags override the root for that family only.+## Generation Settings### Basic Generation@@ -298,8 +303,8 @@ Create and share lora configurations:# Load specific presetpython wgp.py --lora-preset anime_style.lset-# With custom lora directory-python wgp.py --lora-preset mystyle.lset --lora-dir /shared/loras+# With custom lora root+python wgp.py --loras /shared/loras --lora-preset mystyle.lset```## Environment Variablesdiff --git a/models/TTS/tts_handler.py b/models/TTS/tts_handler.pyindex b5b6c3b..b21f387 100644--- a/models/TTS/tts_handler.py+++ b/models/TTS/tts_handler.py@@ -304,17 +304,17 @@ class family_handler:return {"tts": (200, "TTS")}@staticmethod- def register_lora_cli_args(parser):+ def register_lora_cli_args(parser, lora_root):parser.add_argument("--lora-dir-tts",type=str,- default=os.path.join("loras", "tts"),- help="Path to a directory that contains TTS settings",+ default=None,+ help=f"Path to a directory that contains TTS settings (default: {os.path.join(lora_root, 'tts')})",)@staticmethod- def get_lora_dir(base_model_type, args):- return args.lora_dir_tts+ def get_lora_dir(base_model_type, args, lora_root):+ return getattr(args, "lora_dir_tts", None) or os.path.join(lora_root, "tts")@staticmethoddef query_model_def(base_model_type, model_def):diff --git a/models/flux/flux_handler.py b/models/flux/flux_handler.pyindex c435f9d..2ed270e 100644--- a/models/flux/flux_handler.py+++ b/models/flux/flux_handler.py@@ -260,41 +260,41 @@ class family_handler():return {"flux":(100, "Flux 1"), "flux2":(101, "Flux 2")}@staticmethod- def register_lora_cli_args(parser):+ def register_lora_cli_args(parser, lora_root):parser.add_argument("--lora-dir-flux",type=str,- default=os.path.join("loras", "flux"),- help="Path to a directory that contains flux images Loras"+ default=None,+ help=f"Path to a directory that contains flux images Loras (default: {os.path.join(lora_root, 'flux')})")parser.add_argument("--lora-dir-flux2",type=str,- default=os.path.join("loras", "flux2"),- help="Path to a directory that contains flux2 images Loras"+ default=None,+ help=f"Path to a directory that contains flux2 images Loras (default: {os.path.join(lora_root, 'flux2')})")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"+ default=None,+ help=f"Path to a directory that contains Flux 2 Klein 4B Loras (default: {os.path.join(lora_root, 'flux2_klein_4b')})")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"+ default=None,+ help=f"Path to a directory that contains Flux 2 Klein 9B Loras (default: {os.path.join(lora_root, 'flux2_klein_9b')})")@staticmethod- def get_lora_dir(base_model_type, args):+ def get_lora_dir(base_model_type, args, lora_root):if base_model_type == "flux2_klein_4b":- return args.lora_dir_flux2_klein_4b+ return getattr(args, "lora_dir_flux2_klein_4b", None) or os.path.join(lora_root, "flux2_klein_4b")if base_model_type == "flux2_klein_9b":- return args.lora_dir_flux2_klein_9b+ return getattr(args, "lora_dir_flux2_klein_9b", None) or os.path.join(lora_root, "flux2_klein_9b")if test_flux2(base_model_type):- return args.lora_dir_flux2- return args.lora_dir_flux+ return getattr(args, "lora_dir_flux2", None) or os.path.join(lora_root, "flux2")+ return getattr(args, "lora_dir_flux", None) or os.path.join(lora_root, "flux")@staticmethoddef query_model_files(computeList, base_model_type, model_def=None):diff --git a/models/hyvideo/hunyuan_handler.py b/models/hyvideo/hunyuan_handler.pyindex 4a04250..3c0bbb9 100644--- a/models/hyvideo/hunyuan_handler.py+++ b/models/hyvideo/hunyuan_handler.py@@ -165,36 +165,35 @@ class family_handler():return {"hunyuan":(20, "Hunyuan Video"), "hunyuan_1_5":(21, "Hunyuan Video 1.5")}@staticmethod- def register_lora_cli_args(parser):+ def register_lora_cli_args(parser, lora_root):parser.add_argument("--lora-dir-hunyuan",type=str,- default=os.path.join("loras", "hunyuan"),- help="Path to a directory that contains Hunyuan Video t2v Loras"+ default=None,+ help=f"Path to a directory that contains Hunyuan Video t2v Loras (default: {os.path.join(lora_root, 'hunyuan')})")parser.add_argument("--lora-dir-hunyuan-i2v",type=str,- default=os.path.join("loras", "hunyuan_i2v"),- help="Path to a directory that contains Hunyuan Video i2v Loras"+ default=None,+ help=f"Path to a directory that contains Hunyuan Video i2v Loras (default: {os.path.join(lora_root, 'hunyuan_i2v')})")parser.add_argument("--lora-dir-hunyuan-1-5",type=str,- default=os.path.join("loras", "hunyuan_1_5"),- help="Path to a directory that contains Hunyuan Video 1.5 Loras"+ default=None,+ help=f"Path to a directory that contains Hunyuan Video 1.5 Loras (default: {os.path.join(lora_root, 'hunyuan_1_5')})")@staticmethod- def get_lora_dir(base_model_type, args):+ def get_lora_dir(base_model_type, args, lora_root):if test_hunyuan_1_5(base_model_type):- return args.lora_dir_hunyuan_1_5+ return getattr(args, "lora_dir_hunyuan_1_5", None) or os.path.join(lora_root, "hunyuan_1_5")elif "i2v" in base_model_type:- return args.lora_dir_hunyuan_i2v+ return getattr(args, "lora_dir_hunyuan_i2v", None) or os.path.join(lora_root, "hunyuan_i2v")- root_lora_dir = args.lora_dir_hunyuan- return root_lora_dir+ return getattr(args, "lora_dir_hunyuan", None) or os.path.join(lora_root, "hunyuan")@staticmethoddef get_rgb_factors(base_model_type ):diff --git a/models/kandinsky5/kandinsky_handler.py b/models/kandinsky5/kandinsky_handler.pyindex 360c52a..4ea28c4 100644--- a/models/kandinsky5/kandinsky_handler.py+++ b/models/kandinsky5/kandinsky_handler.py@@ -100,46 +100,46 @@ class family_handler:}@staticmethod- def register_lora_cli_args(parser):+ def register_lora_cli_args(parser, lora_root):parser.add_argument("--lora-dir-kandinsky5",type=str,- default=os.path.join("loras", "kandinsky5"),- help="Base path for Kandinsky 5 loras (per-architecture subfolders are used).",+ default=None,+ help=f"Base path for Kandinsky 5 loras (per-architecture subfolders are used). Default: {os.path.join(lora_root, 'kandinsky5')}.",)parser.add_argument("--lora-dir-k5-lite-t2v",type=str,- default=os.path.join("loras", "k5_lite_t2v"),- help="Path to a directory that contains Kandinsky 5 Lite T2V loras.",+ default=None,+ help=f"Path to a directory that contains Kandinsky 5 Lite T2V loras (default: {os.path.join(lora_root, 'k5_lite_t2v')}).",)parser.add_argument("--lora-dir-k5-lite-i2v",type=str,- default=os.path.join("loras", "k5_lite_i2v"),- help="Path to a directory that contains Kandinsky 5 Lite I2V loras.",+ default=None,+ help=f"Path to a directory that contains Kandinsky 5 Lite I2V loras (default: {os.path.join(lora_root, 'k5_lite_i2v')}).",)parser.add_argument("--lora-dir-k5-pro-t2v",type=str,- default=os.path.join("loras", "k5_pro_t2v"),- help="Path to a directory that contains Kandinsky 5 Pro T2V loras.",+ default=None,+ help=f"Path to a directory that contains Kandinsky 5 Pro T2V loras (default: {os.path.join(lora_root, 'k5_pro_t2v')}).",)parser.add_argument("--lora-dir-k5-pro-i2v",type=str,- default=os.path.join("loras", "k5_pro_i2v"),- help="Path to a directory that contains Kandinsky 5 Pro I2V loras.",+ default=None,+ help=f"Path to a directory that contains Kandinsky 5 Pro I2V loras (default: {os.path.join(lora_root, 'k5_pro_i2v')}).",)@staticmethod- def get_lora_dir(base_model_type, args):- base_dir = getattr(args, "lora_dir_kandinsky5", None) or os.path.join("loras", "kandinsky5")+ def get_lora_dir(base_model_type, args, lora_root):+ base_dir = getattr(args, "lora_dir_kandinsky5", None) or os.path.join(lora_root, "kandinsky5")per_arch = {- "k5_lite_t2v": getattr(args, "lora_dir_k5_lite_t2v", None) or os.path.join("loras", "k5_lite_t2v"),- "k5_lite_i2v": getattr(args, "lora_dir_k5_lite_i2v", None) or os.path.join("loras", "k5_lite_i2v"),- "k5_pro_t2v": getattr(args, "lora_dir_k5_pro_t2v", None) or os.path.join("loras", "k5_pro_t2v"),- "k5_pro_i2v": getattr(args, "lora_dir_k5_pro_i2v", None) or os.path.join("loras", "k5_pro_i2v"),+ "k5_lite_t2v": getattr(args, "lora_dir_k5_lite_t2v", None) or os.path.join(lora_root, "k5_lite_t2v"),+ "k5_lite_i2v": getattr(args, "lora_dir_k5_lite_i2v", None) or os.path.join(lora_root, "k5_lite_i2v"),+ "k5_pro_t2v": getattr(args, "lora_dir_k5_pro_t2v", None) or os.path.join(lora_root, "k5_pro_t2v"),+ "k5_pro_i2v": getattr(args, "lora_dir_k5_pro_i2v", None) or os.path.join(lora_root, "k5_pro_i2v"),}if base_model_type in per_arch:return per_arch[base_model_type]diff --git a/models/longcat/longcat_handler.py b/models/longcat/longcat_handler.pyindex 11bcd52..d58264a 100644--- a/models/longcat/longcat_handler.py+++ b/models/longcat/longcat_handler.py@@ -21,25 +21,25 @@ class family_handler:return {"longcat": (60, "LongCat")}@staticmethod- def register_lora_cli_args(parser):+ def register_lora_cli_args(parser, lora_root):parser.add_argument("--lora-dir-longcat",type=str,- default=os.path.join("loras", "longcat"),- help="Path to a directory that contains LongCat Video LoRAs",+ default=None,+ help=f"Path to a directory that contains LongCat Video LoRAs (default: {os.path.join(lora_root, 'longcat')})",)parser.add_argument("--lora-dir-longcat-avatar",type=str,- default=os.path.join("loras", "longcat_avatar"),- help="Path to a directory that contains LongCat Avatar LoRAs",+ default=None,+ help=f"Path to a directory that contains LongCat Avatar LoRAs (default: {os.path.join(lora_root, 'longcat_avatar')})",)@staticmethod- def get_lora_dir(base_model_type, args):+ def get_lora_dir(base_model_type, args, lora_root):if base_model_type == "longcat_avatar":- return args.lora_dir_longcat_avatar- return args.lora_dir_longcat+ return getattr(args, "lora_dir_longcat_avatar", None) or os.path.join(lora_root, "longcat_avatar")+ return getattr(args, "lora_dir_longcat", None) or os.path.join(lora_root, "longcat")@staticmethoddef query_model_def(base_model_type, model_def):diff --git a/models/ltx2/ltx2_handler.py b/models/ltx2/ltx2_handler.pyindex 506d02b..3130a4c 100644--- a/models/ltx2/ltx2_handler.py+++ b/models/ltx2/ltx2_handler.py@@ -139,17 +139,17 @@ class family_handler:return get_rgb_factors("ltx2")@staticmethod- def register_lora_cli_args(parser):+ def register_lora_cli_args(parser, lora_root):parser.add_argument("--lora-dir-ltx2",type=str,- default=os.path.join("loras", "ltx2"),- help="Path to a directory that contains LTX-2 LoRAs",+ default=None,+ help=f"Path to a directory that contains LTX-2 LoRAs (default: {os.path.join(lora_root, 'ltx2')})",)@staticmethod- def get_lora_dir(base_model_type, args):- return args.lora_dir_ltx2+ def get_lora_dir(base_model_type, args, lora_root):+ return getattr(args, "lora_dir_ltx2", None) or os.path.join(lora_root, "ltx2")@staticmethoddef get_vae_block_size(base_model_type):diff --git a/models/ltx_video/ltxv_handler.py b/models/ltx_video/ltxv_handler.pyindex f52ddf2..a0b3f25 100644--- a/models/ltx_video/ltxv_handler.py+++ b/models/ltx_video/ltxv_handler.py@@ -63,17 +63,17 @@ class family_handler():return {"ltxv":(30, "LTX Video")}@staticmethod- def register_lora_cli_args(parser):+ def register_lora_cli_args(parser, lora_root):parser.add_argument("--lora-dir-ltxv",type=str,- default=os.path.join("loras", "ltxv"),- help="Path to a directory that contains LTX Videos Loras"+ default=None,+ help=f"Path to a directory that contains LTX Videos Loras (default: {os.path.join(lora_root, 'ltxv')})")@staticmethod- def get_lora_dir(base_model_type, args):- return args.lora_dir_ltxv+ def get_lora_dir(base_model_type, args, lora_root):+ return getattr(args, "lora_dir_ltxv", None) or os.path.join(lora_root, "ltxv")@staticmethoddef get_vae_block_size(base_model_type):diff --git a/models/ltx_video/utils/prompt_enhance_utils.py b/models/ltx_video/utils/prompt_enhance_utils.pyindex 2a87c7e..a7a7f75 100644--- a/models/ltx_video/utils/prompt_enhance_utils.py+++ b/models/ltx_video/utils/prompt_enhance_utils.py@@ -1,5 +1,6 @@import loggingfrom typing import Union, List, Optional+from contextlib import nullcontextimport torchfrom PIL import Image@@ -158,6 +159,11 @@ def generate_cinematic_prompt(text_prompt = False,max_new_tokens: int = 256,prompt_enhancer_instructions = None,+ do_sample: bool = True,+ temperature: Optional[float] = None,+ top_p: Optional[float] = None,+ top_k: Optional[int] = None,+ seed: Optional[int] = None,) -> List[str]:prompts = [prompt] if isinstance(prompt, str) else prompt@@ -170,6 +176,11 @@ def generate_cinematic_prompt(prompts,max_new_tokens,prompt_enhancer_instructions,+ do_sample,+ temperature,+ top_p,+ top_k,+ seed,)else:if prompt_enhancer_instructions is None:@@ -184,6 +195,11 @@ def generate_cinematic_prompt(images,max_new_tokens,prompt_enhancer_instructions,+ do_sample,+ temperature,+ top_p,+ top_k,+ seed,)return prompts@@ -203,6 +219,11 @@ def _generate_t2v_prompt(prompts: List[str],max_new_tokens: int,system_prompt: str,+ do_sample: bool,+ temperature: Optional[float],+ top_p: Optional[float],+ top_k: Optional[int],+ seed: Optional[int],) -> List[str]:messages = [[@@ -220,11 +241,24 @@ def _generate_t2v_prompt(]out_prompts = []- for text in texts:+ for idx, text in enumerate(texts):model_inputs = prompt_enhancer_tokenizer(text, return_tensors="pt").to(prompt_enhancer_model.device)- out_prompts.append(_generate_and_decode_prompts(prompt_enhancer_model, prompt_enhancer_tokenizer, model_inputs, max_new_tokens)[0])+ prompt_seed = None if seed is None else int(seed) + idx+ out_prompts.append(+ _generate_and_decode_prompts(+ prompt_enhancer_model,+ prompt_enhancer_tokenizer,+ model_inputs,+ max_new_tokens,+ do_sample=do_sample,+ temperature=temperature,+ top_p=top_p,+ top_k=top_k,+ seed=prompt_seed,+ )[0]+ )return out_prompts@@ -237,6 +271,11 @@ def _generate_i2v_prompt(first_frames: List[Image.Image],max_new_tokens: int,system_prompt: str,+ do_sample: bool,+ temperature: Optional[float],+ top_p: Optional[float],+ top_k: Optional[int],+ seed: Optional[int],) -> List[str]:image_captions = _generate_image_captions(image_caption_model, image_caption_processor, first_frames@@ -258,11 +297,24 @@ def _generate_i2v_prompt(for m in messages]out_prompts = []- for text in texts:+ for idx, text in enumerate(texts):model_inputs = prompt_enhancer_tokenizer(text, return_tensors="pt").to(prompt_enhancer_model.device)- out_prompts.append(_generate_and_decode_prompts(prompt_enhancer_model, prompt_enhancer_tokenizer, model_inputs, max_new_tokens)[0])+ prompt_seed = None if seed is None else int(seed) + idx+ out_prompts.append(+ _generate_and_decode_prompts(+ prompt_enhancer_model,+ prompt_enhancer_tokenizer,+ model_inputs,+ max_new_tokens,+ do_sample=do_sample,+ temperature=temperature,+ top_p=top_p,+ top_k=top_k,+ seed=prompt_seed,+ )[0]+ )return out_prompts@@ -291,11 +343,43 @@ def _generate_image_captions(def _generate_and_decode_prompts(- prompt_enhancer_model, prompt_enhancer_tokenizer, model_inputs, max_new_tokens: int+ prompt_enhancer_model,+ prompt_enhancer_tokenizer,+ model_inputs,+ max_new_tokens: int,+ do_sample: bool = True,+ temperature: Optional[float] = None,+ top_p: Optional[float] = None,+ top_k: Optional[int] = None,+ seed: Optional[int] = None,) -> List[str]:- with torch.inference_mode():+ device = getattr(prompt_enhancer_model, "device", None)+ if seed is None:+ rng_context = nullcontext()+ else:+ devices = []+ if isinstance(device, torch.device) and device.type == "cuda":+ devices = [device.index or 0]+ rng_context = torch.random.fork_rng(devices=devices) if devices else torch.random.fork_rng()+ with rng_context, torch.inference_mode():+ if seed is not None:+ torch.manual_seed(int(seed))+ if isinstance(device, torch.device) and device.type == "cuda":+ with torch.cuda.device(device):+ torch.cuda.manual_seed(int(seed))+ gen_kwargs = {+ "max_new_tokens": max_new_tokens,+ "do_sample": do_sample,+ }+ if temperature is not None:+ gen_kwargs["temperature"] = float(temperature)+ if top_p is not None:+ gen_kwargs["top_p"] = float(top_p)+ if top_k is not None:+ gen_kwargs["top_k"] = int(top_k)outputs = prompt_enhancer_model.generate(- **model_inputs, max_new_tokens=max_new_tokens+ **model_inputs,+ **gen_kwargs,)generated_ids = [output_ids[len(input_ids) :]diff --git a/models/qwen/qwen_handler.py b/models/qwen/qwen_handler.pyindex dbbecd5..f2d7909 100644--- a/models/qwen/qwen_handler.py+++ b/models/qwen/qwen_handler.py@@ -119,17 +119,17 @@ class family_handler():return {"qwen":(110, "Qwen")}@staticmethod- def register_lora_cli_args(parser):+ def register_lora_cli_args(parser, lora_root):parser.add_argument("--lora-dir-qwen",type=str,- default=os.path.join("loras", "qwen"),- help="Path to a directory that contains qwen images Loras"+ default=None,+ help=f"Path to a directory that contains qwen images Loras (default: {os.path.join(lora_root, 'qwen')})")@staticmethod- def get_lora_dir(base_model_type, args):- return args.lora_dir_qwen+ def get_lora_dir(base_model_type, args, lora_root):+ return getattr(args, "lora_dir_qwen", None) or os.path.join(lora_root, "qwen")@staticmethoddef query_model_files(computeList, base_model_type, model_def=None):diff --git a/models/wan/df_handler.py b/models/wan/df_handler.pyindex 8b94959..084f232 100644--- a/models/wan/df_handler.py+++ b/models/wan/df_handler.py@@ -75,16 +75,16 @@ class family_handler():return {}@staticmethod- def register_lora_cli_args(parser):+ def register_lora_cli_args(parser, lora_root):from .wan_handler import family_handler as wan_family_handler- return wan_family_handler.register_lora_cli_args(parser)+ return wan_family_handler.register_lora_cli_args(parser, lora_root)@staticmethod- def get_lora_dir(base_model_type, args):+ def get_lora_dir(base_model_type, args, lora_root):from .wan_handler import family_handler as wan_family_handler- return wan_family_handler.get_lora_dir(base_model_type, args)+ return wan_family_handler.get_lora_dir(base_model_type, args, lora_root)@staticmethoddef get_rgb_factors(base_model_type ):diff --git a/models/wan/ovi_handler.py b/models/wan/ovi_handler.pyindex b552ab7..e47a8f9 100644--- a/models/wan/ovi_handler.py+++ b/models/wan/ovi_handler.py@@ -25,10 +25,10 @@ class family_handler:return {}@staticmethod- def register_lora_cli_args(parser):+ def register_lora_cli_args(parser, lora_root):from .wan_handler import family_handler as wan_family_handler- return wan_family_handler.register_lora_cli_args(parser)+ return wan_family_handler.register_lora_cli_args(parser, lora_root)@staticmethoddef query_model_def(base_model_type: str, model_def: Dict[str, Any]):@@ -82,10 +82,10 @@ class family_handler:return download_def@staticmethod- def get_lora_dir(base_model_type, args):+ def get_lora_dir(base_model_type, args, lora_root):from .wan_handler import family_handler as wan_family_handler- return wan_family_handler.get_lora_dir(base_model_type, args)+ return wan_family_handler.get_lora_dir(base_model_type, args, lora_root)@staticmethoddef load_model(diff --git a/models/wan/wan_handler.py b/models/wan/wan_handler.pyindex 245cab1..bb4079c 100644--- a/models/wan/wan_handler.py+++ b/models/wan/wan_handler.py@@ -89,45 +89,45 @@ class family_handler():return {"wan":(0, "Wan2.1"), "wan2_2":(1, "Wan2.2") }@staticmethod- def register_lora_cli_args(parser):+ def register_lora_cli_args(parser, lora_root):parser.add_argument("--lora-dir-i2v",type=str,- default=os.path.join("loras", "wan_i2v"),- help="Path to a directory that contains Wan i2v Loras "+ default=None,+ help=f"Path to a directory that contains Wan i2v Loras (default: {os.path.join(lora_root, 'wan_i2v')})")parser.add_argument("--lora-dir",type=str,- default=os.path.join("loras", "wan"),- help="Path to a directory that contains Wan t2v Loras"+ default=None,+ help=f"Path to a directory that contains Wan t2v Loras (default: {os.path.join(lora_root, 'wan')})")parser.add_argument("--lora-dir-wan-1-3b",type=str,- default=os.path.join("loras", "wan_1.3B"),- help="Path to a directory that contains Wan 1.3B Loras"+ default=None,+ help=f"Path to a directory that contains Wan 1.3B Loras (default: {os.path.join(lora_root, 'wan_1.3B')})")parser.add_argument("--lora-dir-wan-5b",type=str,- default=os.path.join("loras", "wan_5B"),- help="Path to a directory that contains Wan 5B Loras"+ default=None,+ help=f"Path to a directory that contains Wan 5B Loras (default: {os.path.join(lora_root, 'wan_5B')})")parser.add_argument("--lora-dir-wan-i2v",type=str,- default=os.path.join("loras", "wan_i2v"),- help="Path to a directory that contains Wan i2v Loras"+ default=None,+ help=f"Path to a directory that contains Wan i2v Loras (default: {os.path.join(lora_root, 'wan_i2v')})")@staticmethod- def get_lora_dir(base_model_type, args):+ def get_lora_dir(base_model_type, args, lora_root):i2v = test_class_i2v(base_model_type) and not test_i2v_2_2(base_model_type)- wan_dir = getattr(args, "lora_dir_wan", None) or getattr(args, "lora_dir", None) or os.path.join("loras", "wan")- wan_i2v_dir = getattr(args, "lora_dir_wan_i2v", None) or getattr(args, "lora_dir_i2v", None) or os.path.join("loras", "wan_i2v")- wan_1_3b_dir = getattr(args, "lora_dir_wan_1_3b", None) or os.path.join("loras", "wan_1.3B")- wan_5b_dir = getattr(args, "lora_dir_wan_5b", None) or os.path.join("loras", "wan_5B")+ wan_dir = getattr(args, "lora_dir_wan", None) or getattr(args, "lora_dir", None) or os.path.join(lora_root, "wan")+ wan_i2v_dir = getattr(args, "lora_dir_wan_i2v", None) or getattr(args, "lora_dir_i2v", None) or os.path.join(lora_root, "wan_i2v")+ wan_1_3b_dir = getattr(args, "lora_dir_wan_1_3b", None) or os.path.join(lora_root, "wan_1.3B")+ wan_5b_dir = getattr(args, "lora_dir_wan_5b", None) or os.path.join(lora_root, "wan_5B")if i2v:return wan_i2v_dirdiff --git a/models/z_image/configs/z_image_base.json b/models/z_image/configs/z_image_base.jsonnew file mode 100644index 0000000..968b15c--- /dev/null+++ b/models/z_image/configs/z_image_base.json@@ -0,0 +1,32 @@+{+ "_class_name": "ZImageTransformer2DModel",+ "_diffusers_version": "0.37.0.dev0",+ "all_f_patch_size": [+ 1+ ],+ "all_patch_size": [+ 2+ ],+ "axes_dims": [+ 32,+ 48,+ 48+ ],+ "axes_lens": [+ 1536,+ 512,+ 512+ ],+ "cap_feat_dim": 2560,+ "dim": 3840,+ "in_channels": 16,+ "n_heads": 30,+ "n_kv_heads": 30,+ "n_layers": 30,+ "n_refiner_layers": 2,+ "norm_eps": 1e-05,+ "qk_norm": true,+ "rope_theta": 256.0,+ "siglip_feat_dim": null,+ "t_scale": 1000.0+}diff --git a/models/z_image/pipeline_z_image.py b/models/z_image/pipeline_z_image.pyindex f106237..590bb5d 100644--- a/models/z_image/pipeline_z_image.py+++ b/models/z_image/pipeline_z_image.py@@ -493,7 +493,8 @@ class ZImagePipeline(DiffusionPipeline, FromSingleFileMixin):self._guidance_scale = guidance_scalekwargs = {}NAG = None- if NAG_scale > 1:+ # NAG is only safe without CFG; skip it when guidance > 1.+ if NAG_scale > 1 and guidance_scale <= 1:NAG = { "scale": NAG_scale, "tau": NAG_tau, "alpha": NAG_alpha, }dtype = (@@ -544,6 +545,19 @@ class ZImagePipeline(DiffusionPipeline, FromSingleFileMixin):max_sequence_length=max_sequence_length,lora_scale=lora_scale,)+ # Ensure CFG prompt lengths match to avoid RoPE shape mismatches.+ if self.do_classifier_free_guidance and isinstance(prompt_embeds, list) and isinstance(negative_prompt_embeds, list):+ for i in range(min(len(prompt_embeds), len(negative_prompt_embeds))):+ pos = prompt_embeds[i]+ neg = negative_prompt_embeds[i]+ if pos is None or neg is None:+ continue+ if neg.shape[0] < pos.shape[0]:+ pad_len = pos.shape[0] - neg.shape[0]+ neg = torch.cat([neg, neg[-1:].repeat(pad_len, 1)], dim=0)+ elif neg.shape[0] > pos.shape[0]:+ neg = neg[: pos.shape[0]]+ negative_prompt_embeds[i] = negneg_embeds_list = negative_prompt_embeds if isinstance(negative_prompt_embeds, list) else []if NAG is not None and len(neg_embeds_list) > 0:NAG["neg_feats"] = neg_embeds_list[0]diff --git a/models/z_image/z_image_handler.py b/models/z_image/z_image_handler.pyindex 33132a5..d9e23f3 100644--- a/models/z_image/z_image_handler.py+++ b/models/z_image/z_image_handler.py@@ -6,9 +6,11 @@ from shared.utils.hf import build_hf_urlclass family_handler:@staticmethoddef query_model_def(base_model_type, model_def):+ z_image_base = base_model_type == "z_image_base"+ guidance_max_phases = 1 if z_image_base else 0extra_model_def = {"image_outputs": True,- "guidance_max_phases": 0,+ "guidance_max_phases": guidance_max_phases,"fit_into_canvas_image_refs": 0,"profiles_dir": [],}@@ -38,6 +40,7 @@ class family_handler:"selection":[ "", "A", "NA"],"visible": False,}+ extra_model_def["parent_model_type"] = "z_image_control"extra_model_def["inpaint_support"] = Trueextra_model_def["inpaint_video_prompt_type"]= "VA"@@ -49,18 +52,21 @@ class family_handler:# "label": "Reference Image for Inpainting",# "visible": True,# }++ extra_model_def["flow_shift"] = z_image_baseextra_model_def["NAG"] = base_model_type in ["z_image"]return extra_model_def@staticmethoddef query_supported_types():- return ["z_image", "z_image_control", "z_image_control2", "z_image_control2_1"]+ return ["z_image", "z_image_base", "z_image_control", "z_image_control2", "z_image_control2_1"]@staticmethoddef query_family_maps():models_eqv_map = {"z_image_control2_1" : "z_image_control2",+ "z_image_base": "z_image",}models_comp_map = {}@@ -76,17 +82,17 @@ class family_handler:return {"z_image": (120, "Z-Image") }@staticmethod- def register_lora_cli_args(parser):+ def register_lora_cli_args(parser, lora_root):parser.add_argument("--lora-dir-z-image",type=str,- default=os.path.join("loras", "z_image"),- help="Path to a directory that contains z image settings"+ default=None,+ help=f"Path to a directory that contains z image settings (default: {os.path.join(lora_root, 'z_image')})")@staticmethod- def get_lora_dir(base_model_type, args):- return args.lora_dir_z_image+ def get_lora_dir(base_model_type, args, lora_root):+ return getattr(args, "lora_dir_z_image", None) or os.path.join(lora_root, "z_image")@staticmethoddef query_model_files(computeList, base_model_type, model_def=None):@@ -152,20 +158,31 @@ class family_handler:@staticmethoddef update_default_settings(base_model_type, model_def, ui_defaults):- ui_defaults.update(+ z_image_base = base_model_type == "z_image_base"++ if z_image_base:+ ui_defaults.update({- "guidance_scale": 0.0,- "num_inference_steps": ui_defaults.get("num_inference_steps", 9),- "NAG_scale": ui_defaults.get("NAG_scale", 1.0),- "NAG_tau": ui_defaults.get("NAG_tau", 3.5),- "NAG_alpha": ui_defaults.get("NAG_alpha", 0.5),+ "guidance_scale": 4,+ "num_inference_steps": 30 ,+ "flow_shift": 6.0,}- )-- # Add control defaults for z_image_control and z_image_control2- if base_model_type in ["z_image_control", "z_image_control2", "z_image_control2_1"]:+ )+ else:ui_defaults.update({- "control_net_weight": 0.75,+ "guidance_scale": 0,+ "num_inference_steps": 8,+ "NAG_scale": 1.0,+ "NAG_tau": 3.5,+ "NAG_alpha": 0.5,})++ # Add control defaults for z_image_control and z_image_control2+ if base_model_type in ["z_image_control", "z_image_control2", "z_image_control2_1"]:+ ui_defaults.update(+ {+ "control_net_weight": 0.75,+ }+ )diff --git a/models/z_image/z_image_main.py b/models/z_image/z_image_main.pyindex 2f311fd..fd07ca9 100644--- a/models/z_image/z_image_main.py+++ b/models/z_image/z_image_main.py@@ -214,7 +214,8 @@ class model_factory:elif not sample_solver:sample_solver = "default"- guide_scale = 0+ if self.model_def.get("guidance_max_phases", 0) < 1:+ guide_scale = 0images = self.pipeline(prompt=input_prompt,diff --git a/models/z_image/z_image_transformer2d.py b/models/z_image/z_image_transformer2d.pyindex d55513b..f0384f1 100644--- a/models/z_image/z_image_transformer2d.py+++ b/models/z_image/z_image_transformer2d.py@@ -424,6 +424,7 @@ class ZImageTransformer2DModel(nn.Module):norm_eps=1e-5,qk_norm=True,cap_feat_dim=2560,+ siglip_feat_dim=None,rope_theta=256.0,t_scale=1000.0,axes_dims=[32, 48, 48],diff --git a/plugins/wan2gp-configuration/plugin.py b/plugins/wan2gp-configuration/plugin.pyindex ba68fa1..6b0be18 100644--- a/plugins/wan2gp-configuration/plugin.py+++ b/plugins/wan2gp-configuration/plugin.py@@ -134,6 +134,11 @@ class ConfigTabPlugin(WAN2GPPlugin):lines=3,interactive=not self.args.lock_config)+ self.loras_root_choice = gr.Textbox(+ label="Lora Root Folder",+ value=self.server_config.get("loras_root", "loras"),+ interactive=not self.args.lock_config+ )self.UI_theme_choice = gr.Dropdown(choices=[("Blue Sky (Default)", "default"), ("Classic Gradio", "gradio")],value=self.server_config.get("UI_theme", "default"), label="UI Theme (requires restart)"@@ -183,8 +188,31 @@ class ConfigTabPlugin(WAN2GPPlugin):self.release_RAM_btn = gr.Button("Force Unload Models from RAM")with gr.Tab("Extensions"):- self.enhancer_enabled_choice = gr.Dropdown(choices=[("Off", 0), ("Florence 2 + LLama 3.2", 1), ("Florence 2 + Llama Joy (uncensored)", 2)], value=self.server_config.get("enhancer_enabled", 0), label="Prompt Enhancer (requires 8-14GB extra download)")- self.enhancer_mode_choice = gr.Dropdown(choices=[("Automatic on Generation", 0), ("On-Demand Button Only", 1)], value=self.server_config.get("enhancer_mode", 0), label="Prompt Enhancer Usage")+ with gr.Group():+ self.enhancer_enabled_choice = gr.Dropdown(choices=[("Off", 0), ("Florence 2 + LLama 3.2", 1), ("Florence 2 + Llama Joy (uncensored)", 2)], value=self.server_config.get("enhancer_enabled", 0), label="Prompt Enhancer (requires 8-14GB extra download)")+ self.enhancer_mode_choice = gr.Dropdown(choices=[("Automatic on Generation", 0), ("On-Demand Button Only", 1)], value=self.server_config.get("enhancer_mode", 0), label="Prompt Enhancer Usage")+ with gr.Row():+ self.prompt_enhancer_temperature_choice = gr.Slider(+ 0.1,+ 1.5,+ value=self.server_config.get("prompt_enhancer_temperature", 0.6),+ step=0.01,+ label="Prompt Enhancer Temperature (High = More Creativity)",+ interactive=not self.args.lock_config,+ )+ self.prompt_enhancer_top_p_choice = gr.Slider(+ 0.1,+ 1.0,+ value=self.server_config.get("prompt_enhancer_top_p", 0.9),+ step=0.01,+ label="Prompt Enhancer Top-p (High = More Variety)",+ interactive=not self.args.lock_config,+ )+ self.prompt_enhancer_randomize_seed_choice = gr.Checkbox(+ value=self.server_config.get("prompt_enhancer_randomize_seed", True),+ label="Randomize Prompt Enhancer Seed",+ interactive=not self.args.lock_config,+ )mmaudio_mode_default = self.server_config.get("mmaudio_mode", None)mmaudio_persistence_default = self.server_config.get("mmaudio_persistence", None)if mmaudio_mode_default is None:@@ -254,14 +282,16 @@ class ConfigTabPlugin(WAN2GPPlugin):self.state,self.transformer_types_choices, self.model_hierarchy_type_choice, self.fit_canvas_choice,self.attention_choice, self.preload_model_policy_choice, self.clear_file_list_choice,- self.display_stats_choice, self.max_frames_multiplier_choice, self.enable_4k_resolutions_choice, self.checkpoints_paths_choice,+ self.display_stats_choice, self.max_frames_multiplier_choice, self.enable_4k_resolutions_choice, self.checkpoints_paths_choice, self.loras_root_choice,self.UI_theme_choice, self.queue_color_scheme_choice,self.quantization_choice, self.transformer_dtype_policy_choice, self.mixed_precision_choice,self.text_encoder_quantization_choice, self.VAE_precision_choice, self.compile_choice,self.depth_anything_v2_variant_choice, self.vae_config_choice, self.boost_choice,self.video_profile_choice, self.image_profile_choice, self.audio_profile_choice,self.preload_in_VRAM_choice, self.max_reserved_loras_choice,- self.enhancer_enabled_choice, self.enhancer_mode_choice, self.mmaudio_mode_choice, self.mmaudio_persistence_choice, self.rife_version_choice,+ self.enhancer_enabled_choice, self.enhancer_mode_choice,+ self.prompt_enhancer_temperature_choice, self.prompt_enhancer_top_p_choice, self.prompt_enhancer_randomize_seed_choice,+ self.mmaudio_mode_choice, self.mmaudio_persistence_choice, self.rife_version_choice,self.video_output_codec_choice, self.image_output_codec_choice, self.audio_output_codec_choice, self.audio_stand_alone_output_codec_choice,self.metadata_choice, self.embed_source_images_choice,self.video_save_path_choice, self.image_save_path_choice, self.audio_save_path_choice,@@ -304,14 +334,16 @@ class ConfigTabPlugin(WAN2GPPlugin):(transformer_types_choices, model_hierarchy_type_choice, fit_canvas_choice,attention_choice, preload_model_policy_choice, clear_file_list_choice,- display_stats_choice, max_frames_multiplier_choice, enable_4k_resolutions_choice, checkpoints_paths_choice,+ display_stats_choice, max_frames_multiplier_choice, enable_4k_resolutions_choice, checkpoints_paths_choice, loras_root_choice,UI_theme_choice, queue_color_scheme_choice,quantization_choice, transformer_dtype_policy_choice, mixed_precision_choice,text_encoder_quantization_choice, VAE_precision_choice, compile_choice,depth_anything_v2_variant_choice, vae_config_choice, boost_choice,video_profile_choice, image_profile_choice, audio_profile_choice,preload_in_VRAM_choice, max_reserved_loras_choice,- enhancer_enabled_choice, enhancer_mode_choice, mmaudio_mode_choice, mmaudio_persistence_choice, rife_version_choice,+ enhancer_enabled_choice, enhancer_mode_choice,+ prompt_enhancer_temperature_choice, prompt_enhancer_top_p_choice, prompt_enhancer_randomize_seed_choice,+ mmaudio_mode_choice, mmaudio_persistence_choice, rife_version_choice,video_output_codec_choice, image_output_codec_choice, audio_output_codec_choice, audio_stand_alone_output_codec_choice,metadata_choice, embed_source_images_choice,save_path_choice, image_save_path_choice, audio_save_path_choice,@@ -343,6 +375,9 @@ class ConfigTabPlugin(WAN2GPPlugin):"enhancer_mode": enhancer_mode_choice, "mmaudio_mode": mmaudio_mode_choice,"mmaudio_persistence": mmaudio_persistence_choice, "mmaudio_enabled": mmaudio_enabled_choice,"rife_version": rife_version_choice,+ "prompt_enhancer_temperature": prompt_enhancer_temperature_choice,+ "prompt_enhancer_top_p": prompt_enhancer_top_p_choice,+ "prompt_enhancer_randomize_seed": prompt_enhancer_randomize_seed_choice,"preload_in_VRAM": preload_in_VRAM_choice, "depth_anything_v2_variant": depth_anything_v2_variant_choice,"notification_sound_enabled": notification_sound_enabled_choice,"notification_sound_volume": notification_sound_volume_choice,@@ -354,6 +389,7 @@ class ConfigTabPlugin(WAN2GPPlugin):"audio_stand_alone_output_codec": audio_stand_alone_output_codec_choice,"model_hierarchy_type": model_hierarchy_type_choice,"checkpoints_paths": checkpoints_paths,+ "loras_root": loras_root_choice,"queue_color_scheme": queue_color_scheme_choice,"embed_source_images": embed_source_images_choice,"video_container": "mp4", # Fixed to MP4@@ -381,8 +417,9 @@ class ConfigTabPlugin(WAN2GPPlugin):"metadata_type", "clear_file_list", "fit_canvas", "depth_anything_v2_variant","notification_sound_enabled", "notification_sound_volume", "mmaudio_mode","mmaudio_persistence", "mmaudio_enabled", "rife_version",+ "prompt_enhancer_temperature", "prompt_enhancer_top_p", "prompt_enhancer_randomize_seed","max_frames_multiplier", "display_stats", "enable_4k_resolutions", "max_reserved_loras", "video_output_codec", "video_container",- "embed_source_images", "image_output_codec", "audio_output_codec", "audio_stand_alone_output_codec", "checkpoints_paths",+ "embed_source_images", "image_output_codec", "audio_output_codec", "audio_stand_alone_output_codec", "checkpoints_paths", "loras_root","model_hierarchy_type", "UI_theme", "queue_color_scheme"]diff --git a/wgp.py b/wgp.pyindex 99d213d..c099b52 100644--- a/wgp.py+++ b/wgp.py@@ -85,7 +85,7 @@ AUTOSAVE_TEMPLATE_PATH = AUTOSAVE_FILENAMECONFIG_FILENAME = "wgp_config.json"PROMPT_VARS_MAX = 10target_mmgp_version = "3.7.2"-WanGP_version = "10.53"+WanGP_version = "10.54"settings_version = 2.44max_source_video_frames = 3000prompt_enhancer_image_caption_model, prompt_enhancer_image_caption_processor, prompt_enhancer_llm_model, prompt_enhancer_llm_tokenizer = None, None, None, None@@ -1700,8 +1700,9 @@ def update_generation_status(html_content):return gr.update(value=html_content)family_handlers = ["models.wan.wan_handler", "models.wan.ovi_handler", "models.wan.df_handler", "models.hyvideo.hunyuan_handler", "models.ltx_video.ltxv_handler", "models.ltx2.ltx2_handler", "models.longcat.longcat_handler", "models.flux.flux_handler", "models.qwen.qwen_handler", "models.kandinsky5.kandinsky_handler", "models.z_image.z_image_handler", "models.TTS.tts_handler"]+DEFAULT_LORA_ROOT = "loras"-def register_family_lora_args(parser):+def register_family_lora_args(parser, lora_root):registered_families = set()for path in family_handlers:handler = importlib.import_module(path).family_handler@@ -1710,7 +1711,7 @@ def register_family_lora_args(parser):if family_key in registered_families:continueif hasattr(handler, "register_lora_cli_args"):- handler.register_lora_cli_args(parser)+ handler.register_lora_cli_args(parser, lora_root)registered_families.add(family_key)def _parse_args():@@ -1791,8 +1792,14 @@ def _parse_args():help="Allow inputting multiple images with image to video")+ parser.add_argument(+ "--loras",+ type=str,+ default="",+ help="Root folder for LoRAs (default: loras)"+ )- register_family_lora_args(parser)+ register_family_lora_args(parser, DEFAULT_LORA_ROOT)parser.add_argument("--check-loras",@@ -2059,7 +2066,15 @@ def get_lora_dir(model_type):if get_dir is None:raise Exception("loras unknown")- lora_dir = get_dir(base_model_type, args)+ cli_lora_root = getattr(args, "loras", "")+ if isinstance(cli_lora_root, str):+ cli_lora_root = cli_lora_root.strip()+ config_lora_root = None+ if "server_config" in globals():+ config_lora_root = server_config.get("loras_root", DEFAULT_LORA_ROOT)+ lora_root = cli_lora_root or config_lora_root or DEFAULT_LORA_ROOT++ lora_dir = get_dir(base_model_type, args, lora_root)if lora_dir is None:raise Exception("loras unknown")if os.path.isfile(lora_dir):@@ -2161,11 +2176,15 @@ if not Path(config_load_filename).is_file():"preload_model_policy": [],"UI_theme": "default","checkpoints_paths": fl.default_checkpoints_paths,+ "loras_root": DEFAULT_LORA_ROOT,"queue_color_scheme": "pastel","model_hierarchy_type": 1,"mmaudio_mode": 0,"mmaudio_persistence": 1,"rife_version": "v4",+ "prompt_enhancer_temperature": 0.6,+ "prompt_enhancer_top_p": 0.9,+ "prompt_enhancer_randomize_seed": True,"audio_save_path": "outputs",}@@ -2789,6 +2808,10 @@ if not "image_output_codec" in server_config: server_config["image_output_codec"if not "audio_output_codec" in server_config: server_config["audio_output_codec"]= "aac_128"if not "audio_stand_alone_output_codec" in server_config: server_config["audio_stand_alone_output_codec"]= "wav"if not "rife_version" in server_config: server_config["rife_version"] = "v4"+if "loras_root" not in server_config: server_config["loras_root"] = DEFAULT_LORA_ROOT+if "prompt_enhancer_temperature" not in server_config: server_config["prompt_enhancer_temperature"] = 0.6+if "prompt_enhancer_top_p" not in server_config: server_config["prompt_enhancer_top_p"] = 0.9+if "prompt_enhancer_randomize_seed" not in server_config: server_config["prompt_enhancer_randomize_seed"] = Truepreload_model_policy = server_config.get("preload_model_policy", [])@@ -5113,8 +5136,14 @@ def process_prompt_enhancer(model_def, prompt_enhancer, original_prompts, imageif len(original_prompts) == 0 and not "T" in prompt_enhancer:return Noneelse:- from shared.utils.utils import seed_everything- seed = seed_everything(seed)+ import secrets+ enhancer_temperature = server_config.get("prompt_enhancer_temperature", 0.6)+ enhancer_top_p = server_config.get("prompt_enhancer_top_p", 0.9)+ randomize_seed = server_config.get("prompt_enhancer_randomize_seed", True)+ if randomize_seed:+ enhancer_seed = secrets.randbits(32)+ else:+ enhancer_seed = seed if seed is not None and seed >= 0 else 0# for i, original_prompt in enumerate(original_prompts):prompts = generate_cinematic_prompt(prompt_enhancer_image_caption_model,@@ -5127,6 +5156,10 @@ def process_prompt_enhancer(model_def, prompt_enhancer, original_prompts, imagetext_prompt = audio_only,max_new_tokens=text_encoder_max_tokens,prompt_enhancer_instructions = prompt_enhancer_instructions,+ do_sample = True,+ temperature = enhancer_temperature,+ top_p = enhancer_top_p,+ seed = enhancer_seed,)return prompts