P-H3-Image SDNQ INT4

bf16 INT4
bf16 INT4

Left: original bf16 路 Right: this INT4 model (same prompt and seed).

This is a dynamic 4-bit quantized version of PrunaAI/P-H3-Image using SDNQ. Both the transformer and the Qwen3-VL-4B text encoder are quantized; the VAE and the text connector stay in bf16. The prompt upsampler is not included in this repository.

Note: You need SDNQ v0.2.8 or superior and diffusers installed from source (pip install git+https://github.com/huggingface/diffusers), since P-H3-Image support is not in a release yet.

Usage

You can find ready-to-use scripts in the diffusers-recipes repository.

P-H3-Image runs as a Modular Diffusers pipeline. Import sdnq before loading so the quantized weights are registered. On disk the transformer is 18.8 GB and the text encoder 3.1 GB. The sample below peaked at 10.7 GiB of VRAM at 2720x1536, measured with the transformer group-offloaded block by block and the text encoder and VAE on the GPU.

The example removes the pipeline's prompt upsampler step and renders the prompt as written. If you keep the step, the pipeline loads the bf16 prompt upsampler from PrunaAI/P-H3-Image. The model samples 8 steps over the checkpoint's own sigma grid without CFG, so there is no num_inference_steps, guidance_scale or negative prompt. For prompting, recommended resolutions and image editing, see the original model card.

Sample image

The INT4 image above was generated with the following prompt and settings (seed 7):

import sdnq  # noqa: F401
import torch
from diffusers import ModularPipeline


blocks = ModularPipeline.from_pretrained("OzzyGT/P_H3_Image_sdnq_dynamic_4bit").blocks
blocks.sub_blocks.pop("prompt_upsampler")
pipe = blocks.init_pipeline("OzzyGT/P_H3_Image_sdnq_dynamic_4bit")
pipe.load_components(dtype=torch.bfloat16)
pipe.to("cuda")

prompt = """A photograph by an experienced documentary photographer, shot on a 35mm lens at f/4 and 1/250 second, ISO 200, of a small hardware store counter in mid-morning. Soft daylight enters from the front window on the left and falls across the worn wooden counter, with gentle shadows and detail kept in the darker areas. A middle-aged shopkeeper in a grey canvas apron stands behind the counter, weighing a handful of brass screws on a small white scale, his hands slightly blurred by the motion of tipping the screws. On the counter sit a cardboard box of nails, a tape measure and a paper bag, all with real wear and creases. Behind him on the wall hangs a hand-painted wooden sign reading "DIFFUSERS HARDWARE", its paint chipped at the edges. Below it, a small paper tag on a shelf reads "8 STEPS". The shopkeeper's face is calm and focused, with real skin texture and fine lines. Natural, restrained palette, true white balance, fine film grain. There is no other text."""

image = pipe(
    prompt=prompt,
    height=1536,
    width=2720,
    generator=torch.Generator().manual_seed(7),
    output="images",
)[0]
image.save("p_h3_image_int4.png")

Image editing sample

P-H3-Image edits with up to 8 input images: the first is the image to edit, the others are references named Picture 2, Picture 3 and so on. In this example the rhino is Picture 1 and the man is Picture 2, both at 2720x1536.

Picture 1 Picture 2
Picture 1 Picture 2
bf16 INT4
bf16 edit INT4 edit

Left: original bf16 路 Right: this INT4 model (same inputs, prompt and seed).

Picture 1 is a photo by Nejc Sokli膷 on Unsplash, outpainted to 16:9. The edit prompt below was written by the P-H3-Image prompt upsampler from a one-line request. The edit peaked at 12.0 GiB of VRAM, measured the same way as the sample image.

import sdnq  # noqa: F401
import torch
from diffusers import ModularPipeline
from diffusers.utils import load_image


blocks = ModularPipeline.from_pretrained("OzzyGT/P_H3_Image_sdnq_dynamic_4bit").blocks
blocks.sub_blocks.pop("prompt_upsampler")
pipe = blocks.init_pipeline("OzzyGT/P_H3_Image_sdnq_dynamic_4bit")
pipe.load_components(dtype=torch.bfloat16)
pipe.to("cuda")

images = [
    load_image("https://huggingface.co/datasets/OzzyGT/diffusers-examples/resolve/main/p_h3_image/edit_picture_1.png"),
    load_image("https://huggingface.co/datasets/OzzyGT/diffusers-examples/resolve/main/p_h3_image/edit_picture_2.png"),
]

prompt = """subject_definitions:
<Picture 1> is the source image and composition anchor: a rhino walking on sand.
<Picture 2> is a reference image: a man wearing a hat, sunglasses, and jacket.
<Subject 1> is the rhino in <Picture 1>.
<Subject 2> is the man in <Picture 2>.

summary:
[keyframe completion] The target is a single still frame, an edited version of <Picture 1>, in which <Subject 2> rides atop <Subject 1>.

retention_analysis:
<Picture 1> (composition anchor): partially_preserved - enclosure and lighting kept
<Picture 2> (reference): attribute_transfer - man's appearance and clothing
<Subject 1>: partially_preserved - pose adjusted to carry rider
<Subject 2>: attribute_transfer - seated on rhino's back

detailed_description:
Photographic style matching <Picture 1>. [Shot 1] <Subject 1> walks forward across the sandy enclosure. <Subject 2> sits mounted on the rhino's back, wearing his brown hat, sunglasses, and jacket from <Picture 2>, sized naturally to the animal. The wooden fence and warm lighting from <Picture 1> remain unchanged. The camera is static and nothing moves; the frame holds this single still image.

overall_soundscape:
N/A

non_diegetic_music:
N/A"""

image = pipe(
    prompt=prompt,
    image=images,
    height=1536,
    width=2720,
    generator=torch.Generator().manual_seed(7),
    output="images",
)[0]
image.save("p_h3_image_edit_int4.png")

License

This model is released under the MiniMax H3 Community License, the same as the original. Please read it before use. The Qwen3-VL-4B parts of the text encoder are under the Apache License 2.0. See NOTICE for details.

Downloads last month
2
Safetensors
Model size
18B params
Tensor type
F32
路
BF16
路
U8
路
Inference Providers NEW
This model isn't deployed by any Inference Provider. 馃檵 Ask for provider support

Model tree for OzzyGT/P_H3_Image_sdnq_dynamic_4bit

Quantized
(5)
this model