Skip to content

Add Chroma modular pipeline (text2image) - #14417

Open
charchit7 wants to merge 1 commit into
huggingface:mainfrom
charchit7:modular-chroma
Open

charchit7 wants to merge 1 commit into
huggingface:mainfrom
charchit7:modular-chroma

Conversation

@charchit7

@charchit7 charchit7 commented Aug 7, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?

Fixes #13295. Adds a ModularPipeline for Chroma (t2i only):

  • T5-only text encoder block with Chroma's padding-token attention masking
  • guider-based CFG denoise loop (ClassifierFreeGuidance)
  • reuses Flux-style packed-latent prep, mu-shift timesteps, RoPE ids, decode

Ran the self-review:

  • Verdict: READY

Before submitting

  • Did you use an AI agent (Claude Code, Codex, Cursor, etc.) to help with this PR? If so:
    • Did you read the Coding with AI agents guide?
    • Did you run the self-review skill on the diff?
    • Did you share the final self-review notes in the PR description or a comment?
  • Did you read the contributor guideline?
  • Did you read our philosophy doc? (important for complex PRs)
  • Was this discussed/approved via a GitHub issue or the forum? Please add a link to it if that's the case.

Who can review?

@yiyixuxu @dg845 and @asomoza

Contribution to huggingface#13295. Adds a ModularPipeline for Chroma (t2i only):
- T5-only text encoder block with Chroma's padding-token attention masking
- guider-based CFG denoise loop (ClassifierFreeGuidance)
- reuses Flux-style packed-latent prep, mu-shift timesteps, RoPE ids, decode
@github-actions github-actions Bot added documentation Improvements or additions to documentation tests modular-pipelines utils fixes-issue size/L PR with diff > 200 LOC labels Aug 7, 2026
@charchit7

Copy link
Copy Markdown
Contributor Author

config:

import os
os.environ["HF_HOME"] = "/home/jupyter/images/hf_cache"

import numpy as np
import torch
from PIL import Image

from diffusers import ChromaPipeline
from diffusers.guiders import ClassifierFreeGuidance
from diffusers.modular_pipelines import ChromaAutoBlocks

MODEL_ID = "lodestones/Chroma1-HD"

PROMPT = (
    "A painting of a squirrel eating a burger, highly detailed, vibrant colors, "
    "professional art, sharp focus, cinematic lighting"
)

NEGATIVE_PROMPT = (
    "low quality, ugly, unfinished, out of focus, deformed, "
    "disfigure, blurry, smudged, restricted palette, flat colors"
)

HEIGHT = WIDTH = 1024
NUM_STEPS = 40
GUIDANCE_SCALE = 3.0
MAX_SEQ_LEN = 512

OUTPUT_DIR = "/home/jupyter/images/chroma_output"
os.makedirs(OUTPUT_DIR, exist_ok=True)

DTYPE = torch.bfloat16
DEVICE = "cuda"
SEED = 42

Modular output :
image

standard output:
image

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation fixes-issue modular-pipelines size/L PR with diff > 200 LOC tests utils

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Modular Diffusers 馃Ж

1 participant