Buckets:
| import{s as vt,o as Jt,n as Tt}from"../chunks/scheduler.53228c21.js";import{S as jt,i as $t,e as l,s as n,c as p,h as Ut,a as i,d as a,b as o,f as G,g as d,j as f,k as W,l as r,m as s,n as m,t as c,o as u,p as g}from"../chunks/index.cac5d66a.js";import{C as xt}from"../chunks/CopyLLMTxtMenu.6ec4d35d.js";import{D as Me}from"../chunks/Docstring.b5daa438.js";import{C as Se}from"../chunks/CodeBlock.606cbaf4.js";import{E as Gt}from"../chunks/ExampleCodeBlock.789505ca.js";import{H as Z,E as Wt}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.1d6bb3d3.js";function Zt(be){let _,k="Examples:",J,b,w;return b=new Se({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwSWRlb2dyYW00UGlwZWxpbmUlMEElMEFwaXBlJTIwJTNEJTIwSWRlb2dyYW00UGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKCUyMmlkZW9ncmFtLWFpJTJGaWRlb2dyYW0tdjQlMjIlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmJmbG9hdDE2KSUwQXBpcGUudG8oJTIyY3VkYSUyMiklMEElMEFwcm9tcHQlMjAlM0QlMjAlMjJBJTIwcGhvdG8lMjBvZiUyMGElMjBjYXQlMjBob2xkaW5nJTIwYSUyMHNpZ24lMjB0aGF0JTIwc2F5cyUyMGhlbGxvJTIwd29ybGQlMjIlMEElMjMlMjBUaGUlMjBkZWZhdWx0cyUyMGFyZSUyMHRoZSUyMHJlY29tbWVuZGVkJTIwc2V0dGluZ3MlMjBmb3IlMjBiZXN0JTIwcXVhbGl0eS4lMEFpbWFnZSUyMCUzRCUyMHBpcGUocHJvbXB0JTJDJTIwaGVpZ2h0JTNEMjA0OCUyQyUyMHdpZHRoJTNEMjA0OCUyQyUyMGdlbmVyYXRvciUzRHRvcmNoLkdlbmVyYXRvciglMjJjdWRhJTIyKS5tYW51YWxfc2VlZCgwKSkuaW1hZ2VzJTVCMCU1RCUwQWltYWdlLnNhdmUoJTIyaWRlb2dyYW00LnBuZyUyMik=",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">import</span> torch | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> Ideogram4Pipeline | |
| <span class="hljs-meta">>>> </span>pipe = Ideogram4Pipeline.from_pretrained(<span class="hljs-string">"ideogram-ai/ideogram-v4"</span>, torch_dtype=torch.bfloat16) | |
| <span class="hljs-meta">>>> </span>pipe.to(<span class="hljs-string">"cuda"</span>) | |
| <span class="hljs-meta">>>> </span>prompt = <span class="hljs-string">"A photo of a cat holding a sign that says hello world"</span> | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># The defaults are the recommended settings for best quality.</span> | |
| <span class="hljs-meta">>>> </span>image = pipe(prompt, height=<span class="hljs-number">2048</span>, width=<span class="hljs-number">2048</span>, generator=torch.Generator(<span class="hljs-string">"cuda"</span>).manual_seed(<span class="hljs-number">0</span>)).images[<span class="hljs-number">0</span>] | |
| <span class="hljs-meta">>>> </span>image.save(<span class="hljs-string">"ideogram4.png"</span>)`,lang:"py",wrap:!1}}),{c(){_=l("p"),_.textContent=k,J=n(),p(b.$$.fragment)},l(h){_=i(h,"P",{"data-svelte-h":!0}),f(_)!=="svelte-kvfsh7"&&(_.textContent=k),J=o(h),d(b.$$.fragment,h)},m(h,I){s(h,_,I),s(h,J,I),m(b,h,I),w=!0},p:Tt,i(h){w||(c(b.$$.fragment,h),w=!0)},o(h){u(b.$$.fragment,h),w=!1},d(h){h&&(a(_),a(J)),g(b,h)}}}function kt(be){let _,k,J,b,w,h,I,we,C,rt=`Ideogram 4 is a flow-matching text-to-image model that uses a multimodal text encoder and an asymmetric | |
| classifier-free guidance scheme: a dedicated <code>unconditional_transformer</code> produces the negative branch with zeroed text | |
| features, while the main <code>transformer</code> consumes the full packed text + image sequence.`,Ie,E,lt=`The pipeline defaults are the recommended settings for best quality, so a plain <code>pipe(prompt)</code> call produces | |
| best-quality results out of the box: 48 flow-matching steps on a logit-normal schedule (<code>mu=0.0</code>, <code>std=1.5</code>) with | |
| classifier-free guidance held at 7.0 for the main steps and dropped to 3.0 for the final 3 “polish” steps.`,ve,B,it="Key inference-time knobs are exposed via the pipeline call:",Je,P,pt="<li><code>num_inference_steps</code>, <code>mu</code>, and <code>std</code> control the resolution-aware logit-normal flow-matching schedule.</li> <li><code>guidance_scale</code> (or a full per-step <code>guidance_schedule</code>) blends the conditional and unconditional velocities.</li>",Te,H,je,R,$e,q,Ue,V,dt=`Ideogram 4 is trained on a structured JSON caption rather than a free-form prompt, so a short prompt is best | |
| expanded into that native schema before generation. There are two ways to produce the caption.`,xe,Y,Ge,F,mt=`For the best results, expand the prompt with Ideogram’s hosted magic-prompt API and pass the returned caption | |
| straight to the pipeline (get a key at <a href="https://developer.ideogram.ai/" rel="nofollow">developer.ideogram.ai</a>):`,We,N,Ze,S,ke,z,ct=`For a fully local pipeline, load a small <a href="/docs/diffusers/pr_13975/en/api/pipelines/ideogram4#diffusers.Ideogram4PromptEnhancerHead">Ideogram4PromptEnhancerHead</a> (the Qwen3-VL LM head) as the optional | |
| <code>prompt_enhancer_head</code> component and pass <code>prompt_upsampling=True</code>. The head is grafted onto the shared | |
| <code>text_encoder</code>, so no second text encoder is loaded. Install <code>outlines</code> for schema-constrained captions (the nf4 | |
| checkpoint also needs <code>bitsandbytes</code>):`,Ce,Q,Ee,X,Be,M,L,ze,oe,ut="Text-to-image pipeline for Ideogram4.",Qe,se,gt=`Ideogram4 is a flow-matching model trained with asymmetric classifier-free guidance: a <code>transformer</code> consumes | |
| text-conditioned features alongside the image latents, while a separate <code>unconditional_transformer</code> denoises with | |
| zeroed text features. The two velocity predictions are linearly blended each step.`,Xe,T,A,Le,re,ht="Run text-to-image generation.",Ae,x,De,j,D,Oe,le,ft="Prepare the conditioning for the packed text+image sequence (one entry per prompt).",Ke,ie,_t=`Returns a flat tuple <code>(prompt_embeds, position_ids, segment_ids, indicator)</code>. The unconditional branch carries | |
| no text, so the pipeline builds its (zeroed) inputs directly rather than encoding a negative prompt.`,et,$,O,tt,pe,Mt="Rewrite each prompt into Ideogram4’s native structured JSON caption.",at,de,yt=`Requires the optional <code>prompt_enhancer_head</code> component, which is grafted onto the shared <code>text_encoder</code> body to | |
| make it generative. Generation is schema-constrained when <code>outlines</code> is installed, otherwise it runs | |
| unconstrained. Pass <code>generator</code> (the same one accepted by <code>__call__</code>) to make sampling reproducible.`,Pe,K,He,v,ee,nt,me,bt="LM head that makes the head-less Qwen3-VL <code>text_encoder</code> generative for prompt upsampling.",ot,ce,wt=`An optional pipeline component (<code>prompt_enhancer_head</code>): its weights load via a normal <code>from_pretrained</code> (its own | |
| small repo, or bundled in the model repo) rather than an in-pipeline download. At upsample time the pipeline | |
| combines it with the shared <code>text_encoder</code> body to form the generative model.`,Re,te,qe,U,ae,st,ue,It="Output class for the Ideogram 4 pipeline.",Ve,ne,Ye,ye,Fe;return w=new xt({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),I=new Z({props:{title:"Ideogram 4",local:"ideogram-4",headingTag:"h1"}}),H=new Z({props:{title:"Text-to-image",local:"text-to-image",headingTag:"h2"}}),R=new Se({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwSWRlb2dyYW00UGlwZWxpbmUlMEElMEFwaXBlJTIwJTNEJTIwSWRlb2dyYW00UGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKCUyMmlkZW9ncmFtLWFpJTJGaWRlb2dyYW0tdjQlMjIlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmJmbG9hdDE2KSUwQXBpcGUudG8oJTIyY3VkYSUyMiklMEElMEFwcm9tcHQlMjAlM0QlMjAlMjJBJTIwcGhvdG8lMjBvZiUyMGElMjBjYXQlMjBob2xkaW5nJTIwYSUyMHNpZ24lMjB0aGF0JTIwc2F5cyUyMGhlbGxvJTIwd29ybGQlMjIlMEElMjMlMjBUaGUlMjBkZWZhdWx0cyUyMGFyZSUyMHRoZSUyMHJlY29tbWVuZGVkJTIwc2V0dGluZ3MlMjBmb3IlMjBiZXN0JTIwcXVhbGl0eS4lMEFpbWFnZSUyMCUzRCUyMHBpcGUocHJvbXB0JTJDJTIwaGVpZ2h0JTNEMTAyNCUyQyUyMHdpZHRoJTNEMTAyNCUyQyUyMGdlbmVyYXRvciUzRHRvcmNoLkdlbmVyYXRvciglMjJjdWRhJTIyKS5tYW51YWxfc2VlZCgwKSkuaW1hZ2VzJTVCMCU1RCUwQWltYWdlLnNhdmUoJTIyaWRlb2dyYW00LnBuZyUyMik=",highlighted:`<span class="hljs-keyword">import</span> torch | |
| <span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> Ideogram4Pipeline | |
| pipe = Ideogram4Pipeline.from_pretrained(<span class="hljs-string">"ideogram-ai/ideogram-v4"</span>, torch_dtype=torch.bfloat16) | |
| pipe.to(<span class="hljs-string">"cuda"</span>) | |
| prompt = <span class="hljs-string">"A photo of a cat holding a sign that says hello world"</span> | |
| <span class="hljs-comment"># The defaults are the recommended settings for best quality.</span> | |
| image = pipe(prompt, height=<span class="hljs-number">1024</span>, width=<span class="hljs-number">1024</span>, generator=torch.Generator(<span class="hljs-string">"cuda"</span>).manual_seed(<span class="hljs-number">0</span>)).images[<span class="hljs-number">0</span>] | |
| image.save(<span class="hljs-string">"ideogram4.png"</span>)`,lang:"python",wrap:!1}}),q=new Z({props:{title:"Prompt upsampling",local:"prompt-upsampling",headingTag:"h2"}}),Y=new Z({props:{title:"Remote (Ideogram API)",local:"remote-ideogram-api",headingTag:"h3"}}),N=new Se({props:{code:"aW1wb3J0JTIwanNvbiUwQWltcG9ydCUyMHJlcXVlc3RzJTBBaW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwSWRlb2dyYW00UGlwZWxpbmUlMEElMEFwaXBlJTIwJTNEJTIwSWRlb2dyYW00UGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKCUyMmlkZW9ncmFtLWFpJTJGaWRlb2dyYW0tNC1uZjQlMjIlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmJmbG9hdDE2KSUwQXBpcGUudG8oJTIyY3VkYSUyMiklMEElMEElMjMlMjBFeHBhbmQlMjB0aGUlMjBwcm9tcHQlMjBpbnRvJTIwYSUyMHN0cnVjdHVyZWQlMjBKU09OJTIwY2FwdGlvbiUyMHdpdGglMjBJZGVvZ3JhbSdzJTIwaG9zdGVkJTIwbWFnaWMtcHJvbXB0JTIwQVBJLiUwQXJlc3BvbnNlJTIwJTNEJTIwcmVxdWVzdHMucG9zdCglMEElMjAlMjAlMjAlMjAlMjJodHRwcyUzQSUyRiUyRmFwaS5pZGVvZ3JhbS5haSUyRnYxJTJGaWRlb2dyYW0tdjQlMkZtYWdpYy1wcm9tcHQlMjIlMkMlMEElMjAlMjAlMjAlMjBoZWFkZXJzJTNEJTdCJTIyQXBpLUtleSUyMiUzQSUyMCUyMnlvdXJfaWRlb2dyYW1fYXBpX2tleSUyMiU3RCUyQyUwQSUyMCUyMCUyMCUyMGpzb24lM0QlN0IlMjJ0ZXh0X3Byb21wdCUyMiUzQSUyMCUyMkElMjBwaG90byUyMG9mJTIwYSUyMGNhdCUyMGhvbGRpbmclMjBhJTIwc2lnbiUyMHRoYXQlMjBzYXlzJTIwaGVsbG8lMjB3b3JsZCUyMiUyQyUyMCUyMmFzcGVjdF9yYXRpbyUyMiUzQSUyMCUyMjF4MSUyMiU3RCUyQyUwQSkuanNvbigpJTBBY2FwdGlvbiUyMCUzRCUyMGpzb24uZHVtcHMocmVzcG9uc2UlNUIlMjJqc29uX3Byb21wdCUyMiU1RCklMEElMEElMjMlMjBUaGUlMjBjYXB0aW9uJTIwaXMlMjBhbHJlYWR5JTIwdXBzYW1wbGVkJTJDJTIwc28lMjBwYXNzJTIwaXQlMjBkaXJlY3RseSUyMChubyUyMHByb21wdF91cHNhbXBsaW5nKS4lMEFpbWFnZSUyMCUzRCUyMHBpcGUoY2FwdGlvbiUyQyUyMGhlaWdodCUzRDEwMjQlMkMlMjB3aWR0aCUzRDEwMjQlMkMlMjBnZW5lcmF0b3IlM0R0b3JjaC5HZW5lcmF0b3IoJTIyY3VkYSUyMikubWFudWFsX3NlZWQoMCkpLmltYWdlcyU1QjAlNUQlMEFpbWFnZS5zYXZlKCUyMmlkZW9ncmFtNF91cHNhbXBsZWQucG5nJTIyKQ==",highlighted:`<span class="hljs-keyword">import</span> json | |
| <span class="hljs-keyword">import</span> requests | |
| <span class="hljs-keyword">import</span> torch | |
| <span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> Ideogram4Pipeline | |
| pipe = Ideogram4Pipeline.from_pretrained(<span class="hljs-string">"ideogram-ai/ideogram-4-nf4"</span>, torch_dtype=torch.bfloat16) | |
| pipe.to(<span class="hljs-string">"cuda"</span>) | |
| <span class="hljs-comment"># Expand the prompt into a structured JSON caption with Ideogram's hosted magic-prompt API.</span> | |
| response = requests.post( | |
| <span class="hljs-string">"https://api.ideogram.ai/v1/ideogram-v4/magic-prompt"</span>, | |
| headers={<span class="hljs-string">"Api-Key"</span>: <span class="hljs-string">"your_ideogram_api_key"</span>}, | |
| json={<span class="hljs-string">"text_prompt"</span>: <span class="hljs-string">"A photo of a cat holding a sign that says hello world"</span>, <span class="hljs-string">"aspect_ratio"</span>: <span class="hljs-string">"1x1"</span>}, | |
| ).json() | |
| caption = json.dumps(response[<span class="hljs-string">"json_prompt"</span>]) | |
| <span class="hljs-comment"># The caption is already upsampled, so pass it directly (no prompt_upsampling).</span> | |
| image = pipe(caption, height=<span class="hljs-number">1024</span>, width=<span class="hljs-number">1024</span>, generator=torch.Generator(<span class="hljs-string">"cuda"</span>).manual_seed(<span class="hljs-number">0</span>)).images[<span class="hljs-number">0</span>] | |
| image.save(<span class="hljs-string">"ideogram4_upsampled.png"</span>)`,lang:"python",wrap:!1}}),S=new Z({props:{title:"Local (on-device)",local:"local-on-device",headingTag:"h3"}}),Q=new Se({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwSWRlb2dyYW00UGlwZWxpbmUlMkMlMjBJZGVvZ3JhbTRQcm9tcHRFbmhhbmNlckhlYWQlMEElMEFwcm9tcHRfZW5oYW5jZXJfaGVhZCUyMCUzRCUyMElkZW9ncmFtNFByb21wdEVuaGFuY2VySGVhZC5mcm9tX3ByZXRyYWluZWQoJTBBJTIwJTIwJTIwJTIwJTIyZGlmZnVzZXJzJTJGcXdlbjMtdmwtOGItaW5zdHJ1Y3QtbG0taGVhZCUyMiUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guYmZsb2F0MTYlMEEpJTBBcGlwZSUyMCUzRCUyMElkZW9ncmFtNFBpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjAlMjJpZGVvZ3JhbS1haSUyRmlkZW9ncmFtLTQtbmY0JTIyJTJDJTIwcHJvbXB0X2VuaGFuY2VyX2hlYWQlM0Rwcm9tcHRfZW5oYW5jZXJfaGVhZCUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guYmZsb2F0MTYlMEEpJTBBcGlwZS50byglMjJjdWRhJTIyKSUwQSUwQXByb21wdCUyMCUzRCUyMCUyMkElMjBwaG90byUyMG9mJTIwYSUyMGNhdCUyMGhvbGRpbmclMjBhJTIwc2lnbiUyMHRoYXQlMjBzYXlzJTIwaGVsbG8lMjB3b3JsZCUyMiUwQWltYWdlJTIwJTNEJTIwcGlwZSglMEElMjAlMjAlMjAlMjBwcm9tcHQlMkMlMEElMjAlMjAlMjAlMjBoZWlnaHQlM0QxMDI0JTJDJTBBJTIwJTIwJTIwJTIwd2lkdGglM0QxMDI0JTJDJTBBJTIwJTIwJTIwJTIwcHJvbXB0X3Vwc2FtcGxpbmclM0RUcnVlJTJDJTBBJTIwJTIwJTIwJTIwZ2VuZXJhdG9yJTNEdG9yY2guR2VuZXJhdG9yKCUyMmN1ZGElMjIpLm1hbnVhbF9zZWVkKDApJTJDJTBBKS5pbWFnZXMlNUIwJTVEJTBBaW1hZ2Uuc2F2ZSglMjJpZGVvZ3JhbTRfdXBzYW1wbGVkLnBuZyUyMik=",highlighted:`<span class="hljs-keyword">import</span> torch | |
| <span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> Ideogram4Pipeline, Ideogram4PromptEnhancerHead | |
| prompt_enhancer_head = Ideogram4PromptEnhancerHead.from_pretrained( | |
| <span class="hljs-string">"diffusers/qwen3-vl-8b-instruct-lm-head"</span>, torch_dtype=torch.bfloat16 | |
| ) | |
| pipe = Ideogram4Pipeline.from_pretrained( | |
| <span class="hljs-string">"ideogram-ai/ideogram-4-nf4"</span>, prompt_enhancer_head=prompt_enhancer_head, torch_dtype=torch.bfloat16 | |
| ) | |
| pipe.to(<span class="hljs-string">"cuda"</span>) | |
| prompt = <span class="hljs-string">"A photo of a cat holding a sign that says hello world"</span> | |
| image = pipe( | |
| prompt, | |
| height=<span class="hljs-number">1024</span>, | |
| width=<span class="hljs-number">1024</span>, | |
| prompt_upsampling=<span class="hljs-literal">True</span>, | |
| generator=torch.Generator(<span class="hljs-string">"cuda"</span>).manual_seed(<span class="hljs-number">0</span>), | |
| ).images[<span class="hljs-number">0</span>] | |
| image.save(<span class="hljs-string">"ideogram4_upsampled.png"</span>)`,lang:"python",wrap:!1}}),X=new Z({props:{title:"Ideogram4Pipeline",local:"diffusers.Ideogram4Pipeline",headingTag:"h2"}}),L=new Me({props:{name:"class diffusers.Ideogram4Pipeline",anchor:"diffusers.Ideogram4Pipeline",parameters:[{name:"scheduler",val:": FlowMatchEulerDiscreteScheduler"},{name:"vae",val:": AutoencoderKLFlux2"},{name:"text_encoder",val:": PreTrainedModel"},{name:"tokenizer",val:": AutoTokenizer"},{name:"transformer",val:": Ideogram4Transformer2DModel"},{name:"unconditional_transformer",val:": Ideogram4Transformer2DModel"},{name:"prompt_enhancer_head",val:": diffusers.pipelines.ideogram4.prompt_enhancer.Ideogram4PromptEnhancerHead | None = None"}],parametersDescription:[{anchor:"diffusers.Ideogram4Pipeline.scheduler",description:`<strong>scheduler</strong> (<a href="/docs/diffusers/pr_13975/en/api/schedulers/flow_match_euler_discrete#diffusers.FlowMatchEulerDiscreteScheduler">FlowMatchEulerDiscreteScheduler</a>) — | |
| Flow-matching scheduler. The pipeline overrides the default sigma schedule with a resolution-aware | |
| logit-normal schedule.`,name:"scheduler"},{anchor:"diffusers.Ideogram4Pipeline.vae",description:`<strong>vae</strong> (<code>AutoencoderKLFlux2</code>) — | |
| Variational auto-encoder used to decode latents back into images.`,name:"vae"},{anchor:"diffusers.Ideogram4Pipeline.text_encoder",description:`<strong>text_encoder</strong> (<code>PreTrainedModel</code>) — | |
| Multimodal text encoder. The pipeline consumes hidden states from a fixed set of intermediate decoder | |
| layers (see <code>QWEN3_VL_ACTIVATION_LAYERS</code>).`,name:"text_encoder"},{anchor:"diffusers.Ideogram4Pipeline.tokenizer",description:`<strong>tokenizer</strong> (<code>AutoTokenizer</code>) — | |
| Tokenizer paired with <code>text_encoder</code>.`,name:"tokenizer"},{anchor:"diffusers.Ideogram4Pipeline.transformer",description:`<strong>transformer</strong> (<a href="/docs/diffusers/pr_13975/en/api/models/ideogram4_transformer2d#diffusers.Ideogram4Transformer2DModel">Ideogram4Transformer2DModel</a>) — | |
| Conditional flow-matching transformer.`,name:"transformer"},{anchor:"diffusers.Ideogram4Pipeline.unconditional_transformer",description:`<strong>unconditional_transformer</strong> (<a href="/docs/diffusers/pr_13975/en/api/models/ideogram4_transformer2d#diffusers.Ideogram4Transformer2DModel">Ideogram4Transformer2DModel</a>) — | |
| Unconditional (asymmetric-CFG) flow-matching transformer.`,name:"unconditional_transformer"}],source:"https://github.com/huggingface/diffusers/blob/vr_13975/src/diffusers/pipelines/ideogram4/pipeline_ideogram4.py#L140"}}),A=new Me({props:{name:"__call__",anchor:"diffusers.Ideogram4Pipeline.__call__",parameters:[{name:"prompt",val:": str | list[str] | None = None"},{name:"height",val:": int = 2048"},{name:"width",val:": int = 2048"},{name:"num_inference_steps",val:": int = 48"},{name:"guidance_scale",val:": float | None = None"},{name:"guidance_schedule",val:": list[float] | torch.Tensor | None = (7.0, 7.0, 7.0, 7.0, 7.0, 7.0, 7.0, 7.0, 7.0, 7.0, 7.0, 7.0, 7.0, 7.0, 7.0, 7.0, 7.0, 7.0, 7.0, 7.0, 7.0, 7.0, 7.0, 7.0, 7.0, 7.0, 7.0, 7.0, 7.0, 7.0, 7.0, 7.0, 7.0, 7.0, 7.0, 7.0, 7.0, 7.0, 7.0, 7.0, 7.0, 7.0, 7.0, 7.0, 7.0, 3.0, 3.0, 3.0)"},{name:"mu",val:": float = 0.0"},{name:"std",val:": float = 1.5"},{name:"prompt_upsampling",val:": bool = False"},{name:"prompt_upsampling_temperature",val:": float = 1.0"},{name:"max_sequence_length",val:": int = 2048"},{name:"num_images_per_prompt",val:": int = 1"},{name:"generator",val:": torch._C.Generator | list[torch._C.Generator] | None = None"},{name:"latents",val:": torch.Tensor | None = None"},{name:"output_type",val:": str = 'pil'"},{name:"return_dict",val:": bool = True"},{name:"callback_on_step_end",val:": typing.Optional[typing.Callable[[ForwardRef('Ideogram4Pipeline'), int, int, dict[str, typing.Any]], dict[str, typing.Any]]] = None"},{name:"callback_on_step_end_tensor_inputs",val:": list = ['latents']"}],parametersDescription:[{anchor:"diffusers.Ideogram4Pipeline.__call__.prompt",description:`<strong>prompt</strong> (<code>str</code> or <code>list[str]</code>) — | |
| Prompt(s) to guide image generation.`,name:"prompt"},{anchor:"diffusers.Ideogram4Pipeline.__call__.height",description:`<strong>height</strong> (<code>int</code>, <em>optional</em>, defaults to 2048) — | |
| Output image height in pixels; must be a multiple of <code>vae_scale_factor * patch_size</code>.`,name:"height"},{anchor:"diffusers.Ideogram4Pipeline.__call__.width",description:`<strong>width</strong> (<code>int</code>, <em>optional</em>, defaults to 2048) — | |
| Output image width in pixels; must be a multiple of <code>vae_scale_factor * patch_size</code>.`,name:"width"},{anchor:"diffusers.Ideogram4Pipeline.__call__.num_inference_steps",description:`<strong>num_inference_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 48) — | |
| Number of flow-matching steps. The default is the recommended setting for best quality.`,name:"num_inference_steps"},{anchor:"diffusers.Ideogram4Pipeline.__call__.guidance_scale",description:`<strong>guidance_scale</strong> (<code>float</code>, <em>optional</em>) — | |
| Constant classifier-free guidance scale applied at every step. The conditional and unconditional | |
| velocity predictions are blended as <code>v = guidance_scale * v_pos + (1 - guidance_scale) * v_neg</code>. | |
| Mutually exclusive with <code>guidance_schedule</code> (setting both raises). Defaults to <code>None</code>.`,name:"guidance_scale"},{anchor:"diffusers.Ideogram4Pipeline.__call__.guidance_schedule",description:`<strong>guidance_schedule</strong> (<code>list[float]</code> or <code>torch.Tensor</code>, <em>optional</em>) — | |
| Per-step guidance scale schedule; must have length <code>num_inference_steps</code>. The first entry corresponds | |
| to the first step (largest noise level). Mutually exclusive with <code>guidance_scale</code>; exactly one must be | |
| set. Defaults to the recommended schedule (7.0 for the main steps, dropping to 3.0 for the final 3 | |
| “polish” steps). To use a constant scale instead, pass <code>guidance_scale</code> and <code>guidance_schedule=None</code>.`,name:"guidance_schedule"},{anchor:"diffusers.Ideogram4Pipeline.__call__.mu",description:`<strong>mu</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) — | |
| Base mean of the logit-normal flow-matching schedule. The schedule mean is shifted by half the log of | |
| the resolution ratio relative to 512x512.`,name:"mu"},{anchor:"diffusers.Ideogram4Pipeline.__call__.std",description:`<strong>std</strong> (<code>float</code>, <em>optional</em>, defaults to 1.5) — | |
| Standard deviation of the logit-normal flow-matching schedule.`,name:"std"},{anchor:"diffusers.Ideogram4Pipeline.__call__.prompt_upsampling",description:`<strong>prompt_upsampling</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) — | |
| If <code>True</code>, rewrite <code>prompt</code> into Ideogram4’s native structured JSON caption via | |
| <a href="/docs/diffusers/pr_13975/en/api/pipelines/ideogram4#diffusers.Ideogram4Pipeline.upsample_prompt">upsample_prompt()</a> before encoding. Requires the optional <code>prompt_enhancer_head</code> | |
| component; install <code>outlines</code> for schema-constrained captions. <code>generator</code> is reused to make the | |
| upsampling reproducible.`,name:"prompt_upsampling"},{anchor:"diffusers.Ideogram4Pipeline.__call__.prompt_upsampling_temperature",description:`<strong>prompt_upsampling_temperature</strong> (<code>float</code>, <em>optional</em>, defaults to 1.0) — | |
| Sampling temperature for prompt upsampling when <code>prompt_upsampling=True</code>.`,name:"prompt_upsampling_temperature"},{anchor:"diffusers.Ideogram4Pipeline.__call__.max_sequence_length",description:`<strong>max_sequence_length</strong> (<code>int</code>, <em>optional</em>, defaults to 2048) — | |
| Maximum number of text tokens per prompt.`,name:"max_sequence_length"},{anchor:"diffusers.Ideogram4Pipeline.__call__.num_images_per_prompt",description:`<strong>num_images_per_prompt</strong> (<code>int</code>, <em>optional</em>, defaults to 1) — | |
| Number of images to generate per prompt.`,name:"num_images_per_prompt"},{anchor:"diffusers.Ideogram4Pipeline.__call__.generator",description:`<strong>generator</strong> (<code>torch.Generator</code> or <code>list[torch.Generator]</code>, <em>optional</em>) — | |
| Generator(s) used to make sampling deterministic.`,name:"generator"},{anchor:"diffusers.Ideogram4Pipeline.__call__.latents",description:`<strong>latents</strong> (<code>torch.Tensor</code>, <em>optional</em>) — | |
| Pre-generated noise of shape <code>(batch_size, num_image_tokens, latent_dim)</code>.`,name:"latents"},{anchor:"diffusers.Ideogram4Pipeline.__call__.output_type",description:`<strong>output_type</strong> (<code>str</code>, <em>optional</em>, defaults to <code>"pil"</code>) — | |
| One of <code>"pil"</code>, <code>"np"</code>, <code>"pt"</code>, or <code>"latent"</code>.`,name:"output_type"},{anchor:"diffusers.Ideogram4Pipeline.__call__.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) — | |
| Whether to return an <a href="/docs/diffusers/pr_13975/en/api/pipelines/ideogram4#diffusers.pipelines.ideogram4.Ideogram4PipelineOutput">Ideogram4PipelineOutput</a>.`,name:"return_dict"},{anchor:"diffusers.Ideogram4Pipeline.__call__.callback_on_step_end",description:`<strong>callback_on_step_end</strong> (<code>Callable</code>, <em>optional</em>) — | |
| Callback invoked at the end of every denoising step.`,name:"callback_on_step_end"},{anchor:"diffusers.Ideogram4Pipeline.__call__.callback_on_step_end_tensor_inputs",description:`<strong>callback_on_step_end_tensor_inputs</strong> (<code>list[str]</code>, <em>optional</em>) — | |
| Names of tensors to expose to the callback via <code>callback_kwargs</code>.`,name:"callback_on_step_end_tensor_inputs"}],source:"https://github.com/huggingface/diffusers/blob/vr_13975/src/diffusers/pipelines/ideogram4/pipeline_ideogram4.py#L468",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p><a | |
| href="/docs/diffusers/pr_13975/en/api/pipelines/ideogram4#diffusers.pipelines.ideogram4.Ideogram4PipelineOutput" | |
| >Ideogram4PipelineOutput</a> or <code>tuple</code>.</p> | |
| `}}),x=new Gt({props:{anchor:"diffusers.Ideogram4Pipeline.__call__.example",$$slots:{default:[Zt]},$$scope:{ctx:be}}}),D=new Me({props:{name:"encode_prompt",anchor:"diffusers.Ideogram4Pipeline.encode_prompt",parameters:[{name:"prompt",val:": str | list[str]"},{name:"grid_h",val:": int"},{name:"grid_w",val:": int"},{name:"max_sequence_length",val:": int"},{name:"device",val:": device"}],source:"https://github.com/huggingface/diffusers/blob/vr_13975/src/diffusers/pipelines/ideogram4/pipeline_ideogram4.py#L334"}}),O=new Me({props:{name:"upsample_prompt",anchor:"diffusers.Ideogram4Pipeline.upsample_prompt",parameters:[{name:"prompt",val:": str | list[str]"},{name:"height",val:": int = 2048"},{name:"width",val:": int = 2048"},{name:"temperature",val:": float = 1.0"},{name:"max_new_tokens",val:": int = 1024"},{name:"generator",val:": torch._C.Generator | list[torch._C.Generator] | None = None"},{name:"device",val:": torch.device | None = None"}],source:"https://github.com/huggingface/diffusers/blob/vr_13975/src/diffusers/pipelines/ideogram4/pipeline_ideogram4.py#L203"}}),K=new Z({props:{title:"Ideogram4PromptEnhancerHead",local:"diffusers.Ideogram4PromptEnhancerHead",headingTag:"h2"}}),ee=new Me({props:{name:"class diffusers.Ideogram4PromptEnhancerHead",anchor:"diffusers.Ideogram4PromptEnhancerHead",parameters:[{name:"hidden_size",val:": int = 4096"},{name:"vocab_size",val:": int = 151936"}],source:"https://github.com/huggingface/diffusers/blob/vr_13975/src/diffusers/pipelines/ideogram4/prompt_enhancer.py#L42"}}),te=new Z({props:{title:"Ideogram4PipelineOutput",local:"diffusers.pipelines.ideogram4.Ideogram4PipelineOutput",headingTag:"h2"}}),ae=new Me({props:{name:"class diffusers.pipelines.ideogram4.Ideogram4PipelineOutput",anchor:"diffusers.pipelines.ideogram4.Ideogram4PipelineOutput",parameters:[{name:"images",val:": list[PIL.Image.Image] | numpy.ndarray"}],parametersDescription:[{anchor:"diffusers.pipelines.ideogram4.Ideogram4PipelineOutput.images",description:`<strong>images</strong> (<code>list[PIL.Image.Image]</code> or <code>np.ndarray</code>) — | |
| List of denoised PIL images of length <code>batch_size</code>, or numpy array of shape <code>(batch_size, height, width, num_channels)</code>.`,name:"images"}],source:"https://github.com/huggingface/diffusers/blob/vr_13975/src/diffusers/pipelines/ideogram4/pipeline_output.py#L24"}}),ne=new Wt({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/pipelines/ideogram4.md"}}),{c(){_=l("meta"),k=n(),J=l("p"),b=n(),p(w.$$.fragment),h=n(),p(I.$$.fragment),we=n(),C=l("p"),C.innerHTML=rt,Ie=n(),E=l("p"),E.innerHTML=lt,ve=n(),B=l("p"),B.textContent=it,Je=n(),P=l("ul"),P.innerHTML=pt,Te=n(),p(H.$$.fragment),je=n(),p(R.$$.fragment),$e=n(),p(q.$$.fragment),Ue=n(),V=l("p"),V.textContent=dt,xe=n(),p(Y.$$.fragment),Ge=n(),F=l("p"),F.innerHTML=mt,We=n(),p(N.$$.fragment),Ze=n(),p(S.$$.fragment),ke=n(),z=l("p"),z.innerHTML=ct,Ce=n(),p(Q.$$.fragment),Ee=n(),p(X.$$.fragment),Be=n(),M=l("div"),p(L.$$.fragment),ze=n(),oe=l("p"),oe.textContent=ut,Qe=n(),se=l("p"),se.innerHTML=gt,Xe=n(),T=l("div"),p(A.$$.fragment),Le=n(),re=l("p"),re.textContent=ht,Ae=n(),p(x.$$.fragment),De=n(),j=l("div"),p(D.$$.fragment),Oe=n(),le=l("p"),le.textContent=ft,Ke=n(),ie=l("p"),ie.innerHTML=_t,et=n(),$=l("div"),p(O.$$.fragment),tt=n(),pe=l("p"),pe.textContent=Mt,at=n(),de=l("p"),de.innerHTML=yt,Pe=n(),p(K.$$.fragment),He=n(),v=l("div"),p(ee.$$.fragment),nt=n(),me=l("p"),me.innerHTML=bt,ot=n(),ce=l("p"),ce.innerHTML=wt,Re=n(),p(te.$$.fragment),qe=n(),U=l("div"),p(ae.$$.fragment),st=n(),ue=l("p"),ue.textContent=It,Ve=n(),p(ne.$$.fragment),Ye=n(),ye=l("p"),this.h()},l(e){const t=Ut("svelte-u9bgzb",document.head);_=i(t,"META",{name:!0,content:!0}),t.forEach(a),k=o(e),J=i(e,"P",{}),G(J).forEach(a),b=o(e),d(w.$$.fragment,e),h=o(e),d(I.$$.fragment,e),we=o(e),C=i(e,"P",{"data-svelte-h":!0}),f(C)!=="svelte-z8pr89"&&(C.innerHTML=rt),Ie=o(e),E=i(e,"P",{"data-svelte-h":!0}),f(E)!=="svelte-xco4w2"&&(E.innerHTML=lt),ve=o(e),B=i(e,"P",{"data-svelte-h":!0}),f(B)!=="svelte-gyrac2"&&(B.textContent=it),Je=o(e),P=i(e,"UL",{"data-svelte-h":!0}),f(P)!=="svelte-1s1ga53"&&(P.innerHTML=pt),Te=o(e),d(H.$$.fragment,e),je=o(e),d(R.$$.fragment,e),$e=o(e),d(q.$$.fragment,e),Ue=o(e),V=i(e,"P",{"data-svelte-h":!0}),f(V)!=="svelte-4yrxad"&&(V.textContent=dt),xe=o(e),d(Y.$$.fragment,e),Ge=o(e),F=i(e,"P",{"data-svelte-h":!0}),f(F)!=="svelte-1w3o321"&&(F.innerHTML=mt),We=o(e),d(N.$$.fragment,e),Ze=o(e),d(S.$$.fragment,e),ke=o(e),z=i(e,"P",{"data-svelte-h":!0}),f(z)!=="svelte-1sh472t"&&(z.innerHTML=ct),Ce=o(e),d(Q.$$.fragment,e),Ee=o(e),d(X.$$.fragment,e),Be=o(e),M=i(e,"DIV",{class:!0});var y=G(M);d(L.$$.fragment,y),ze=o(y),oe=i(y,"P",{"data-svelte-h":!0}),f(oe)!=="svelte-ysojjo"&&(oe.textContent=ut),Qe=o(y),se=i(y,"P",{"data-svelte-h":!0}),f(se)!=="svelte-1jolije"&&(se.innerHTML=gt),Xe=o(y),T=i(y,"DIV",{class:!0});var ge=G(T);d(A.$$.fragment,ge),Le=o(ge),re=i(ge,"P",{"data-svelte-h":!0}),f(re)!=="svelte-1n34az2"&&(re.textContent=ht),Ae=o(ge),d(x.$$.fragment,ge),ge.forEach(a),De=o(y),j=i(y,"DIV",{class:!0});var he=G(j);d(D.$$.fragment,he),Oe=o(he),le=i(he,"P",{"data-svelte-h":!0}),f(le)!=="svelte-p737jv"&&(le.textContent=ft),Ke=o(he),ie=i(he,"P",{"data-svelte-h":!0}),f(ie)!=="svelte-1ymcwo9"&&(ie.innerHTML=_t),he.forEach(a),et=o(y),$=i(y,"DIV",{class:!0});var fe=G($);d(O.$$.fragment,fe),tt=o(fe),pe=i(fe,"P",{"data-svelte-h":!0}),f(pe)!=="svelte-hhy1np"&&(pe.textContent=Mt),at=o(fe),de=i(fe,"P",{"data-svelte-h":!0}),f(de)!=="svelte-dqjpxm"&&(de.innerHTML=yt),fe.forEach(a),y.forEach(a),Pe=o(e),d(K.$$.fragment,e),He=o(e),v=i(e,"DIV",{class:!0});var _e=G(v);d(ee.$$.fragment,_e),nt=o(_e),me=i(_e,"P",{"data-svelte-h":!0}),f(me)!=="svelte-gu2f5z"&&(me.innerHTML=bt),ot=o(_e),ce=i(_e,"P",{"data-svelte-h":!0}),f(ce)!=="svelte-bejgnu"&&(ce.innerHTML=wt),_e.forEach(a),Re=o(e),d(te.$$.fragment,e),qe=o(e),U=i(e,"DIV",{class:!0});var Ne=G(U);d(ae.$$.fragment,Ne),st=o(Ne),ue=i(Ne,"P",{"data-svelte-h":!0}),f(ue)!=="svelte-5vp3kd"&&(ue.textContent=It),Ne.forEach(a),Ve=o(e),d(ne.$$.fragment,e),Ye=o(e),ye=i(e,"P",{}),G(ye).forEach(a),this.h()},h(){W(_,"name","hf:doc:metadata"),W(_,"content",Ct),W(T,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),W(j,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),W($,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),W(M,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),W(v,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),W(U,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(e,t){r(document.head,_),s(e,k,t),s(e,J,t),s(e,b,t),m(w,e,t),s(e,h,t),m(I,e,t),s(e,we,t),s(e,C,t),s(e,Ie,t),s(e,E,t),s(e,ve,t),s(e,B,t),s(e,Je,t),s(e,P,t),s(e,Te,t),m(H,e,t),s(e,je,t),m(R,e,t),s(e,$e,t),m(q,e,t),s(e,Ue,t),s(e,V,t),s(e,xe,t),m(Y,e,t),s(e,Ge,t),s(e,F,t),s(e,We,t),m(N,e,t),s(e,Ze,t),m(S,e,t),s(e,ke,t),s(e,z,t),s(e,Ce,t),m(Q,e,t),s(e,Ee,t),m(X,e,t),s(e,Be,t),s(e,M,t),m(L,M,null),r(M,ze),r(M,oe),r(M,Qe),r(M,se),r(M,Xe),r(M,T),m(A,T,null),r(T,Le),r(T,re),r(T,Ae),m(x,T,null),r(M,De),r(M,j),m(D,j,null),r(j,Oe),r(j,le),r(j,Ke),r(j,ie),r(M,et),r(M,$),m(O,$,null),r($,tt),r($,pe),r($,at),r($,de),s(e,Pe,t),m(K,e,t),s(e,He,t),s(e,v,t),m(ee,v,null),r(v,nt),r(v,me),r(v,ot),r(v,ce),s(e,Re,t),m(te,e,t),s(e,qe,t),s(e,U,t),m(ae,U,null),r(U,st),r(U,ue),s(e,Ve,t),m(ne,e,t),s(e,Ye,t),s(e,ye,t),Fe=!0},p(e,[t]){const y={};t&2&&(y.$$scope={dirty:t,ctx:e}),x.$set(y)},i(e){Fe||(c(w.$$.fragment,e),c(I.$$.fragment,e),c(H.$$.fragment,e),c(R.$$.fragment,e),c(q.$$.fragment,e),c(Y.$$.fragment,e),c(N.$$.fragment,e),c(S.$$.fragment,e),c(Q.$$.fragment,e),c(X.$$.fragment,e),c(L.$$.fragment,e),c(A.$$.fragment,e),c(x.$$.fragment,e),c(D.$$.fragment,e),c(O.$$.fragment,e),c(K.$$.fragment,e),c(ee.$$.fragment,e),c(te.$$.fragment,e),c(ae.$$.fragment,e),c(ne.$$.fragment,e),Fe=!0)},o(e){u(w.$$.fragment,e),u(I.$$.fragment,e),u(H.$$.fragment,e),u(R.$$.fragment,e),u(q.$$.fragment,e),u(Y.$$.fragment,e),u(N.$$.fragment,e),u(S.$$.fragment,e),u(Q.$$.fragment,e),u(X.$$.fragment,e),u(L.$$.fragment,e),u(A.$$.fragment,e),u(x.$$.fragment,e),u(D.$$.fragment,e),u(O.$$.fragment,e),u(K.$$.fragment,e),u(ee.$$.fragment,e),u(te.$$.fragment,e),u(ae.$$.fragment,e),u(ne.$$.fragment,e),Fe=!1},d(e){e&&(a(k),a(J),a(b),a(h),a(we),a(C),a(Ie),a(E),a(ve),a(B),a(Je),a(P),a(Te),a(je),a($e),a(Ue),a(V),a(xe),a(Ge),a(F),a(We),a(Ze),a(ke),a(z),a(Ce),a(Ee),a(Be),a(M),a(Pe),a(He),a(v),a(Re),a(qe),a(U),a(Ve),a(Ye),a(ye)),a(_),g(w,e),g(I,e),g(H,e),g(R,e),g(q,e),g(Y,e),g(N,e),g(S,e),g(Q,e),g(X,e),g(L),g(A),g(x),g(D),g(O),g(K,e),g(ee),g(te,e),g(ae),g(ne,e)}}}const Ct='{"title":"Ideogram 4","local":"ideogram-4","sections":[{"title":"Text-to-image","local":"text-to-image","sections":[],"depth":2},{"title":"Prompt upsampling","local":"prompt-upsampling","sections":[{"title":"Remote (Ideogram API)","local":"remote-ideogram-api","sections":[],"depth":3},{"title":"Local (on-device)","local":"local-on-device","sections":[],"depth":3}],"depth":2},{"title":"Ideogram4Pipeline","local":"diffusers.Ideogram4Pipeline","sections":[],"depth":2},{"title":"Ideogram4PromptEnhancerHead","local":"diffusers.Ideogram4PromptEnhancerHead","sections":[],"depth":2},{"title":"Ideogram4PipelineOutput","local":"diffusers.pipelines.ideogram4.Ideogram4PipelineOutput","sections":[],"depth":2}],"depth":1}';function Et(be){return Jt(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Ft extends jt{constructor(_){super(),$t(this,_,Et,kt,vt,{})}}export{Ft as component}; | |
Xet Storage Details
- Size:
- 35 kB
- Xet hash:
- 80058f132b4241d3eed58f03133de448f1a63d54984820903c0604b7e490cad0
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.