|
| 1 | +<!--Copyright 2026 Ideogram AI and The HuggingFace Team. All rights reserved. |
| 2 | +
|
| 3 | +Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with |
| 4 | +the License. You may obtain a copy of the License at |
| 5 | +
|
| 6 | +http://www.apache.org/licenses/LICENSE-2.0 |
| 7 | +
|
| 8 | +Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on |
| 9 | +an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the |
| 10 | +specific language governing permissions and limitations under the License. |
| 11 | +--> |
| 12 | + |
| 13 | +# Ideogram 4 |
| 14 | + |
| 15 | +Ideogram 4 is a flow-matching text-to-image model that uses a multimodal text encoder and an asymmetric |
| 16 | +classifier-free guidance scheme: a dedicated `unconditional_transformer` produces the negative branch with zeroed text |
| 17 | +features, while the main `transformer` consumes the full packed text + image sequence. |
| 18 | + |
| 19 | +The pipeline defaults are the recommended settings for best quality, so a plain `pipe(prompt)` call produces |
| 20 | +best-quality results out of the box: 48 flow-matching steps on a logit-normal schedule (`mu=0.0`, `std=1.5`) with |
| 21 | +classifier-free guidance held at 7.0 for the main steps and dropped to 3.0 for the final 3 "polish" steps. |
| 22 | + |
| 23 | +Key inference-time knobs are exposed via the pipeline call: |
| 24 | + |
| 25 | +- `num_inference_steps`, `mu`, and `std` control the resolution-aware logit-normal flow-matching schedule. |
| 26 | +- `guidance_scale` (or a full per-step `guidance_schedule`) blends the conditional and unconditional velocities. |
| 27 | + |
| 28 | +## Text-to-image |
| 29 | + |
| 30 | +```python |
| 31 | +import torch |
| 32 | +from diffusers import Ideogram4Pipeline |
| 33 | + |
| 34 | +pipe = Ideogram4Pipeline.from_pretrained("ideogram-ai/ideogram-v4", torch_dtype=torch.bfloat16) |
| 35 | +pipe.to("cuda") |
| 36 | + |
| 37 | +prompt = "A photo of a cat holding a sign that says hello world" |
| 38 | +# The defaults are the recommended settings for best quality. |
| 39 | +image = pipe(prompt, height=1024, width=1024, generator=torch.Generator("cuda").manual_seed(0)).images[0] |
| 40 | +image.save("ideogram4.png") |
| 41 | +``` |
| 42 | + |
| 43 | +## Ideogram4Pipeline |
| 44 | + |
| 45 | +[[autodoc]] Ideogram4Pipeline |
| 46 | + - all |
| 47 | + - __call__ |
| 48 | + |
| 49 | +## Ideogram4PipelineOutput |
| 50 | + |
| 51 | +[[autodoc]] pipelines.ideogram4.pipeline_output.Ideogram4PipelineOutput |
0 commit comments