Python
added Hunyuan 1.5 i2v distilled + magcache
DeepBeepMeep2d509b012011
diff --git a/README.md b/README.mdindex 8febf87..06e9140 100644--- a/README.md+++ b/README.md@@ -37,19 +37,21 @@ WanGP supports the Wan (and derived models), Hunyuan Video and LTV Video models## 🔥 Latest Updates :-### December 5 2025: WanGP v9.8, Simple Pleasures...+### December 5 2025: WanGP v9.81, Simple Pleasures...These two features are going to change the life of many people:-- **Pause Button**: ever had a urge to use your GPU for a very important task that can't wait (a game for instance ?), here comes your new friend the *Pause* button. Not only it will suspend the current gen in progress but it will free most of the VRAM used by WanGP (please note that the RAM by WanGP used wont be released). When you are done just click the *Resume* button+- **Pause Button**: ever had a urge to use your GPU for a very important task that can't wait (a game for instance ?), here comes your new friend the *Pause* button. Not only it will suspend the current gen in progress but it will free most of the VRAM used by WanGP (please note that the RAM by WanGP used wont be released). When you are done just click the *Resume* button to restart exactly from where you stopped.- **WanGP Headless**: trouble running remotely WanGP or having some stability issues with Gradio or your Web Browser. This is all past thanks to *WanGP Headless* mode. Here is how it works : first make you shopping list of Video Gen using the classic WanGP gradio interface. When you are done, click the *Save Queue* button and quit WanGP.+- **Hunyuan Video 1.5 i2v distilled** : for those in need of their daily dose of new models, added *Hunyuan Video 1.5 i2v Distilled* (official release) + Lora Accelerator extracted from it (to be used in future finetunes). Also added *Magcache* support (optimized for 20 steps) for Hunyuan Video 1.5.+Then in your terminal window just write this:```bashpython wgp.py --process my_queue.zip```-+*update 9.81*: Hunyuan Video 1.5### December 4 2025: WanGP v9.74, The Alpha & the Omega ... and the Dancerdiff --git a/defaults/hunyuan_1_5_480_i2v_step_distilled.json b/defaults/hunyuan_1_5_480_i2v_step_distilled.jsonnew file mode 100644index 0000000..177f283--- /dev/null+++ b/defaults/hunyuan_1_5_480_i2v_step_distilled.json@@ -0,0 +1,17 @@+{+ "model": {+ "name": "Hunyuan Video 1.5 Image2video 480p Step Distilled 8B",+ "architecture": "hunyuan_1_5_i2v",+ "description": "HunyuanVideo-1.5 is a video generation model that delivers top-tier quality with only 8.3B parameters, significantly lowering the barrier to usage. This is the official Step Distilled 480p versionby the Hunyuan Team.",+ "URLs": [+ "https://huggingface.co/DeepBeepMeep/HunyuanVideo1.5/resolve/main/hunyuan_video_1.5_i2v_480_step_distilled_quanto_bf16_int8.safetensors",+ "https://huggingface.co/DeepBeepMeep/HunyuanVideo1.5/resolve/main/hunyuan_video_1.5_i2v_480_step_distilled_bf16.safetensors"+ ]+ },+ "prompt": "",+ "resolution": "832x480",+ "video_length": 97,+ "num_inference_steps": 8,+ "guidance_scale": 1.0,+ "flow_shift": 5.0+}\ No newline at end of filediff --git a/models/hyvideo/hunyuan_handler.py b/models/hyvideo/hunyuan_handler.pyindex 3eb4af8..6c06a3f 100644--- a/models/hyvideo/hunyuan_handler.py+++ b/models/hyvideo/hunyuan_handler.py@@ -27,11 +27,20 @@ class family_handler():pixels = int(width) * int(height)if cache_type == "mag":- skip_steps_cache.update({+ skip_steps_cache.update({"magcache_thresh" : 0,"magcache_K" : 2,})- if pixels >= 1280* 720:+ if test_hunyuan_1_5(base_model_type):+ # Hunyuan 1.5 MagCache ratios (from ComfyUI-MagCache project)+ num_steps = inputs.get("num_inference_steps", 20)+ if num_steps > 20:+ # 40 steps version for longer inference+ skip_steps_cache.def_mag_ratios = [1.04199, 1.01953, 1.01172, 1.01855, 1.00293, 1.00586, 1.00098, 1.00195, 1.0, 1.00098, 0.99805, 0.99902, 0.99854, 0.99805, 0.99658, 0.99756, 0.99707, 0.99512, 0.99609, 0.99609, 0.99658, 0.99658, 0.99658, 0.99805, 0.99658, 0.99707, 0.99561, 0.99561, 0.99561, 0.99658, 0.99658, 0.99658, 0.99609, 0.99658, 0.99512, 0.99561, 0.99463, 0.99512, 0.99463, 0.99512, 0.99365, 0.99414, 0.99365, 0.99365, 0.99219, 0.99219, 0.99219, 0.99268, 0.99072, 0.99121, 0.99072, 0.99072, 0.98926, 0.98975, 0.9873, 0.98779, 0.98535, 0.98584, 0.9834, 0.9834, 0.97998, 0.97998, 0.97607, 0.97607, 0.96973, 0.96973, 0.96338, 0.96338, 0.9502, 0.9502, 0.93066, 0.93066, 0.896, 0.896, 0.81787, 0.81836]+ else:+ # 20 steps version (default)+ skip_steps_cache.def_mag_ratios = [1.01172, 1.00293, 0.9873, 1.0127, 1.01465, 0.98926, 0.99805, 1.00098, 0.99512, 0.99365, 0.99512, 0.99561, 0.99316, 0.99365, 0.99365, 0.99365, 0.99316, 0.99316, 0.99268, 0.99268, 0.9917, 0.9917, 0.99023, 0.99023, 0.98828, 0.98877, 0.98633, 0.98633, 0.9834, 0.9834, 0.97949, 0.97998, 0.97363, 0.97363, 0.96436, 0.96436, 0.94824, 0.94873]+ elif pixels >= 1280* 720:skip_steps_cache.def_mag_ratios = [1.0754, 1.27807, 1.11596, 1.09504, 1.05188, 1.00844, 1.05779, 1.00657, 1.04142, 1.03101, 1.00679, 1.02556, 1.00908, 1.06949, 1.05438, 1.02214, 1.02321, 1.03019, 1.00779, 1.03381, 1.01886, 1.01161, 1.02968, 1.00544, 1.02822, 1.00689, 1.02119, 1.0105, 1.01044, 1.01572, 1.02972, 1.0094, 1.02368, 1.0226, 0.98965, 1.01588, 1.02146, 1.0018, 1.01687, 0.99436, 1.00283, 1.01139, 0.97122, 0.98251, 0.94513, 0.97656, 0.90943, 0.85703, 0.75456]else:skip_steps_cache.def_mag_ratios = [1.06971, 1.29073, 1.11245, 1.09596, 1.05233, 1.01415, 1.05672, 1.00848, 1.03632, 1.02974, 1.00984, 1.03028, 1.00681, 1.06614, 1.05022, 1.02592, 1.01776, 1.02985, 1.00726, 1.03727, 1.01502, 1.00992, 1.03371, 0.9976, 1.02742, 1.0093, 1.01869, 1.00815, 1.01461, 1.01152, 1.03082, 1.0061, 1.02162, 1.01999, 0.99063, 1.01186, 1.0217, 0.99947, 1.01711, 0.9904, 1.00258, 1.00878, 0.97039, 0.97686, 0.94315, 0.97728, 0.91154, 0.86139, 0.76592]@@ -70,7 +79,7 @@ class family_handler():extra_model_def["cfg_star"] = base_model_type in [ "hunyuan_avatar", "hunyuan_custom_audio", "hunyuan_custom_edit", "hunyuan_custom"] or test_hunyuan_1_5(base_model_type)extra_model_def["tea_cache"] = not test_hunyuan_1_5(base_model_type)- extra_model_def["mag_cache"] = not test_hunyuan_1_5(base_model_type)+ extra_model_def["mag_cache"] = True # Enabled for all Hunyuan models including 1.5if base_model_type in ["hunyuan_custom_edit"]:extra_model_def["guide_preprocessing"] = {diff --git a/profiles/hunyuan_1_5/LightX2V dpm - 8 steps.json b/profiles/hunyuan_1_5/LightX2V t2v dpm - 8 steps.jsonsimilarity index 100%rename from profiles/hunyuan_1_5/LightX2V dpm - 8 steps.jsonrename to profiles/hunyuan_1_5/LightX2V t2v dpm - 8 steps.jsondiff --git a/profiles/hunyuan_1_5/Step Distilled i2v dpm - 8 steps.json b/profiles/hunyuan_1_5/Step Distilled i2v dpm - 8 steps.jsonnew file mode 100644index 0000000..a417fd1--- /dev/null+++ b/profiles/hunyuan_1_5/Step Distilled i2v dpm - 8 steps.json@@ -0,0 +1,11 @@+{++ "activated_loras": [+ "https://huggingface.co/DeepBeepMeep/HunyuanVideo1.5/resolve/main/loras_accelerators/Hunyuan_video_1_5_i2v_step_distilled_dpm_rank32.safetensors"+ ],+ "loras_multipliers": "1",+ "num_inference_steps": 8,+ "guidance_phases": 1,+ "guidance_scale": 1,+ "flow_shift": 4+}\ No newline at end of filediff --git a/shared/extract_lora.py b/shared/extract_lora.pyindex 7ededf4..b9949af 100644--- a/shared/extract_lora.py+++ b/shared/extract_lora.py@@ -540,8 +540,8 @@ if __name__ == "__main__":# Load original and fine-tuned models from safetensors files- original_state_dict = load_safetensors("ckpts/hunyuan_video_1.5_480_bf16.safetensors")- finetuned_state_dict = load_safetensors("c:/temp/hy1.5_t2v_480p_lightx2v_4step_bf16.safetensors")+ original_state_dict = load_safetensors("ckpts/hunyuan_video_1.5_i2v_480_bf16.safetensors")+ finetuned_state_dict = load_safetensors("ckpts/hunyuan_video_1.5_i2v_480_step_distilled_bf16.safetensors")# original_state_dict = load_safetensors("ckpts/flux1-dev_bf16.safetensors")# finetuned_state_dict = load_safetensors("ckpts/flux1-schnell_bf16.safetensors")diff --git a/wgp.py b/wgp.pyindex 83a17cb..a61201f 100644--- a/wgp.py+++ b/wgp.py@@ -83,7 +83,7 @@ global_queue_ref = []AUTOSAVE_FILENAME = "queue.zip"PROMPT_VARS_MAX = 10target_mmgp_version = "3.6.9"-WanGP_version = "9.8"+WanGP_version = "9.81"settings_version = 2.41max_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@@ -10862,10 +10862,6 @@ if __name__ == "__main__":if not os.path.isdir(args.output_dir):os.makedirs(args.output_dir, exist_ok=True)server_config["save_path"] = args.output_dir- server_config["image_save_path"] = args.output_dir- # Update the module-level variables that generate_video() uses- globals()["save_path"] = args.output_dir- globals()["image_save_path"] = args.output_dirprint(f"Output directory: {args.output_dir}")# Create minimal state with all required fields@@ -10914,28 +10910,15 @@ if __name__ == "__main__":print(f" Task {i}: model={model}, steps={steps}, frames={length}")print(f" prompt: {prompt}...")print(f"\n[DRY-RUN] Validation complete. {len(queue)} task(s) ready.")- # Clean up cache folder created during parsing- dry_run_cache = os.path.join(server_config.get("save_path", "outputs"), "_loaded_queue_cache")- if os.path.isdir(dry_run_cache):- shutil.rmtree(dry_run_cache, ignore_errors=True)sys.exit(0)state["gen"]["queue"] = queue- # Determine cache dir location for cleanup- cli_save_path = args.output_dir if len(args.output_dir) > 0 else server_config.get("save_path", "outputs")- cli_cache_dir = os.path.join(cli_save_path, "_loaded_queue_cache")-try:success = process_tasks_cli(queue, state)- # Clean up cache folder- if os.path.isdir(cli_cache_dir):- shutil.rmtree(cli_cache_dir, ignore_errors=True)sys.exit(0 if success else 1)except KeyboardInterrupt:print("\n\nAborted by user")- if os.path.isdir(cli_cache_dir):- shutil.rmtree(cli_cache_dir, ignore_errors=True)sys.exit(130)# Normal Gradio mode continues below...