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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
license: apache-2.0
|
| 3 |
base_model:
|
| 4 |
- lodestones/Chroma1-HD
|
| 5 |
+
---
|
| 6 |
+
|
| 7 |
+
# Chroma1-HD-GGUF Official Repo for GGUF Quants
|
| 8 |
+
|
| 9 |
+
Chroma1-HD is an **8.9B** parameter text-to-image foundational model based on **FLUX.1-schnell**. It is fully **Apache 2.0 licensed**, ensuring that anyone can use, modify, and build upon it.
|
| 10 |
+
|
| 11 |
+
As a **base model**, Chroma1 is intentionally designed to be an excellent starting point for **finetuning**. It provides a strong, neutral foundation for developers, researchers, and artists to create specialized models.
|
| 12 |
+
|
| 13 |
+
for the fast CFG "baked" version please go to [Chroma1-Flash](https://huggingface.co/lodestones/Chroma1-Flash).
|
| 14 |
+
|
| 15 |
+
### Key Features
|
| 16 |
+
* **High-Performance Base:** 8.9B parameters, built on the powerful FLUX.1 architecture.
|
| 17 |
+
* **Easily Finetunable:** Designed as an ideal checkpoint for creating custom, specialized models.
|
| 18 |
+
* **Community-Driven & Open-Source:** Fully transparent with an Apache 2.0 license, and training history.
|
| 19 |
+
* **Flexible by Design:** Provides a flexible foundation for a wide range of generative tasks.
|
| 20 |
+
|
| 21 |
+
## Special Thanks
|
| 22 |
+
A massive thank you to our supporters who make this project possible.
|
| 23 |
+
* **Anonymous donor** whose incredible generosity funded the pretraining run and data collections. Your support has been transformative for open-source AI.
|
| 24 |
+
* **Fictional.ai** for their fantastic support and for helping push the boundaries of open-source AI. You can try Chroma on their platform:
|
| 25 |
+
|
| 26 |
+
[](https://fictional.ai/?ref=chroma_hf)
|
| 27 |
+
|
| 28 |
+
## How to Use
|
| 29 |
+
|
| 30 |
+
### `diffusers` Library
|
| 31 |
+
|
| 32 |
+
install the requirements
|
| 33 |
+
|
| 34 |
+
`pip install transformers diffusers sentencepiece accelerate`
|
| 35 |
+
|
| 36 |
+
```python
|
| 37 |
+
import torch
|
| 38 |
+
from diffusers import ChromaPipeline
|
| 39 |
+
|
| 40 |
+
pipe = ChromaPipeline.from_pretrained("lodestones/Chroma1-HD", torch_dtype=torch.bfloat16)
|
| 41 |
+
pipe.enable_model_cpu_offload()
|
| 42 |
+
|
| 43 |
+
prompt = [
|
| 44 |
+
"A high-fashion close-up portrait of a blonde woman in clear sunglasses. The image uses a bold teal and red color split for dramatic lighting. The background is a simple teal-green. The photo is sharp and well-composed, and is designed for viewing with anaglyph 3D glasses for optimal effect. It looks professionally done."
|
| 45 |
+
]
|
| 46 |
+
negative_prompt = ["low quality, ugly, unfinished, out of focus, deformed, disfigure, blurry, smudged, restricted palette, flat colors"]
|
| 47 |
+
|
| 48 |
+
image = pipe(
|
| 49 |
+
prompt=prompt,
|
| 50 |
+
negative_prompt=negative_prompt,
|
| 51 |
+
generator=torch.Generator("cpu").manual_seed(433),
|
| 52 |
+
num_inference_steps=40,
|
| 53 |
+
guidance_scale=3.0,
|
| 54 |
+
num_images_per_prompt=1,
|
| 55 |
+
).images[0]
|
| 56 |
+
image.save("chroma.png")
|
| 57 |
+
```
|
| 58 |
+
|
| 59 |
+
Quantized inference using gemlite
|
| 60 |
+
|
| 61 |
+
```py
|
| 62 |
+
import torch
|
| 63 |
+
from diffusers import ChromaPipeline
|
| 64 |
+
|
| 65 |
+
pipe = ChromaPipeline.from_pretrained("lodestones/Chroma1-HD", torch_dtype=torch.float16)
|
| 66 |
+
#pipe.enable_model_cpu_offload()
|
| 67 |
+
|
| 68 |
+
#######################################################
|
| 69 |
+
import gemlite
|
| 70 |
+
device = 'cuda:0'
|
| 71 |
+
processor = gemlite.helper.A8W8_int8_dynamic
|
| 72 |
+
#processor = gemlite.helper.A8W8_fp8_dynamic
|
| 73 |
+
#processor = gemlite.helper.A16W4_MXFP
|
| 74 |
+
|
| 75 |
+
for name, module in pipe.transformer.named_modules():
|
| 76 |
+
module.name = name
|
| 77 |
+
|
| 78 |
+
def patch_linearlayers(model, fct):
|
| 79 |
+
for name, layer in model.named_children():
|
| 80 |
+
if isinstance(layer, torch.nn.Linear):
|
| 81 |
+
setattr(model, name, fct(layer, name))
|
| 82 |
+
else:
|
| 83 |
+
patch_linearlayers(layer, fct)
|
| 84 |
+
|
| 85 |
+
def patch_linear_to_gemlite(layer, name):
|
| 86 |
+
layer = layer.to(device, non_blocking=True)
|
| 87 |
+
try:
|
| 88 |
+
return processor(device=device).from_linear(layer)
|
| 89 |
+
except Exception as exception:
|
| 90 |
+
print('Skipping gemlite conversion for: ' + str(layer.name), exception)
|
| 91 |
+
return layer
|
| 92 |
+
|
| 93 |
+
patch_linearlayers(pipe.transformer, patch_linear_to_gemlite)
|
| 94 |
+
torch.cuda.synchronize()
|
| 95 |
+
torch.cuda.empty_cache()
|
| 96 |
+
|
| 97 |
+
pipe.to(device)
|
| 98 |
+
pipe.transformer.forward = torch.compile(pipe.transformer.forward, fullgraph=True)
|
| 99 |
+
pipe.vae.forward = torch.compile(pipe.vae.forward, fullgraph=True)
|
| 100 |
+
#pipe.set_progress_bar_config(disable=True)
|
| 101 |
+
#######################################################
|
| 102 |
+
|
| 103 |
+
prompt = [
|
| 104 |
+
"A high-fashion close-up portrait of a blonde woman in clear sunglasses. The image uses a bold teal and red color split for dramatic lighting. The background is a simple teal-green. The photo is sharp and well-composed, and is designed for viewing with anaglyph 3D glasses for optimal effect. It looks professionally done."
|
| 105 |
+
]
|
| 106 |
+
negative_prompt = ["low quality, ugly, unfinished, out of focus, deformed, disfigure, blurry, smudged, restricted palette, flat colors"]
|
| 107 |
+
|
| 108 |
+
import time
|
| 109 |
+
for _ in range(3):
|
| 110 |
+
t_start = time.time()
|
| 111 |
+
image = pipe(
|
| 112 |
+
prompt=prompt,
|
| 113 |
+
negative_prompt=negative_prompt,
|
| 114 |
+
generator=torch.Generator("cpu").manual_seed(433),
|
| 115 |
+
num_inference_steps=40,
|
| 116 |
+
guidance_scale=3.0,
|
| 117 |
+
num_images_per_prompt=1,
|
| 118 |
+
).images[0]
|
| 119 |
+
t_end = time.time()
|
| 120 |
+
print(f"Took: {t_end - t_start} secs.") #66.1242527961731 -> 27.72 sec
|
| 121 |
+
|
| 122 |
+
image.save("chroma.png")
|
| 123 |
+
```
|
| 124 |
+
|
| 125 |
+
ComfyUI
|
| 126 |
+
For advanced users and customized workflows, you can use Chroma with ComfyUI.
|
| 127 |
+
|
| 128 |
+
**Requirements:**
|
| 129 |
+
* A working ComfyUI installation.
|
| 130 |
+
* [Chroma checkpoint](https://huggingface.co/lodestones/Chroma) (latest version).
|
| 131 |
+
* [T5 XXL Text Encoder](https://huggingface.co/comfyanonymous/flux_text_encoders/resolve/main/t5xxl_fp16.safetensors).
|
| 132 |
+
* [FLUX VAE](https://huggingface.co/lodestones/Chroma/resolve/main/ae.safetensors).
|
| 133 |
+
* [Chroma Workflow JSON](https://huggingface.co/lodestones/Chroma/resolve/main/ChromaSimpleWorkflow20250507.json).
|
| 134 |
+
|
| 135 |
+
**Setup:**
|
| 136 |
+
1. Place the `T5_xxl` model in your `ComfyUI/models/clip` folder.
|
| 137 |
+
2. Place the `FLUX VAE` in your `ComfyUI/models/vae` folder.
|
| 138 |
+
3. Place the `Chroma checkpoint` in your `ComfyUI/models/diffusion_models` folder.
|
| 139 |
+
4. Load the Chroma workflow file into ComfyUI and run.
|
| 140 |
+
|
| 141 |
+
## Model Details
|
| 142 |
+
* **Architecture:** Based on the 8.9B parameter FLUX.1-schnell model.
|
| 143 |
+
* **Training Data:** Trained on a 5M sample dataset curated from a 20M pool, including artistic, photographic, and niche styles.
|
| 144 |
+
* **Technical Report:** A comprehensive technical paper detailing the architectural modifications and training process is forthcoming.
|
| 145 |
+
|
| 146 |
+
## Intended Use
|
| 147 |
+
Chroma is intended to be used as a **base model** for researchers and developers to build upon. It is ideal for:
|
| 148 |
+
* Finetuning on specific styles, concepts, or characters.
|
| 149 |
+
* Research into generative model behavior, alignment, and safety.
|
| 150 |
+
* As a foundational component in larger AI systems.
|
| 151 |
+
|
| 152 |
+
## Limitations and Bias Statement
|
| 153 |
+
Chroma is trained on a broad, filtered dataset from the internet. As such, it may reflect the biases and stereotypes present in its training data. The model is released in a state as is and has not been aligned with a specific safety filter.
|
| 154 |
+
|
| 155 |
+
Users are responsible for their own use of this model. It has the potential to generate content that may be considered harmful, explicit, or offensive. I encourage developers to implement appropriate safeguards and ethical considerations in their downstream applications.
|
| 156 |
+
|
| 157 |
+
## Summary of Architectural Modifications
|
| 158 |
+
*(For a full breakdown, tech report soon-ish.)*
|
| 159 |
+
|
| 160 |
+
* **12B → 8.9B Parameters:**
|
| 161 |
+
* **TL;DR:** I replaced a 3.3B parameter timestep-encoding layer with a more efficient 250M parameter FFN, as the original was vastly oversized for its task.
|
| 162 |
+
* **MMDiT Masking:**
|
| 163 |
+
* **TL;DR:** Masking T5 padding tokens enhanced fidelity and increased training stability by preventing the model from focusing on irrelevant `<pad>` tokens.
|
| 164 |
+
* **Custom Timestep Distributions:**
|
| 165 |
+
* **TL;DR:** I implemented a custom timestep sampling distribution (`-x^2`) to prevent loss spikes and ensure the model trains effectively on both high-noise and low-noise regions.
|
| 166 |
+
|
| 167 |
+
## P.S
|
| 168 |
+
Chroma1-HD is not the old Chroma-v.50 it has been retrained from v.48
|
| 169 |
+
|
| 170 |
+
## Citation
|
| 171 |
+
```
|
| 172 |
+
@misc{rock2025chroma,
|
| 173 |
+
author = {Lodestone Rock},
|
| 174 |
+
title = {Chroma1-HD},
|
| 175 |
+
year = {2025},
|
| 176 |
+
publisher = {Hugging Face},
|
| 177 |
+
journal = {Hugging Face repository},
|
| 178 |
+
howpublished = {\url{https://huggingface.co/lodestones/Chroma1-HD}},
|
| 179 |
+
}
|
| 180 |
+
```
|