Buckets:

download
raw
25.9 kB
import{s as Re,o as Ve,n as We}from"../chunks/scheduler.53228c21.js";import{S as Qe,i as Xe,e as i,s as l,c,h as He,a as r,d as n,b as o,f as K,g as m,j as k,k as ee,l as y,m as s,n as u,t as _,o as f,p as h}from"../chunks/index.cac5d66a.js";import{C as qe}from"../chunks/CopyLLMTxtMenu.5de56ed0.js";import{D as we}from"../chunks/Docstring.65784c1d.js";import{C as $e}from"../chunks/CodeBlock.606cbaf4.js";import{E as Se}from"../chunks/ExampleCodeBlock.2f8d5a93.js";import{H as Y,E as ze}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.a06a9e1e.js";function Fe(te){let d,v="Examples:",T,b,M;return b=new $e({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b01vZGVsRm9yQ2F1c2FsTE0lMkMlMjBBdXRvVG9rZW5pemVyJTBBZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEJsb2NrUmVmaW5lbWVudFNjaGVkdWxlciUyQyUyMExMYURBMlBpcGVsaW5lJTBBJTBBbW9kZWxfaWQlMjAlM0QlMjAlMjJpbmNsdXNpb25BSSUyRkxMYURBMi4xLW1pbmklMjIlMEFtb2RlbCUyMCUzRCUyMEF1dG9Nb2RlbEZvckNhdXNhbExNLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjBtb2RlbF9pZCUyQyUyMHRydXN0X3JlbW90ZV9jb2RlJTNEVHJ1ZSUyQyUyMGR0eXBlJTNEdG9yY2guYmZsb2F0MTYlMkMlMjBkZXZpY2VfbWFwJTNEJTIyYXV0byUyMiUwQSklMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZChtb2RlbF9pZCUyQyUyMHRydXN0X3JlbW90ZV9jb2RlJTNEVHJ1ZSklMEFzY2hlZHVsZXIlMjAlM0QlMjBCbG9ja1JlZmluZW1lbnRTY2hlZHVsZXIoKSUwQSUwQXBpcGUlMjAlM0QlMjBMTGFEQTJQaXBlbGluZShtb2RlbCUzRG1vZGVsJTJDJTIwc2NoZWR1bGVyJTNEc2NoZWR1bGVyJTJDJTIwdG9rZW5pemVyJTNEdG9rZW5pemVyKSUwQW91dHB1dCUyMCUzRCUyMHBpcGUocHJvbXB0JTNEJTIyV2hhdCUyMGlzJTIwdGhlJTIwbWVhbmluZyUyMG9mJTIwbGlmZSUzRiUyMiUyQyUyMGdlbl9sZW5ndGglM0QyNTYpJTBBcHJpbnQob3V0cHV0LnRleHRzJTVCMCU1RCk=",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> transformers <span class="hljs-keyword">import</span> AutoModelForCausalLM, AutoTokenizer
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> BlockRefinementScheduler, LLaDA2Pipeline
<span class="hljs-meta">&gt;&gt;&gt; </span>model_id = <span class="hljs-string">&quot;inclusionAI/LLaDA2.1-mini&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = AutoModelForCausalLM.from_pretrained(
<span class="hljs-meta">... </span> model_id, trust_remote_code=<span class="hljs-literal">True</span>, dtype=torch.bfloat16, device_map=<span class="hljs-string">&quot;auto&quot;</span>
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=<span class="hljs-literal">True</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>scheduler = BlockRefinementScheduler()
<span class="hljs-meta">&gt;&gt;&gt; </span>pipe = LLaDA2Pipeline(model=model, scheduler=scheduler, tokenizer=tokenizer)
<span class="hljs-meta">&gt;&gt;&gt; </span>output = pipe(prompt=<span class="hljs-string">&quot;What is the meaning of life?&quot;</span>, gen_length=<span class="hljs-number">256</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(output.texts[<span class="hljs-number">0</span>])`,lang:"python",wrap:!1}}),{c(){d=i("p"),d.textContent=v,T=l(),c(b.$$.fragment)},l(a){d=r(a,"P",{"data-svelte-h":!0}),k(d)!=="svelte-kvfsh7"&&(d.textContent=v),T=o(a),m(b.$$.fragment,a)},m(a,L){s(a,d,L),s(a,T,L),u(b,a,L),M=!0},p:We,i(a){M||(_(b.$$.fragment,a),M=!0)},o(a){f(b.$$.fragment,a),M=!1},d(a){a&&(n(d),n(T)),h(b,a)}}}function Ye(te){let d,v,T,b,M,a,L,ne,w,xe=`<a href="https://huggingface.co/collections/inclusionAI/llada21" rel="nofollow">LLaDA2</a> is a family of discrete diffusion language models
that generate text through block-wise iterative refinement. Instead of autoregressive token-by-token generation,
LLaDA2 starts with a fully masked sequence and progressively unmasks tokens by confidence over multiple refinement
steps.`,se,$,le,x,oe,A,ae,U,Ae=`Callbacks run after each refinement step. Pass <code>callback_on_step_end_tensor_inputs</code> to select which tensors are
included in <code>callback_kwargs</code>. In the current implementation, <code>block_x</code> (the sequence window being refined) and
<code>transfer_index</code> (mask-filling commit mask) are provided; return <code>{&quot;block_x&quot;: ...}</code> from the callback to replace the
window.`,ie,N,re,C,de,B,Ue="LLaDA2.1 models support two modes:",pe,Z,Ne="<thead><tr><th>Mode</th> <th><code>threshold</code></th> <th><code>editing_threshold</code></th> <th><code>max_post_steps</code></th></tr></thead> <tbody><tr><td>Quality</td> <td>0.7</td> <td>0.5</td> <td>16</td></tr> <tr><td>Speed</td> <td>0.5</td> <td><code>None</code></td> <td>16</td></tr></tbody>",ce,G,Ce="Pass <code>editing_threshold=None</code>, <code>0.0</code>, or a negative value to turn off post-mask editing.",me,D,Be="For LLaDA2.0 models, disable editing by passing <code>editing_threshold=None</code> or <code>0.0</code>.",ue,E,Ze="For all models: <code>block_length=32</code>, <code>temperature=0.0</code>, <code>num_inference_steps=32</code>.",_e,P,fe,p,I,ke,H,Ge="Pipeline for LLaDA2-style discrete diffusion text generation via block-wise iterative refinement.",Le,q,De=`This pipeline maintains a template sequence filled with a <code>mask_token_id</code> and refines it in blocks. In each
refinement step, it samples candidate tokens for the active block and commits a subset based on confidence.`,Te,S,Ee="The model is expected to accept an attention mask and <code>position_ids</code>, and to return logits of shape <code>[batch, seq, vocab_size]</code>.",Je,J,R,je,z,Pe="Generate text with block-wise refinement.",ve,j,he,V,ge,W,Q,be,X,Me,O,ye;return M=new qe({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),L=new Y({props:{title:"LLaDA2",local:"llada2",headingTag:"h1"}}),$=new Y({props:{title:"Usage",local:"usage",headingTag:"h2"}}),x=new $e({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b01vZGVsRm9yQ2F1c2FsTE0lMkMlMjBBdXRvVG9rZW5pemVyJTBBJTBBZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEJsb2NrUmVmaW5lbWVudFNjaGVkdWxlciUyQyUyMExMYURBMlBpcGVsaW5lJTBBJTBBbW9kZWxfaWQlMjAlM0QlMjAlMjJpbmNsdXNpb25BSSUyRkxMYURBMi4xLW1pbmklMjIlMEFtb2RlbCUyMCUzRCUyMEF1dG9Nb2RlbEZvckNhdXNhbExNLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjBtb2RlbF9pZCUyQyUyMHRydXN0X3JlbW90ZV9jb2RlJTNEVHJ1ZSUyQyUyMGR0eXBlJTNEdG9yY2guYmZsb2F0MTYlMkMlMjBkZXZpY2VfbWFwJTNEJTIyYXV0byUyMiUwQSklMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZChtb2RlbF9pZCUyQyUyMHRydXN0X3JlbW90ZV9jb2RlJTNEVHJ1ZSklMEFzY2hlZHVsZXIlMjAlM0QlMjBCbG9ja1JlZmluZW1lbnRTY2hlZHVsZXIoKSUwQSUwQXBpcGUlMjAlM0QlMjBMTGFEQTJQaXBlbGluZShtb2RlbCUzRG1vZGVsJTJDJTIwc2NoZWR1bGVyJTNEc2NoZWR1bGVyJTJDJTIwdG9rZW5pemVyJTNEdG9rZW5pemVyKSUwQW91dHB1dCUyMCUzRCUyMHBpcGUoJTBBJTIwJTIwJTIwJTIwcHJvbXB0JTNEJTIyV3JpdGUlMjBhJTIwc2hvcnQlMjBwb2VtJTIwYWJvdXQlMjB0aGUlMjBvY2Vhbi4lMjIlMkMlMEElMjAlMjAlMjAlMjBnZW5fbGVuZ3RoJTNEMjU2JTJDJTBBJTIwJTIwJTIwJTIwYmxvY2tfbGVuZ3RoJTNEMzIlMkMlMEElMjAlMjAlMjAlMjBudW1faW5mZXJlbmNlX3N0ZXBzJTNEMzIlMkMlMEElMjAlMjAlMjAlMjB0aHJlc2hvbGQlM0QwLjclMkMlMEElMjAlMjAlMjAlMjBlZGl0aW5nX3RocmVzaG9sZCUzRDAuNSUyQyUwQSUyMCUyMCUyMCUyMG1heF9wb3N0X3N0ZXBzJTNEMTYlMkMlMEElMjAlMjAlMjAlMjB0ZW1wZXJhdHVyZSUzRDAuMCUyQyUwQSklMEFwcmludChvdXRwdXQudGV4dHMlNUIwJTVEKQ==",highlighted:`<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForCausalLM, AutoTokenizer
<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> BlockRefinementScheduler, LLaDA2Pipeline
model_id = <span class="hljs-string">&quot;inclusionAI/LLaDA2.1-mini&quot;</span>
model = AutoModelForCausalLM.from_pretrained(
model_id, trust_remote_code=<span class="hljs-literal">True</span>, dtype=torch.bfloat16, device_map=<span class="hljs-string">&quot;auto&quot;</span>
)
tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=<span class="hljs-literal">True</span>)
scheduler = BlockRefinementScheduler()
pipe = LLaDA2Pipeline(model=model, scheduler=scheduler, tokenizer=tokenizer)
output = pipe(
prompt=<span class="hljs-string">&quot;Write a short poem about the ocean.&quot;</span>,
gen_length=<span class="hljs-number">256</span>,
block_length=<span class="hljs-number">32</span>,
num_inference_steps=<span class="hljs-number">32</span>,
threshold=<span class="hljs-number">0.7</span>,
editing_threshold=<span class="hljs-number">0.5</span>,
max_post_steps=<span class="hljs-number">16</span>,
temperature=<span class="hljs-number">0.0</span>,
)
<span class="hljs-built_in">print</span>(output.texts[<span class="hljs-number">0</span>])`,lang:"py",wrap:!1}}),A=new Y({props:{title:"Callbacks",local:"callbacks",headingTag:"h2"}}),N=new $e({props:{code:"ZGVmJTIwb25fc3RlcF9lbmQocGlwZSUyQyUyMHN0ZXAlMkMlMjB0aW1lc3RlcCUyQyUyMGNhbGxiYWNrX2t3YXJncyklM0ElMEElMjAlMjAlMjAlMjBibG9ja194JTIwJTNEJTIwY2FsbGJhY2tfa3dhcmdzJTVCJTIyYmxvY2tfeCUyMiU1RCUwQSUyMCUyMCUyMCUyMCUyMyUyMEluc3BlY3QlMjBvciUyMG1vZGlmeSUyMCU2MGJsb2NrX3glNjAlMjBoZXJlLiUwQSUyMCUyMCUyMCUyMHJldHVybiUyMCU3QiUyMmJsb2NrX3glMjIlM0ElMjBibG9ja194JTdEJTBBJTBBb3V0JTIwJTNEJTIwcGlwZSglMEElMjAlMjAlMjAlMjBwcm9tcHQlM0QlMjJXcml0ZSUyMGElMjBzaG9ydCUyMHBvZW0uJTIyJTJDJTBBJTIwJTIwJTIwJTIwY2FsbGJhY2tfb25fc3RlcF9lbmQlM0Rvbl9zdGVwX2VuZCUyQyUwQSUyMCUyMCUyMCUyMGNhbGxiYWNrX29uX3N0ZXBfZW5kX3RlbnNvcl9pbnB1dHMlM0QlNUIlMjJibG9ja194JTIyJTVEJTJDJTBBKQ==",highlighted:`<span class="hljs-keyword">def</span> <span class="hljs-title function_">on_step_end</span>(<span class="hljs-params">pipe, step, timestep, callback_kwargs</span>):
block_x = callback_kwargs[<span class="hljs-string">&quot;block_x&quot;</span>]
<span class="hljs-comment"># Inspect or modify \`block_x\` here.</span>
<span class="hljs-keyword">return</span> {<span class="hljs-string">&quot;block_x&quot;</span>: block_x}
out = pipe(
prompt=<span class="hljs-string">&quot;Write a short poem.&quot;</span>,
callback_on_step_end=on_step_end,
callback_on_step_end_tensor_inputs=[<span class="hljs-string">&quot;block_x&quot;</span>],
)`,lang:"py",wrap:!1}}),C=new Y({props:{title:"Recommended parameters",local:"recommended-parameters",headingTag:"h2"}}),P=new Y({props:{title:"LLaDA2Pipeline",local:"diffusers.LLaDA2Pipeline",headingTag:"h2"}}),I=new we({props:{name:"class diffusers.LLaDA2Pipeline",anchor:"diffusers.LLaDA2Pipeline",parameters:[{name:"model",val:": Any"},{name:"scheduler",val:": BlockRefinementScheduler"},{name:"tokenizer",val:": Any | None = None"}],source:"https://github.com/huggingface/diffusers/blob/vr_13889/src/diffusers/pipelines/llada2/pipeline_llada2.py#L59"}}),R=new we({props:{name:"__call__",anchor:"diffusers.LLaDA2Pipeline.__call__",parameters:[{name:"prompt",val:": str | list[str] | None = None"},{name:"messages",val:": list[dict[str, str]] | None = None"},{name:"input_ids",val:": torch.LongTensor | None = None"},{name:"attention_mask",val:": torch.LongTensor | None = None"},{name:"use_chat_template",val:": bool = True"},{name:"add_generation_prompt",val:": bool = True"},{name:"gen_length",val:": int = 2048"},{name:"block_length",val:": int | None = None"},{name:"num_inference_steps",val:": int = 32"},{name:"temperature",val:": float = 0.0"},{name:"top_p",val:": float | None = None"},{name:"top_k",val:": int | None = None"},{name:"sampling_method",val:": str = 'multinomial'"},{name:"threshold",val:": float = 0.7"},{name:"editing_threshold",val:": float | None = 0.5"},{name:"max_post_steps",val:": int = 16"},{name:"minimal_topk",val:": int = 1"},{name:"eos_early_stop",val:": bool = True"},{name:"eos_token_id",val:": int | None = None"},{name:"mask_token_id",val:": int | None = None"},{name:"generator",val:": torch.Generator | None = None"},{name:"output_type",val:": str = 'text'"},{name:"return_dict",val:": bool = True"},{name:"callback_on_step_end",val:": Callable[[int, int, dict], None] | PipelineCallback | MultiPipelineCallbacks | None = None"},{name:"callback_on_step_end_tensor_inputs",val:": list[str] | None = None"}],parametersDescription:[{anchor:"diffusers.LLaDA2Pipeline.__call__.prompt",description:`<strong>prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
Prompt text. When <code>use_chat_template</code> is <code>True</code> (default) and a tokenizer with a chat template is
available, the prompt is wrapped in a chat message before tokenization.`,name:"prompt"},{anchor:"diffusers.LLaDA2Pipeline.__call__.messages",description:`<strong>messages</strong> (<code>List[Dict[str, str]]</code>, <em>optional</em>) &#x2014;
Chat messages to encode (e.g. <code>[{&quot;role&quot;: &quot;user&quot;, &quot;content&quot;: &quot;Hello&quot;}]</code>). Takes precedence over <code>prompt</code>
when provided. Requires a tokenizer with <code>apply_chat_template</code>.`,name:"messages"},{anchor:"diffusers.LLaDA2Pipeline.__call__.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code>, <em>optional</em>) &#x2014;
Pre-tokenized input IDs. Takes precedence over <code>prompt</code> and <code>messages</code>.`,name:"input_ids"},{anchor:"diffusers.LLaDA2Pipeline.__call__.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.LongTensor</code>, <em>optional</em>) &#x2014;
Per-token mask (1 for valid prompt tokens, 0 for padding) matching the shape of <code>input_ids</code>. Only used
when <code>input_ids</code> is provided. When omitted (and <code>input_ids</code> is given), all positions are treated as
valid. When constructing inputs from <code>prompt</code> / <code>messages</code>, the tokenizer&#x2019;s mask is carried through
automatically.`,name:"attention_mask"},{anchor:"diffusers.LLaDA2Pipeline.__call__.use_chat_template",description:`<strong>use_chat_template</strong> (<code>bool</code>, defaults to <code>True</code>) &#x2014;
Whether to wrap the prompt in a chat template.`,name:"use_chat_template"},{anchor:"diffusers.LLaDA2Pipeline.__call__.add_generation_prompt",description:`<strong>add_generation_prompt</strong> (<code>bool</code>, defaults to <code>True</code>) &#x2014;
Whether to add the generation prompt when using chat templates.`,name:"add_generation_prompt"},{anchor:"diffusers.LLaDA2Pipeline.__call__.gen_length",description:`<strong>gen_length</strong> (<code>int</code>) &#x2014;
Number of tokens to generate.`,name:"gen_length"},{anchor:"diffusers.LLaDA2Pipeline.__call__.block_length",description:`<strong>block_length</strong> (<code>int</code>, <em>optional</em>) &#x2014;
Block size for refinement. If not provided, the scheduler&#x2019;s configured <code>block_length</code> is used.`,name:"block_length"},{anchor:"diffusers.LLaDA2Pipeline.__call__.num_inference_steps",description:`<strong>num_inference_steps</strong> (<code>int</code>) &#x2014;
Number of refinement steps per block.`,name:"num_inference_steps"},{anchor:"diffusers.LLaDA2Pipeline.__call__.temperature",description:`<strong>temperature</strong> (<code>float</code>) &#x2014;
Sampling temperature.`,name:"temperature"},{anchor:"diffusers.LLaDA2Pipeline.__call__.top_p",description:`<strong>top_p</strong> (<code>float</code>, <em>optional</em>) &#x2014;
Nucleus sampling cutoff.`,name:"top_p"},{anchor:"diffusers.LLaDA2Pipeline.__call__.top_k",description:`<strong>top_k</strong> (<code>int</code>, <em>optional</em>) &#x2014;
Top-k sampling cutoff.`,name:"top_k"},{anchor:"diffusers.LLaDA2Pipeline.__call__.sampling_method",description:`<strong>sampling_method</strong> (<code>str</code>) &#x2014;
Sampling method (<code>auto</code>, <code>greedy</code>, <code>multinomial</code>).`,name:"sampling_method"},{anchor:"diffusers.LLaDA2Pipeline.__call__.threshold",description:`<strong>threshold</strong> (<code>float</code>) &#x2014;
Confidence threshold for committing tokens.`,name:"threshold"},{anchor:"diffusers.LLaDA2Pipeline.__call__.editing_threshold",description:`<strong>editing_threshold</strong> (<code>float</code>, <em>optional</em>) &#x2014;
Confidence threshold for editing already-committed (non-mask) tokens. When positive, after all mask
tokens in a block are resolved, the pipeline continues refining: if the model predicts a different
token with confidence above this threshold, the existing token is replaced. Set to <code>None</code>, <code>0.0</code>, or a
negative value to disable editing. Defaults to <code>0.5</code>.`,name:"editing_threshold"},{anchor:"diffusers.LLaDA2Pipeline.__call__.max_post_steps",description:`<strong>max_post_steps</strong> (<code>int</code>) &#x2014;
Maximum number of additional refinement iterations after all mask tokens in a block are resolved. Only
used when <code>editing_threshold</code> is enabled. Defaults to <code>16</code>.`,name:"max_post_steps"},{anchor:"diffusers.LLaDA2Pipeline.__call__.minimal_topk",description:`<strong>minimal_topk</strong> (<code>int</code>) &#x2014;
Minimum number of tokens to commit per step.`,name:"minimal_topk"},{anchor:"diffusers.LLaDA2Pipeline.__call__.eos_early_stop",description:`<strong>eos_early_stop</strong> (<code>bool</code>) &#x2014;
Whether to stop after committing EOS in a block.`,name:"eos_early_stop"},{anchor:"diffusers.LLaDA2Pipeline.__call__.eos_token_id",description:`<strong>eos_token_id</strong> (<code>int</code>, <em>optional</em>) &#x2014;
EOS token ID to use for early stopping.`,name:"eos_token_id"},{anchor:"diffusers.LLaDA2Pipeline.__call__.mask_token_id",description:`<strong>mask_token_id</strong> (<code>int</code>, <em>optional</em>) &#x2014;
Mask token ID to use for the template.`,name:"mask_token_id"},{anchor:"diffusers.LLaDA2Pipeline.__call__.generator",description:`<strong>generator</strong> (<code>torch.Generator</code>, <em>optional</em>) &#x2014;
RNG for sampling.`,name:"generator"},{anchor:"diffusers.LLaDA2Pipeline.__call__.output_type",description:`<strong>output_type</strong> (<code>str</code>, defaults to <code>&quot;text&quot;</code>) &#x2014;
Output format. <code>&quot;text&quot;</code> decodes sequences into strings (requires a tokenizer). <code>&quot;seq&quot;</code> returns raw
token ID sequences only.`,name:"output_type"},{anchor:"diffusers.LLaDA2Pipeline.__call__.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to return a <a href="/docs/diffusers/pr_13889/en/api/pipelines/llada2#diffusers.LLaDA2PipelineOutput">LLaDA2PipelineOutput</a> instead of a tuple.`,name:"return_dict"},{anchor:"diffusers.LLaDA2Pipeline.__call__.callback_on_step_end",description:`<strong>callback_on_step_end</strong> (<code>Callable</code> or <code>PipelineCallback</code>, <em>optional</em>) &#x2014;
Callback executed after each refinement step with signature <code>callback_on_step_end(self, step: int, timestep: int, callback_kwargs: Dict)</code>.`,name:"callback_on_step_end"},{anchor:"diffusers.LLaDA2Pipeline.__call__.callback_on_step_end_tensor_inputs",description:`<strong>callback_on_step_end_tensor_inputs</strong> (<code>List[str]</code>, <em>optional</em>) &#x2014;
Tensor keys to pass to the callback. Allowed keys: <code>block_x</code>, <code>transfer_index</code>,
<code>editing_transfer_index</code>, <code>sampled_tokens</code>, <code>sampled_probs</code>, <code>active_block</code>.`,name:"callback_on_step_end_tensor_inputs"}],source:"https://github.com/huggingface/diffusers/blob/vr_13889/src/diffusers/pipelines/llada2/pipeline_llada2.py#L242",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>
<p>If <code>return_dict</code> is <code>True</code>, <a
href="/docs/diffusers/pr_13889/en/api/pipelines/llada2#diffusers.LLaDA2PipelineOutput"
>LLaDA2PipelineOutput</a> is returned,
otherwise a <code>tuple</code> is returned where the first element is the generated token IDs (<code>torch.LongTensor</code>)
and the second element is the decoded texts (<code>list[str]</code>), or <code>None</code> when <code>output_type</code> is <code>"seq"</code>.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>
<p><a
href="/docs/diffusers/pr_13889/en/api/pipelines/llada2#diffusers.LLaDA2PipelineOutput"
>LLaDA2PipelineOutput</a> or <code>tuple</code></p>
`}}),j=new Se({props:{anchor:"diffusers.LLaDA2Pipeline.__call__.example",$$slots:{default:[Fe]},$$scope:{ctx:te}}}),V=new Y({props:{title:"LLaDA2PipelineOutput",local:"diffusers.LLaDA2PipelineOutput",headingTag:"h2"}}),Q=new we({props:{name:"class diffusers.LLaDA2PipelineOutput",anchor:"diffusers.LLaDA2PipelineOutput",parameters:[{name:"sequences",val:": torch.LongTensor"},{name:"texts",val:": list[str] | None = None"}],source:"https://github.com/huggingface/diffusers/blob/vr_13889/src/diffusers/pipelines/llada2/pipeline_llada2.py#L54"}}),X=new ze({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/pipelines/llada2.md"}}),{c(){d=i("meta"),v=l(),T=i("p"),b=l(),c(M.$$.fragment),a=l(),c(L.$$.fragment),ne=l(),w=i("p"),w.innerHTML=xe,se=l(),c($.$$.fragment),le=l(),c(x.$$.fragment),oe=l(),c(A.$$.fragment),ae=l(),U=i("p"),U.innerHTML=Ae,ie=l(),c(N.$$.fragment),re=l(),c(C.$$.fragment),de=l(),B=i("p"),B.textContent=Ue,pe=l(),Z=i("table"),Z.innerHTML=Ne,ce=l(),G=i("p"),G.innerHTML=Ce,me=l(),D=i("p"),D.innerHTML=Be,ue=l(),E=i("p"),E.innerHTML=Ze,_e=l(),c(P.$$.fragment),fe=l(),p=i("div"),c(I.$$.fragment),ke=l(),H=i("p"),H.textContent=Ge,Le=l(),q=i("p"),q.innerHTML=De,Te=l(),S=i("p"),S.innerHTML=Ee,Je=l(),J=i("div"),c(R.$$.fragment),je=l(),z=i("p"),z.textContent=Pe,ve=l(),c(j.$$.fragment),he=l(),c(V.$$.fragment),ge=l(),W=i("div"),c(Q.$$.fragment),be=l(),c(X.$$.fragment),Me=l(),O=i("p"),this.h()},l(e){const t=He("svelte-u9bgzb",document.head);d=r(t,"META",{name:!0,content:!0}),t.forEach(n),v=o(e),T=r(e,"P",{}),K(T).forEach(n),b=o(e),m(M.$$.fragment,e),a=o(e),m(L.$$.fragment,e),ne=o(e),w=r(e,"P",{"data-svelte-h":!0}),k(w)!=="svelte-iy97jd"&&(w.innerHTML=xe),se=o(e),m($.$$.fragment,e),le=o(e),m(x.$$.fragment,e),oe=o(e),m(A.$$.fragment,e),ae=o(e),U=r(e,"P",{"data-svelte-h":!0}),k(U)!=="svelte-oj3ayu"&&(U.innerHTML=Ae),ie=o(e),m(N.$$.fragment,e),re=o(e),m(C.$$.fragment,e),de=o(e),B=r(e,"P",{"data-svelte-h":!0}),k(B)!=="svelte-dyckw0"&&(B.textContent=Ue),pe=o(e),Z=r(e,"TABLE",{"data-svelte-h":!0}),k(Z)!=="svelte-1rivae1"&&(Z.innerHTML=Ne),ce=o(e),G=r(e,"P",{"data-svelte-h":!0}),k(G)!=="svelte-j0510o"&&(G.innerHTML=Ce),me=o(e),D=r(e,"P",{"data-svelte-h":!0}),k(D)!=="svelte-1qsx12h"&&(D.innerHTML=Be),ue=o(e),E=r(e,"P",{"data-svelte-h":!0}),k(E)!=="svelte-1xv5tng"&&(E.innerHTML=Ze),_e=o(e),m(P.$$.fragment,e),fe=o(e),p=r(e,"DIV",{class:!0});var g=K(p);m(I.$$.fragment,g),ke=o(g),H=r(g,"P",{"data-svelte-h":!0}),k(H)!=="svelte-tphs8a"&&(H.textContent=Ge),Le=o(g),q=r(g,"P",{"data-svelte-h":!0}),k(q)!=="svelte-1ierb4m"&&(q.innerHTML=De),Te=o(g),S=r(g,"P",{"data-svelte-h":!0}),k(S)!=="svelte-1prelxv"&&(S.innerHTML=Ee),Je=o(g),J=r(g,"DIV",{class:!0});var F=K(J);m(R.$$.fragment,F),je=o(F),z=r(F,"P",{"data-svelte-h":!0}),k(z)!=="svelte-18pcj9j"&&(z.textContent=Pe),ve=o(F),m(j.$$.fragment,F),F.forEach(n),g.forEach(n),he=o(e),m(V.$$.fragment,e),ge=o(e),W=r(e,"DIV",{class:!0});var Ie=K(W);m(Q.$$.fragment,Ie),Ie.forEach(n),be=o(e),m(X.$$.fragment,e),Me=o(e),O=r(e,"P",{}),K(O).forEach(n),this.h()},h(){ee(d,"name","hf:doc:metadata"),ee(d,"content",Oe),ee(J,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),ee(p,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),ee(W,"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){y(document.head,d),s(e,v,t),s(e,T,t),s(e,b,t),u(M,e,t),s(e,a,t),u(L,e,t),s(e,ne,t),s(e,w,t),s(e,se,t),u($,e,t),s(e,le,t),u(x,e,t),s(e,oe,t),u(A,e,t),s(e,ae,t),s(e,U,t),s(e,ie,t),u(N,e,t),s(e,re,t),u(C,e,t),s(e,de,t),s(e,B,t),s(e,pe,t),s(e,Z,t),s(e,ce,t),s(e,G,t),s(e,me,t),s(e,D,t),s(e,ue,t),s(e,E,t),s(e,_e,t),u(P,e,t),s(e,fe,t),s(e,p,t),u(I,p,null),y(p,ke),y(p,H),y(p,Le),y(p,q),y(p,Te),y(p,S),y(p,Je),y(p,J),u(R,J,null),y(J,je),y(J,z),y(J,ve),u(j,J,null),s(e,he,t),u(V,e,t),s(e,ge,t),s(e,W,t),u(Q,W,null),s(e,be,t),u(X,e,t),s(e,Me,t),s(e,O,t),ye=!0},p(e,[t]){const g={};t&2&&(g.$$scope={dirty:t,ctx:e}),j.$set(g)},i(e){ye||(_(M.$$.fragment,e),_(L.$$.fragment,e),_($.$$.fragment,e),_(x.$$.fragment,e),_(A.$$.fragment,e),_(N.$$.fragment,e),_(C.$$.fragment,e),_(P.$$.fragment,e),_(I.$$.fragment,e),_(R.$$.fragment,e),_(j.$$.fragment,e),_(V.$$.fragment,e),_(Q.$$.fragment,e),_(X.$$.fragment,e),ye=!0)},o(e){f(M.$$.fragment,e),f(L.$$.fragment,e),f($.$$.fragment,e),f(x.$$.fragment,e),f(A.$$.fragment,e),f(N.$$.fragment,e),f(C.$$.fragment,e),f(P.$$.fragment,e),f(I.$$.fragment,e),f(R.$$.fragment,e),f(j.$$.fragment,e),f(V.$$.fragment,e),f(Q.$$.fragment,e),f(X.$$.fragment,e),ye=!1},d(e){e&&(n(v),n(T),n(b),n(a),n(ne),n(w),n(se),n(le),n(oe),n(ae),n(U),n(ie),n(re),n(de),n(B),n(pe),n(Z),n(ce),n(G),n(me),n(D),n(ue),n(E),n(_e),n(fe),n(p),n(he),n(ge),n(W),n(be),n(Me),n(O)),n(d),h(M,e),h(L,e),h($,e),h(x,e),h(A,e),h(N,e),h(C,e),h(P,e),h(I),h(R),h(j),h(V,e),h(Q),h(X,e)}}}const Oe='{"title":"LLaDA2","local":"llada2","sections":[{"title":"Usage","local":"usage","sections":[],"depth":2},{"title":"Callbacks","local":"callbacks","sections":[],"depth":2},{"title":"Recommended parameters","local":"recommended-parameters","sections":[],"depth":2},{"title":"LLaDA2Pipeline","local":"diffusers.LLaDA2Pipeline","sections":[],"depth":2},{"title":"LLaDA2PipelineOutput","local":"diffusers.LLaDA2PipelineOutput","sections":[],"depth":2}],"depth":1}';function Ke(te){return Ve(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class it extends Qe{constructor(d){super(),Xe(this,d,Ke,Ye,Re,{})}}export{it as component};

Xet Storage Details

Size:
25.9 kB
·
Xet hash:
492c0b71d2e95e9f7d6b5d49fbb01e6cc17d9d90ca02397f1d2e687520cae902

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