Run this model with HF Jobs

Run OzzyGT/ming_image_custom_blocks on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.

Paste one of these prompts into your coding agent:

Fine-tune on my dataset

Use HF Jobs to fine-tune https://huggingface.co/OzzyGT/ming_image_custom_blocks. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.

Run batch inference

Use HF Jobs to run batch inference with https://huggingface.co/OzzyGT/ming_image_custom_blocks on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.

Ming-Image Modular Diffusers

Modular Diffusers blocks for Ming-Image Design, a text-to-image model for UI, infographic and poster designs that can also generate images with transparent backgrounds. Both versions share the same architecture and these blocks; pick one with components_repo:

0.2 improves complex composition, lighting and text rendering.

Sample image

A movie poster for a fictional adventure film generated with the code below

This image was generated with 0.2 and the following code, seed 2024. For 0.1, set components_repo="OzzyGT/ming_image_0_1_design_diffusers":

import torch

from diffusers import ModularPipelineBlocks


blocks = ModularPipelineBlocks.from_pretrained(
    "OzzyGT/ming_image_custom_blocks",
    trust_remote_code=True,
    components_repo="OzzyGT/ming_image_0_2_design_diffusers",
    trust_components_code=True,
)
pipe = blocks.init_pipeline()
pipe.load_components(dtype=torch.bfloat16)
for name in ("text_encoder", "transformer"):
    getattr(pipe, name).enable_group_offload(
        onload_device="cuda", offload_type="block_level", num_blocks_per_group=1, use_stream=True
    )
pipe.connector.to("cuda")
pipe.vae.to("cuda")

prompt = r"""{
  "canvas_settings": {
    "aspect_ratio": "2:3, 1664 × 2496 px",
    "ambient_lighting": "Dramatic low-key cinematic lighting: a burning torch is the warm key light on the hero, thin shafts of cool daylight cut through dust from a cracked tomb ceiling, deep teal-black shadows.",
    "image_style": "Theatrical one-sheet movie poster for a big-budget action-adventure film: photorealistic key art with the hero centered, warm torch orange against deep teal shadows, polished blockbuster typography with clean hierarchy, full-bleed with no borders."
  },
  "layers": [
    {
      "description": "Background: the interior of a newly opened ancient tomb, a long corridor of towering crumbling sandstone statues and carved pillars sinking into deep shadow, thin shafts of daylight through a cracked ceiling lighting floating dust, the top of the poster fading to near-black for the credits and the bottom darkening behind the title.",
      "coordinates": "cx: 0.500, cy: 0.500, w: 1.000, h: 1.000",
      "hierarchy_and_relation": "Full-canvas background behind every other layer.",
      "color_specs": [
        "#0E1A1F",
        "#2B3A3D",
        "#8A6A45",
        "#C9A46B"
      ]
    },
    {
      "description": "Hero, waist-up, centered and facing the viewer in a three-quarter turn: a fictional tomb-raiding explorer in his late thirties, very muscular and built like an action-movie lead, with massive shoulders, a thick chest and big arms with visible veins, sunburned skin streaked with dust and grime. Square jaw, short dark tousled hair, a week of stubble, hazel eyes with a determined stare, lips pressed together. He wears a sleeveless faded olive canvas shirt darkened with sweat, a worn leather harness of crossed straps with a coiled climbing rope over one shoulder, and a canvas utility belt with brass buckles. His right hand raises a burning torch beside his head, lighting his face warmly from the side.",
      "coordinates": "cx: 0.500, cy: 0.500, w: 0.800, h: 0.560",
      "hierarchy_and_relation": "Main subject in the middle of the poster, in front of the background; his lower body fades behind the title block.",
      "color_specs": [
        "#6B6A45",
        "#5A3B28",
        "#C47A4A",
        "#FFB347"
      ]
    },
    {
      "description": "Top billing: the actor name \"JACK RENNER\" in widely letter-spaced off-white serif capitals.",
      "coordinates": "cx: 0.500, cy: 0.060, w: 0.500, h: 0.030",
      "hierarchy_and_relation": "Centered at the top of the poster, above the tagline.",
      "color_specs": [
        "#EDE6D6"
      ]
    },
    {
      "description": "Tagline in small letter-spaced warm gold capitals: \"SOME TREASURES ARE BURIED FOR A REASON\".",
      "coordinates": "cx: 0.500, cy: 0.105, w: 0.720, h: 0.020",
      "hierarchy_and_relation": "Centered below the top billing, above the hero's head.",
      "color_specs": [
        "#C9A46B"
      ]
    },
    {
      "description": "Movie title \"THE OBSIDIAN TOMB\" in huge bold chiseled serif capitals with a carved weathered-stone texture, warm gold rim light along the top edges and a dark drop shadow, set on two lines with THE smaller above OBSIDIAN TOMB.",
      "coordinates": "cx: 0.500, cy: 0.810, w: 0.880, h: 0.110",
      "hierarchy_and_relation": "Centered across the lower part of the poster, overlapping the bottom of the hero.",
      "color_specs": [
        "#D8B36A",
        "#3A2A1A",
        "#F4E3B5"
      ]
    },
    {
      "description": "Release line on two centered lines: \"SUMMER 2027\" in bold off-white capitals, and below it \"ONLY IN THEATERS\" in smaller gold capitals.",
      "coordinates": "cx: 0.500, cy: 0.885, w: 0.460, h: 0.035",
      "hierarchy_and_relation": "Centered directly below the title, above the billing block.",
      "color_specs": [
        "#EDE6D6",
        "#C9A46B"
      ]
    },
    {
      "description": "First billing line in tall condensed light-gray capitals: \"IRONPEAK PICTURES PRESENTS A GRANT HOLLOWAY FILM  MARA VOSS  DANIEL OKAFOR\".",
      "coordinates": "cx: 0.500, cy: 0.936, w: 0.840, h: 0.022",
      "hierarchy_and_relation": "Centered near the bottom of the poster, below the release line and above the second billing line.",
      "color_specs": [
        "#A9A9A9"
      ]
    },
    {
      "description": "Second billing line in the same tall condensed light-gray capitals: \"MUSIC BY ELENA MARSH  WRITTEN BY TOM HALE  DIRECTED BY GRANT HOLLOWAY\".",
      "coordinates": "cx: 0.500, cy: 0.964, w: 0.840, h: 0.022",
      "hierarchy_and_relation": "Centered at the very bottom of the poster, directly below the first billing line.",
      "color_specs": [
        "#A9A9A9"
      ]
    }
  ]
}"""

image = pipe(prompt=prompt, height=2496, width=1664, generator=torch.Generator().manual_seed(2024), output="images")[0]
image.save("obsidian_tomb_poster.png")

Tips

The model works best with a structured JSON prompt that lists every element and every piece of text, like the one in the example above. To turn a short request into one, use the prompt rewriter system prompt from the original repository with an LLM of your choice. Plain prose prompts work.

For a transparent background, start the prompt with one of these phrases: RGBA, 4-channel, transparent background, isolated subject, alpha matte, no background, cutout PNG, alpha=0 outside the object, transparent canvas, not white, not checkerboard or production RGBA layer for compositing. Images are always RGBA, and the transparent areas are close to zero alpha rather than exactly zero, so threshold the alpha channel if you need a hard cutout. For opaque images, image.convert("RGB") drops the alpha channel.

Downloads last month
18
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for OzzyGT/ming_image_custom_blocks

Finetuned
(19)
this model