p-h3-image-pdmd-2step

akhaliq/p-h3-image-pdmd-2step

作者
akhaliq
任务
图像生成
下载量
0
点赞数
12
趋势分
12
许可证
apache-2.0
收录时间
2026/11/8

license: apache-2.0 base_model: PrunaAI/P-H3-Image base_model_relation: adapter library_name: diffusers pipeline_tag: text-to-image tags:

  • text-to-image
  • image-generation
  • lora
  • few-step
  • distilled
  • 2-step
  • pdmd
  • minimax-h3
  • pruna-ai
  • comfyui
  • ml-intern

P-H3-Image pDMD 2-Step LoRA

A true 2-step mode for PrunaAI/P-H3-Image, no CFG, same prompting, up to 8 MP: the pDMD 2-NFE LoRA (arXiv 2609.35768, rank 128 over attention + FFN of all 50 blocks) merged into the image transformer. Usable at 2 steps, and essentially indistinguishable from the 8-step baseline at 4 — the same merge runs at 3–4 steps when you want the baseline look.

This repo ships the LoRA as one ready-to-use file: lora_model_0.safetensors (bf16, byte-identical to the upstream pDMD release), plus a ComfyUI-named copy for node workflows — nothing else to hunt down.

Try it: akhaliq/p-h3-image-2step — text-to-image and single-image edits at 2/3/4 steps, with the optional detail refine pass built in.

StepsVerdict (8 MP, shift 12)
2Usable — sharp, coherent; composition drifts from baseline, graphic prompts can invent pseudo-text
3Safer middle ground
4Closest to baseline — the quality pick; use it for quoted text and flat graphics

Samples — 2 steps

The same twelve prompts throughout — 2912×2912, 2 denoising steps, shift 12, seed 3, prompts as written, ~2.9 s per image — so every grid compares tile for tile.

Why the LoRA matters: stock P-H3-Image at 2 steps is still mid-denoise — washed out and half-formed. The merged LoRA lands composition and detail in the same two evaluations:

Stock P-H3-Image, 2 steps+ pDMD 2-step LoRA
stock P-H3-Image at 2 steps2-step pDMD sample grid

All grids rendered with the slim FP8 + fused-Triton build from the 2-step demo Space on an RTX PRO 6000 or an H200.

Optional detail pass — draft + regenerate. For scenes and objects, a Open-H3-Regenerate-2K refine stage adds real detail on top: render a 2 MP draft at 2 steps, upscale 2×, then regenerate at 8 MP with the refiner LoRA at σ₀ = 0.7 (3 Euler steps, its own grid ratios — init (1−σ₀)·draft + σ₀·noise, the latents= input). ~7 s per image all-in — still ~1.7× faster than the bare 8-step baseline, and the same ~4 s add-on applies on top of the 8-step workflow too:

2-step draft + Regenerate-2K refine at sigma 0.7

At σ₀ = 0.7 composition and illustration style hold (ukiyo-e, anime, stickers and collage stay themselves); people can still drift — use σ₀ = 0.5 for portraits (near-identity, subtler gain), and 0.909 (the LoRA's trained point) only when you don't care what the image was. The σ₀ sweep behind this choice: grid. Note the refiner is a video-refinement LoRA — merged into the transformer for straight t2i it collapses prompts entirely; the refine pass is the way to use it.

Usage (ComfyUI)

The easiest way to use the LoRA — P-H3-Image runs natively in ComfyUI (no custom nodes). Ready-made workflow: workflows/p-h3-image-pdmd-2step-t2i.json — the stock P-H3-Image LoRA text-to-image graph with the pDMD LoRA at 1.0, a simple BasicScheduler at 2 steps (set 3–4 for higher quality) and flow shift 12 already wired in. Drop it onto the canvas after steps 1–2 below. The manual changes it makes are listed as steps 3–4.

  1. Set up P-H3-Image per PrunaAI/P-H3-Image-Comfy: update ComfyUI to latest master, download one file per component (bf16, int8, or the 21 GB-VRAM w4a8 set), and open a workflow from that repo's workflows/ folder.
  2. Download the LoRA into ComfyUI/models/loras/:
    hf download akhaliq/p-h3-image-pdmd-2step minimax_h3_pdmd_2nfe_comfyui.safetensors --local-dir ComfyUI/models/loras
    
  3. Add it to the graph (already done in the workflow): Load LoRA (Bypass, Model Only) between Load Diffusion Model and the sampler, minimax_h3_pdmd_2nfe_comfyui.safetensors, strength 1.0.
  4. Cut the steps (also already done): the stock workflow feeds SamplerCustomAdvanced from a ManualSigmas node holding the 8-step grid. Replace it with a BasicScheduler node — scheduler simple, steps: 2, denoise 1.0 — keep everything else as it is (euler sampler, Basic Guider, no CFG, no negative prompt) and set flow shift 12 on MiniMaxH3SigmaShift. For higher quality raise the steps to 3–4; the same LoRA and settings hold, this is not a different mode.

Usage (diffusers)

The LoRA merges into P-H3-Image's transformer with the one-function merge in run_p_h3_turbo.py — its diffusers keys match directly. pDMD's operating point is shift 12 (already P-H3-Image's scheduler config) and N+1 timesteps for N denoising evaluations under this scheduler; the checkpoint's built-in grid is 8-step, so pass explicit sigmas:

import torch
from diffusers import ModularPipeline
from huggingface_hub import hf_hub_download

pipe_blocks = ModularPipeline.from_pretrained("PrunaAI/P-H3-Image").blocks
pipe_blocks.sub_blocks.pop("prompt_upsampler", None)
pipe = pipe_blocks.init_pipeline("PrunaAI/P-H3-Image")
pipe.load_components(dtype=torch.bfloat16)
pipe.to("cuda")

merge_lora(pipe.transformer,
           hf_hub_download("akhaliq/p-h3-image-pdmd-2step", "lora_model_0.safetensors"))

pipe.scheduler.set_shift(12.0)
pipe.scheduler.set_timesteps(3, device="cuda")   # 3 grid points -> 2 denoising steps; 5 -> 4
image = pipe(prompt="...", height=2912, width=2912, sigmas=pipe.scheduler.sigmas,
             generator=torch.Generator("cuda").manual_seed(3), output="images")[0]

GPU memory is unchanged from P-H3-Image (~83 GB bf16 without the prompt upsampler; ~76 GB with ComponentsManager auto-offload — see the base model card).

License

  • The pDMD 2-NFE LoRA is Apache-2.0 (© the pDMD authors; this repo redistributes it unmodified).
  • Anything rendered with or derived from P-H3-Image remains governed by the MiniMax H3 Community License, which among other terms excludes use in the EU, UK, Korea and the US without a separate MiniMax license, and requires "Powered by MiniMax H3" attribution. Read it before use.

Citation

@misc{wang2026pdmdprojecteddistributionmatching,
      title={PDMD: Projected Distribution Matching Distillation for Video Diffusion Models},
      author={Zimo Wang and Junkun Yuan and Angtian Wang and Haotian Yang and Canyu Zhang and Siyuan Yuan and Xingchang Huang and Bo Liu and Yizhi Wang and Yiding Yang and Chongyang Ma and Gordon Guocheng Qian},
      year={2026},
      eprint={2609.35768},
      archivePrefix={arXiv},
      primaryClass={cs.CV},
      url={https://arxiv.org/abs/2609.35768},
}

Credits

内容来源:Hugging Face 模型卡

在 Hugging Face 查看