Buckets:

download
raw
17.4 kB
import"../chunks/DsnmJJEf.js";import{i as k,h as j,H as c,D as n,E as q,s as U,a as V}from"../chunks/BtE7mKSK.js";import{p as G,o as J,s as e,f as N,a as p,b as L,c as t,d as m,r as s,n as d}from"../chunks/jDjavuwI.js";import{E as O}from"../chunks/SrSJA0zO.js";const C='{"title":"NucleusMoE-Image","local":"nucleusmoe-image","sections":[{"title":"NucleusMoEImagePipeline","local":"diffusers.NucleusMoEImagePipeline","sections":[],"depth":2},{"title":"NucleusMoEImagePipelineOutput","local":"diffusers.pipelines.nucleusmoe_image.pipeline_output.NucleusMoEImagePipelineOutput","sections":[],"depth":2}],"depth":1}';var Q=m('<meta name="hf:doc:metadata"/>'),A=m("<p>Examples:</p> <!>",1),D=m(`<p></p> <!> <p><a href="https://huggingface.co/NucleusAI/NucleusMoE-Image" rel="nofollow">NucleusMoE-Image</a> is a text-to-image model that pairs a single-stream DiT with Mixture-of-Experts feed-forward layers, cross-attention to a Qwen3-VL text encoder, and a flow-matching Euler discrete scheduler.</p> <blockquote class="tip"><p>Make sure to check out the Schedulers <a href="../../using-diffusers/schedulers">guide</a> to learn how to explore the tradeoff between scheduler speed and quality, and see the <a href="../../using-diffusers/loading#reuse-a-pipeline">reuse components across pipelines</a> section to learn how to efficiently load the same components into multiple pipelines.</p></blockquote> <!> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>Pipeline for text-to-image generation using NucleusMoE.</p> <p>This pipeline uses a single-stream DiT with Mixture-of-Experts feed-forward layers, cross-attention to a Qwen3-VL
text encoder, and a flow-matching Euler discrete scheduler.</p> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>Function invoked when calling the pipeline for generation.</p> <!></div> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>Encode text prompt(s) into embeddings using the Qwen3-VL text encoder.</p></div></div> <!> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>Output class for NucleusMoE Image pipelines.</p></div> <!> <p></p>`,1);function S(x,I){G(I,!1),J(()=>{new URLSearchParams(window.location.search).get("fw")}),k();var u=D();j("irm1lo",o=>{var l=Q();U(l,"content",C),p(o,l)});var g=e(N(u),2);c(g,{title:"NucleusMoE-Image",local:"nucleusmoe-image",headingTag:"h1"});var _=e(g,6);c(_,{title:"NucleusMoEImagePipeline",local:"diffusers.NucleusMoEImagePipeline",headingTag:"h2"});var a=e(_,2),f=t(a);n(f,{name:"class diffusers.NucleusMoEImagePipeline",anchor:"diffusers.NucleusMoEImagePipeline",source:"https://github.com/huggingface/diffusers/blob/vr_14192/src/diffusers/pipelines/nucleusmoe_image/pipeline_nucleusmoe_image.py#L132",parameters:[{name:"transformer",val:": NucleusMoEImageTransformer2DModel"},{name:"scheduler",val:": FlowMatchEulerDiscreteScheduler"},{name:"vae",val:": AutoencoderKLQwenImage"},{name:"text_encoder",val:": Qwen3VLForConditionalGeneration"},{name:"processor",val:": Qwen3VLProcessor"}],parametersDescription:[{anchor:"diffusers.NucleusMoEImagePipeline.transformer",description:`<strong>transformer</strong> (<code>NucleusMoEImageTransformer2DModel</code>) &#x2014;
Conditional Transformer (MMDiT) architecture to denoise the encoded image latents.`,name:"transformer"},{anchor:"diffusers.NucleusMoEImagePipeline.scheduler",description:`<strong>scheduler</strong> (<a href="/docs/diffusers/pr_14192/en/api/schedulers/flow_match_euler_discrete#diffusers.FlowMatchEulerDiscreteScheduler">FlowMatchEulerDiscreteScheduler</a>) &#x2014;
A scheduler to be used in combination with <code>transformer</code> to denoise the encoded image latents.`,name:"scheduler"},{anchor:"diffusers.NucleusMoEImagePipeline.vae",description:`<strong>vae</strong> (<a href="/docs/diffusers/pr_14192/en/api/models/autoencoderkl_qwenimage#diffusers.AutoencoderKLQwenImage">AutoencoderKLQwenImage</a>) &#x2014;
Variational Auto-Encoder (VAE) Model to encode and decode images to and from latent representations.`,name:"vae"},{anchor:"diffusers.NucleusMoEImagePipeline.text_encoder",description:`<strong>text_encoder</strong> (<code>Qwen3VLForConditionalGeneration</code>) &#x2014;
Text encoder for computing prompt embeddings.`,name:"text_encoder"},{anchor:"diffusers.NucleusMoEImagePipeline.processor",description:`<strong>processor</strong> (<code>Qwen3VLProcessor</code>) &#x2014;
Processor for tokenizing text inputs.`,name:"processor"}]});var r=e(f,6),h=t(r);n(h,{name:"__call__",anchor:"diffusers.NucleusMoEImagePipeline.__call__",source:"https://github.com/huggingface/diffusers/blob/vr_14192/src/diffusers/pipelines/nucleusmoe_image/pipeline_nucleusmoe_image.py#L379",parameters:[{name:"prompt",val:": str | list[str] = None"},{name:"negative_prompt",val:": str | list[str] = None"},{name:"guidance_scale",val:": float = 4.0"},{name:"height",val:": int | None = None"},{name:"width",val:": int | None = None"},{name:"num_inference_steps",val:": int = 50"},{name:"sigmas",val:": list[float] | None = None"},{name:"num_images_per_prompt",val:": int = 1"},{name:"max_sequence_length",val:": int | None = None"},{name:"return_index",val:": int | None = None"},{name:"generator",val:": typing.Union[torch.Generator, list[torch.Generator], NoneType] = None"},{name:"latents",val:": typing.Optional[torch.Tensor] = None"},{name:"prompt_embeds",val:": typing.Optional[torch.Tensor] = None"},{name:"prompt_embeds_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"negative_prompt_embeds",val:": typing.Optional[torch.Tensor] = None"},{name:"negative_prompt_embeds_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"output_type",val:": str | None = 'pil'"},{name:"return_dict",val:": bool = True"},{name:"attention_kwargs",val:": dict[str, typing.Any] | None = None"},{name:"callback_on_step_end",val:": typing.Optional[typing.Callable[[int, int, dict], NoneType]] = None"},{name:"callback_on_step_end_tensor_inputs",val:": list = ['latents']"}],parametersDescription:[{anchor:"diffusers.NucleusMoEImagePipeline.__call__.prompt",description:`<strong>prompt</strong> (<code>str</code> or <code>list[str]</code>, <em>optional</em>) &#x2014;
The prompt or prompts to guide the image generation. If not defined, one has to pass <code>prompt_embeds</code>.`,name:"prompt"},{anchor:"diffusers.NucleusMoEImagePipeline.__call__.negative_prompt",description:`<strong>negative_prompt</strong> (<code>str</code> or <code>list[str]</code>, <em>optional</em>) &#x2014;
The prompt or prompts not to guide the image generation. If not defined, an empty string is used when
<code>true_cfg_scale &gt; 1</code>.`,name:"negative_prompt"},{anchor:"diffusers.NucleusMoEImagePipeline.__call__.guidance_scale",description:`<strong>guidance_scale</strong> (<code>float</code>, <em>optional</em>, defaults to 4.0) &#x2014;
Classifier-free guidance scale. Values greater than 1 enable CFG.`,name:"guidance_scale"},{anchor:"diffusers.NucleusMoEImagePipeline.__call__.return_index",description:`<strong>return_index</strong> (<code>int</code>, <em>optional</em>) &#x2014;
Layer index of the text encoder output to use for the prompt embeddings.`,name:"return_index"},{anchor:"diffusers.NucleusMoEImagePipeline.__call__.height",description:`<strong>height</strong> (<code>int</code>, <em>optional</em>, defaults to <code>self.default_sample_size * self.vae_scale_factor</code>) &#x2014;
The height in pixels of the generated image.`,name:"height"},{anchor:"diffusers.NucleusMoEImagePipeline.__call__.width",description:`<strong>width</strong> (<code>int</code>, <em>optional</em>, defaults to <code>self.default_sample_size * self.vae_scale_factor</code>) &#x2014;
The width in pixels of the generated image.`,name:"width"},{anchor:"diffusers.NucleusMoEImagePipeline.__call__.num_inference_steps",description:`<strong>num_inference_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 50) &#x2014;
The number of denoising steps.`,name:"num_inference_steps"},{anchor:"diffusers.NucleusMoEImagePipeline.__call__.sigmas",description:`<strong>sigmas</strong> (<code>list[float]</code>, <em>optional</em>) &#x2014;
Custom sigmas for the denoising schedule. If not defined, a linear schedule is used.`,name:"sigmas"},{anchor:"diffusers.NucleusMoEImagePipeline.__call__.num_images_per_prompt",description:`<strong>num_images_per_prompt</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The number of images to generate per prompt.`,name:"num_images_per_prompt"},{anchor:"diffusers.NucleusMoEImagePipeline.__call__.generator",description:`<strong>generator</strong> (<code>torch.Generator</code> or <code>list[torch.Generator]</code>, <em>optional</em>) &#x2014;
One or a list of torch generators to make generation deterministic.`,name:"generator"},{anchor:"diffusers.NucleusMoEImagePipeline.__call__.latents",description:`<strong>latents</strong> (<code>torch.Tensor</code>, <em>optional</em>) &#x2014;
Pre-generated noisy latents to be used as inputs for image generation.`,name:"latents"},{anchor:"diffusers.NucleusMoEImagePipeline.__call__.prompt_embeds",description:`<strong>prompt_embeds</strong> (<code>torch.Tensor</code>, <em>optional</em>) &#x2014;
Pre-generated text embeddings.`,name:"prompt_embeds"},{anchor:"diffusers.NucleusMoEImagePipeline.__call__.prompt_embeds_mask",description:`<strong>prompt_embeds_mask</strong> (<code>torch.Tensor</code>, <em>optional</em>) &#x2014;
Attention mask for pre-generated text embeddings.`,name:"prompt_embeds_mask"},{anchor:"diffusers.NucleusMoEImagePipeline.__call__.negative_prompt_embeds",description:`<strong>negative_prompt_embeds</strong> (<code>torch.Tensor</code>, <em>optional</em>) &#x2014;
Pre-generated negative text embeddings.`,name:"negative_prompt_embeds"},{anchor:"diffusers.NucleusMoEImagePipeline.__call__.negative_prompt_embeds_mask",description:`<strong>negative_prompt_embeds_mask</strong> (<code>torch.Tensor</code>, <em>optional</em>) &#x2014;
Attention mask for pre-generated negative text embeddings.`,name:"negative_prompt_embeds_mask"},{anchor:"diffusers.NucleusMoEImagePipeline.__call__.output_type",description:`<strong>output_type</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;pil&quot;</code>) &#x2014;
The output format of the generated image. Choose between <code>&quot;pil&quot;</code>, <code>&quot;np&quot;</code>, or <code>&quot;latent&quot;</code>.`,name:"output_type"},{anchor:"diffusers.NucleusMoEImagePipeline.__call__.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to return a <code>NucleusMoEImagePipelineOutput</code> instead of a plain tuple.`,name:"return_dict"},{anchor:"diffusers.NucleusMoEImagePipeline.__call__.attention_kwargs",description:`<strong>attention_kwargs</strong> (<code>dict</code>, <em>optional</em>) &#x2014;
Kwargs passed to the attention processor.`,name:"attention_kwargs"},{anchor:"diffusers.NucleusMoEImagePipeline.__call__.callback_on_step_end",description:`<strong>callback_on_step_end</strong> (<code>Callable</code>, <em>optional</em>) &#x2014;
A function called at the end of each denoising step.`,name:"callback_on_step_end"},{anchor:"diffusers.NucleusMoEImagePipeline.__call__.callback_on_step_end_tensor_inputs",description:`<strong>callback_on_step_end_tensor_inputs</strong> (<code>list</code>, <em>optional</em>) &#x2014;
Tensor inputs for the <code>callback_on_step_end</code> function.`,name:"callback_on_step_end_tensor_inputs"},{anchor:"diffusers.NucleusMoEImagePipeline.__call__.max_sequence_length",description:`<strong>max_sequence_length</strong> (<code>int</code>, defaults to 512) &#x2014;
Maximum sequence length for the text prompt.`,name:"max_sequence_length"}],returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>
<p><code>NucleusMoEImagePipelineOutput</code> if <code>return_dict</code> is True, otherwise a <code>tuple</code> where the first element
is a list with the generated images.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>
<p><code>NucleusMoEImagePipelineOutput</code> or <code>tuple</code></p>
`});var E=e(h,4);O(E,{anchor:"diffusers.NucleusMoEImagePipeline.__call__.example",children:(o,l)=>{var M=A(),T=e(N(M),2);V(T,{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwTnVjbGV1c01vRUltYWdlUGlwZWxpbmUlMEElMEFwaXBlJTIwJTNEJTIwTnVjbGV1c01vRUltYWdlUGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKCUyMk51Y2xldXNBSSUyRk51Y2xldXNNb0UtSW1hZ2UlMjIlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmJmbG9hdDE2KSUwQXBpcGUudG8oJTIyY3VkYSUyMiklMEFwcm9tcHQlMjAlM0QlMjAlMjJBJTIwY2F0JTIwaG9sZGluZyUyMGElMjBzaWduJTIwdGhhdCUyMHNheXMlMjBoZWxsbyUyMHdvcmxkJTIyJTBBaW1hZ2UlMjAlM0QlMjBwaXBlKHByb21wdCUyQyUyMG51bV9pbmZlcmVuY2Vfc3RlcHMlM0Q1MCkuaW1hZ2VzJTVCMCU1RCUwQWltYWdlLnNhdmUoJTIybnVjbGV1c19tb2UucG5nJTIyKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> NucleusMoEImagePipeline
<span class="hljs-meta">&gt;&gt;&gt; </span>pipe = NucleusMoEImagePipeline.from_pretrained(<span class="hljs-string">&quot;NucleusAI/NucleusMoE-Image&quot;</span>, torch_dtype=torch.bfloat16)
<span class="hljs-meta">&gt;&gt;&gt; </span>pipe.to(<span class="hljs-string">&quot;cuda&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>prompt = <span class="hljs-string">&quot;A cat holding a sign that says hello world&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>image = pipe(prompt, num_inference_steps=<span class="hljs-number">50</span>).images[<span class="hljs-number">0</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>image.save(<span class="hljs-string">&quot;nucleus_moe.png&quot;</span>)`,lang:"py",wrap:!1}),p(o,M)},$$slots:{default:!0}}),s(r);var b=e(r,2),w=t(b);n(w,{name:"encode_prompt",anchor:"diffusers.NucleusMoEImagePipeline.encode_prompt",source:"https://github.com/huggingface/diffusers/blob/vr_14192/src/diffusers/pipelines/nucleusmoe_image/pipeline_nucleusmoe_image.py#L187",parameters:[{name:"prompt",val:": str | list[str] = None"},{name:"device",val:": typing.Optional[torch.device] = None"},{name:"num_images_per_prompt",val:": int = 1"},{name:"prompt_embeds",val:": typing.Optional[torch.Tensor] = None"},{name:"prompt_embeds_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"max_sequence_length",val:": int | None = None"},{name:"return_index",val:": int | None = None"}],parametersDescription:[{anchor:"diffusers.NucleusMoEImagePipeline.encode_prompt.prompt",description:`<strong>prompt</strong> (<code>str</code> or <code>list[str]</code>, <em>optional</em>) &#x2014;
The prompt or prompts to encode.`,name:"prompt"},{anchor:"diffusers.NucleusMoEImagePipeline.encode_prompt.device",description:`<strong>device</strong> (<code>torch.device</code>, <em>optional</em>) &#x2014;
Torch device for the resulting tensors.`,name:"device"},{anchor:"diffusers.NucleusMoEImagePipeline.encode_prompt.num_images_per_prompt",description:`<strong>num_images_per_prompt</strong> (<code>int</code>, defaults to 1) &#x2014;
Number of images to generate per prompt.`,name:"num_images_per_prompt"},{anchor:"diffusers.NucleusMoEImagePipeline.encode_prompt.prompt_embeds",description:`<strong>prompt_embeds</strong> (<code>torch.Tensor</code>, <em>optional</em>) &#x2014;
Pre-generated text embeddings. Skips encoding when provided.`,name:"prompt_embeds"},{anchor:"diffusers.NucleusMoEImagePipeline.encode_prompt.prompt_embeds_mask",description:`<strong>prompt_embeds_mask</strong> (<code>torch.Tensor</code>, <em>optional</em>) &#x2014;
Attention mask for pre-generated embeddings.`,name:"prompt_embeds_mask"},{anchor:"diffusers.NucleusMoEImagePipeline.encode_prompt.max_sequence_length",description:`<strong>max_sequence_length</strong> (<code>int</code>, defaults to 1024) &#x2014;
Maximum token length for the encoded prompt.`,name:"max_sequence_length"}]}),d(2),s(b),s(a);var v=e(a,2);c(v,{title:"NucleusMoEImagePipelineOutput",local:"diffusers.pipelines.nucleusmoe_image.pipeline_output.NucleusMoEImagePipelineOutput",headingTag:"h2"});var i=e(v,2),P=t(i);n(P,{name:"class diffusers.pipelines.nucleusmoe_image.pipeline_output.NucleusMoEImagePipelineOutput",anchor:"diffusers.pipelines.nucleusmoe_image.pipeline_output.NucleusMoEImagePipelineOutput",source:"https://github.com/huggingface/diffusers/blob/vr_14192/src/diffusers/pipelines/nucleusmoe_image/pipeline_output.py#L10",parameters:[{name:"images",val:": list[PIL.Image.Image] | numpy.ndarray"}],parametersDescription:[{anchor:"diffusers.pipelines.nucleusmoe_image.pipeline_output.NucleusMoEImagePipelineOutput.images",description:`<strong>images</strong> (<code>list[PIL.Image.Image]</code> or <code>np.ndarray</code>) &#x2014;
List of denoised PIL images of length <code>batch_size</code> or numpy array of shape <code>(batch_size, height, width, num_channels)</code>. PIL images or numpy array present the denoised images of the diffusion pipeline.`,name:"images"}]}),d(2),s(i);var y=e(i,2);q(y,{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/pipelines/nucleusmoe_image.md"}),d(2),p(x,u),L()}export{S as component};

Xet Storage Details

Size:
17.4 kB
·
Xet hash:
8c125b2d426888b29f3a47384e197957f7ac3752140c21bcada8adb113493d2d

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.