import{s as En,o as Un,n as H}from"../chunks/scheduler.25b97de1.js";import{S as jn,i as Cn,g as d,s,r as m,A as xn,h as c,f as o,c as a,j as w,u as p,x as _,k as v,y as r,a as i,v as u,d as h,t as f,w as g}from"../chunks/index.d9030fc9.js";import{T as Jt}from"../chunks/Tip.baa67368.js";import{D as k}from"../chunks/Docstring.ffac8efa.js";import{C as Mt}from"../chunks/CodeBlock.e6cd0d95.js";import{E as co}from"../chunks/ExampleCodeBlock.22dfe688.js";import{H as x,E as In}from"../chunks/EditOnGithub.91d95064.js";function $n(M){let n,y="Emu3 implementation in Transformers uses a special image token to indicate where to merge image embeddings. The special image token isn’t new and uses one of the reserved tokens: <code>&lt;|extra_0|&gt;</code>. You have to add <code>&lt;image&gt;</code> to your prompt in the place where the image should be embedded for correct generation.";return{c(){n=d("p"),n.innerHTML=y},l(l){n=c(l,"P",{"data-svelte-h":!0}),_(n)!=="svelte-1tre9uw"&&(n.innerHTML=y)},m(l,T){i(l,n,T)},p:H,d(l){l&&o(n)}}}function zn(M){let n,y;return n=new Mt({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEVtdTNWUVZBRSUyQyUyMEVtdTNWUVZBRUNvbmZpZyUwQSUwQSUyMyUyMEluaXRpYWxpemluZyUyMGElMjB2aWRlbyUyMFZRJTIwbW9kZWwlMjBvZiUyMEVtdTMlMjBjb25maWd1cmF0aW9uJTBBY29uZmlndXJhdGlvbiUyMCUzRCUyMEVtdTNWUVZBRUNvbmZpZygpJTBBJTBBJTIzJTIwSW5pdGlhbGl6aW5nJTIwYSUyMG1vZGVsJTIwZnJvbSUyMHRoZSUyMEVtdTMlMjBWUSUyMG1vZGVsJTIwc3R5bGUlMjBjb25maWd1cmF0aW9uJTBBbW9kZWwlMjAlM0QlMjBFbXUzVlFWQUUoY29uZmlndXJhdGlvbiklMEElMEElMjMlMjBBY2Nlc3NpbmclMjB0aGUlMjBtb2RlbCUyMGNvbmZpZ3VyYXRpb24lMEFjb25maWd1cmF0aW9uJTIwJTNEJTIwbW9kZWwuY29uZmln",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> Emu3VQVAE, Emu3VQVAEConfig

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a video VQ model of Emu3 configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = Emu3VQVAEConfig()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a model from the Emu3 VQ model style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = Emu3VQVAE(configuration)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Accessing the model configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = model.config`,wrap:!1}}),{c(){m(n.$$.fragment)},l(l){p(n.$$.fragment,l)},m(l,T){u(n,l,T),y=!0},p:H,i(l){y||(h(n.$$.fragment,l),y=!0)},o(l){f(n.$$.fragment,l),y=!1},d(l){g(n,l)}}}function Zn(M){let n,y;return n=new Mt({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEVtdTNNb2RlbCUyQyUyMEVtdTNDb25maWclMEElMEElMjMlMjBJbml0aWFsaXppbmclMjBhJTIwRW11My1jb21tdW5pdHklMkZFbXUzLUNoYXQtaGYlMjBzdHlsZSUyMGNvbmZpZ3VyYXRpb24lMEFjb25maWd1cmF0aW9uJTIwJTNEJTIwRW11M0NvbmZpZygpJTBBJTBBJTIzJTIwSW5pdGlhbGl6aW5nJTIwYSUyMG1vZGVsJTIwZnJvbSUyMHRoZSUyMEVtdTMtY29tbXVuaXR5JTJGRW11My1DaGF0LWhmJTIwc3R5bGUlMjBjb25maWd1cmF0aW9uJTBBbW9kZWwlMjAlM0QlMjBFbXUzTW9kZWwoY29uZmlndXJhdGlvbiklMEElMEElMjMlMjBBY2Nlc3NpbmclMjB0aGUlMjBtb2RlbCUyMGNvbmZpZ3VyYXRpb24lMEFjb25maWd1cmF0aW9uJTIwJTNEJTIwbW9kZWwuY29uZmln",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> Emu3Model, Emu3Config

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a Emu3-community/Emu3-Chat-hf style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = Emu3Config()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a model from the Emu3-community/Emu3-Chat-hf style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = Emu3Model(configuration)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Accessing the model configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = model.config`,wrap:!1}}),{c(){m(n.$$.fragment)},l(l){p(n.$$.fragment,l)},m(l,T){u(n,l,T),y=!0},p:H,i(l){y||(h(n.$$.fragment,l),y=!0)},o(l){f(n.$$.fragment,l),y=!1},d(l){g(n,l)}}}function Wn(M){let n,y=`Although the recipe for forward pass needs to be defined within
this function, one should call the <code>Module</code> instance afterwards
instead of this since the former takes care of running the
registered hooks while the latter silently ignores them.`;return{c(){n=d("p"),n.innerHTML=y},l(l){n=c(l,"P",{"data-svelte-h":!0}),_(n)!=="svelte-rqqap8"&&(n.innerHTML=y)},m(l,T){i(l,n,T)},p:H,d(l){l&&o(n)}}}function Vn(M){let n,y=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code>
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`;return{c(){n=d("p"),n.innerHTML=y},l(l){n=c(l,"P",{"data-svelte-h":!0}),_(n)!=="svelte-fincs2"&&(n.innerHTML=y)},m(l,T){i(l,n,T)},p:H,d(l){l&&o(n)}}}function Bn(M){let n,y=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code>
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`;return{c(){n=d("p"),n.innerHTML=y},l(l){n=c(l,"P",{"data-svelte-h":!0}),_(n)!=="svelte-fincs2"&&(n.innerHTML=y)},m(l,T){i(l,n,T)},p:H,d(l){l&&o(n)}}}function Fn(M){let n,y="Example:",l,T,J;return T=new Mt({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEVtdTNQcm9jZXNzb3IlMkMlMjBFbXUzRm9yQ29uZGl0aW9uYWxHZW5lcmF0aW9uJTBBaW1wb3J0JTIwdG9yY2glMEFpbXBvcnQlMjByZXF1ZXN0cyUwQWZyb20lMjBQSUwlMjBpbXBvcnQlMjBJbWFnZSUwQSUwQW1vZGVsJTIwJTNEJTIwRW11M0ZvckNhdXNhbExNLmZyb21fcHJldHJhaW5lZCglMjJCQUFJJTJGRW11My1DaGF0LWhmJTIyJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5iZmxvYXQxNiklMEFwcm9jZXNzb3IlMjAlM0QlMjBFbXUzUHJvY2Vzc29yLmZyb21fcHJldHJhaW5lZCglMjJCQUFJJTJGRW11My1DaGF0LWhmJTIyKSUwQSUwQWlucHV0cyUyMCUzRCUyMHByb2Nlc3Nvcih0ZXh0JTNEJTVCJTIyQ2FuJTIweW91JTIwd3JpdGUlMjBtZSUyMGElMjBwb2VtJTIwYWJvdXQlMjB3aW50ZXIuJTIyJTVEJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMikudG8obW9kZWwuZGV2aWNlKSUwQSUwQWdlbmVyYXRlZF9pZHMlMjAlM0QlMjBtb2RlbC5nZW5lcmF0ZSgqKmlucHV0cyUyQyUyMG1heF9uZXdfdG9rZW5zJTNEMTAwJTJDJTIwZG9fc2FtcGxlJTNERmFsc2UpJTBBcHJvY2Vzc29yLmJhdGNoX2RlY29kZShnZW5lcmF0ZWRfaWRzJTJDJTIwc2tpcF9zcGVjaWFsX3Rva2VucyUzRFRydWUpJTVCMCU1RA==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> Emu3Processor, Emu3ForConditionalGeneration
<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">import</span> requests
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> PIL <span class="hljs-keyword">import</span> Image

<span class="hljs-meta">&gt;&gt;&gt; </span>model = Emu3ForCausalLM.from_pretrained(<span class="hljs-string">&quot;BAAI/Emu3-Chat-hf&quot;</span>, torch_dtype=torch.bfloat16)
<span class="hljs-meta">&gt;&gt;&gt; </span>processor = Emu3Processor.from_pretrained(<span class="hljs-string">&quot;BAAI/Emu3-Chat-hf&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = processor(text=[<span class="hljs-string">&quot;Can you write me a poem about winter.&quot;</span>], return_tensors=<span class="hljs-string">&quot;pt&quot;</span>).to(model.device)

<span class="hljs-meta">&gt;&gt;&gt; </span>generated_ids = model.generate(**inputs, max_new_tokens=<span class="hljs-number">100</span>, do_sample=<span class="hljs-literal">False</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>processor.batch_decode(generated_ids, skip_special_tokens=<span class="hljs-literal">True</span>)[<span class="hljs-number">0</span>]`,wrap:!1}}),{c(){n=d("p"),n.textContent=y,l=s(),m(T.$$.fragment)},l(b){n=c(b,"P",{"data-svelte-h":!0}),_(n)!=="svelte-11lpom8"&&(n.textContent=y),l=a(b),p(T.$$.fragment,b)},m(b,E){i(b,n,E),i(b,l,E),u(T,b,E),J=!0},p:H,i(b){J||(h(T.$$.fragment,b),J=!0)},o(b){f(T.$$.fragment,b),J=!1},d(b){b&&(o(n),o(l)),g(T,b)}}}function Rn(M){let n,y=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code>
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`;return{c(){n=d("p"),n.innerHTML=y},l(l){n=c(l,"P",{"data-svelte-h":!0}),_(n)!=="svelte-fincs2"&&(n.innerHTML=y)},m(l,T){i(l,n,T)},p:H,d(l){l&&o(n)}}}function Gn(M){let n,y="Example:",l,T,J;return T=new Mt({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEVtdTNQcm9jZXNzb3IlMkMlMjBFbXUzRm9yQ29uZGl0aW9uYWxHZW5lcmF0aW9uJTBBaW1wb3J0JTIwdG9yY2glMEFpbXBvcnQlMjByZXF1ZXN0cyUwQWZyb20lMjBQSUwlMjBpbXBvcnQlMjBJbWFnZSUwQSUwQW1vZGVsJTIwJTNEJTIwRW11M0ZvckNvbmRpdGlvbmFsR2VuZXJhdGlvbi5mcm9tX3ByZXRyYWluZWQoJTIyQkFBSSUyRkVtdTMtQ2hhdC1oZiUyMiUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guYmZsb2F0MTYpJTBBcHJvY2Vzc29yJTIwJTNEJTIwRW11M1Byb2Nlc3Nvci5mcm9tX3ByZXRyYWluZWQoJTIyQkFBSSUyRkVtdTMtQ2hhdC1oZiUyMiklMEElMEFjb252ZXJzYXRpb24lMjAlM0QlMjAlNUIlMEElMjAlMjAlMjAlMjAlN0IlMEElMjAlMjAlMjAlMjAlMjJyb2xlJTIyJTNBJTIwJTIyc3lzdGVtJTIyJTJDJTBBJTIwJTIwJTIwJTIwJTIyY29udGVudCUyMiUzQSUyMCU1QiUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCU3QiUyMnR5cGUlMjIlM0ElMjAlMjJ0ZXh0JTIyJTJDJTIwJTIydGV4dCUyMiUzQSUyMCUyMllvdSUyMGFyZSUyMGElMjBoZWxwZnVsJTIwYXNzaXN0YW50LiUyMiU3RCUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCU1RCUyQyUwQSUyMCUyMCUyMCUyMCU3RCUyQyUwQSUyMCUyMCUyMCUyMCU3QiUwQSUyMCUyMCUyMCUyMCUyMnJvbGUlMjIlM0ElMjAlMjJ1c2VyJTIyJTJDJTBBJTIwJTIwJTIwJTIwJTIyY29udGVudCUyMiUzQSUyMCU1QiUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCU3QiUyMnR5cGUlMjIlM0ElMjAlMjJpbWFnZSUyMiU3RCUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCU3QiUyMnR5cGUlMjIlM0ElMjAlMjJ0ZXh0JTIyJTJDJTIwJTIydGV4dCUyMiUzQSUyMCUyMlBsZWFzZSUyMGRlc2NyaWJlJTIwdGhlJTIwaW1hZ2UuJTIyJTdEJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTVEJTJDJTBBJTIwJTIwJTIwJTIwJTdEJTJDJTBBJTVEJTBBJTBBcHJvbXB0JTIwJTNEJTIwcHJvY2Vzc29yLmFwcGx5X2NoYXRfdGVtcGxhdGUoY29udmVyc2F0aW9uJTJDJTIwYWRkX2dlbmVyYXRpb25fcHJvbXB0JTNEVHJ1ZSklMEFpbWFnZSUyMCUzRCUyMEltYWdlLm9wZW4ocmVxdWVzdHMuZ2V0KCUyMmh0dHBzJTNBJTJGJTJGd3d3LmlsYW5rZWxtYW4ub3JnJTJGc3RvcHNpZ25zJTJGYXVzdHJhbGlhLmpwZyUyMiUyQyUyMHN0cmVhbSUzRFRydWUpLnJhdyklMEElMEFpbnB1dHMlMjAlM0QlMjBwcm9jZXNzb3IoaW1hZ2VzJTNEJTVCaW1hZ2UlNUQlMkMlMjB0ZXh0JTNEJTVCcHJvbXB0JTVEJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMikudG8obW9kZWwuZGV2aWNlJTJDJTIwdG9yY2guYmZsb2F0MTYpJTBBJTBBZ2VuZXJhdGVkX2lkcyUyMCUzRCUyMG1vZGVsLmdlbmVyYXRlKCoqaW5wdXRzJTJDJTIwbWF4X25ld190b2tlbnMlM0QxMDAlMkMlMjBkb19zYW1wbGUlM0RGYWxzZSklMEFwcm9jZXNzb3IuYmF0Y2hfZGVjb2RlKGdlbmVyYXRlZF9pZHMlMkMlMjBza2lwX3NwZWNpYWxfdG9rZW5zJTNEVHJ1ZSklNUIwJTVE",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> Emu3Processor, Emu3ForConditionalGeneration
<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">import</span> requests
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> PIL <span class="hljs-keyword">import</span> Image

<span class="hljs-meta">&gt;&gt;&gt; </span>model = Emu3ForConditionalGeneration.from_pretrained(<span class="hljs-string">&quot;BAAI/Emu3-Chat-hf&quot;</span>, torch_dtype=torch.bfloat16)
<span class="hljs-meta">&gt;&gt;&gt; </span>processor = Emu3Processor.from_pretrained(<span class="hljs-string">&quot;BAAI/Emu3-Chat-hf&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>conversation = [
<span class="hljs-meta">... </span>    {
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;role&quot;</span>: <span class="hljs-string">&quot;system&quot;</span>,
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;content&quot;</span>: [
<span class="hljs-meta">... </span>        {<span class="hljs-string">&quot;type&quot;</span>: <span class="hljs-string">&quot;text&quot;</span>, <span class="hljs-string">&quot;text&quot;</span>: <span class="hljs-string">&quot;You are a helpful assistant.&quot;</span>},
<span class="hljs-meta">... </span>        ],
<span class="hljs-meta">... </span>    },
<span class="hljs-meta">... </span>    {
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;role&quot;</span>: <span class="hljs-string">&quot;user&quot;</span>,
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;content&quot;</span>: [
<span class="hljs-meta">... </span>        {<span class="hljs-string">&quot;type&quot;</span>: <span class="hljs-string">&quot;image&quot;</span>},
<span class="hljs-meta">... </span>        {<span class="hljs-string">&quot;type&quot;</span>: <span class="hljs-string">&quot;text&quot;</span>, <span class="hljs-string">&quot;text&quot;</span>: <span class="hljs-string">&quot;Please describe the image.&quot;</span>},
<span class="hljs-meta">... </span>        ],
<span class="hljs-meta">... </span>    },
<span class="hljs-meta">... </span>]

<span class="hljs-meta">&gt;&gt;&gt; </span>prompt = processor.apply_chat_template(conversation, add_generation_prompt=<span class="hljs-literal">True</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>image = Image.<span class="hljs-built_in">open</span>(requests.get(<span class="hljs-string">&quot;https://www.ilankelman.org/stopsigns/australia.jpg&quot;</span>, stream=<span class="hljs-literal">True</span>).raw)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = processor(images=[image], text=[prompt], return_tensors=<span class="hljs-string">&quot;pt&quot;</span>).to(model.device, torch.bfloat16)

<span class="hljs-meta">&gt;&gt;&gt; </span>generated_ids = model.generate(**inputs, max_new_tokens=<span class="hljs-number">100</span>, do_sample=<span class="hljs-literal">False</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>processor.batch_decode(generated_ids, skip_special_tokens=<span class="hljs-literal">True</span>)[<span class="hljs-number">0</span>]`,wrap:!1}}),{c(){n=d("p"),n.textContent=y,l=s(),m(T.$$.fragment)},l(b){n=c(b,"P",{"data-svelte-h":!0}),_(n)!=="svelte-11lpom8"&&(n.textContent=y),l=a(b),p(T.$$.fragment,b)},m(b,E){i(b,n,E),i(b,l,E),u(T,b,E),J=!0},p:H,i(b){J||(h(T.$$.fragment,b),J=!0)},o(b){f(T.$$.fragment,b),J=!1},d(b){b&&(o(n),o(l)),g(T,b)}}}function Qn(M){let n,y,l,T,J,b,E,kt,de,Ho='The Emu3 model was proposed in <a href="https://arxiv.org/abs/2409.18869" rel="nofollow">Emu3: Next-Token Prediction is All You Need</a> by Xinlong Wang, Xiaosong Zhang, Zhengxiong Luo, Quan Sun, Yufeng Cui, Jinsheng Wang, Fan Zhang, Yueze Wang, Zhen Li, Qiying Yu, Yingli Zhao, Yulong Ao, Xuebin Min, Tao Li, Boya Wu, Bo Zhao, Bowen Zhang, Liangdong Wang, Guang Liu, Zheqi He, Xi Yang, Jingjing Liu, Yonghua Lin, Tiejun Huang, Zhongyuan Wang.',Et,ce,So="Emu3 is a multimodal LLM that uses vector quantization to tokenize images into discrete tokens. Discretized image tokens are later fused with text token ids for image and text generation. The model can additionally generate images by predicting image token ids.",Ut,me,Yo="The abstract from the paper is the following:",jt,pe,Do="<em>While next-token prediction is considered a promising path towards artificial general intelligence, it has struggled to excel in multimodal tasks, which are still dominated by diffusion models (e.g., Stable Diffusion) and compositional approaches (e.g., CLIP combined with LLMs). In this paper, we introduce Emu3, a new suite of state-of-the-art multimodal models trained solely with next-token prediction. By tokenizing images, text, and videos into a discrete space, we train a single transformer from scratch on a mixture of multimodal sequences. Emu3 outperforms several well-established task-specific models in both generation and perception tasks, surpassing flagship models such as SDXL and LLaVA-1.6, while eliminating the need for diffusion or compositional architectures. Emu3 is also capable of generating high-fidelity video via predicting the next token in a video sequence. We simplify complex multimodal model designs by converging on a singular focus: tokens, unlocking great potential for scaling both during training and inference. Our results demonstrate that next-token prediction is a promising path towards building general multimodal intelligence beyond language. We open-source key techniques and models to support further research in this direction.</em>",Ct,ue,Oo="Tips:",xt,he,Ko="<li><p>We advise users to set <code>processor.tokenizer.padding_side = &quot;left&quot;</code> before batched generation as it leads to more accurate results.</p></li> <li><p>Note that the model has been trained with a specific prompt format for chatting. Use <code>processor.apply_chat_template(my_conversation_dict)</code> to correctly format your prompts.</p></li> <li><p>Emu3 has two different checkpoints for image-generation and text-generation, make sure to use the correct checkpoint when loading the model. To generate an image, it is advised to use <code>prefix_constraints</code> so that the generated tokens are sampled only from possible image tokens. See more below for usage examples.</p></li>",It,S,$t,fe,en=`This model was contributed by <a href="https://huggingface.co/RaushanTurganbay" rel="nofollow">RaushanTurganbay</a>.
The original code can be found <a href="https://github.com/baaivision/Emu3" rel="nofollow">here</a>.`,zt,ge,Zt,_e,Wt,ye,tn="Here’s how to load the model and perform inference in half-precision (<code>torch.bfloat16</code>) to generate textual output from text or text and image inputs:",Vt,Te,Bt,be,Ft,Me,on="Emu3 can also generate images from textual input. Here is how you can do it:",Rt,we,Gt,ve,Qt,F,Je,mo,De,nn=`This is the configuration class to store the configuration of a <code>Emu3Model</code>. It is used to instantiate a
emu3 model according to the specified arguments, defining the model architecture. Instantiating a
configuration with the defaults will yield a similar configuration to that of the
<a href="https://huggingface.co/Emu3-community/Emu3-Chat-hf" rel="nofollow">Emu3-community/Emu3-Chat-hf</a>.`,po,Oe,sn=`Configuration objects inherit from <a href="/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> and can be used to control the model outputs. Read the
documentation from <a href="/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> for more information.`,Nt,ke,At,I,Ee,uo,Ke,an=`This is the configuration class to store the configuration of a <a href="/docs/transformers/main/en/model_doc/emu3#transformers.Emu3VQVAE">Emu3VQVAE</a>. It is used to instantiate an VQ-VAE
model according to the specified arguments, defining the model architecture. Instantiating a configuration with the
defaults will yield a configuration to the VQ model presented in Emu3 paper.`,ho,et,rn=`Configuration objects inherit from <a href="/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> and can be used to control the model outputs. Read the
documentation from <a href="/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> for more information.`,fo,Y,Lt,Ue,Xt,$,je,go,tt,ln=`This is the configuration class to store the configuration of a <a href="/docs/transformers/main/en/model_doc/emu3#transformers.Emu3TextModel">Emu3TextModel</a>. It is used to instantiate a
emu3 model according to the specified arguments, defining the model architecture. Instantiating a
configuration with the defaults will yield a similar configuration to that of the
<a href="https://huggingface.co/Emu3-community/Emu3-Chat-hf" rel="nofollow">Emu3-community/Emu3-Chat-hf</a>.`,_o,ot,dn=`Configuration objects inherit from <a href="/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> and can be used to control the model outputs. Read the
documentation from <a href="/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> for more information.`,yo,D,Pt,Ce,qt,U,xe,To,nt,cn=`Constructs a Emu3 processor which wraps a Emu3 image processor and a GPT2 tokenizer into a single
processor.`,bo,st,mn=`<a href="/docs/transformers/main/en/model_doc/emu3#transformers.Emu3Processor">Emu3Processor</a> offers all the functionalities of <a href="/docs/transformers/main/en/model_doc/emu3#transformers.Emu3ImageProcessor">Emu3ImageProcessor</a> and <a href="/docs/transformers/main/en/model_doc/gpt2#transformers.GPT2TokenizerFast">GPT2TokenizerFast</a>.
See the <code>__call__()</code> and <a href="/docs/transformers/main/en/model_doc/emu3#transformers.Emu3Processor.decode">decode()</a> for more information.`,Mo,O,Ie,wo,at,pn=`This method forwards all its arguments to Emu3TokenizerFast’s <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.batch_decode">batch_decode()</a>. Please
refer to the docstring of this method for more information.`,vo,K,$e,Jo,rt,un=`This method forwards all its arguments to Emu3TokenizerFast’s <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.decode">decode()</a>. Please refer to
the docstring of this method for more information.`,Ht,ze,St,R,Ze,ko,it,hn="Constructs a Emu3 image processor that dynamically resizes images based on the original images.",Eo,lt,We,Yt,Ve,Dt,j,Be,Uo,dt,fn=`The VQ-VAE model used in Emu3 for encoding/decoding images into discrete tokens.
This model follows the “Make-a-scene: Scene-based text-to-image generation with human priors” paper from
<a href="https://arxiv.org/abs/2203.13131" rel="nofollow">Oran Gafni, Adam Polyak, Oron Ashual, Shelly Sheynin, Devi Parikh, and Yaniv Taigman</a>.`,jo,ct,gn=`This model inherits from <a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel">PreTrainedModel</a>. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`,Co,mt,_n=`This model is also a PyTorch <a href="https://pytorch.org/docs/stable/nn.html#torch.nn.Module" rel="nofollow">torch.nn.Module</a> subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`,xo,W,Fe,Io,pt,yn="Define the computation performed at every call.",$o,ut,Tn="Should be overridden by all subclasses.",zo,ee,Ot,Re,Kt,C,Ge,Zo,ht,bn=`The bare Emu3Text Model outputting raw hidden-states without any specific head on top.
This model inherits from <a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel">PreTrainedModel</a>. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`,Wo,ft,Mn=`This model is also a PyTorch <a href="https://pytorch.org/docs/stable/nn.html#torch.nn.Module" rel="nofollow">torch.nn.Module</a> subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`,Vo,gt,wn="Transformer decoder consisting of <em>config.num_hidden_layers</em> layers. Each layer is a <code>Emu3TextDecoderLayer</code>",Bo,N,Qe,Fo,_t,vn='The <a href="/docs/transformers/main/en/model_doc/emu3#transformers.Emu3TextModel">Emu3TextModel</a> forward method, overrides the <code>__call__</code> special method.',Ro,te,eo,Ne,to,L,Ae,Go,V,Le,Qo,yt,Jn='The <a href="/docs/transformers/main/en/model_doc/emu3#transformers.Emu3ForCausalLM">Emu3ForCausalLM</a> forward method, overrides the <code>__call__</code> special method.',No,oe,Ao,ne,oo,Xe,no,X,Pe,Lo,B,qe,Xo,Tt,kn='The <a href="/docs/transformers/main/en/model_doc/emu3#transformers.Emu3ForConditionalGeneration">Emu3ForConditionalGeneration</a> forward method, overrides the <code>__call__</code> special method.',Po,se,qo,ae,so,He,ao,wt,ro;return J=new x({props:{title:"Emu3",local:"emu3",headingTag:"h1"}}),E=new x({props:{title:"Overview",local:"overview",headingTag:"h2"}}),S=new Jt({props:{warning:!1,$$slots:{default:[$n]},$$scope:{ctx:M}}}),ge=new x({props:{title:"Usage example",local:"usage-example",headingTag:"h2"}}),_e=new x({props:{title:"Text generation inference",local:"text-generation-inference",headingTag:"h3"}}),Te=new Mt({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEVtdTNQcm9jZXNzb3IlMkMlMjBFbXUzRm9yQ29uZGl0aW9uYWxHZW5lcmF0aW9uJTBBaW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwUElMJTIwaW1wb3J0JTIwSW1hZ2UlMEFpbXBvcnQlMjByZXF1ZXN0cyUwQSUwQXByb2Nlc3NvciUyMCUzRCUyMEVtdTNQcm9jZXNzb3IuZnJvbV9wcmV0cmFpbmVkKCUyMkJBQUklMkZFbXUzLUNoYXQtaGYlMjIpJTBBbW9kZWwlMjAlM0QlMjBFbXUzRm9yQ29uZGl0aW9uYWxHZW5lcmF0aW9uLmZyb21fcHJldHJhaW5lZCglMjJCQUFJJTJGRW11My1DaGF0LWhmJTIyJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5iZmxvYXQxNiUyQyUyMGRldmljZV9tYXAlM0QlMjJjdWRhJTIyKSUwQSUwQSUyMyUyMHByZXBhcmUlMjBpbWFnZSUyMGFuZCUyMHRleHQlMjBwcm9tcHQlMEF1cmwlMjAlM0QlMjAnaHR0cCUzQSUyRiUyRmltYWdlcy5jb2NvZGF0YXNldC5vcmclMkZ2YWwyMDE3JTJGMDAwMDAwMDM5NzY5LmpwZyclMEFpbWFnZSUyMCUzRCUyMEltYWdlLm9wZW4ocmVxdWVzdHMuZ2V0KHVybCUyQyUyMHN0cmVhbSUzRFRydWUpLnJhdyklMEFwcm9tcHQlMjAlM0QlMjAlMjJXaGF0JTIwZG8lMjB5b3UlMjBzZWUlMjBpbiUyMHRoaXMlMjBpbWFnZSUzRiUzQ2ltYWdlJTNFJTIyJTBBJTBBaW5wdXRzJTIwJTNEJTIwcHJvY2Vzc29yKGltYWdlcyUzRGltYWdlJTJDJTIwdGV4dCUzRHByb21wdCUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpLnRvKG1vZGVsLmRldmljZSUyQyUyMGR0eXBlJTNEdG9yY2guYmZsb2F0MTYpJTBBJTBBJTIzJTIwYXV0b3JlZ3Jlc3NpdmVseSUyMGNvbXBsZXRlJTIwcHJvbXB0JTBBb3V0cHV0JTIwJTNEJTIwbW9kZWwuZ2VuZXJhdGUoKippbnB1dHMlMkMlMjBtYXhfbmV3X3Rva2VucyUzRDUwKSUwQXByaW50KHByb2Nlc3Nvci5kZWNvZGUob3V0cHV0JTVCMCU1RCUyQyUyMHNraXBfc3BlY2lhbF90b2tlbnMlM0RUcnVlKSk=",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> Emu3Processor, Emu3ForConditionalGeneration
<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> PIL <span class="hljs-keyword">import</span> Image
<span class="hljs-keyword">import</span> requests

processor = Emu3Processor.from_pretrained(<span class="hljs-string">&quot;BAAI/Emu3-Chat-hf&quot;</span>)
model = Emu3ForConditionalGeneration.from_pretrained(<span class="hljs-string">&quot;BAAI/Emu3-Chat-hf&quot;</span>, torch_dtype=torch.bfloat16, device_map=<span class="hljs-string">&quot;cuda&quot;</span>)

<span class="hljs-comment"># prepare image and text prompt</span>
url = <span class="hljs-string">&#x27;http://images.cocodataset.org/val2017/000000039769.jpg&#x27;</span>
image = Image.<span class="hljs-built_in">open</span>(requests.get(url, stream=<span class="hljs-literal">True</span>).raw)
prompt = <span class="hljs-string">&quot;What do you see in this image?&lt;image&gt;&quot;</span>

inputs = processor(images=image, text=prompt, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>).to(model.device, dtype=torch.bfloat16)

<span class="hljs-comment"># autoregressively complete prompt</span>
output = model.generate(**inputs, max_new_tokens=<span class="hljs-number">50</span>)
<span class="hljs-built_in">print</span>(processor.decode(output[<span class="hljs-number">0</span>], skip_special_tokens=<span class="hljs-literal">True</span>))`,wrap:!1}}),be=new x({props:{title:"Image generation inference",local:"image-generation-inference",headingTag:"h3"}}),we=new Mt({props:{code:" ",highlighted:`processor = Emu3Processor.from_pretrained(<span class="hljs-string">&quot;BAAI/Emu3-Gen-hf&quot;</span>)
model = Emu3ForConditionalGeneration.from_pretrained(<span class="hljs-string">&quot;BAAI/Emu3-Gen-hf&quot;</span>, torch_dtype=<span class="hljs-string">&quot;bfloat16&quot;</span>, device_map=<span class="hljs-string">&quot;auto&quot;</span>, attn_implementation=<span class="hljs-string">&quot;flash_attention_2&quot;</span>)


inputs = processor(
    text=[<span class="hljs-string">&quot;a portrait of young girl. masterpiece, film grained, best quality.&quot;</span>, <span class="hljs-string">&quot;a dog running under the rain&quot;</span>],
    padding=<span class="hljs-literal">True</span>,
    return_tensors=<span class="hljs-string">&quot;pt&quot;</span>,
    return_for_image_generation=<span class="hljs-literal">True</span>,
)
inputs = inputs.to(device=<span class="hljs-string">&quot;cuda:0&quot;</span>, dtype=torch.bfloat16)

neg_prompt = <span class="hljs-string">&quot;lowres, bad anatomy, bad hands, text, error, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality, normal quality, jpeg artifacts, signature, watermark, username, blurry.&quot;</span>
neg_inputs = processor(text=[neg_prompt] * <span class="hljs-number">2</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>).to(device=<span class="hljs-string">&quot;cuda:0&quot;</span>)

image_sizes = inputs.pop(<span class="hljs-string">&quot;image_sizes&quot;</span>)
HEIGHT, WIDTH = image_sizes[<span class="hljs-number">0</span>]
VISUAL_TOKENS = model.vocabulary_mapping.image_tokens

<span class="hljs-keyword">def</span> <span class="hljs-title function_">prefix_allowed_tokens_fn</span>(<span class="hljs-params">batch_id, input_ids</span>):
    height, width = HEIGHT, WIDTH
    visual_tokens = VISUAL_TOKENS
    image_wrapper_token_id = torch.tensor([processor.tokenizer.image_wrapper_token_id], device=model.device)
    eoi_token_id = torch.tensor([processor.tokenizer.eoi_token_id], device=model.device)
    eos_token_id = torch.tensor([processor.tokenizer.eos_token_id], device=model.device)
    pad_token_id = torch.tensor([processor.tokenizer.pad_token_id], device=model.device)
    eof_token_id = torch.tensor([processor.tokenizer.eof_token_id], device=model.device)
    eol_token_id = processor.tokenizer.encode(<span class="hljs-string">&quot;&lt;|extra_200|&gt;&quot;</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)[<span class="hljs-number">0</span>]

    position = torch.nonzero(input_ids == image_wrapper_token_id, as_tuple=<span class="hljs-literal">True</span>)[<span class="hljs-number">0</span>][<span class="hljs-number">0</span>]
    offset = input_ids.shape[<span class="hljs-number">0</span>] - position
    <span class="hljs-keyword">if</span> offset % (width + <span class="hljs-number">1</span>) == <span class="hljs-number">0</span>:
        <span class="hljs-keyword">return</span> (eol_token_id, )
    <span class="hljs-keyword">elif</span> offset == (width + <span class="hljs-number">1</span>) * height + <span class="hljs-number">1</span>:
        <span class="hljs-keyword">return</span> (eof_token_id, )
    <span class="hljs-keyword">elif</span> offset == (width + <span class="hljs-number">1</span>) * height + <span class="hljs-number">2</span>:
        <span class="hljs-keyword">return</span> (eoi_token_id, )
    <span class="hljs-keyword">elif</span> offset == (width + <span class="hljs-number">1</span>) * height + <span class="hljs-number">3</span>:
        <span class="hljs-keyword">return</span> (eos_token_id, )
    <span class="hljs-keyword">elif</span> offset &gt; (width + <span class="hljs-number">1</span>) * height + <span class="hljs-number">3</span>:
        <span class="hljs-keyword">return</span> (pad_token_id, )
    <span class="hljs-keyword">else</span>:
        <span class="hljs-keyword">return</span> visual_tokens


out = model.generate(
    **inputs,
    max_new_tokens=<span class="hljs-number">50_000</span>, <span class="hljs-comment"># make sure to have enough tokens for one image</span>
    prefix_allowed_tokens_fn=prefix_allowed_tokens_fn,
    return_dict_in_generate=<span class="hljs-literal">True</span>,
    negative_prompt_ids=neg_inputs.input_ids, <span class="hljs-comment"># indicate for Classifier-Free Guidance</span>
    negative_prompt_attention_mask=neg_inputs.attention_mask,
)

image = model.decode_image_tokens(out.sequences[:, inputs.input_ids.shape[<span class="hljs-number">1</span>]: ], height=HEIGHT, width=WIDTH)
images = processor.postprocess(<span class="hljs-built_in">list</span>(image.<span class="hljs-built_in">float</span>()), return_tensors=<span class="hljs-string">&quot;PIL.Image.Image&quot;</span>) <span class="hljs-comment"># internally we convert to np but it&#x27;s not supported in bf16 precision</span>
<span class="hljs-keyword">for</span> i, image <span class="hljs-keyword">in</span> <span class="hljs-built_in">enumerate</span>(images[<span class="hljs-string">&#x27;pixel_values&#x27;</span>]):
    image.save(<span class="hljs-string">f&quot;result<span class="hljs-subst">{i}</span>.png&quot;</span>)
`,wrap:!1}}),ve=new x({props:{title:"Emu3Config",local:"transformers.Emu3Config",headingTag:"h2"}}),Je=new k({props:{name:"class transformers.Emu3Config",anchor:"transformers.Emu3Config",parameters:[{name:"vq_config",val:": typing.Union[typing.Dict, transformers.models.emu3.configuration_emu3.Emu3VQVAEConfig] = None"},{name:"text_config",val:": typing.Union[typing.Dict, transformers.models.emu3.configuration_emu3.Emu3TextConfig] = None"},{name:"vocabulary_map",val:": typing.Dict[int, int] = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.Emu3Config.vq_config",description:`<strong>vq_config</strong> (<code>Union[Dict, Emu3VQVAEConfig]</code>, <em>optional</em>) &#x2014;
Emu3VQVAEConfig instance containing the configuration for the VQ-VAE model.`,name:"vq_config"},{anchor:"transformers.Emu3Config.text_config",description:"<strong>text_config</strong> (`Union[Dict, Emu3TextConfig]&#x201C;, <em>optional</em>) &#x2014;\nEmu3TextConfig instance containing the configuration for the language model.",name:"text_config"},{anchor:"transformers.Emu3Config.vocabulary_map",description:`<strong>vocabulary_map</strong> (<code>dict</code>, <em>optional</em>) &#x2014;
A dictionary containing the vocabulary map from the tokenizer. Used to obtain tokens from the image inputs.`,name:"vocabulary_map"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/emu3/configuration_emu3.py#L279"}}),ke=new x({props:{title:"Emu3VQVAEConfig",local:"transformers.Emu3VQVAEConfig",headingTag:"h2"}}),Ee=new k({props:{name:"class transformers.Emu3VQVAEConfig",anchor:"transformers.Emu3VQVAEConfig",parameters:[{name:"codebook_size",val:": int = 32768"},{name:"embed_dim",val:": int = 4"},{name:"latent_channels",val:": int = 4"},{name:"double_latent",val:": bool = False"},{name:"in_channels",val:": int = 3"},{name:"out_channels",val:": int = 3"},{name:"temporal_downsample_factor",val:": int = 4"},{name:"base_channels",val:": int = 256"},{name:"channel_multiplier",val:": typing.List[int] = [1, 2, 2, 4]"},{name:"num_res_blocks",val:": int = 2"},{name:"attn_resolutions",val:": typing.List[int] = [3]"},{name:"hidden_size",val:": int = 1024"},{name:"num_attention_heads",val:": int = 1"},{name:"attention_dropout",val:": float = 0.0"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.Emu3VQVAEConfig.codebook_size",description:`<strong>codebook_size</strong> (<code>int</code>, <em>optional</em>, defaults to 32768) &#x2014;
Codebook size of the VQ model.`,name:"codebook_size"},{anchor:"transformers.Emu3VQVAEConfig.embed_dim",description:`<strong>embed_dim</strong> (<code>int</code>, <em>optional</em>, defaults to 4) &#x2014;
Dimension of the quantized vector in codebook.`,name:"embed_dim"},{anchor:"transformers.Emu3VQVAEConfig.latent_channels",description:`<strong>latent_channels</strong> (<code>int</code>, <em>optional</em>, defaults to 4) &#x2014;
Dimension of the output channel of encoder and the input channel of decoder`,name:"latent_channels"},{anchor:"transformers.Emu3VQVAEConfig.double_latent",description:`<strong>double_latent</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether double the output dim of the encoder.`,name:"double_latent"},{anchor:"transformers.Emu3VQVAEConfig.in_channels",description:`<strong>in_channels</strong> (<code>int</code>, <em>optional</em>, defaults to 3) &#x2014;
Input channel of encoder.`,name:"in_channels"},{anchor:"transformers.Emu3VQVAEConfig.out_channels",description:`<strong>out_channels</strong> (<code>int</code>, <em>optional</em>, defaults to 3) &#x2014;
Output channel of decoder.`,name:"out_channels"},{anchor:"transformers.Emu3VQVAEConfig.temporal_downsample_factor",description:`<strong>temporal_downsample_factor</strong> (<code>int</code>, <em>optional</em>, defaults to 4) &#x2014;
Temporal downsample factor.`,name:"temporal_downsample_factor"},{anchor:"transformers.Emu3VQVAEConfig.base_channels",description:`<strong>base_channels</strong> (<code>int</code>, <em>optional</em>, defaults to 256) &#x2014;
Basic channel number of the intermediate blocks.`,name:"base_channels"},{anchor:"transformers.Emu3VQVAEConfig.channel_multiplier",description:`<strong>channel_multiplier</strong> (<code>List[int]</code>, <em>optional</em>, defaults to <code>[1, 2, 2, 4]</code>) &#x2014;
Channel scaling factor of the intermediate blocks.`,name:"channel_multiplier"},{anchor:"transformers.Emu3VQVAEConfig.num_res_blocks",description:`<strong>num_res_blocks</strong> (<code>int</code>, <em>optional</em>, defaults to 2) &#x2014;
Residual block number in each stage.`,name:"num_res_blocks"},{anchor:"transformers.Emu3VQVAEConfig.attn_resolutions",description:`<strong>attn_resolutions</strong> (<code>List[int]</code>, <em>optional</em>, defaults to <code>[3]</code>) &#x2014;
Stage indices to apply attention.`,name:"attn_resolutions"},{anchor:"transformers.Emu3VQVAEConfig.hidden_size",description:`<strong>hidden_size</strong> (<code>int</code>, <em>optional</em>, defaults to 1024) &#x2014;
Dimension of the hidden representations in the attention layer.`,name:"hidden_size"},{anchor:"transformers.Emu3VQVAEConfig.num_attention_heads",description:`<strong>num_attention_heads</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
Number of attention heads for each attention layer.`,name:"num_attention_heads"},{anchor:"transformers.Emu3VQVAEConfig.attention_dropout",description:`<strong>attention_dropout</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
The dropout ratio for the attention probabilities.`,name:"attention_dropout"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/emu3/configuration_emu3.py#L23"}}),Y=new co({props:{anchor:"transformers.Emu3VQVAEConfig.example",$$slots:{default:[zn]},$$scope:{ctx:M}}}),Ue=new x({props:{title:"Emu3TextConfig",local:"transformers.Emu3TextConfig",headingTag:"h2"}}),je=new k({props:{name:"class transformers.Emu3TextConfig",anchor:"transformers.Emu3TextConfig",parameters:[{name:"vocab_size",val:": int = 184622"},{name:"hidden_size",val:": int = 4096"},{name:"intermediate_size",val:": int = 14336"},{name:"num_hidden_layers",val:": int = 32"},{name:"num_attention_heads",val:": int = 32"},{name:"num_key_value_heads",val:": typing.Optional[int] = 8"},{name:"hidden_act",val:": str = 'silu'"},{name:"max_position_embeddings",val:": int = 9216"},{name:"rms_norm_eps",val:": float = 1e-05"},{name:"use_cache",val:": bool = True"},{name:"pad_token_id",val:": int = 151643"},{name:"bos_token_id",val:": int = 151849"},{name:"eos_token_id",val:": int = 151850"},{name:"tie_word_embeddings",val:": bool = False"},{name:"rope_theta",val:": float = 1000000.0"},{name:"rope_scaling",val:": typing.Optional = None"},{name:"mlp_bias",val:" = False"},{name:"attention_bias",val:" = False"},{name:"attention_dropout",val:": float = 0.1"},{name:"initializer_range",val:": float = 0.02"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.Emu3TextConfig.vocab_size",description:`<strong>vocab_size</strong> (<code>int</code>, <em>optional</em>, defaults to 184622) &#x2014;
Vocabulary size of the Emu3 model. Defines the number of different tokens that can be represented by the
<code>inputs_ids</code> passed when calling <code>Emu3Model</code>`,name:"vocab_size"},{anchor:"transformers.Emu3TextConfig.hidden_size",description:`<strong>hidden_size</strong> (<code>int</code>, <em>optional</em>, defaults to 4096) &#x2014;
Dimension of the hidden representations.`,name:"hidden_size"},{anchor:"transformers.Emu3TextConfig.intermediate_size",description:`<strong>intermediate_size</strong> (<code>int</code>, <em>optional</em>, defaults to 14336) &#x2014;
Dimension of the MLP representations.`,name:"intermediate_size"},{anchor:"transformers.Emu3TextConfig.num_hidden_layers",description:`<strong>num_hidden_layers</strong> (<code>int</code>, <em>optional</em>, defaults to 32) &#x2014;
Number of hidden layers in the Transformer decoder.`,name:"num_hidden_layers"},{anchor:"transformers.Emu3TextConfig.num_attention_heads",description:`<strong>num_attention_heads</strong> (<code>int</code>, <em>optional</em>, defaults to 32) &#x2014;
Number of attention heads for each attention layer in the Transformer decoder.`,name:"num_attention_heads"},{anchor:"transformers.Emu3TextConfig.num_key_value_heads",description:`<strong>num_key_value_heads</strong> (<code>int</code>, <em>optional</em>, defaults to 8) &#x2014;
This is the number of key_value heads that should be used to implement Grouped Query Attention. If
<code>num_key_value_heads=num_attention_heads</code>, the model will use Multi Head Attention (MHA), if
<code>num_key_value_heads=1 the model will use Multi Query Attention (MQA) otherwise GQA is used. When converting a multi-head checkpoint to a GQA checkpoint, each group key and value head should be constructed by meanpooling all the original heads within that group. For more details checkout [this paper](https://arxiv.org/pdf/2305.13245.pdf). If it is not specified, will default to </code>num_attention_heads\`.`,name:"num_key_value_heads"},{anchor:"transformers.Emu3TextConfig.hidden_act",description:`<strong>hidden_act</strong> (<code>str</code> or <code>function</code>, <em>optional</em>, defaults to <code>&quot;silu&quot;</code>) &#x2014;
The non-linear activation function (function or string) in the decoder.`,name:"hidden_act"},{anchor:"transformers.Emu3TextConfig.max_position_embeddings",description:`<strong>max_position_embeddings</strong> (<code>int</code>, <em>optional</em>, defaults to 9216) &#x2014;
The maximum sequence length that this model might ever be used with. Emu supports up to 9216 tokens,`,name:"max_position_embeddings"},{anchor:"transformers.Emu3TextConfig.rms_norm_eps",description:`<strong>rms_norm_eps</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-05) &#x2014;
The epsilon used by the rms normalization layers.`,name:"rms_norm_eps"},{anchor:"transformers.Emu3TextConfig.use_cache",description:`<strong>use_cache</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not the model should return the last key/values attentions (not used by all models). Only
relevant if <code>config.is_decoder=True</code>.`,name:"use_cache"},{anchor:"transformers.Emu3TextConfig.pad_token_id",description:`<strong>pad_token_id</strong> (<code>int</code>, <em>optional</em>, defaults to 151643) &#x2014;
Padding token id.`,name:"pad_token_id"},{anchor:"transformers.Emu3TextConfig.bos_token_id",description:`<strong>bos_token_id</strong> (<code>int</code>, <em>optional</em>, defaults to 151849) &#x2014;
Beginning of stream token id.`,name:"bos_token_id"},{anchor:"transformers.Emu3TextConfig.eos_token_id",description:`<strong>eos_token_id</strong> (<code>int</code>, <em>optional</em>, defaults to 151850) &#x2014;
End of stream token id.`,name:"eos_token_id"},{anchor:"transformers.Emu3TextConfig.tie_word_embeddings",description:`<strong>tie_word_embeddings</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to tie weight embeddings`,name:"tie_word_embeddings"},{anchor:"transformers.Emu3TextConfig.rope_theta",description:`<strong>rope_theta</strong> (<code>float</code>, <em>optional</em>, defaults to 1000000.0) &#x2014;
The base period of the RoPE embeddings.`,name:"rope_theta"},{anchor:"transformers.Emu3TextConfig.rope_scaling",description:`<strong>rope_scaling</strong> (<code>Dict</code>, <em>optional</em>) &#x2014;
Dictionary containing the scaling configuration for the RoPE embeddings. NOTE: if you apply new rope type
and you expect the model to work on longer <code>max_position_embeddings</code>, we recommend you to update this value
accordingly.
Expected contents:
<code>rope_type</code> (<code>str</code>):
The sub-variant of RoPE to use. Can be one of [&#x2018;default&#x2019;, &#x2018;linear&#x2019;, &#x2018;dynamic&#x2019;, &#x2018;yarn&#x2019;, &#x2018;longrope&#x2019;,
&#x2018;llama3&#x2019;], with &#x2018;default&#x2019; being the original RoPE implementation.
<code>factor</code> (<code>float</code>, <em>optional</em>):
Used with all rope types except &#x2018;default&#x2019;. The scaling factor to apply to the RoPE embeddings. In
most scaling types, a <code>factor</code> of x will enable the model to handle sequences of length x <em>
original maximum pre-trained length.
<code>original_max_position_embeddings</code> (<code>int</code>, </em>optional<em>):
Used with &#x2018;dynamic&#x2019;, &#x2018;longrope&#x2019; and &#x2018;llama3&#x2019;. The original max position embeddings used during
pretraining.
<code>attention_factor</code> (<code>float</code>, </em>optional<em>):
Used with &#x2018;yarn&#x2019; and &#x2018;longrope&#x2019;. The scaling factor to be applied on the attention
computation. If unspecified, it defaults to value recommended by the implementation, using the
<code>factor</code> field to infer the suggested value.
<code>beta_fast</code> (<code>float</code>, </em>optional<em>):
Only used with &#x2018;yarn&#x2019;. Parameter to set the boundary for extrapolation (only) in the linear
ramp function. If unspecified, it defaults to 32.
<code>beta_slow</code> (<code>float</code>, </em>optional<em>):
Only used with &#x2018;yarn&#x2019;. Parameter to set the boundary for interpolation (only) in the linear
ramp function. If unspecified, it defaults to 1.
<code>short_factor</code> (<code>List[float]</code>, </em>optional<em>):
Only used with &#x2018;longrope&#x2019;. The scaling factor to be applied to short contexts (&lt;
<code>original_max_position_embeddings</code>). Must be a list of numbers with the same length as the hidden
size divided by the number of attention heads divided by 2
<code>long_factor</code> (<code>List[float]</code>, </em>optional<em>):
Only used with &#x2018;longrope&#x2019;. The scaling factor to be applied to long contexts (&lt;
<code>original_max_position_embeddings</code>). Must be a list of numbers with the same length as the hidden
size divided by the number of attention heads divided by 2
<code>low_freq_factor</code> (<code>float</code>, </em>optional<em>):
Only used with &#x2018;llama3&#x2019;. Scaling factor applied to low frequency components of the RoPE
<code>high_freq_factor</code> (<code>float</code>, </em>optional*):
Only used with &#x2018;llama3&#x2019;. Scaling factor applied to high frequency components of the RoPE`,name:"rope_scaling"},{anchor:"transformers.Emu3TextConfig.mlp_bias",description:`<strong>mlp_bias</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to use a bias in up_proj, down_proj and gate_proj layers in the MLP layers.`,name:"mlp_bias"},{anchor:"transformers.Emu3TextConfig.attention_bias",description:`<strong>attention_bias</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to use a bias in the query, key, value and output projection layers during self-attention.`,name:"attention_bias"},{anchor:"transformers.Emu3TextConfig.attention_dropout",description:`<strong>attention_dropout</strong> (<code>float</code>, <em>optional</em>, defaults to 0.1) &#x2014;
The dropout ratio for the attention probabilities.`,name:"attention_dropout"},{anchor:"transformers.Emu3TextConfig.initializer_range",description:`<strong>initializer_range</strong> (<code>float</code>, <em>optional</em>, defaults to 0.02) &#x2014;
The standard deviation of the truncated_normal_initializer for initializing all weight matrices.`,name:"initializer_range"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/emu3/configuration_emu3.py#L113"}}),D=new co({props:{anchor:"transformers.Emu3TextConfig.example",$$slots:{default:[Zn]},$$scope:{ctx:M}}}),Ce=new x({props:{title:"Emu3Processor",local:"transformers.Emu3Processor",headingTag:"h2"}}),xe=new k({props:{name:"class transformers.Emu3Processor",anchor:"transformers.Emu3Processor",parameters:[{name:"image_processor",val:""},{name:"tokenizer",val:""},{name:"chat_template",val:" = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.Emu3Processor.image_processor",description:`<strong>image_processor</strong> (<a href="/docs/transformers/main/en/model_doc/emu3#transformers.Emu3ImageProcessor">Emu3ImageProcessor</a>) &#x2014;
The image processor is a required input.`,name:"image_processor"},{anchor:"transformers.Emu3Processor.tokenizer",description:`<strong>tokenizer</strong> (<code>Emu3TokenizerFast</code>) &#x2014;
The tokenizer is a required input.`,name:"tokenizer"},{anchor:"transformers.Emu3Processor.chat_template",description:`<strong>chat_template</strong> (<code>str</code>, <em>optional</em>) &#x2014; A Jinja template which will be used to convert lists of messages
in a chat into a tokenizable string.`,name:"chat_template"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/emu3/processing_emu3.py#L48"}}),Ie=new k({props:{name:"batch_decode",anchor:"transformers.Emu3Processor.batch_decode",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/emu3/processing_emu3.py#L196"}}),$e=new k({props:{name:"decode",anchor:"transformers.Emu3Processor.decode",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/emu3/processing_emu3.py#L203"}}),ze=new x({props:{title:"Emu3ImageProcessor",local:"transformers.Emu3ImageProcessor",headingTag:"h2"}}),Ze=new k({props:{name:"class transformers.Emu3ImageProcessor",anchor:"transformers.Emu3ImageProcessor",parameters:[{name:"do_resize",val:": bool = True"},{name:"resample",val:": Resampling = <Resampling.BICUBIC: 3>"},{name:"do_rescale",val:": bool = True"},{name:"rescale_factor",val:": typing.Union[int, float] = 0.00392156862745098"},{name:"do_normalize",val:": bool = True"},{name:"image_mean",val:": typing.Union[float, typing.List[float], NoneType] = None"},{name:"image_std",val:": typing.Union[float, typing.List[float], NoneType] = None"},{name:"do_convert_rgb",val:": bool = True"},{name:"do_pad",val:": bool = True"},{name:"min_pixels",val:": int = 262144"},{name:"max_pixels",val:": int = 1048576"},{name:"spatial_factor",val:": int = 8"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.Emu3ImageProcessor.do_resize",description:`<strong>do_resize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to resize the image&#x2019;s (height, width) dimensions.`,name:"do_resize"},{anchor:"transformers.Emu3ImageProcessor.resample",description:`<strong>resample</strong> (<code>PILImageResampling</code>, <em>optional</em>, defaults to <code>Resampling.BICUBIC</code>) &#x2014;
Resampling filter to use when resizing the image.`,name:"resample"},{anchor:"transformers.Emu3ImageProcessor.do_rescale",description:`<strong>do_rescale</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to rescale the image by the specified scale <code>rescale_factor</code>.`,name:"do_rescale"},{anchor:"transformers.Emu3ImageProcessor.rescale_factor",description:`<strong>rescale_factor</strong> (<code>int</code> or <code>float</code>, <em>optional</em>, defaults to <code>1/255</code>) &#x2014;
Scale factor to use if rescaling the image.`,name:"rescale_factor"},{anchor:"transformers.Emu3ImageProcessor.do_normalize",description:`<strong>do_normalize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to normalize the image.`,name:"do_normalize"},{anchor:"transformers.Emu3ImageProcessor.image_mean",description:`<strong>image_mean</strong> (<code>float</code> or <code>List[float]</code>, <em>optional</em>, defaults to <code>[0.48145466, 0.4578275, 0.40821073]</code>) &#x2014;
Mean to use if normalizing the image. This is a float or list of floats for each channel in the image.`,name:"image_mean"},{anchor:"transformers.Emu3ImageProcessor.image_std",description:`<strong>image_std</strong> (<code>float</code> or <code>List[float]</code>, <em>optional</em>, defaults to <code>[0.26862954, 0.26130258, 0.27577711]</code>) &#x2014;
Standard deviation to use if normalizing the image. This is a float or list of floats for each channel in the image.`,name:"image_std"},{anchor:"transformers.Emu3ImageProcessor.do_convert_rgb",description:`<strong>do_convert_rgb</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to convert the image to RGB.`,name:"do_convert_rgb"},{anchor:"transformers.Emu3ImageProcessor.do_pad",description:`<strong>do_pad</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to pad the image. If <code>True</code>, will pad the patch dimension of the images in the batch to the largest
number of patches in the batch. Padding will be applied to the bottom and right with zeros.`,name:"do_pad"},{anchor:"transformers.Emu3ImageProcessor.min_pixels",description:`<strong>min_pixels</strong> (<code>int</code>, <em>optional</em>, defaults to <code>512 * 512</code>) &#x2014;
The min pixels of the image to resize the image.`,name:"min_pixels"},{anchor:"transformers.Emu3ImageProcessor.max_pixels",description:`<strong>max_pixels</strong> (<code>int</code>, <em>optional</em>, defaults to <code>1024 * 1024</code>) &#x2014;
The max pixels of the image to resize the image.`,name:"max_pixels"},{anchor:"transformers.Emu3ImageProcessor.spatial_factor",description:`<strong>spatial_factor</strong> (<code>int</code>, <em>optional</em>, defaults to 8) &#x2014;
The spatial downsample factor the image will be downsampled in feature extracting phase`,name:"spatial_factor"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/emu3/image_processing_emu3.py#L103"}}),We=new k({props:{name:"preprocess",anchor:"transformers.Emu3ImageProcessor.preprocess",parameters:[{name:"images",val:": typing.Union[ForwardRef('PIL.Image.Image'), numpy.ndarray, ForwardRef('torch.Tensor'), typing.List[ForwardRef('PIL.Image.Image')], typing.List[numpy.ndarray], typing.List[ForwardRef('torch.Tensor')]]"},{name:"do_resize",val:": bool = None"},{name:"size",val:": typing.Dict[str, int] = None"},{name:"resample",val:": Resampling = None"},{name:"do_rescale",val:": bool = None"},{name:"rescale_factor",val:": float = None"},{name:"do_normalize",val:": bool = None"},{name:"image_mean",val:": typing.Union[float, typing.List[float], NoneType] = None"},{name:"image_std",val:": typing.Union[float, typing.List[float], NoneType] = None"},{name:"do_convert_rgb",val:": bool = None"},{name:"do_pad",val:": bool = True"},{name:"return_tensors",val:": typing.Union[str, transformers.utils.generic.TensorType, NoneType] = None"},{name:"data_format",val:": typing.Optional[transformers.image_utils.ChannelDimension] = <ChannelDimension.FIRST: 'channels_first'>"},{name:"input_data_format",val:": typing.Union[str, transformers.image_utils.ChannelDimension, NoneType] = None"}],parametersDescription:[{anchor:"transformers.Emu3ImageProcessor.preprocess.images",description:`<strong>images</strong> (<code>ImageInput</code>) &#x2014;
Image to preprocess. Expects a single or batch of images with pixel values ranging from 0 to 255. If
passing in images with pixel values between 0 and 1, set <code>do_rescale=False</code>.`,name:"images"},{anchor:"transformers.Emu3ImageProcessor.preprocess.do_resize",description:`<strong>do_resize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>self.do_resize</code>) &#x2014;
Whether to resize the image.`,name:"do_resize"},{anchor:"transformers.Emu3ImageProcessor.preprocess.size",description:`<strong>size</strong> (<code>Dict[str, int]</code>, <em>optional</em>, defaults to <code>self.size</code>) &#x2014;
Size of the image after resizing. Shortest edge of the image is resized to size[&#x201C;shortest_edge&#x201D;], with
the longest edge resized to keep the input aspect ratio.`,name:"size"},{anchor:"transformers.Emu3ImageProcessor.preprocess.resample",description:`<strong>resample</strong> (<code>int</code>, <em>optional</em>, defaults to <code>self.resample</code>) &#x2014;
Resampling filter to use if resizing the image. This can be one of the enum <code>PILImageResampling</code>. Only
has an effect if <code>do_resize</code> is set to <code>True</code>.`,name:"resample"},{anchor:"transformers.Emu3ImageProcessor.preprocess.do_rescale",description:`<strong>do_rescale</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>self.do_rescale</code>) &#x2014;
Whether to rescale the image.`,name:"do_rescale"},{anchor:"transformers.Emu3ImageProcessor.preprocess.rescale_factor",description:`<strong>rescale_factor</strong> (<code>float</code>, <em>optional</em>, defaults to <code>self.rescale_factor</code>) &#x2014;
Rescale factor to rescale the image by if <code>do_rescale</code> is set to <code>True</code>.`,name:"rescale_factor"},{anchor:"transformers.Emu3ImageProcessor.preprocess.do_normalize",description:`<strong>do_normalize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>self.do_normalize</code>) &#x2014;
Whether to normalize the image.`,name:"do_normalize"},{anchor:"transformers.Emu3ImageProcessor.preprocess.image_mean",description:`<strong>image_mean</strong> (<code>float</code> or <code>List[float]</code>, <em>optional</em>, defaults to <code>self.image_mean</code>) &#x2014;
Image mean to use for normalization. Only has an effect if <code>do_normalize</code> is set to <code>True</code>.`,name:"image_mean"},{anchor:"transformers.Emu3ImageProcessor.preprocess.image_std",description:`<strong>image_std</strong> (<code>float</code> or <code>List[float]</code>, <em>optional</em>, defaults to <code>self.image_std</code>) &#x2014;
Image standard deviation to use for normalization. Only has an effect if <code>do_normalize</code> is set to
<code>True</code>.`,name:"image_std"},{anchor:"transformers.Emu3ImageProcessor.preprocess.do_convert_rgb",description:`<strong>do_convert_rgb</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>self.do_convert_rgb</code>) &#x2014;
Whether to convert the image to RGB.`,name:"do_convert_rgb"},{anchor:"transformers.Emu3ImageProcessor.preprocess.do_pad",description:`<strong>do_pad</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to pad the image. If <code>True</code>, will pad the patch dimension of the images in the batch to the largest
number of patches in the batch. Padding will be applied to the bottom and right with zeros.`,name:"do_pad"},{anchor:"transformers.Emu3ImageProcessor.preprocess.return_tensors",description:`<strong>return_tensors</strong> (<code>str</code> or <code>TensorType</code>, <em>optional</em>) &#x2014;
The type of tensors to return. Can be one of:<ul>
<li>Unset: Return a list of <code>np.ndarray</code>.</li>
<li><code>TensorType.TENSORFLOW</code> or <code>&apos;tf&apos;</code>: Return a batch of type <code>tf.Tensor</code>.</li>
<li><code>TensorType.PYTORCH</code> or <code>&apos;pt&apos;</code>: Return a batch of type <code>torch.Tensor</code>.</li>
<li><code>TensorType.NUMPY</code> or <code>&apos;np&apos;</code>: Return a batch of type <code>np.ndarray</code>.</li>
<li><code>TensorType.JAX</code> or <code>&apos;jax&apos;</code>: Return a batch of type <code>jax.numpy.ndarray</code>.</li>
</ul>`,name:"return_tensors"},{anchor:"transformers.Emu3ImageProcessor.preprocess.data_format",description:`<strong>data_format</strong> (<code>ChannelDimension</code> or <code>str</code>, <em>optional</em>, defaults to <code>ChannelDimension.FIRST</code>) &#x2014;
The channel dimension format for the output image. Can be one of:<ul>
<li><code>&quot;channels_first&quot;</code> or <code>ChannelDimension.FIRST</code>: image in (num_channels, height, width) format.</li>
<li><code>&quot;channels_last&quot;</code> or <code>ChannelDimension.LAST</code>: image in (height, width, num_channels) format.</li>
<li>Unset: Use the channel dimension format of the input image.</li>
</ul>`,name:"data_format"},{anchor:"transformers.Emu3ImageProcessor.preprocess.input_data_format",description:`<strong>input_data_format</strong> (<code>ChannelDimension</code> or <code>str</code>, <em>optional</em>) &#x2014;
The channel dimension format for the input image. If unset, the channel dimension format is inferred
from the input image. Can be one of:<ul>
<li><code>&quot;channels_first&quot;</code> or <code>ChannelDimension.FIRST</code>: image in (num_channels, height, width) format.</li>
<li><code>&quot;channels_last&quot;</code> or <code>ChannelDimension.LAST</code>: image in (height, width, num_channels) format.</li>
<li><code>&quot;none&quot;</code> or <code>ChannelDimension.NONE</code>: image in (height, width) format.</li>
</ul>`,name:"input_data_format"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/emu3/image_processing_emu3.py#L308"}}),Ve=new x({props:{title:"Emu3VQVAE",local:"transformers.Emu3VQVAE",headingTag:"h2"}}),Be=new k({props:{name:"class transformers.Emu3VQVAE",anchor:"transformers.Emu3VQVAE",parameters:[{name:"config",val:": Emu3VQVAEConfig"}],parametersDescription:[{anchor:"transformers.Emu3VQVAE.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/emu3#transformers.Emu3VQVAEConfig">Emu3VQVAEConfig</a>) &#x2014;
Model configuration class with all the parameters of the model. Initializing with a config file does not
load the weights associated with the model, only the configuration. Check out the
<a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/emu3/modeling_emu3.py#L989"}}),Fe=new k({props:{name:"_forward_unimplemented",anchor:"transformers.Emu3VQVAE.forward",parameters:[{name:"*input",val:": typing.Any"}],source:"https://github.com/huggingface/transformers/blob/main/src/torch/nn/modules/module.py#L383"}}),ee=new Jt({props:{$$slots:{default:[Wn]},$$scope:{ctx:M}}}),Re=new x({props:{title:"Emu3TextModel",local:"transformers.Emu3TextModel",headingTag:"h2"}}),Ge=new k({props:{name:"class transformers.Emu3TextModel",anchor:"transformers.Emu3TextModel",parameters:[{name:"config",val:": Emu3Config"}],parametersDescription:[{anchor:"transformers.Emu3TextModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/emu3#transformers.Emu3Config">Emu3Config</a>) &#x2014;
Model configuration class with all the parameters of the model. Initializing with a config file does not
load the weights associated with the model, only the configuration. Check out the
<a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"},{anchor:"transformers.Emu3TextModel.config",description:"<strong>config</strong> &#x2014; Emu3TextConfig",name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/emu3/modeling_emu3.py#L1332"}}),Qe=new k({props:{name:"forward",anchor:"transformers.Emu3TextModel.forward",parameters:[{name:"input_ids",val:": LongTensor = None"},{name:"attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"position_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"past_key_values",val:": typing.Optional[transformers.cache_utils.Cache] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"use_cache",val:": typing.Optional[bool] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"},{name:"cache_position",val:": typing.Optional[torch.LongTensor] = None"},{name:"**flash_attn_kwargs",val:": typing_extensions.Unpack[transformers.modeling_flash_attention_utils.FlashAttentionKwargs]"}],parametersDescription:[{anchor:"transformers.Emu3TextModel.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary. Padding will be ignored by default should you provide
it.</p>
<p>Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.Emu3TextModel.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a></p>
<p>Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p>If <code>past_key_values</code> is used, optionally only the last <code>input_ids</code> have to be input (see
<code>past_key_values</code>).</p>
<p>If you want to change padding behavior, you should read <code>modeling_opt._prepare_decoder_attention_mask</code>
and modify to your needs. See diagram 1 in <a href="https://arxiv.org/abs/1910.13461" rel="nofollow">the paper</a> for more
information on the default strategy.</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"attention_mask"},{anchor:"transformers.Emu3TextModel.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.n_positions - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.Emu3TextModel.forward.past_key_values",description:`<strong>past_key_values</strong> (<code>Cache</code>, <em>optional</em>) &#x2014;
Pre-computed hidden-states (key and values in the self-attention blocks and in the cross-attention
blocks) that can be used to speed up sequential decoding. This typically consists in the <code>past_key_values</code>
returned by the model at a previous stage of decoding, when <code>use_cache=True</code> or <code>config.use_cache=True</code>.</p>
<p>Has to be an instance of <a href="/docs/transformers/main/en/internal/generation_utils#transformers.Cache">Cache</a> instance, see our
<a href="https://huggingface.co/docs/transformers/en/kv_cache" rel="nofollow">kv cache guide</a>.</p>
<p>The model will output the same cache type that is fed as input. If no <code>past_key_values</code> are passed, the
legacy cache format will be returned.</p>
<p>If <code>past_key_values</code> are used, the user can optionally input only the last <code>input_ids</code> (those that don&#x2019;t
have their past key value states given to this model) of shape <code>(batch_size, 1)</code> instead of all <code>input_ids</code>
of shape <code>(batch_size, sequence_length)</code>.`,name:"past_key_values"},{anchor:"transformers.Emu3TextModel.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.Emu3TextModel.forward.use_cache",description:`<strong>use_cache</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
If set to <code>True</code>, <code>past_key_values</code> key value states are returned and can be used to speed up decoding (see
<code>past_key_values</code>).`,name:"use_cache"},{anchor:"transformers.Emu3TextModel.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.Emu3TextModel.forward.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail.`,name:"output_hidden_states"},{anchor:"transformers.Emu3TextModel.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.Emu3TextModel.forward.cache_position",description:`<strong>cache_position</strong> (<code>torch.LongTensor</code> of shape <code>(sequence_length)</code>, <em>optional</em>) &#x2014;
Indices depicting the position of the input sequence tokens in the sequence. Contrarily to <code>position_ids</code>,
this tensor is not affected by padding. It is used to update the cache in the correct position and to infer
the complete sequence length.`,name:"cache_position"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/emu3/modeling_emu3.py#L1366"}}),te=new Jt({props:{$$slots:{default:[Vn]},$$scope:{ctx:M}}}),Ne=new x({props:{title:"Emu3ForCausalLM",local:"transformers.Emu3ForCausalLM",headingTag:"h2"}}),Ae=new k({props:{name:"class transformers.Emu3ForCausalLM",anchor:"transformers.Emu3ForCausalLM",parameters:[{name:"config",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/emu3/modeling_emu3.py#L1598"}}),Le=new k({props:{name:"forward",anchor:"transformers.Emu3ForCausalLM.forward",parameters:[{name:"input_ids",val:": LongTensor = None"},{name:"attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"position_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"past_key_values",val:": typing.Union[transformers.cache_utils.Cache, typing.List[torch.FloatTensor], NoneType] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"labels",val:": typing.Optional[torch.LongTensor] = None"},{name:"use_cache",val:": typing.Optional[bool] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"},{name:"cache_position",val:": typing.Optional[torch.LongTensor] = None"},{name:"logits_to_keep",val:": typing.Union[int, torch.Tensor] = 0"},{name:"**kwargs",val:": typing_extensions.Unpack[transformers.models.emu3.modeling_emu3.KwargsForCausalLM]"}],parametersDescription:[{anchor:"transformers.Emu3ForCausalLM.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary. Padding will be ignored by default should you provide
it.</p>
<p>Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.Emu3ForCausalLM.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a></p>
<p>Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p>If <code>past_key_values</code> is used, optionally only the last <code>input_ids</code> have to be input (see
<code>past_key_values</code>).</p>
<p>If you want to change padding behavior, you should read <code>modeling_opt._prepare_decoder_attention_mask</code>
and modify to your needs. See diagram 1 in <a href="https://arxiv.org/abs/1910.13461" rel="nofollow">the paper</a> for more
information on the default strategy.</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"attention_mask"},{anchor:"transformers.Emu3ForCausalLM.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.n_positions - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.Emu3ForCausalLM.forward.past_key_values",description:`<strong>past_key_values</strong> (<code>Cache</code>, <em>optional</em>) &#x2014;
Pre-computed hidden-states (key and values in the self-attention blocks and in the cross-attention
blocks) that can be used to speed up sequential decoding. This typically consists in the <code>past_key_values</code>
returned by the model at a previous stage of decoding, when <code>use_cache=True</code> or <code>config.use_cache=True</code>.</p>
<p>Has to be an instance of <a href="/docs/transformers/main/en/internal/generation_utils#transformers.Cache">Cache</a> instance, see our
<a href="https://huggingface.co/docs/transformers/en/kv_cache" rel="nofollow">kv cache guide</a>.</p>
<p>The model will output the same cache type that is fed as input. If no <code>past_key_values</code> are passed, the
legacy cache format will be returned.</p>
<p>If <code>past_key_values</code> are used, the user can optionally input only the last <code>input_ids</code> (those that don&#x2019;t
have their past key value states given to this model) of shape <code>(batch_size, 1)</code> instead of all <code>input_ids</code>
of shape <code>(batch_size, sequence_length)</code>.`,name:"past_key_values"},{anchor:"transformers.Emu3ForCausalLM.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.Emu3ForCausalLM.forward.use_cache",description:`<strong>use_cache</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
If set to <code>True</code>, <code>past_key_values</code> key value states are returned and can be used to speed up decoding (see
<code>past_key_values</code>).`,name:"use_cache"},{anchor:"transformers.Emu3ForCausalLM.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.Emu3ForCausalLM.forward.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail.`,name:"output_hidden_states"},{anchor:"transformers.Emu3ForCausalLM.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.Emu3ForCausalLM.forward.cache_position",description:`<strong>cache_position</strong> (<code>torch.LongTensor</code> of shape <code>(sequence_length)</code>, <em>optional</em>) &#x2014;
Indices depicting the position of the input sequence tokens in the sequence. Contrarily to <code>position_ids</code>,
this tensor is not affected by padding. It is used to update the cache in the correct position and to infer
the complete sequence length.`,name:"cache_position"},{anchor:"transformers.Emu3ForCausalLM.forward.Args",description:`<strong>Args</strong> &#x2014;
labels (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>):
Labels for computing the masked language modeling loss. Indices should either be in <code>[0, ..., config.vocab_size]</code> or -100 (see <code>input_ids</code> docstring). Tokens with indices set to <code>-100</code> are ignored
(masked), the loss is only computed for the tokens with labels in <code>[0, ..., config.vocab_size]</code>.</p>
<p>logits_to_keep (<code>int</code> or <code>torch.Tensor</code>, <em>optional</em>):
If an <code>int</code>, compute logits for the last <code>logits_to_keep</code> tokens. If <code>0</code>, calculate logits for all
<code>input_ids</code> (special case). Only last token logits are needed for generation, and calculating them only for that
token can save memory, which becomes pretty significant for long sequences or large vocabulary size.
If a <code>torch.Tensor</code>, must be 1D corresponding to the indices to keep in the sequence length dimension.
This is useful when using packed tensor format (single dimension for batch and sequence length).`,name:"Args"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/emu3/modeling_emu3.py#L1630",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.CausalLMOutputWithPast"
>transformers.modeling_outputs.CausalLMOutputWithPast</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/main/en/model_doc/emu3#transformers.Emu3TextConfig"
>Emu3TextConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>loss</strong> (<code>torch.FloatTensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>labels</code> is provided) — Language modeling loss (for next-token prediction).</p>
</li>
<li>
<p><strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, config.vocab_size)</code>) — Prediction scores of the language modeling head (scores for each vocabulary token before SoftMax).</p>
</li>
<li>
<p><strong>past_key_values</strong> (<code>tuple(tuple(torch.FloatTensor))</code>, <em>optional</em>, returned when <code>use_cache=True</code> is passed or when <code>config.use_cache=True</code>) — Tuple of <code>tuple(torch.FloatTensor)</code> of length <code>config.n_layers</code>, with each tuple having 2 tensors of shape
<code>(batch_size, num_heads, sequence_length, embed_size_per_head)</code>)</p>
<p>Contains pre-computed hidden-states (key and values in the self-attention blocks) that can be used (see
<code>past_key_values</code> input) to speed up sequential decoding.</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) — Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, +
one for the output of each layer) of shape <code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) — Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.CausalLMOutputWithPast"
>transformers.modeling_outputs.CausalLMOutputWithPast</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),oe=new Jt({props:{$$slots:{default:[Bn]},$$scope:{ctx:M}}}),ne=new co({props:{anchor:"transformers.Emu3ForCausalLM.forward.example",$$slots:{default:[Fn]},$$scope:{ctx:M}}}),Xe=new x({props:{title:"Emu3ForConditionalGeneration",local:"transformers.Emu3ForConditionalGeneration",headingTag:"h2"}}),Pe=new k({props:{name:"class transformers.Emu3ForConditionalGeneration",anchor:"transformers.Emu3ForConditionalGeneration",parameters:[{name:"config",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/emu3/modeling_emu3.py#L1803"}}),qe=new k({props:{name:"forward",anchor:"transformers.Emu3ForConditionalGeneration.forward",parameters:[{name:"input_ids",val:": LongTensor = None"},{name:"pixel_values",val:": FloatTensor = None"},{name:"image_sizes",val:": Tensor = None"},{name:"attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"position_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"past_key_values",val:": typing.Optional[transformers.cache_utils.Cache] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"use_cache",val:": typing.Optional[bool] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"},{name:"cache_position",val:": typing.Optional[torch.LongTensor] = None"},{name:"labels",val:": typing.Optional[torch.LongTensor] = None"},{name:"logits_to_keep",val:": typing.Union[int, torch.Tensor] = 0"}],parametersDescription:[{anchor:"transformers.Emu3ForConditionalGeneration.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary. Padding will be ignored by default should you provide
it.</p>
<p>Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.Emu3ForConditionalGeneration.forward.pixel_values",description:'<strong>pixel_values</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, max_num_images, max_num_tiles, channels, image_size, image_size)) -- The tensors corresponding to the input images. Pixel values can be obtained using [AutoImageProcessor](/docs/transformers/main/en/model_doc/auto#transformers.AutoImageProcessor). See [Emu3ImageProcessor.__call__()](/docs/transformers/main/en/model_doc/deit#transformers.DeiTFeatureExtractor.__call__) for details ([]</code>Emu3Processor`] uses\n<a href="/docs/transformers/main/en/model_doc/emu3#transformers.Emu3ImageProcessor">Emu3ImageProcessor</a> for processing images).',name:"pixel_values"},{anchor:"transformers.Emu3ForConditionalGeneration.forward.image_sizes",description:`<strong>image_sizes</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, 2)</code>) &#x2014;
The sizes of the images in the batch, being (height, width) for each image. Image sizes can be obtained using
<a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <a href="/docs/transformers/main/en/model_doc/deit#transformers.DeiTFeatureExtractor.__call__">Emu3ImageProcessor.<strong>call</strong>()</a> for details ([]<code>Emu3Processor</code>] uses
<a href="/docs/transformers/main/en/model_doc/emu3#transformers.Emu3ImageProcessor">Emu3ImageProcessor</a> for processing images).`,name:"image_sizes"},{anchor:"transformers.Emu3ForConditionalGeneration.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a></p>
<p>Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p>If <code>past_key_values</code> is used, optionally only the last <code>input_ids</code> have to be input (see
<code>past_key_values</code>).</p>
<p>If you want to change padding behavior, you should read <code>modeling_opt._prepare_decoder_attention_mask</code>
and modify to your needs. See diagram 1 in <a href="https://arxiv.org/abs/1910.13461" rel="nofollow">the paper</a> for more
information on the default strategy.</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"attention_mask"},{anchor:"transformers.Emu3ForConditionalGeneration.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.n_positions - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.Emu3ForConditionalGeneration.forward.past_key_values",description:`<strong>past_key_values</strong> (<code>Cache</code> or <code>tuple(tuple(torch.FloatTensor))</code>, <em>optional</em>) &#x2014;
Pre-computed hidden-states (key and values in the self-attention blocks and in the cross-attention
blocks) that can be used to speed up sequential decoding. This typically consists in the <code>past_key_values</code>
returned by the model at a previous stage of decoding, when <code>use_cache=True</code> or <code>config.use_cache=True</code>.</p>
<p>Has to be an instance of <a href="/docs/transformers/main/en/internal/generation_utils#transformers.Cache">Cache</a> instance, see our
<a href="https://huggingface.co/docs/transformers/en/kv_cache" rel="nofollow">kv cache guide</a>.</p>
<p>The model will output the same cache format that is fed as input. If no <code>past_key_values</code> are passed, the
legacy cache format will be returned.</p>
<p>If <code>past_key_values</code> are used, the user can optionally input only the last <code>input_ids</code> (those that don&#x2019;t
have their past key value states given to this model) of shape <code>(batch_size, 1)</code> instead of all <code>input_ids</code>
of shape <code>(batch_size, sequence_length)</code>.`,name:"past_key_values"},{anchor:"transformers.Emu3ForConditionalGeneration.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.Emu3ForConditionalGeneration.forward.use_cache",description:`<strong>use_cache</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
If set to <code>True</code>, <code>past_key_values</code> key value states are returned and can be used to speed up decoding (see
<code>past_key_values</code>).`,name:"use_cache"},{anchor:"transformers.Emu3ForConditionalGeneration.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.Emu3ForConditionalGeneration.forward.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail.`,name:"output_hidden_states"},{anchor:"transformers.Emu3ForConditionalGeneration.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.Emu3ForConditionalGeneration.forward.cache_position",description:`<strong>cache_position</strong> (<code>torch.LongTensor</code> of shape <code>(sequence_length)</code>, <em>optional</em>) &#x2014;
Indices depicting the position of the input sequence tokens in the sequence. Contrarily to <code>position_ids</code>,
this tensor is not affected by padding. It is used to update the cache in the correct position and to infer
the complete sequence length.`,name:"cache_position"},{anchor:"transformers.Emu3ForConditionalGeneration.forward.Args",description:`<strong>Args</strong> &#x2014;
labels (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>):
Labels for computing the masked language modeling loss. Indices should either be in <code>[0, ..., config.vocab_size]</code> or -100 (see <code>input_ids</code> docstring). Tokens with indices set to <code>-100</code> are ignored
(masked), the loss is only computed for the tokens with labels in <code>[0, ..., config.vocab_size]</code>.</p>
<p>logits_to_keep (<code>int</code> or <code>torch.Tensor</code>, <em>optional</em>):
If an <code>int</code>, compute logits for the last <code>logits_to_keep</code> tokens. If <code>0</code>, calculate logits for all
<code>input_ids</code> (special case). Only last token logits are needed for generation, and calculating them only for that
token can save memory, which becomes pretty significant for long sequences or large vocabulary size.
If a <code>torch.Tensor</code>, must be 1D corresponding to the indices to keep in the sequence length dimension.
This is useful when using packed tensor format (single dimension for batch and sequence length).`,name:"Args"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/emu3/modeling_emu3.py#L1858",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.CausalLMOutputWithPast"
>transformers.modeling_outputs.CausalLMOutputWithPast</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/main/en/model_doc/emu3#transformers.Emu3Config"
>Emu3Config</a>) and inputs.</p>
<ul>
<li>
<p><strong>loss</strong> (<code>torch.FloatTensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>labels</code> is provided) — Language modeling loss (for next-token prediction).</p>
</li>
<li>
<p><strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, config.vocab_size)</code>) — Prediction scores of the language modeling head (scores for each vocabulary token before SoftMax).</p>
</li>
<li>
<p><strong>past_key_values</strong> (<code>tuple(tuple(torch.FloatTensor))</code>, <em>optional</em>, returned when <code>use_cache=True</code> is passed or when <code>config.use_cache=True</code>) — Tuple of <code>tuple(torch.FloatTensor)</code> of length <code>config.n_layers</code>, with each tuple having 2 tensors of shape
<code>(batch_size, num_heads, sequence_length, embed_size_per_head)</code>)</p>
<p>Contains pre-computed hidden-states (key and values in the self-attention blocks) that can be used (see
<code>past_key_values</code> input) to speed up sequential decoding.</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) — Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, +
one for the output of each layer) of shape <code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) — Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.CausalLMOutputWithPast"
>transformers.modeling_outputs.CausalLMOutputWithPast</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),se=new Jt({props:{$$slots:{default:[Rn]},$$scope:{ctx:M}}}),ae=new co({props:{anchor:"transformers.Emu3ForConditionalGeneration.forward.example",$$slots:{default:[Gn]},$$scope:{ctx:M}}}),He=new In({props:{source:"https://github.com/huggingface/transformers/blob/main/docs/source/en/model_doc/emu3.md"}}),{c(){n=d("meta"),y=s(),l=d("p"),T=s(),m(J.$$.fragment),b=s(),m(E.$$.fragment),kt=s(),de=d("p"),de.innerHTML=Ho,Et=s(),ce=d("p"),ce.textContent=So,Ut=s(),me=d("p"),me.textContent=Yo,jt=s(),pe=d("p"),pe.innerHTML=Do,Ct=s(),ue=d("p"),ue.textContent=Oo,xt=s(),he=d("ul"),he.innerHTML=Ko,It=s(),m(S.$$.fragment),$t=s(),fe=d("p"),fe.innerHTML=en,zt=s(),m(ge.$$.fragment),Zt=s(),m(_e.$$.fragment),Wt=s(),ye=d("p"),ye.innerHTML=tn,Vt=s(),m(Te.$$.fragment),Bt=s(),m(be.$$.fragment),Ft=s(),Me=d("p"),Me.textContent=on,Rt=s(),m(we.$$.fragment),Gt=s(),m(ve.$$.fragment),Qt=s(),F=d("div"),m(Je.$$.fragment),mo=s(),De=d("p"),De.innerHTML=nn,po=s(),Oe=d("p"),Oe.innerHTML=sn,Nt=s(),m(ke.$$.fragment),At=s(),I=d("div"),m(Ee.$$.fragment),uo=s(),Ke=d("p"),Ke.innerHTML=an,ho=s(),et=d("p"),et.innerHTML=rn,fo=s(),m(Y.$$.fragment),Lt=s(),m(Ue.$$.fragment),Xt=s(),$=d("div"),m(je.$$.fragment),go=s(),tt=d("p"),tt.innerHTML=ln,_o=s(),ot=d("p"),ot.innerHTML=dn,yo=s(),m(D.$$.fragment),Pt=s(),m(Ce.$$.fragment),qt=s(),U=d("div"),m(xe.$$.fragment),To=s(),nt=d("p"),nt.textContent=cn,bo=s(),st=d("p"),st.innerHTML=mn,Mo=s(),O=d("div"),m(Ie.$$.fragment),wo=s(),at=d("p"),at.innerHTML=pn,vo=s(),K=d("div"),m($e.$$.fragment),Jo=s(),rt=d("p"),rt.innerHTML=un,Ht=s(),m(ze.$$.fragment),St=s(),R=d("div"),m(Ze.$$.fragment),ko=s(),it=d("p"),it.textContent=hn,Eo=s(),lt=d("div"),m(We.$$.fragment),Yt=s(),m(Ve.$$.fragment),Dt=s(),j=d("div"),m(Be.$$.fragment),Uo=s(),dt=d("p"),dt.innerHTML=fn,jo=s(),ct=d("p"),ct.innerHTML=gn,Co=s(),mt=d("p"),mt.innerHTML=_n,xo=s(),W=d("div"),m(Fe.$$.fragment),Io=s(),pt=d("p"),pt.textContent=yn,$o=s(),ut=d("p"),ut.textContent=Tn,zo=s(),m(ee.$$.fragment),Ot=s(),m(Re.$$.fragment),Kt=s(),C=d("div"),m(Ge.$$.fragment),Zo=s(),ht=d("p"),ht.innerHTML=bn,Wo=s(),ft=d("p"),ft.innerHTML=Mn,Vo=s(),gt=d("p"),gt.innerHTML=wn,Bo=s(),N=d("div"),m(Qe.$$.fragment),Fo=s(),_t=d("p"),_t.innerHTML=vn,Ro=s(),m(te.$$.fragment),eo=s(),m(Ne.$$.fragment),to=s(),L=d("div"),m(Ae.$$.fragment),Go=s(),V=d("div"),m(Le.$$.fragment),Qo=s(),yt=d("p"),yt.innerHTML=Jn,No=s(),m(oe.$$.fragment),Ao=s(),m(ne.$$.fragment),oo=s(),m(Xe.$$.fragment),no=s(),X=d("div"),m(Pe.$$.fragment),Lo=s(),B=d("div"),m(qe.$$.fragment),Xo=s(),Tt=d("p"),Tt.innerHTML=kn,Po=s(),m(se.$$.fragment),qo=s(),m(ae.$$.fragment),so=s(),m(He.$$.fragment),ao=s(),wt=d("p"),this.h()},l(e){const t=xn("svelte-u9bgzb",document.head);n=c(t,"META",{name:!0,content:!0}),t.forEach(o),y=a(e),l=c(e,"P",{}),w(l).forEach(o),T=a(e),p(J.$$.fragment,e),b=a(e),p(E.$$.fragment,e),kt=a(e),de=c(e,"P",{"data-svelte-h":!0}),_(de)!=="svelte-1obcc32"&&(de.innerHTML=Ho),Et=a(e),ce=c(e,"P",{"data-svelte-h":!0}),_(ce)!=="svelte-e8x44f"&&(ce.textContent=So),Ut=a(e),me=c(e,"P",{"data-svelte-h":!0}),_(me)!=="svelte-vfdo9a"&&(me.textContent=Yo),jt=a(e),pe=c(e,"P",{"data-svelte-h":!0}),_(pe)!=="svelte-1h0gla8"&&(pe.innerHTML=Do),Ct=a(e),ue=c(e,"P",{"data-svelte-h":!0}),_(ue)!=="svelte-axv494"&&(ue.textContent=Oo),xt=a(e),he=c(e,"UL",{"data-svelte-h":!0}),_(he)!=="svelte-70x06q"&&(he.innerHTML=Ko),It=a(e),p(S.$$.fragment,e),$t=a(e),fe=c(e,"P",{"data-svelte-h":!0}),_(fe)!=="svelte-icel92"&&(fe.innerHTML=en),zt=a(e),p(ge.$$.fragment,e),Zt=a(e),p(_e.$$.fragment,e),Wt=a(e),ye=c(e,"P",{"data-svelte-h":!0}),_(ye)!=="svelte-1krl2ia"&&(ye.innerHTML=tn),Vt=a(e),p(Te.$$.fragment,e),Bt=a(e),p(be.$$.fragment,e),Ft=a(e),Me=c(e,"P",{"data-svelte-h":!0}),_(Me)!=="svelte-a7zypi"&&(Me.textContent=on),Rt=a(e),p(we.$$.fragment,e),Gt=a(e),p(ve.$$.fragment,e),Qt=a(e),F=c(e,"DIV",{class:!0});var P=w(F);p(Je.$$.fragment,P),mo=a(P),De=c(P,"P",{"data-svelte-h":!0}),_(De)!=="svelte-14gq99f"&&(De.innerHTML=nn),po=a(P),Oe=c(P,"P",{"data-svelte-h":!0}),_(Oe)!=="svelte-o55m63"&&(Oe.innerHTML=sn),P.forEach(o),Nt=a(e),p(ke.$$.fragment,e),At=a(e),I=c(e,"DIV",{class:!0});var G=w(I);p(Ee.$$.fragment,G),uo=a(G),Ke=c(G,"P",{"data-svelte-h":!0}),_(Ke)!=="svelte-1b4awql"&&(Ke.innerHTML=an),ho=a(G),et=c(G,"P",{"data-svelte-h":!0}),_(et)!=="svelte-o55m63"&&(et.innerHTML=rn),fo=a(G),p(Y.$$.fragment,G),G.forEach(o),Lt=a(e),p(Ue.$$.fragment,e),Xt=a(e),$=c(e,"DIV",{class:!0});var Q=w($);p(je.$$.fragment,Q),go=a(Q),tt=c(Q,"P",{"data-svelte-h":!0}),_(tt)!=="svelte-uux9ae"&&(tt.innerHTML=ln),_o=a(Q),ot=c(Q,"P",{"data-svelte-h":!0}),_(ot)!=="svelte-o55m63"&&(ot.innerHTML=dn),yo=a(Q),p(D.$$.fragment,Q),Q.forEach(o),Pt=a(e),p(Ce.$$.fragment,e),qt=a(e),U=c(e,"DIV",{class:!0});var z=w(U);p(xe.$$.fragment,z),To=a(z),nt=c(z,"P",{"data-svelte-h":!0}),_(nt)!=="svelte-jza07y"&&(nt.textContent=cn),bo=a(z),st=c(z,"P",{"data-svelte-h":!0}),_(st)!=="svelte-120txaj"&&(st.innerHTML=mn),Mo=a(z),O=c(z,"DIV",{class:!0});var Se=w(O);p(Ie.$$.fragment,Se),wo=a(Se),at=c(Se,"P",{"data-svelte-h":!0}),_(at)!=="svelte-xyq33x"&&(at.innerHTML=pn),Se.forEach(o),vo=a(z),K=c(z,"DIV",{class:!0});var Ye=w(K);p($e.$$.fragment,Ye),Jo=a(Ye),rt=c(Ye,"P",{"data-svelte-h":!0}),_(rt)!=="svelte-15q229j"&&(rt.innerHTML=un),Ye.forEach(o),z.forEach(o),Ht=a(e),p(ze.$$.fragment,e),St=a(e),R=c(e,"DIV",{class:!0});var q=w(R);p(Ze.$$.fragment,q),ko=a(q),it=c(q,"P",{"data-svelte-h":!0}),_(it)!=="svelte-16rx7fp"&&(it.textContent=hn),Eo=a(q),lt=c(q,"DIV",{class:!0});var vt=w(lt);p(We.$$.fragment,vt),vt.forEach(o),q.forEach(o),Yt=a(e),p(Ve.$$.fragment,e),Dt=a(e),j=c(e,"DIV",{class:!0});var Z=w(j);p(Be.$$.fragment,Z),Uo=a(Z),dt=c(Z,"P",{"data-svelte-h":!0}),_(dt)!=="svelte-1bqqyxl"&&(dt.innerHTML=fn),jo=a(Z),ct=c(Z,"P",{"data-svelte-h":!0}),_(ct)!=="svelte-6pahdo"&&(ct.innerHTML=gn),Co=a(Z),mt=c(Z,"P",{"data-svelte-h":!0}),_(mt)!=="svelte-hswkmf"&&(mt.innerHTML=_n),xo=a(Z),W=c(Z,"DIV",{class:!0});var re=w(W);p(Fe.$$.fragment,re),Io=a(re),pt=c(re,"P",{"data-svelte-h":!0}),_(pt)!=="svelte-1q5ym45"&&(pt.textContent=yn),$o=a(re),ut=c(re,"P",{"data-svelte-h":!0}),_(ut)!=="svelte-w8wo9i"&&(ut.textContent=Tn),zo=a(re),p(ee.$$.fragment,re),re.forEach(o),Z.forEach(o),Ot=a(e),p(Re.$$.fragment,e),Kt=a(e),C=c(e,"DIV",{class:!0});var A=w(C);p(Ge.$$.fragment,A),Zo=a(A),ht=c(A,"P",{"data-svelte-h":!0}),_(ht)!=="svelte-qf1clf"&&(ht.innerHTML=bn),Wo=a(A),ft=c(A,"P",{"data-svelte-h":!0}),_(ft)!=="svelte-hswkmf"&&(ft.innerHTML=Mn),Vo=a(A),gt=c(A,"P",{"data-svelte-h":!0}),_(gt)!=="svelte-6rxg4"&&(gt.innerHTML=wn),Bo=a(A),N=c(A,"DIV",{class:!0});var bt=w(N);p(Qe.$$.fragment,bt),Fo=a(bt),_t=c(bt,"P",{"data-svelte-h":!0}),_(_t)!=="svelte-1ndfvqx"&&(_t.innerHTML=vn),Ro=a(bt),p(te.$$.fragment,bt),bt.forEach(o),A.forEach(o),eo=a(e),p(Ne.$$.fragment,e),to=a(e),L=c(e,"DIV",{class:!0});var io=w(L);p(Ae.$$.fragment,io),Go=a(io),V=c(io,"DIV",{class:!0});var ie=w(V);p(Le.$$.fragment,ie),Qo=a(ie),yt=c(ie,"P",{"data-svelte-h":!0}),_(yt)!=="svelte-7wcvwl"&&(yt.innerHTML=Jn),No=a(ie),p(oe.$$.fragment,ie),Ao=a(ie),p(ne.$$.fragment,ie),ie.forEach(o),io.forEach(o),oo=a(e),p(Xe.$$.fragment,e),no=a(e),X=c(e,"DIV",{class:!0});var lo=w(X);p(Pe.$$.fragment,lo),Lo=a(lo),B=c(lo,"DIV",{class:!0});var le=w(B);p(qe.$$.fragment,le),Xo=a(le),Tt=c(le,"P",{"data-svelte-h":!0}),_(Tt)!=="svelte-b8oeq3"&&(Tt.innerHTML=kn),Po=a(le),p(se.$$.fragment,le),qo=a(le),p(ae.$$.fragment,le),le.forEach(o),lo.forEach(o),so=a(e),p(He.$$.fragment,e),ao=a(e),wt=c(e,"P",{}),w(wt).forEach(o),this.h()},h(){v(n,"name","hf:doc:metadata"),v(n,"content",Nn),v(F,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(I,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v($,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(O,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(K,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(U,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(lt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(R,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(W,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(j,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(N,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(C,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(V,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(L,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(B,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(X,"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,n),i(e,y,t),i(e,l,t),i(e,T,t),u(J,e,t),i(e,b,t),u(E,e,t),i(e,kt,t),i(e,de,t),i(e,Et,t),i(e,ce,t),i(e,Ut,t),i(e,me,t),i(e,jt,t),i(e,pe,t),i(e,Ct,t),i(e,ue,t),i(e,xt,t),i(e,he,t),i(e,It,t),u(S,e,t),i(e,$t,t),i(e,fe,t),i(e,zt,t),u(ge,e,t),i(e,Zt,t),u(_e,e,t),i(e,Wt,t),i(e,ye,t),i(e,Vt,t),u(Te,e,t),i(e,Bt,t),u(be,e,t),i(e,Ft,t),i(e,Me,t),i(e,Rt,t),u(we,e,t),i(e,Gt,t),u(ve,e,t),i(e,Qt,t),i(e,F,t),u(Je,F,null),r(F,mo),r(F,De),r(F,po),r(F,Oe),i(e,Nt,t),u(ke,e,t),i(e,At,t),i(e,I,t),u(Ee,I,null),r(I,uo),r(I,Ke),r(I,ho),r(I,et),r(I,fo),u(Y,I,null),i(e,Lt,t),u(Ue,e,t),i(e,Xt,t),i(e,$,t),u(je,$,null),r($,go),r($,tt),r($,_o),r($,ot),r($,yo),u(D,$,null),i(e,Pt,t),u(Ce,e,t),i(e,qt,t),i(e,U,t),u(xe,U,null),r(U,To),r(U,nt),r(U,bo),r(U,st),r(U,Mo),r(U,O),u(Ie,O,null),r(O,wo),r(O,at),r(U,vo),r(U,K),u($e,K,null),r(K,Jo),r(K,rt),i(e,Ht,t),u(ze,e,t),i(e,St,t),i(e,R,t),u(Ze,R,null),r(R,ko),r(R,it),r(R,Eo),r(R,lt),u(We,lt,null),i(e,Yt,t),u(Ve,e,t),i(e,Dt,t),i(e,j,t),u(Be,j,null),r(j,Uo),r(j,dt),r(j,jo),r(j,ct),r(j,Co),r(j,mt),r(j,xo),r(j,W),u(Fe,W,null),r(W,Io),r(W,pt),r(W,$o),r(W,ut),r(W,zo),u(ee,W,null),i(e,Ot,t),u(Re,e,t),i(e,Kt,t),i(e,C,t),u(Ge,C,null),r(C,Zo),r(C,ht),r(C,Wo),r(C,ft),r(C,Vo),r(C,gt),r(C,Bo),r(C,N),u(Qe,N,null),r(N,Fo),r(N,_t),r(N,Ro),u(te,N,null),i(e,eo,t),u(Ne,e,t),i(e,to,t),i(e,L,t),u(Ae,L,null),r(L,Go),r(L,V),u(Le,V,null),r(V,Qo),r(V,yt),r(V,No),u(oe,V,null),r(V,Ao),u(ne,V,null),i(e,oo,t),u(Xe,e,t),i(e,no,t),i(e,X,t),u(Pe,X,null),r(X,Lo),r(X,B),u(qe,B,null),r(B,Xo),r(B,Tt),r(B,Po),u(se,B,null),r(B,qo),u(ae,B,null),i(e,so,t),u(He,e,t),i(e,ao,t),i(e,wt,t),ro=!0},p(e,[t]){const P={};t&2&&(P.$$scope={dirty:t,ctx:e}),S.$set(P);const G={};t&2&&(G.$$scope={dirty:t,ctx:e}),Y.$set(G);const Q={};t&2&&(Q.$$scope={dirty:t,ctx:e}),D.$set(Q);const z={};t&2&&(z.$$scope={dirty:t,ctx:e}),ee.$set(z);const Se={};t&2&&(Se.$$scope={dirty:t,ctx:e}),te.$set(Se);const Ye={};t&2&&(Ye.$$scope={dirty:t,ctx:e}),oe.$set(Ye);const q={};t&2&&(q.$$scope={dirty:t,ctx:e}),ne.$set(q);const vt={};t&2&&(vt.$$scope={dirty:t,ctx:e}),se.$set(vt);const Z={};t&2&&(Z.$$scope={dirty:t,ctx:e}),ae.$set(Z)},i(e){ro||(h(J.$$.fragment,e),h(E.$$.fragment,e),h(S.$$.fragment,e),h(ge.$$.fragment,e),h(_e.$$.fragment,e),h(Te.$$.fragment,e),h(be.$$.fragment,e),h(we.$$.fragment,e),h(ve.$$.fragment,e),h(Je.$$.fragment,e),h(ke.$$.fragment,e),h(Ee.$$.fragment,e),h(Y.$$.fragment,e),h(Ue.$$.fragment,e),h(je.$$.fragment,e),h(D.$$.fragment,e),h(Ce.$$.fragment,e),h(xe.$$.fragment,e),h(Ie.$$.fragment,e),h($e.$$.fragment,e),h(ze.$$.fragment,e),h(Ze.$$.fragment,e),h(We.$$.fragment,e),h(Ve.$$.fragment,e),h(Be.$$.fragment,e),h(Fe.$$.fragment,e),h(ee.$$.fragment,e),h(Re.$$.fragment,e),h(Ge.$$.fragment,e),h(Qe.$$.fragment,e),h(te.$$.fragment,e),h(Ne.$$.fragment,e),h(Ae.$$.fragment,e),h(Le.$$.fragment,e),h(oe.$$.fragment,e),h(ne.$$.fragment,e),h(Xe.$$.fragment,e),h(Pe.$$.fragment,e),h(qe.$$.fragment,e),h(se.$$.fragment,e),h(ae.$$.fragment,e),h(He.$$.fragment,e),ro=!0)},o(e){f(J.$$.fragment,e),f(E.$$.fragment,e),f(S.$$.fragment,e),f(ge.$$.fragment,e),f(_e.$$.fragment,e),f(Te.$$.fragment,e),f(be.$$.fragment,e),f(we.$$.fragment,e),f(ve.$$.fragment,e),f(Je.$$.fragment,e),f(ke.$$.fragment,e),f(Ee.$$.fragment,e),f(Y.$$.fragment,e),f(Ue.$$.fragment,e),f(je.$$.fragment,e),f(D.$$.fragment,e),f(Ce.$$.fragment,e),f(xe.$$.fragment,e),f(Ie.$$.fragment,e),f($e.$$.fragment,e),f(ze.$$.fragment,e),f(Ze.$$.fragment,e),f(We.$$.fragment,e),f(Ve.$$.fragment,e),f(Be.$$.fragment,e),f(Fe.$$.fragment,e),f(ee.$$.fragment,e),f(Re.$$.fragment,e),f(Ge.$$.fragment,e),f(Qe.$$.fragment,e),f(te.$$.fragment,e),f(Ne.$$.fragment,e),f(Ae.$$.fragment,e),f(Le.$$.fragment,e),f(oe.$$.fragment,e),f(ne.$$.fragment,e),f(Xe.$$.fragment,e),f(Pe.$$.fragment,e),f(qe.$$.fragment,e),f(se.$$.fragment,e),f(ae.$$.fragment,e),f(He.$$.fragment,e),ro=!1},d(e){e&&(o(y),o(l),o(T),o(b),o(kt),o(de),o(Et),o(ce),o(Ut),o(me),o(jt),o(pe),o(Ct),o(ue),o(xt),o(he),o(It),o($t),o(fe),o(zt),o(Zt),o(Wt),o(ye),o(Vt),o(Bt),o(Ft),o(Me),o(Rt),o(Gt),o(Qt),o(F),o(Nt),o(At),o(I),o(Lt),o(Xt),o($),o(Pt),o(qt),o(U),o(Ht),o(St),o(R),o(Yt),o(Dt),o(j),o(Ot),o(Kt),o(C),o(eo),o(to),o(L),o(oo),o(no),o(X),o(so),o(ao),o(wt)),o(n),g(J,e),g(E,e),g(S,e),g(ge,e),g(_e,e),g(Te,e),g(be,e),g(we,e),g(ve,e),g(Je),g(ke,e),g(Ee),g(Y),g(Ue,e),g(je),g(D),g(Ce,e),g(xe),g(Ie),g($e),g(ze,e),g(Ze),g(We),g(Ve,e),g(Be),g(Fe),g(ee),g(Re,e),g(Ge),g(Qe),g(te),g(Ne,e),g(Ae),g(Le),g(oe),g(ne),g(Xe,e),g(Pe),g(qe),g(se),g(ae),g(He,e)}}}const Nn='{"title":"Emu3","local":"emu3","sections":[{"title":"Overview","local":"overview","sections":[],"depth":2},{"title":"Usage example","local":"usage-example","sections":[{"title":"Text generation inference","local":"text-generation-inference","sections":[],"depth":3},{"title":"Image generation inference","local":"image-generation-inference","sections":[],"depth":3}],"depth":2},{"title":"Emu3Config","local":"transformers.Emu3Config","sections":[],"depth":2},{"title":"Emu3VQVAEConfig","local":"transformers.Emu3VQVAEConfig","sections":[],"depth":2},{"title":"Emu3TextConfig","local":"transformers.Emu3TextConfig","sections":[],"depth":2},{"title":"Emu3Processor","local":"transformers.Emu3Processor","sections":[],"depth":2},{"title":"Emu3ImageProcessor","local":"transformers.Emu3ImageProcessor","sections":[],"depth":2},{"title":"Emu3VQVAE","local":"transformers.Emu3VQVAE","sections":[],"depth":2},{"title":"Emu3TextModel","local":"transformers.Emu3TextModel","sections":[],"depth":2},{"title":"Emu3ForCausalLM","local":"transformers.Emu3ForCausalLM","sections":[],"depth":2},{"title":"Emu3ForConditionalGeneration","local":"transformers.Emu3ForConditionalGeneration","sections":[],"depth":2}],"depth":1}';function An(M){return Un(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Dn extends jn{constructor(n){super(),Cn(this,n,An,Qn,En,{})}}export{Dn as component};
