import{s as Yn,o as Dn,n as P}from"../chunks/scheduler.01eeda35.js";import{S as On,i as Kn,g as c,s as r,r as p,m as ea,A as oa,h as d,f as a,c as i,j as I,x as b,u as g,n as ta,k as U,l as na,y as s,a as l,v as h,d as f,t as u,w as _}from"../chunks/index.6dd51b66.js";import{T as wt}from"../chunks/Tip.de9bae2b.js";import{D as j}from"../chunks/Docstring.cb556860.js";import{C as R}from"../chunks/CodeBlock.19ec9b8c.js";import{E as Jt}from"../chunks/ExampleCodeBlock.69db56ad.js";import{H as Q,E as aa}from"../chunks/index.58fe8f9d.js";import{H as sa,a as un}from"../chunks/HfOption.f7f04550.js";function ra(J){let o,y="Click on the Gemma 3 models in the right sidebar for more examples of how to apply Gemma to different vision and language tasks.";return{c(){o=c("p"),o.textContent=y},l(t){o=d(t,"P",{"data-svelte-h":!0}),b(o)!=="svelte-1vrs0gl"&&(o.textContent=y)},m(t,M){l(t,o,M)},p:P,d(t){t&&a(o)}}}function ia(J){let o,y;return o=new R({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwcGlwZWxpbmUlMEElMEFwaXBlbGluZSUyMCUzRCUyMHBpcGVsaW5lKCUwQSUyMCUyMCUyMCUyMHRhc2slM0QlMjJpbWFnZS10ZXh0LXRvLXRleHQlMjIlMkMlMEElMjAlMjAlMjAlMjBtb2RlbCUzRCUyMmdvb2dsZSUyRmdlbW1hLTMtNGItcHQlMjIlMkMlMEElMjAlMjAlMjAlMjBkZXZpY2UlM0QwJTJDJTBBJTIwJTIwJTIwJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5iZmxvYXQxNiUwQSklMEFwaXBlbGluZSglMEElMjAlMjAlMjAlMjAlMjJodHRwcyUzQSUyRiUyRmh1Z2dpbmdmYWNlLmNvJTJGZGF0YXNldHMlMkZodWdnaW5nZmFjZSUyRmRvY3VtZW50YXRpb24taW1hZ2VzJTJGcmVzb2x2ZSUyRm1haW4lMkZwaXBlbGluZS1jYXQtY2hvbmsuanBlZyUyMiUyQyUwQSUyMCUyMCUyMCUyMHRleHQlM0QlMjIlM0NzdGFydF9vZl9pbWFnZSUzRSUyMFdoYXQlMjBpcyUyMHNob3duJTIwaW4lMjB0aGlzJTIwaW1hZ2UlM0YlMjIlMEEp",highlighted:`<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> pipeline

pipeline = pipeline(
    task=<span class="hljs-string">&quot;image-text-to-text&quot;</span>,
    model=<span class="hljs-string">&quot;google/gemma-3-4b-pt&quot;</span>,
    device=<span class="hljs-number">0</span>,
    torch_dtype=torch.bfloat16
)
pipeline(
    <span class="hljs-string">&quot;https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/pipeline-cat-chonk.jpeg&quot;</span>,
    text=<span class="hljs-string">&quot;&lt;start_of_image&gt; What is shown in this image?&quot;</span>
)`,wrap:!1}}),{c(){p(o.$$.fragment)},l(t){g(o.$$.fragment,t)},m(t,M){h(o,t,M),y=!0},p:P,i(t){y||(f(o.$$.fragment,t),y=!0)},o(t){u(o.$$.fragment,t),y=!1},d(t){_(o,t)}}}function la(J){let o,y;return o=new R({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b1Byb2Nlc3NvciUyQyUyMEdlbW1hM0ZvckNvbmRpdGlvbmFsR2VuZXJhdGlvbiUwQSUwQW1vZGVsJTIwJTNEJTIwR2VtbWEzRm9yQ29uZGl0aW9uYWxHZW5lcmF0aW9uLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjAlMjJnb29nbGUlMkZnZW1tYS0zLTRiLWl0JTIyJTJDJTBBJTIwJTIwJTIwJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5iZmxvYXQxNiUyQyUwQSUyMCUyMCUyMCUyMGRldmljZV9tYXAlM0QlMjJhdXRvJTIyJTJDJTBBJTIwJTIwJTIwJTIwYXR0bl9pbXBsZW1lbnRhdGlvbiUzRCUyMnNkcGElMjIlMEEpJTBBcHJvY2Vzc29yJTIwJTNEJTIwQXV0b1Byb2Nlc3Nvci5mcm9tX3ByZXRyYWluZWQoJTBBJTIwJTIwJTIwJTIwJTIyZ29vZ2xlJTJGZ2VtbWEtMy00Yi1pdCUyMiUyQyUwQSUyMCUyMCUyMCUyMHBhZGRpbmdfc2lkZSUzRCUyMmxlZnQlMjIlMEEpJTBBJTBBbWVzc2FnZXMlMjAlM0QlMjAlNUIlMEElMjAlMjAlMjAlMjAlN0IlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjJyb2xlJTIyJTNBJTIwJTIyc3lzdGVtJTIyJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIyY29udGVudCUyMiUzQSUyMCU1QiUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCU3QiUyMnR5cGUlMjIlM0ElMjAlMjJ0ZXh0JTIyJTJDJTIwJTIydGV4dCUyMiUzQSUyMCUyMllvdSUyMGFyZSUyMGElMjBoZWxwZnVsJTIwYXNzaXN0YW50LiUyMiU3RCUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCU1RCUwQSUyMCUyMCUyMCUyMCU3RCUyQyUwQSUyMCUyMCUyMCUyMCU3QiUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMnJvbGUlMjIlM0ElMjAlMjJ1c2VyJTIyJTJDJTIwJTIyY29udGVudCUyMiUzQSUyMCU1QiUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCU3QiUyMnR5cGUlMjIlM0ElMjAlMjJpbWFnZSUyMiUyQyUyMCUyMnVybCUyMiUzQSUyMCUyMmh0dHBzJTNBJTJGJTJGaHVnZ2luZ2ZhY2UuY28lMkZkYXRhc2V0cyUyRmh1Z2dpbmdmYWNlJTJGZG9jdW1lbnRhdGlvbi1pbWFnZXMlMkZyZXNvbHZlJTJGbWFpbiUyRnBpcGVsaW5lLWNhdC1jaG9uay5qcGVnJTIyJTdEJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTdCJTIydHlwZSUyMiUzQSUyMCUyMnRleHQlMjIlMkMlMjAlMjJ0ZXh0JTIyJTNBJTIwJTIyV2hhdCUyMGlzJTIwc2hvd24lMjBpbiUyMHRoaXMlMjBpbWFnZSUzRiUyMiU3RCUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCU1RCUwQSUyMCUyMCUyMCUyMCU3RCUyQyUwQSU1RCUwQWlucHV0cyUyMCUzRCUyMHByb2Nlc3Nvci5hcHBseV9jaGF0X3RlbXBsYXRlKCUwQSUyMCUyMCUyMCUyMG1lc3NhZ2VzJTJDJTBBJTIwJTIwJTIwJTIwdG9rZW5pemUlM0RUcnVlJTJDJTBBJTIwJTIwJTIwJTIwcmV0dXJuX2RpY3QlM0RUcnVlJTJDJTBBJTIwJTIwJTIwJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMiUyQyUwQSUyMCUyMCUyMCUyMGFkZF9nZW5lcmF0aW9uX3Byb21wdCUzRFRydWUlMkMlMEEpLnRvKCUyMmN1ZGElMjIpJTBBJTBBb3V0cHV0JTIwJTNEJTIwbW9kZWwuZ2VuZXJhdGUoKippbnB1dHMlMkMlMjBtYXhfbmV3X3Rva2VucyUzRDUwJTJDJTIwY2FjaGVfaW1wbGVtZW50YXRpb24lM0QlMjJzdGF0aWMlMjIpJTBBcHJpbnQocHJvY2Vzc29yLmRlY29kZShvdXRwdXQlNUIwJTVEJTJDJTIwc2tpcF9zcGVjaWFsX3Rva2VucyUzRFRydWUpKQ==",highlighted:`<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoProcessor, Gemma3ForConditionalGeneration

model = Gemma3ForConditionalGeneration.from_pretrained(
    <span class="hljs-string">&quot;google/gemma-3-4b-it&quot;</span>,
    torch_dtype=torch.bfloat16,
    device_map=<span class="hljs-string">&quot;auto&quot;</span>,
    attn_implementation=<span class="hljs-string">&quot;sdpa&quot;</span>
)
processor = AutoProcessor.from_pretrained(
    <span class="hljs-string">&quot;google/gemma-3-4b-it&quot;</span>,
    padding_side=<span class="hljs-string">&quot;left&quot;</span>
)

messages = [
    {
        <span class="hljs-string">&quot;role&quot;</span>: <span class="hljs-string">&quot;system&quot;</span>,
        <span class="hljs-string">&quot;content&quot;</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-string">&quot;role&quot;</span>: <span class="hljs-string">&quot;user&quot;</span>, <span class="hljs-string">&quot;content&quot;</span>: [
            {<span class="hljs-string">&quot;type&quot;</span>: <span class="hljs-string">&quot;image&quot;</span>, <span class="hljs-string">&quot;url&quot;</span>: <span class="hljs-string">&quot;https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/pipeline-cat-chonk.jpeg&quot;</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;What is shown in this image?&quot;</span>},
        ]
    },
]
inputs = processor.apply_chat_template(
    messages,
    tokenize=<span class="hljs-literal">True</span>,
    return_dict=<span class="hljs-literal">True</span>,
    return_tensors=<span class="hljs-string">&quot;pt&quot;</span>,
    add_generation_prompt=<span class="hljs-literal">True</span>,
).to(<span class="hljs-string">&quot;cuda&quot;</span>)

output = model.generate(**inputs, max_new_tokens=<span class="hljs-number">50</span>, cache_implementation=<span class="hljs-string">&quot;static&quot;</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}}),{c(){p(o.$$.fragment)},l(t){g(o.$$.fragment,t)},m(t,M){h(o,t,M),y=!0},p:P,i(t){y||(f(o.$$.fragment,t),y=!0)},o(t){u(o.$$.fragment,t),y=!1},d(t){_(o,t)}}}function ca(J){let o,y;return o=new R({props:{code:"ZWNobyUyMC1lJTIwJTIyUGxhbnRzJTIwY3JlYXRlJTIwZW5lcmd5JTIwdGhyb3VnaCUyMGElMjBwcm9jZXNzJTIwa25vd24lMjBhcyUyMiUyMCU3QyUyMHRyYW5zZm9ybWVycy1jbGklMjBydW4lMjAtLXRhc2slMjB0ZXh0LWdlbmVyYXRpb24lMjAtLW1vZGVsJTIwZ29vZ2xlJTJGZ2VtbWEtMy0xYi1wdCUyMC0tZGV2aWNlJTIwMA==",highlighted:'<span class="hljs-built_in">echo</span> -e <span class="hljs-string">&quot;Plants create energy through a process known as&quot;</span> | transformers-cli run --task text-generation --model google/gemma-3-1b-pt --device 0',wrap:!1}}),{c(){p(o.$$.fragment)},l(t){g(o.$$.fragment,t)},m(t,M){h(o,t,M),y=!0},p:P,i(t){y||(f(o.$$.fragment,t),y=!0)},o(t){u(o.$$.fragment,t),y=!1},d(t){_(o,t)}}}function da(J){let o,y,t,M,w,m;return o=new un({props:{id:"usage",option:"Pipeline",$$slots:{default:[ia]},$$scope:{ctx:J}}}),t=new un({props:{id:"usage",option:"AutoModel",$$slots:{default:[la]},$$scope:{ctx:J}}}),w=new un({props:{id:"usage",option:"transformers-cli",$$slots:{default:[ca]},$$scope:{ctx:J}}}),{c(){p(o.$$.fragment),y=r(),p(t.$$.fragment),M=r(),p(w.$$.fragment)},l(T){g(o.$$.fragment,T),y=i(T),g(t.$$.fragment,T),M=i(T),g(w.$$.fragment,T)},m(T,v){h(o,T,v),l(T,y,v),h(t,T,v),l(T,M,v),h(w,T,v),m=!0},p(T,v){const he={};v&2&&(he.$$scope={dirty:v,ctx:T}),o.$set(he);const A={};v&2&&(A.$$scope={dirty:v,ctx:T}),t.$set(A);const Ro={};v&2&&(Ro.$$scope={dirty:v,ctx:T}),w.$set(Ro)},i(T){m||(f(o.$$.fragment,T),f(t.$$.fragment,T),f(w.$$.fragment,T),m=!0)},o(T){u(o.$$.fragment,T),u(t.$$.fragment,T),u(w.$$.fragment,T),m=!1},d(T){T&&(a(y),a(M)),_(o,T),_(t,T),_(w,T)}}}function ma(J){let o,y;return o=new R({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEdlbW1hM1RleHRNb2RlbCUyQyUyMEdlbW1hM1RleHRDb25maWclMEElMjMlMjBJbml0aWFsaXppbmclMjBhJTIwR2VtbWEzVGV4dCUyMGdlbW1hM190ZXh0LTdiJTIwc3R5bGUlMjBjb25maWd1cmF0aW9uJTBBY29uZmlndXJhdGlvbiUyMCUzRCUyMEdlbW1hM1RleHRDb25maWcoKSUwQSUyMyUyMEluaXRpYWxpemluZyUyMGElMjBtb2RlbCUyMGZyb20lMjB0aGUlMjBnZW1tYTNfdGV4dC03YiUyMHN0eWxlJTIwY29uZmlndXJhdGlvbiUwQW1vZGVsJTIwJTNEJTIwR2VtbWEzVGV4dE1vZGVsKGNvbmZpZ3VyYXRpb24pJTBBJTIzJTIwQWNjZXNzaW5nJTIwdGhlJTIwbW9kZWwlMjBjb25maWd1cmF0aW9uJTBBY29uZmlndXJhdGlvbiUyMCUzRCUyMG1vZGVsLmNvbmZpZw==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> Gemma3TextModel, Gemma3TextConfig
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a Gemma3Text gemma3_text-7b style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = Gemma3TextConfig()
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a model from the gemma3_text-7b style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = Gemma3TextModel(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(){p(o.$$.fragment)},l(t){g(o.$$.fragment,t)},m(t,M){h(o,t,M),y=!0},p:P,i(t){y||(f(o.$$.fragment,t),y=!0)},o(t){u(o.$$.fragment,t),y=!1},d(t){_(o,t)}}}function pa(J){let o,y="Example:",t,M,w;return M=new R({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEdlbW1hM0ZvckNvbmRpdGlvbmFsR2VuZXJhdGlvbiUyQyUyMEdlbW1hM0NvbmZpZyUyQyUyMFNpZ2xpcFZpc2lvbkNvbmZpZyUyQyUyMEdlbW1hM1RleHRDb25maWclMEElMEElMjMlMjBJbml0aWFsaXppbmclMjBhJTIwU2lnbGlwLWxpa2UlMjB2aXNpb24lMjBjb25maWclMEF2aXNpb25fY29uZmlnJTIwJTNEJTIwU2lnbGlwVmlzaW9uQ29uZmlnKCklMEElMEElMjMlMjBJbml0aWFsaXppbmclMjBhJTIwR2VtbWEzJTIwVGV4dCUyMGNvbmZpZyUwQXRleHRfY29uZmlnJTIwJTNEJTIwR2VtbWEzVGV4dENvbmZpZygpJTBBJTBBJTIzJTIwSW5pdGlhbGl6aW5nJTIwYSUyMEdlbW1hMyUyMGdlbW1hLTMtNGIlMjBzdHlsZSUyMGNvbmZpZ3VyYXRpb24lMEFjb25maWd1cmF0aW9uJTIwJTNEJTIwR2VtbWEzQ29uZmlnKHZpc2lvbl9jb25maWclMkMlMjB0ZXh0X2NvbmZpZyklMEElMEElMjMlMjBJbml0aWFsaXppbmclMjBhJTIwbW9kZWwlMjBmcm9tJTIwdGhlJTIwZ2VtbWEtMy00YiUyMHN0eWxlJTIwY29uZmlndXJhdGlvbiUwQW1vZGVsJTIwJTNEJTIwR2VtbWEzVGV4dENvbmZpZyhjb25maWd1cmF0aW9uKSUwQSUwQSUyMyUyMEFjY2Vzc2luZyUyMHRoZSUyMG1vZGVsJTIwY29uZmlndXJhdGlvbiUwQWNvbmZpZ3VyYXRpb24lMjAlM0QlMjBtb2RlbC5jb25maWc=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> Gemma3ForConditionalGeneration, Gemma3Config, SiglipVisionConfig, Gemma3TextConfig

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a Siglip-like vision config</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>vision_config = SiglipVisionConfig()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a Gemma3 Text config</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>text_config = Gemma3TextConfig()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a Gemma3 gemma-3-4b style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = Gemma3Config(vision_config, text_config)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a model from the gemma-3-4b style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = Gemma3TextConfig(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(){o=c("p"),o.textContent=y,t=r(),p(M.$$.fragment)},l(m){o=d(m,"P",{"data-svelte-h":!0}),b(o)!=="svelte-11lpom8"&&(o.textContent=y),t=i(m),g(M.$$.fragment,m)},m(m,T){l(m,o,T),l(m,t,T),h(M,m,T),w=!0},p:P,i(m){w||(f(M.$$.fragment,m),w=!0)},o(m){u(M.$$.fragment,m),w=!1},d(m){m&&(a(o),a(t)),_(M,m)}}}function ga(J){let o,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(){o=c("p"),o.innerHTML=y},l(t){o=d(t,"P",{"data-svelte-h":!0}),b(o)!=="svelte-fincs2"&&(o.innerHTML=y)},m(t,M){l(t,o,M)},p:P,d(t){t&&a(o)}}}function ha(J){let o,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(){o=c("p"),o.innerHTML=y},l(t){o=d(t,"P",{"data-svelte-h":!0}),b(o)!=="svelte-fincs2"&&(o.innerHTML=y)},m(t,M){l(t,o,M)},p:P,d(t){t&&a(o)}}}function fa(J){let o,y="Example:",t,M,w;return M=new R({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBHZW1tYTNGb3JDYXVzYWxMTSUwQSUwQW1vZGVsJTIwJTNEJTIwR2VtbWEzRm9yQ2F1c2FsTE0uZnJvbV9wcmV0cmFpbmVkKCUyMmdvb2dsZSUyRmdlbW1hLTItOWIlMjIpJTBBdG9rZW5pemVyJTIwJTNEJTIwQXV0b1Rva2VuaXplci5mcm9tX3ByZXRyYWluZWQoJTIyZ29vZ2xlJTJGZ2VtbWEtMi05YiUyMiklMEElMEFwcm9tcHQlMjAlM0QlMjAlMjJXaGF0JTIwaXMlMjB5b3VyJTIwZmF2b3JpdGUlMjBjb25kaW1lbnQlM0YlMjIlMEFpbnB1dHMlMjAlM0QlMjB0b2tlbml6ZXIocHJvbXB0JTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMiklMEElMEElMjMlMjBHZW5lcmF0ZSUwQWdlbmVyYXRlX2lkcyUyMCUzRCUyMG1vZGVsLmdlbmVyYXRlKGlucHV0cy5pbnB1dF9pZHMlMkMlMjBtYXhfbGVuZ3RoJTNEMzApJTBBdG9rZW5pemVyLmJhdGNoX2RlY29kZShnZW5lcmF0ZV9pZHMlMkMlMjBza2lwX3NwZWNpYWxfdG9rZW5zJTNEVHJ1ZSUyQyUyMGNsZWFuX3VwX3Rva2VuaXphdGlvbl9zcGFjZXMlM0RGYWxzZSklNUIwJTVE",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, Gemma3ForCausalLM

<span class="hljs-meta">&gt;&gt;&gt; </span>model = Gemma3ForCausalLM.from_pretrained(<span class="hljs-string">&quot;google/gemma-2-9b&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;google/gemma-2-9b&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>prompt = <span class="hljs-string">&quot;What is your favorite condiment?&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(prompt, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Generate</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>generate_ids = model.generate(inputs.input_ids, max_length=<span class="hljs-number">30</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer.batch_decode(generate_ids, skip_special_tokens=<span class="hljs-literal">True</span>, clean_up_tokenization_spaces=<span class="hljs-literal">False</span>)[<span class="hljs-number">0</span>]
<span class="hljs-string">&quot;What is your favorite condiment?&quot;</span>`,wrap:!1}}),{c(){o=c("p"),o.textContent=y,t=r(),p(M.$$.fragment)},l(m){o=d(m,"P",{"data-svelte-h":!0}),b(o)!=="svelte-11lpom8"&&(o.textContent=y),t=i(m),g(M.$$.fragment,m)},m(m,T){l(m,o,T),l(m,t,T),h(M,m,T),w=!0},p:P,i(m){w||(f(M.$$.fragment,m),w=!0)},o(m){u(M.$$.fragment,m),w=!1},d(m){m&&(a(o),a(t)),_(M,m)}}}function ua(J){let o,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(){o=c("p"),o.innerHTML=y},l(t){o=d(t,"P",{"data-svelte-h":!0}),b(o)!=="svelte-fincs2"&&(o.innerHTML=y)},m(t,M){l(t,o,M)},p:P,d(t){t&&a(o)}}}function _a(J){let o,y="Example:",t,M,w;return M=new R({props:{code:"ZnJvbSUyMFBJTCUyMGltcG9ydCUyMEltYWdlJTBBaW1wb3J0JTIwcmVxdWVzdHMlMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b1Byb2Nlc3NvciUyQyUyMEdlbW1hM0ZvckNvbmRpdGlvbmFsR2VuZXJhdGlvbiUwQSUwQW1vZGVsJTIwJTNEJTIwR2VtbWEzRm9yQ29uZGl0aW9uYWxHZW5lcmF0aW9uLmZyb21fcHJldHJhaW5lZCglMjJnb29nbGUlMkZnZW1tYS0zLTRiLWl0JTIyKSUwQXByb2Nlc3NvciUyMCUzRCUyMEF1dG9Qcm9jZXNzb3IuZnJvbV9wcmV0cmFpbmVkKCUyMmdvb2dsZSUyRmdlbW1hLTMtNGItaXQlMjIpJTBBJTBBbWVzc2FnZXMlMjAlM0QlMjAlNUIlMEElMjAlMjAlMjAlMjAlN0IlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjJyb2xlJTIyJTNBJTIwJTIyc3lzdGVtJTIyJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIyY29udGVudCUyMiUzQSUyMCU1QiUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCU3QiUyMnR5cGUlMjIlM0ElMjAlMjJ0ZXh0JTIyJTJDJTIwJTIydGV4dCUyMiUzQSUyMCUyMllvdSUyMGFyZSUyMGElMjBoZWxwZnVsJTIwYXNzaXN0YW50LiUyMiU3RCUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCU1RCUwQSUyMCUyMCUyMCUyMCU3RCUyQyUwQSUyMCUyMCUyMCUyMCU3QiUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMnJvbGUlMjIlM0ElMjAlMjJ1c2VyJTIyJTJDJTIwJTIyY29udGVudCUyMiUzQSUyMCU1QiUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCU3QiUyMnR5cGUlMjIlM0ElMjAlMjJpbWFnZSUyMiUyQyUyMCUyMnVybCUyMiUzQSUyMCUyMmh0dHBzJTNBJTJGJTJGaHVnZ2luZ2ZhY2UuY28lMkZkYXRhc2V0cyUyRmh1Z2dpbmdmYWNlJTJGZG9jdW1lbnRhdGlvbi1pbWFnZXMlMkZyZXNvbHZlJTJGbWFpbiUyRnBpcGVsaW5lLWNhdC1jaG9uay5qcGVnJTIyJTdEJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTdCJTIydHlwZSUyMiUzQSUyMCUyMnRleHQlMjIlMkMlMjAlMjJ0ZXh0JTIyJTNBJTIwJTIyV2hlcmUlMjBpcyUyMHRoZSUyMGNhdCUyMHN0YW5kaW5nJTNGJTIyJTdEJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTVEJTBBJTIwJTIwJTIwJTIwJTdEJTJDJTBBJTVEJTBBJTBBaW5wdXRzJTIwJTNEJTIwcHJvY2Vzc29yLmFwcGx5X2NoYXRfdGVtcGxhdGUoJTBBJTIwJTIwJTIwJTIwbWVzc2FnZXMlMkMlMEElMjAlMjAlMjAlMjB0b2tlbml6ZXIlM0RUcnVlJTJDJTBBJTIwJTIwJTIwJTIwcmV0dXJuX2RpY3QlM0RUcnVlJTJDJTBBJTIwJTIwJTIwJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMiUyQyUwQSUyMCUyMCUyMCUyMGFkZF9nZW5lcmF0aW9uX3Byb21wdCUzRFRydWUlMEEpJTBBJTIzJTIwR2VuZXJhdGUlMEFnZW5lcmF0ZV9pZHMlMjAlM0QlMjBtb2RlbC5nZW5lcmF0ZSgqKmlucHV0cyklMEFwcm9jZXNzb3IuYmF0Y2hfZGVjb2RlKGdlbmVyYXRlX2lkcyUyQyUyMHNraXBfc3BlY2lhbF90b2tlbnMlM0RUcnVlJTJDJTIwY2xlYW5fdXBfdG9rZW5pemF0aW9uX3NwYWNlcyUzREZhbHNlKSU1QjAlNUQ=",highlighted:`<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><span class="hljs-keyword">import</span> requests
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoProcessor, Gemma3ForConditionalGeneration

<span class="hljs-meta">&gt;&gt;&gt; </span>model = Gemma3ForConditionalGeneration.from_pretrained(<span class="hljs-string">&quot;google/gemma-3-4b-it&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>processor = AutoProcessor.from_pretrained(<span class="hljs-string">&quot;google/gemma-3-4b-it&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>messages = [
<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-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-string">&quot;url&quot;</span>: <span class="hljs-string">&quot;https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/pipeline-cat-chonk.jpeg&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;Where is the cat standing?&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>inputs = processor.apply_chat_template(
<span class="hljs-meta">... </span>    messages,
<span class="hljs-meta">... </span>    tokenizer=<span class="hljs-literal">True</span>,
<span class="hljs-meta">... </span>    return_dict=<span class="hljs-literal">True</span>,
<span class="hljs-meta">... </span>    return_tensors=<span class="hljs-string">&quot;pt&quot;</span>,
<span class="hljs-meta">... </span>    add_generation_prompt=<span class="hljs-literal">True</span>
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Generate</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>generate_ids = model.generate(**inputs)
<span class="hljs-meta">&gt;&gt;&gt; </span>processor.batch_decode(generate_ids, skip_special_tokens=<span class="hljs-literal">True</span>, clean_up_tokenization_spaces=<span class="hljs-literal">False</span>)[<span class="hljs-number">0</span>]
<span class="hljs-string">&quot;user\\nYou are a helpful assistant.\\n\\n\\n\\n\\n\\nWhere is the cat standing?\\nmodel\\nBased on the image, the cat is standing in a snowy area, likely outdoors. It appears to&quot;</span>`,wrap:!1}}),{c(){o=c("p"),o.textContent=y,t=r(),p(M.$$.fragment)},l(m){o=d(m,"P",{"data-svelte-h":!0}),b(o)!=="svelte-11lpom8"&&(o.textContent=y),t=i(m),g(M.$$.fragment,m)},m(m,T){l(m,o,T),l(m,t,T),h(M,m,T),w=!0},p:P,i(m){w||(f(M.$$.fragment,m),w=!0)},o(m){u(M.$$.fragment,m),w=!1},d(m){m&&(a(o),a(t)),_(M,m)}}}function ya(J){let o,y,t,M,w,m='<div class="flex flex-wrap space-x-1"><img alt="PyTorch" src="https://img.shields.io/badge/PyTorch-DE3412?style=flat&amp;logo=pytorch&amp;logoColor=white"/> <img alt="SDPA" src="https://img.shields.io/badge/SDPA-DE3412?style=flat&amp;logo=pytorch&amp;logoColor=white"/></div>',T,v,he,A,Ro='<a href="https://goo.gle/Gemma3Report" rel="nofollow">Gemma 3</a> is a multimodal model with pretrained and instruction-tuned variants, available in 1B, 13B, and 27B parameters. The architecture is mostly the same as the previous Gemma versions. The key differences are alternating 5 local sliding window self-attention layers for every global self-attention layer, support for a longer context length of 128K tokens, and a <a href="./siglip">SigLip</a> encoder that can “pan &amp; scan” high-resolution images to prevent information from disappearing in high resolution images or images with non-square aspect ratios.',No,fe,_n="The instruction-tuned variant was post-trained with knowledge distillation and reinforcement learning.",Eo,ue,yn='You can find all the original Gemma 3 checkpoints under the <a href="https://huggingface.co/collections/meta-llama/llama-2-family-661da1f90a9d678b6f55773b" rel="nofollow">Gemma 3</a> release.',Po,H,Ao,_e,Mn='The example below demonstrates how to generate text based on an image with <a href="/docs/transformers/main/en/main_classes/pipelines#transformers.Pipeline">Pipeline</a> or the <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoModel">AutoModel</a> class.',Vo,Y,Lo,ye,Tn='Quantization reduces the memory burden of large models by representing the weights in a lower precision. Refer to the <a href="../quantization/overview">Quantization</a> overview for more available quantization backends.',Xo,Me,bn='The example below uses <a href="../quantization/torchao">torchao</a> to only quantize the weights to int4.',Qo,Te,So,be,wn='Use the <a href="https://github.com/huggingface/transformers/blob/beb9b5b02246b9b7ee81ddf938f93f44cfeaad19/src/transformers/utils/attention_visualizer.py#L139" rel="nofollow">AttentionMaskVisualizer</a> to better understand what tokens the model can and cannot attend to.',Ho,we,Yo,D,Jn='<img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/model_doc/gemma-3-attn-mask.png"/>',Do,Je,Oo,C,co,In='<p>Use <a href="/docs/transformers/main/en/model_doc/gemma3#transformers.Gemma3ForConditionalGeneration">Gemma3ForConditionalGeneration</a> for image-and-text and image-only inputs.</p>',It,Ie,mo,vn="Gemma 3 supports multiple input images, but make sure the images are correctly batched before passing them to the processor. Each batch should be a list of one or more images.",vt,ve,Ut,po,Un="<p>Text passed to the processor should have a <code>&lt;start_of_image&gt;</code> token wherever an image should be inserted.</p>",jt,go,jn='<p>The processor has its own <a href="/docs/transformers/main/en/main_classes/processors#transformers.ProcessorMixin.apply_chat_template">apply_chat_template()</a> method to convert chat messages to model inputs.</p>',Ct,Ue,ho,Cn="By default, images aren’t cropped and only the base image is forwarded to the model. In high resolution images or images with non-square aspect ratios, artifacts can result because the vision encoder uses a fixed resolution of 896x896. To prevent these artifacts and improve performance during inference, set <code>do_pan_and_scan=True</code> to crop the image into multiple smaller patches and concatenate them with the base image embedding. You can disable pan and scan for faster inference.",Gt,je,xt,Ce,fo,Gn='For Gemma-3 1B checkpoint trained in text-only mode, use <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoModelForCausalLM">AutoModelForCausalLM</a> instead.',$t,Ge,Ko,xe,et,k,$e,kt,uo,xn="Constructs a SigLIP image processor.",zt,O,ke,qt,_o,$n=`Pan and Scan and image, by cropping into smaller images when the aspect ratio exceeds
minumum allowed ratio.`,Wt,K,ze,Zt,yo,kn="Preprocess an image or batch of images.",ot,qe,tt,z,We,Ft,Mo,zn='Constructs a fast ConvNeXT image processor. Based on <a href="/docs/transformers/main/en/model_doc/siglip#transformers.SiglipImageProcessor">SiglipImageProcessor</a> with incorporation of Pan adn Scan cropping method.',Rt,ee,Ze,Bt,To,qn=`Pan and Scan an image, by cropping into smaller images when the aspect ratio exceeds
minumum allowed ratio.`,Nt,oe,Fe,Et,bo,Wn="Preprocess an image or batch of images.",nt,Re,at,B,Be,Pt,te,Ne,At,wo,Zn=`This method forwards all its arguments to GemmaTokenizerFast’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.`,Vt,ne,Ee,Lt,Jo,Fn=`This method forwards all its arguments to GemmaTokenizerFast’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.`,st,Pe,rt,W,Ae,Xt,Io,Rn=`This is the configuration class to store the configuration of a <a href="/docs/transformers/main/en/model_doc/gemma3#transformers.Gemma3TextModel">Gemma3TextModel</a>. It is used to instantiate an Gemma3Text
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 Gemma3Text-7B.
e.g. <a href="https://huggingface.co/google/gemma3_text-7b" rel="nofollow">google/gemma3_text-7b</a>
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.`,Qt,ae,St,it,Ve,lt,G,Le,Ht,vo,Bn=`This is the configuration class to store the configuration of a <a href="/docs/transformers/main/en/model_doc/gemma3#transformers.Gemma3ForConditionalGeneration">Gemma3ForConditionalGeneration</a>. It is used to instantiate an
Gemma3ForConditionalGeneration according to the specified arguments, defining the model architecture. Instantiating a configuration
with the defaults will yield a similar configuration to that of the PaliGemma-2B.`,Yt,Uo,Nn='e.g. <a href="https://huggingface.co/google/gemma-3-4b" rel="nofollow">google/gemma-3-4b</a>',Dt,jo,En=`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.`,Ot,se,ct,Xe,dt,x,Qe,Kt,Co,Pn=`The bare Gemma3Text 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.)`,en,Go,An=`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.`,on,xo,Vn="Transformer decoder consisting of <em>config.num_hidden_layers</em> layers. Each layer is a <code>Gemma3TextDecoderLayer</code>",tn,V,Se,nn,$o,Ln='The <a href="/docs/transformers/main/en/model_doc/gemma3#transformers.Gemma3TextModel">Gemma3TextModel</a> forward method, overrides the <code>__call__</code> special method.',an,re,mt,He,pt,S,Ye,sn,Z,De,rn,ko,Xn='The <a href="/docs/transformers/main/en/model_doc/gemma3#transformers.Gemma3ForCausalLM">Gemma3ForCausalLM</a> forward method, overrides the <code>__call__</code> special method.',ln,ie,cn,le,gt,Oe,ht,q,Ke,dn,zo,Qn=`The GEMMA3 model which consists of a vision backbone and a language model.
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.)`,mn,qo,Sn=`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.`,pn,F,eo,gn,Wo,Hn='The <a href="/docs/transformers/main/en/model_doc/gemma3#transformers.Gemma3ForConditionalGeneration">Gemma3ForConditionalGeneration</a> forward method, overrides the <code>__call__</code> special method.',hn,ce,fn,de,ft,oo,ut,Bo,_t;return v=new Q({props:{title:"Gemma 3",local:"gemma-3",headingTag:"h1"}}),H=new wt({props:{warning:!1,$$slots:{default:[ra]},$$scope:{ctx:J}}}),Y=new sa({props:{id:"usage",options:["Pipeline","AutoModel","transformers-cli"],$$slots:{default:[da]},$$scope:{ctx:J}}}),Te=new R({props:{code:"JTIzJTIwcGlwJTIwaW5zdGFsbCUyMHRvcmNoYW8lMEFpbXBvcnQlMjB0b3JjaCUwQWZyb20lMjB0cmFuc2Zvcm1lcnMlMjBpbXBvcnQlMjBUb3JjaEFvQ29uZmlnJTJDJTIwR2VtbWEzRm9yQ29uZGl0aW9uYWxHZW5lcmF0aW9uJTJDJTIwQXV0b1Byb2Nlc3NvciUwQSUwQXF1YW50aXphdGlvbl9jb25maWclMjAlM0QlMjBUb3JjaEFvQ29uZmlnKCUyMmludDRfd2VpZ2h0X29ubHklMjIlMkMlMjBncm91cF9zaXplJTNEMTI4KSUwQW1vZGVsJTIwJTNEJTIwR2VtbWEzRm9yQ29uZGl0aW9uYWxHZW5lcmF0aW9uLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjAlMjJnb29nbGUlMkZnZW1tYS0zLTI3Yi1pdCUyMiUyQyUwQSUyMCUyMCUyMCUyMHRvcmNoX2R0eXBlJTNEdG9yY2guYmZsb2F0MTYlMkMlMEElMjAlMjAlMjAlMjBkZXZpY2VfbWFwJTNEJTIyYXV0byUyMiUyQyUwQSUyMCUyMCUyMCUyMHF1YW50aXphdGlvbl9jb25maWclM0RxdWFudGl6YXRpb25fY29uZmlnJTBBKSUwQXByb2Nlc3NvciUyMCUzRCUyMEF1dG9Qcm9jZXNzb3IuZnJvbV9wcmV0cmFpbmVkKCUwQSUyMCUyMCUyMCUyMCUyMmdvb2dsZSUyRmdlbW1hLTMtMjdiLWl0JTIyJTJDJTBBJTIwJTIwJTIwJTIwcGFkZGluZ19zaWRlJTNEJTIybGVmdCUyMiUwQSklMEElMEFtZXNzYWdlcyUyMCUzRCUyMCU1QiUwQSUyMCUyMCUyMCUyMCU3QiUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMnJvbGUlMjIlM0ElMjAlMjJzeXN0ZW0lMjIlMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjJjb250ZW50JTIyJTNBJTIwJTVCJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTdCJTIydHlwZSUyMiUzQSUyMCUyMnRleHQlMjIlMkMlMjAlMjJ0ZXh0JTIyJTNBJTIwJTIyWW91JTIwYXJlJTIwYSUyMGhlbHBmdWwlMjBhc3Npc3RhbnQuJTIyJTdEJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTVEJTBBJTIwJTIwJTIwJTIwJTdEJTJDJTBBJTIwJTIwJTIwJTIwJTdCJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIycm9sZSUyMiUzQSUyMCUyMnVzZXIlMjIlMkMlMjAlMjJjb250ZW50JTIyJTNBJTIwJTVCJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTdCJTIydHlwZSUyMiUzQSUyMCUyMmltYWdlJTIyJTJDJTIwJTIydXJsJTIyJTNBJTIwJTIyaHR0cHMlM0ElMkYlMkZodWdnaW5nZmFjZS5jbyUyRmRhdGFzZXRzJTJGaHVnZ2luZ2ZhY2UlMkZkb2N1bWVudGF0aW9uLWltYWdlcyUyRnJlc29sdmUlMkZtYWluJTJGcGlwZWxpbmUtY2F0LWNob25rLmpwZWclMjIlN0QlMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlN0IlMjJ0eXBlJTIyJTNBJTIwJTIydGV4dCUyMiUyQyUyMCUyMnRleHQlMjIlM0ElMjAlMjJXaGF0JTIwaXMlMjBzaG93biUyMGluJTIwdGhpcyUyMGltYWdlJTNGJTIyJTdEJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTVEJTBBJTIwJTIwJTIwJTIwJTdEJTJDJTBBJTVEJTBBaW5wdXRzJTIwJTNEJTIwcHJvY2Vzc29yLmFwcGx5X2NoYXRfdGVtcGxhdGUoJTBBJTIwJTIwJTIwJTIwbWVzc2FnZXMlMkMlMEElMjAlMjAlMjAlMjB0b2tlbml6ZSUzRFRydWUlMkMlMEElMjAlMjAlMjAlMjByZXR1cm5fZGljdCUzRFRydWUlMkMlMEElMjAlMjAlMjAlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyJTJDJTBBJTIwJTIwJTIwJTIwYWRkX2dlbmVyYXRpb25fcHJvbXB0JTNEVHJ1ZSUyQyUwQSkudG8oJTIyY3VkYSUyMiklMEElMEFvdXRwdXQlMjAlM0QlMjBtb2RlbC5nZW5lcmF0ZSgqKmlucHV0cyUyQyUyMG1heF9uZXdfdG9rZW5zJTNENTAlMkMlMjBjYWNoZV9pbXBsZW1lbnRhdGlvbiUzRCUyMnN0YXRpYyUyMiklMEFwcmludChwcm9jZXNzb3IuZGVjb2RlKG91dHB1dCU1QjAlNUQlMkMlMjBza2lwX3NwZWNpYWxfdG9rZW5zJTNEVHJ1ZSkp",highlighted:`<span class="hljs-comment"># pip install torchao</span>
<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> TorchAoConfig, Gemma3ForConditionalGeneration, AutoProcessor

quantization_config = TorchAoConfig(<span class="hljs-string">&quot;int4_weight_only&quot;</span>, group_size=<span class="hljs-number">128</span>)
model = Gemma3ForConditionalGeneration.from_pretrained(
    <span class="hljs-string">&quot;google/gemma-3-27b-it&quot;</span>,
    torch_dtype=torch.bfloat16,
    device_map=<span class="hljs-string">&quot;auto&quot;</span>,
    quantization_config=quantization_config
)
processor = AutoProcessor.from_pretrained(
    <span class="hljs-string">&quot;google/gemma-3-27b-it&quot;</span>,
    padding_side=<span class="hljs-string">&quot;left&quot;</span>
)

messages = [
    {
        <span class="hljs-string">&quot;role&quot;</span>: <span class="hljs-string">&quot;system&quot;</span>,
        <span class="hljs-string">&quot;content&quot;</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-string">&quot;role&quot;</span>: <span class="hljs-string">&quot;user&quot;</span>, <span class="hljs-string">&quot;content&quot;</span>: [
            {<span class="hljs-string">&quot;type&quot;</span>: <span class="hljs-string">&quot;image&quot;</span>, <span class="hljs-string">&quot;url&quot;</span>: <span class="hljs-string">&quot;https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/pipeline-cat-chonk.jpeg&quot;</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;What is shown in this image?&quot;</span>},
        ]
    },
]
inputs = processor.apply_chat_template(
    messages,
    tokenize=<span class="hljs-literal">True</span>,
    return_dict=<span class="hljs-literal">True</span>,
    return_tensors=<span class="hljs-string">&quot;pt&quot;</span>,
    add_generation_prompt=<span class="hljs-literal">True</span>,
).to(<span class="hljs-string">&quot;cuda&quot;</span>)

output = model.generate(**inputs, max_new_tokens=<span class="hljs-number">50</span>, cache_implementation=<span class="hljs-string">&quot;static&quot;</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}}),we=new R({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycy51dGlscy5hdHRlbnRpb25fdmlzdWFsaXplciUyMGltcG9ydCUyMEF0dGVudGlvbk1hc2tWaXN1YWxpemVyJTBBJTBBdmlzdWFsaXplciUyMCUzRCUyMEF0dGVudGlvbk1hc2tWaXN1YWxpemVyKCUyMmdvb2dsZSUyRmdlbW1hLTMtNGItaXQlMjIpJTBBdmlzdWFsaXplciglMjIlM0NpbWclM0VXaGF0JTIwaXMlMjBzaG93biUyMGluJTIwdGhpcyUyMGltYWdlJTNGJTIyKQ==",highlighted:`<span class="hljs-keyword">from</span> transformers.utils.attention_visualizer <span class="hljs-keyword">import</span> AttentionMaskVisualizer

visualizer = AttentionMaskVisualizer(<span class="hljs-string">&quot;google/gemma-3-4b-it&quot;</span>)
visualizer(<span class="hljs-string">&quot;&lt;img&gt;What is shown in this image?&quot;</span>)`,wrap:!1}}),Je=new Q({props:{title:"Notes",local:"notes",headingTag:"h2"}}),ve=new R({props:{code:"dXJsX2NvdyUyMCUzRCUyMCUyMmh0dHBzJTNBJTJGJTJGbWVkaWEuaXN0b2NrcGhvdG8uY29tJTJGaWQlMkYxMTkyODY3NzUzJTJGcGhvdG8lMkZjb3ctaW4tYmVyY2hpZGEtYmVhY2gtc2luaXNjb2xhLmpwZyUzRnMlM0Q2MTJ4NjEyJTI2dyUzRDAlMjZrJTNEMjAlMjZjJTNEdjBoampuaXdzTU5mSlN1S1dadUluOHBzc21ENWg1YlNOMXBlQmQxQ21INCUzRCUyMiUwQXVybF9jYXQlMjAlM0QlMjAlMjJodHRwcyUzQSUyRiUyRmh1Z2dpbmdmYWNlLmNvJTJGZGF0YXNldHMlMkZodWdnaW5nZmFjZSUyRmRvY3VtZW50YXRpb24taW1hZ2VzJTJGcmVzb2x2ZSUyRm1haW4lMkZwaXBlbGluZS1jYXQtY2hvbmsuanBlZyUyMiUwQSUwQW1lc3NhZ2VzJTIwJTNEJTVCJTBBJTIwJTIwJTIwJTIwJTdCJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIycm9sZSUyMiUzQSUyMCUyMnN5c3RlbSUyMiUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMmNvbnRlbnQlMjIlM0ElMjAlNUIlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlN0IlMjJ0eXBlJTIyJTNBJTIwJTIydGV4dCUyMiUyQyUyMCUyMnRleHQlMjIlM0ElMjAlMjJZb3UlMjBhcmUlMjBhJTIwaGVscGZ1bCUyMGFzc2lzdGFudC4lMjIlN0QlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlNUQlMEElMjAlMjAlMjAlMjAlN0QlMkMlMEElMjAlMjAlMjAlMjAlN0IlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjJyb2xlJTIyJTNBJTIwJTIydXNlciUyMiUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMmNvbnRlbnQlMjIlM0ElMjAlNUIlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlN0IlMjJ0eXBlJTIyJTNBJTIwJTIyaW1hZ2UlMjIlMkMlMjAlMjJ1cmwlMjIlM0ElMjB1cmxfY293JTdEJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTdCJTIydHlwZSUyMiUzQSUyMCUyMmltYWdlJTIyJTJDJTIwJTIydXJsJTIyJTNBJTIwdXJsX2NhdCU3RCUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCU3QiUyMnR5cGUlMjIlM0ElMjAlMjJ0ZXh0JTIyJTJDJTIwJTIydGV4dCUyMiUzQSUyMCUyMldoaWNoJTIwaW1hZ2UlMjBpcyUyMGN1dGVyJTNGJTIyJTdEJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTVEJTBBJTIwJTIwJTIwJTIwJTdEJTJDJTBBJTVE",highlighted:`url_cow = <span class="hljs-string">&quot;https://media.istockphoto.com/id/1192867753/photo/cow-in-berchida-beach-siniscola.jpg?s=612x612&amp;w=0&amp;k=20&amp;c=v0hjjniwsMNfJSuKWZuIn8pssmD5h5bSN1peBd1CmH4=&quot;</span>
url_cat = <span class="hljs-string">&quot;https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/pipeline-cat-chonk.jpeg&quot;</span>

messages =[
    {
        <span class="hljs-string">&quot;role&quot;</span>: <span class="hljs-string">&quot;system&quot;</span>,
        <span class="hljs-string">&quot;content&quot;</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-string">&quot;role&quot;</span>: <span class="hljs-string">&quot;user&quot;</span>,
        <span class="hljs-string">&quot;content&quot;</span>: [
            {<span class="hljs-string">&quot;type&quot;</span>: <span class="hljs-string">&quot;image&quot;</span>, <span class="hljs-string">&quot;url&quot;</span>: url_cow},
            {<span class="hljs-string">&quot;type&quot;</span>: <span class="hljs-string">&quot;image&quot;</span>, <span class="hljs-string">&quot;url&quot;</span>: url_cat},
            {<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;Which image is cuter?&quot;</span>},
        ]
    },
]`,wrap:!1}}),je=new R({props:{code:"aW5wdXRzJTIwJTNEJTIwcHJvY2Vzc29yLmFwcGx5X2NoYXRfdGVtcGxhdGUoJTBBJTIwJTIwJTIwJTIwbWVzc2FnZXMlMkMlMEElMjAlMjAlMjAlMjB0b2tlbml6ZSUzRFRydWUlMkMlMEElMjAlMjAlMjAlMjByZXR1cm5fZGljdCUzRFRydWUlMkMlMEElMjAlMjAlMjAlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyJTJDJTBBJTIwJTIwJTIwJTIwYWRkX2dlbmVyYXRpb25fcHJvbXB0JTNEVHJ1ZSUyQyUwQSUyQiUyMCUyMCUyMGRvX3Bhbl9hbmRfc2NhbiUzRFRydWUlMkMlMEElMjAlMjAlMjAlMjApLnRvKCUyMmN1ZGElMjIp",highlighted:`inputs = processor.apply_chat_template(
    messages,
    tokenize=True,
    return_dict=True,
    return_tensors=&quot;pt&quot;,
    add_generation_prompt=True,
<span class="hljs-addition">+   do_pan_and_scan=True,</span>
    ).to(&quot;cuda&quot;)`,wrap:!1}}),Ge=new R({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b01vZGVsRm9yQ2F1c2FsTE0lMkMlMjBBdXRvVG9rZW5pemVyJTBBJTBBdG9rZW5pemVyJTIwJTNEJTIwQXV0b1Rva2VuaXplci5mcm9tX3ByZXRyYWluZWQoJTBBJTIwJTIwJTIwJTIwJTIyZ29vZ2xlJTJGZ2VtbWEtMy0xYi1wdCUyMiUyQyUwQSklMEFtb2RlbCUyMCUzRCUyMEF1dG9Nb2RlbEZvckNhdXNhbExNLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjAlMjJnb29nbGUlMkZnZW1tYS0zLTFiLXB0JTIyJTJDJTBBJTIwJTIwJTIwJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5iZmxvYXQxNiUyQyUwQSUyMCUyMCUyMCUyMGRldmljZV9tYXAlM0QlMjJhdXRvJTIyJTJDJTBBJTIwJTIwJTIwJTIwYXR0bl9pbXBsZW1lbnRhdGlvbiUzRCUyMnNkcGElMjIlMEEpJTBBaW5wdXRfaWRzJTIwJTNEJTIwdG9rZW5pemVyKCUyMlBsYW50cyUyMGNyZWF0ZSUyMGVuZXJneSUyMHRocm91Z2glMjBhJTIwcHJvY2VzcyUyMGtub3duJTIwYXMlMjIlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKS50byglMjJjdWRhJTIyKSUwQSUwQW91dHB1dCUyMCUzRCUyMG1vZGVsLmdlbmVyYXRlKCoqaW5wdXRfaWRzJTJDJTIwY2FjaGVfaW1wbGVtZW50YXRpb24lM0QlMjJzdGF0aWMlMjIpJTBBcHJpbnQodG9rZW5pemVyLmRlY29kZShvdXRwdXQlNUIwJTVEJTJDJTIwc2tpcF9zcGVjaWFsX3Rva2VucyUzRFRydWUpKQ==",highlighted:`<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForCausalLM, AutoTokenizer

tokenizer = AutoTokenizer.from_pretrained(
    <span class="hljs-string">&quot;google/gemma-3-1b-pt&quot;</span>,
)
model = AutoModelForCausalLM.from_pretrained(
    <span class="hljs-string">&quot;google/gemma-3-1b-pt&quot;</span>,
    torch_dtype=torch.bfloat16,
    device_map=<span class="hljs-string">&quot;auto&quot;</span>,
    attn_implementation=<span class="hljs-string">&quot;sdpa&quot;</span>
)
input_ids = tokenizer(<span class="hljs-string">&quot;Plants create energy through a process known as&quot;</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>).to(<span class="hljs-string">&quot;cuda&quot;</span>)

output = model.generate(**input_ids, cache_implementation=<span class="hljs-string">&quot;static&quot;</span>)
<span class="hljs-built_in">print</span>(tokenizer.decode(output[<span class="hljs-number">0</span>], skip_special_tokens=<span class="hljs-literal">True</span>))`,wrap:!1}}),xe=new Q({props:{title:"Gemma3ImageProcessor",local:"transformers.Gemma3ImageProcessor",headingTag:"h2"}}),$e=new j({props:{name:"class transformers.Gemma3ImageProcessor",anchor:"transformers.Gemma3ImageProcessor",parameters:[{name:"do_resize",val:": bool = True"},{name:"size",val:": typing.Dict[str, int] = None"},{name:"resample",val:": Resampling = <Resampling.BILINEAR: 2>"},{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:": typing.Optional[bool] = None"},{name:"do_pan_and_scan",val:": typing.Optional[bool] = None"},{name:"pan_and_scan_min_crop_size",val:": typing.Optional[int] = None"},{name:"pan_and_scan_max_num_crops",val:": typing.Optional[int] = None"},{name:"pan_and_scan_min_ratio_to_activate",val:": typing.Optional[float] = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.Gemma3ImageProcessor.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 to the specified <code>size</code>. Can be overridden by
<code>do_resize</code> in the <code>preprocess</code> method.`,name:"do_resize"},{anchor:"transformers.Gemma3ImageProcessor.size",description:`<strong>size</strong> (<code>Dict[str, int]</code> <em>optional</em>, defaults to <code>{&quot;height&quot; -- 224, &quot;width&quot;: 224}</code>):
Size of the image after resizing. Can be overridden by <code>size</code> in the <code>preprocess</code> method.`,name:"size"},{anchor:"transformers.Gemma3ImageProcessor.resample",description:`<strong>resample</strong> (<code>PILImageResampling</code>, <em>optional</em>, defaults to <code>Resampling.BILINEAR</code>) &#x2014;
Resampling filter to use if resizing the image. Can be overridden by <code>resample</code> in the <code>preprocess</code> method.`,name:"resample"},{anchor:"transformers.Gemma3ImageProcessor.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>. Can be overridden by <code>do_rescale</code> in
the <code>preprocess</code> method.`,name:"do_rescale"},{anchor:"transformers.Gemma3ImageProcessor.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. Can be overridden by <code>rescale_factor</code> in the <code>preprocess</code>
method.`,name:"rescale_factor"},{anchor:"transformers.Gemma3ImageProcessor.do_normalize",description:`<strong>do_normalize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to normalize the image by the specified mean and standard deviation. Can be overridden by
<code>do_normalize</code> in the <code>preprocess</code> method.`,name:"do_normalize"},{anchor:"transformers.Gemma3ImageProcessor.image_mean",description:`<strong>image_mean</strong> (<code>float</code> or <code>List[float]</code>, <em>optional</em>, defaults to <code>[0.5, 0.5, 0.5]</code>) &#x2014;
Mean to use if normalizing the image. This is a float or list of floats the length of the number of
channels in the image. Can be overridden by the <code>image_mean</code> parameter in the <code>preprocess</code> method.`,name:"image_mean"},{anchor:"transformers.Gemma3ImageProcessor.image_std",description:`<strong>image_std</strong> (<code>float</code> or <code>List[float]</code>, <em>optional</em>, defaults to <code>[0.5, 0.5, 0.5]</code>) &#x2014;
Standard deviation to use if normalizing the image. This is a float or list of floats the length of the
number of channels in the image. Can be overridden by the <code>image_std</code> parameter in the <code>preprocess</code> method.
Can be overridden by the <code>image_std</code> parameter in the <code>preprocess</code> method.`,name:"image_std"},{anchor:"transformers.Gemma3ImageProcessor.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.Gemma3ImageProcessor.do_pan_and_scan",description:`<strong>do_pan_and_scan</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether to apply <code>pan_and_scan</code> to images.`,name:"do_pan_and_scan"},{anchor:"transformers.Gemma3ImageProcessor.pan_and_scan_min_crop_size",description:`<strong>pan_and_scan_min_crop_size</strong> (<code>int</code>, <em>optional</em>) &#x2014;
Minimum size of each crop in pan and scan.`,name:"pan_and_scan_min_crop_size"},{anchor:"transformers.Gemma3ImageProcessor.pan_and_scan_max_num_crops",description:`<strong>pan_and_scan_max_num_crops</strong> (<code>int</code>, <em>optional</em>) &#x2014;
Maximum number of crops per image in pan and scan.`,name:"pan_and_scan_max_num_crops"},{anchor:"transformers.Gemma3ImageProcessor.pan_and_scan_min_ratio_to_activate",description:`<strong>pan_and_scan_min_ratio_to_activate</strong> (<code>float</code>, <em>optional</em>) &#x2014;
Minimum aspect ratio to activate pan and scan.`,name:"pan_and_scan_min_ratio_to_activate"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/gemma3/image_processing_gemma3.py#L53"}}),ke=new j({props:{name:"pan_and_scan",anchor:"transformers.Gemma3ImageProcessor.pan_and_scan",parameters:[{name:"image",val:": ndarray"},{name:"pan_and_scan_min_crop_size",val:": int"},{name:"pan_and_scan_max_num_crops",val:": int"},{name:"pan_and_scan_min_ratio_to_activate",val:": float"},{name:"data_format",val:": typing.Union[str, transformers.image_utils.ChannelDimension, NoneType] = None"},{name:"input_data_format",val:": typing.Union[str, transformers.image_utils.ChannelDimension, NoneType] = None"}],parametersDescription:[{anchor:"transformers.Gemma3ImageProcessor.pan_and_scan.image",description:`<strong>image</strong> (<code>np.ndarray</code>) &#x2014;
Image to resize.`,name:"image"},{anchor:"transformers.Gemma3ImageProcessor.pan_and_scan.pan_and_scan_min_crop_size",description:`<strong>pan_and_scan_min_crop_size</strong> (<code>int</code>, <em>optional</em>) &#x2014;
Minimum size of each crop in pan and scan.`,name:"pan_and_scan_min_crop_size"},{anchor:"transformers.Gemma3ImageProcessor.pan_and_scan.pan_and_scan_max_num_crops",description:`<strong>pan_and_scan_max_num_crops</strong> (<code>int</code>, <em>optional</em>) &#x2014;
Maximum number of crops per image in pan and scan.`,name:"pan_and_scan_max_num_crops"},{anchor:"transformers.Gemma3ImageProcessor.pan_and_scan.pan_and_scan_min_ratio_to_activate",description:`<strong>pan_and_scan_min_ratio_to_activate</strong> (<code>float</code>, <em>optional</em>) &#x2014;
Minimum aspect ratio to activate pan and scan.`,name:"pan_and_scan_min_ratio_to_activate"},{anchor:"transformers.Gemma3ImageProcessor.pan_and_scan.data_format",description:`<strong>data_format</strong> (<code>str</code> or <code>ChannelDimension</code>, <em>optional</em>) &#x2014;
The channel dimension format of the image. If not provided, it will be the same as the input image.`,name:"data_format"},{anchor:"transformers.Gemma3ImageProcessor.pan_and_scan.input_data_format",description:`<strong>input_data_format</strong> (<code>ChannelDimension</code> or <code>str</code>, <em>optional</em>) &#x2014;
The channel dimension format of the input image. If not provided, it will be inferred.`,name:"input_data_format"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/gemma3/image_processing_gemma3.py#L132"}}),ze=new j({props:{name:"preprocess",anchor:"transformers.Gemma3ImageProcessor.preprocess",parameters:[{name:"images",val:": typing.Union[ForwardRef('PIL.Image.Image'), numpy.ndarray, ForwardRef('torch.Tensor'), list['PIL.Image.Image'], list[numpy.ndarray], list['torch.Tensor']]"},{name:"do_resize",val:": typing.Optional[bool] = None"},{name:"size",val:": typing.Dict[str, int] = None"},{name:"resample",val:": Resampling = None"},{name:"do_rescale",val:": typing.Optional[bool] = None"},{name:"rescale_factor",val:": typing.Optional[float] = None"},{name:"do_normalize",val:": typing.Optional[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:"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"},{name:"do_convert_rgb",val:": typing.Optional[bool] = None"},{name:"do_pan_and_scan",val:": typing.Optional[bool] = None"},{name:"pan_and_scan_min_crop_size",val:": typing.Optional[int] = None"},{name:"pan_and_scan_max_num_crops",val:": typing.Optional[int] = None"},{name:"pan_and_scan_min_ratio_to_activate",val:": typing.Optional[float] = None"}],parametersDescription:[{anchor:"transformers.Gemma3ImageProcessor.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.Gemma3ImageProcessor.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.Gemma3ImageProcessor.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.`,name:"size"},{anchor:"transformers.Gemma3ImageProcessor.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.Gemma3ImageProcessor.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.Gemma3ImageProcessor.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.Gemma3ImageProcessor.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.Gemma3ImageProcessor.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.Gemma3ImageProcessor.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.Gemma3ImageProcessor.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.Gemma3ImageProcessor.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.Gemma3ImageProcessor.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"},{anchor:"transformers.Gemma3ImageProcessor.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.Gemma3ImageProcessor.preprocess.do_pan_and_scan",description:`<strong>do_pan_and_scan</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>self.do_convert_rgb</code>) &#x2014;
Whether to apply <code>pan_and_scan</code> to images.`,name:"do_pan_and_scan"},{anchor:"transformers.Gemma3ImageProcessor.preprocess.pan_and_scan_min_crop_size",description:`<strong>pan_and_scan_min_crop_size</strong> (<code>int</code>, <em>optional</em>, defaults to <code>self.pan_and_scan_min_crop_size</code>) &#x2014;
Minimum size of each crop in pan and scan.`,name:"pan_and_scan_min_crop_size"},{anchor:"transformers.Gemma3ImageProcessor.preprocess.pan_and_scan_max_num_crops",description:`<strong>pan_and_scan_max_num_crops</strong> (<code>int</code>, <em>optional</em>, defaults to <code>self.pan_and_scan_max_num_crops</code>) &#x2014;
Maximum number of crops per image in pan and scan.`,name:"pan_and_scan_max_num_crops"},{anchor:"transformers.Gemma3ImageProcessor.preprocess.pan_and_scan_min_ratio_to_activate",description:`<strong>pan_and_scan_min_ratio_to_activate</strong> (<code>float</code>, <em>optional</em>, defaults to <code>self.pan_and_scan_min_ratio_to_activate</code>) &#x2014;
Minimum aspect ratio to activate pan and scan.`,name:"pan_and_scan_min_ratio_to_activate"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/gemma3/image_processing_gemma3.py#L239"}}),qe=new Q({props:{title:"Gemma3ImageProcessorFast",local:"transformers.Gemma3ImageProcessorFast",headingTag:"h2"}}),We=new j({props:{name:"class transformers.Gemma3ImageProcessorFast",anchor:"transformers.Gemma3ImageProcessorFast",parameters:[{name:"**kwargs",val:": typing_extensions.Unpack[transformers.models.gemma3.image_processing_gemma3_fast.Gemma3FastImageProcessorKwargs]"}],parametersDescription:[{anchor:"transformers.Gemma3ImageProcessorFast.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&#x2019;s (height, width) dimensions to the specified <code>size</code>. Can be overridden by the
<code>do_resize</code> parameter in the <code>preprocess</code> method.`,name:"do_resize"},{anchor:"transformers.Gemma3ImageProcessorFast.size",description:`<strong>size</strong> (<code>dict</code>, <em>optional</em>, defaults to <code>self.size</code>) &#x2014;
Size of the output image after resizing. Can be overridden by the <code>size</code> parameter in the <code>preprocess</code>
method.`,name:"size"},{anchor:"transformers.Gemma3ImageProcessorFast.default_to_square",description:`<strong>default_to_square</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>self.default_to_square</code>) &#x2014;
Whether to default to a square image when resizing, if size is an int.`,name:"default_to_square"},{anchor:"transformers.Gemma3ImageProcessorFast.resample",description:`<strong>resample</strong> (<code>PILImageResampling</code>, <em>optional</em>, defaults to <code>self.resample</code>) &#x2014;
Resampling filter to use if resizing the image. Only has an effect if <code>do_resize</code> is set to <code>True</code>. Can be
overridden by the <code>resample</code> parameter in the <code>preprocess</code> method.`,name:"resample"},{anchor:"transformers.Gemma3ImageProcessorFast.do_center_crop",description:`<strong>do_center_crop</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>self.do_center_crop</code>) &#x2014;
Whether to center crop the image to the specified <code>crop_size</code>. Can be overridden by <code>do_center_crop</code> in the
<code>preprocess</code> method.`,name:"do_center_crop"},{anchor:"transformers.Gemma3ImageProcessorFast.crop_size",description:`<strong>crop_size</strong> (<code>Dict[str, int]</code> <em>optional</em>, defaults to <code>self.crop_size</code>) &#x2014;
Size of the output image after applying <code>center_crop</code>. Can be overridden by <code>crop_size</code> in the <code>preprocess</code>
method.`,name:"crop_size"},{anchor:"transformers.Gemma3ImageProcessorFast.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 by the specified scale <code>rescale_factor</code>. Can be overridden by the
<code>do_rescale</code> parameter in the <code>preprocess</code> method.`,name:"do_rescale"},{anchor:"transformers.Gemma3ImageProcessorFast.rescale_factor",description:`<strong>rescale_factor</strong> (<code>int</code> or <code>float</code>, <em>optional</em>, defaults to <code>self.rescale_factor</code>) &#x2014;
Scale factor to use if rescaling the image. Only has an effect if <code>do_rescale</code> is set to <code>True</code>. Can be
overridden by the <code>rescale_factor</code> parameter in the <code>preprocess</code> method.`,name:"rescale_factor"},{anchor:"transformers.Gemma3ImageProcessorFast.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. Can be overridden by the <code>do_normalize</code> parameter in the <code>preprocess</code>
method. Can be overridden by the <code>do_normalize</code> parameter in the <code>preprocess</code> method.`,name:"do_normalize"},{anchor:"transformers.Gemma3ImageProcessorFast.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;
Mean to use if normalizing the image. This is a float or list of floats the length of the number of
channels in the image. Can be overridden by the <code>image_mean</code> parameter in the <code>preprocess</code> method. Can be
overridden by the <code>image_mean</code> parameter in the <code>preprocess</code> method.`,name:"image_mean"},{anchor:"transformers.Gemma3ImageProcessorFast.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;
Standard deviation to use if normalizing the image. This is a float or list of floats the length of the
number of channels in the image. Can be overridden by the <code>image_std</code> parameter in the <code>preprocess</code> method.
Can be overridden by the <code>image_std</code> parameter in the <code>preprocess</code> method.`,name:"image_std"},{anchor:"transformers.Gemma3ImageProcessorFast.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.Gemma3ImageProcessorFast.return_tensors",description:"<strong>return_tensors</strong> (<code>str</code> or <code>TensorType</code>, <em>optional</em>, defaults to <code>self.return_tensors</code>) &#x2014;\nReturns stacked tensors if set to `pt, otherwise returns a list of tensors.",name:"return_tensors"},{anchor:"transformers.Gemma3ImageProcessorFast.data_format",description:`<strong>data_format</strong> (<code>ChannelDimension</code> or <code>str</code>, <em>optional</em>, defaults to <code>self.data_format</code>) &#x2014;
Only <code>ChannelDimension.FIRST</code> is supported. Added for compatibility with slow processors.`,name:"data_format"},{anchor:"transformers.Gemma3ImageProcessorFast.input_data_format",description:`<strong>input_data_format</strong> (<code>ChannelDimension</code> or <code>str</code>, <em>optional</em>, defaults to <code>self.input_data_format</code>) &#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"},{anchor:"transformers.Gemma3ImageProcessorFast.device",description:`<strong>device</strong> (<code>torch.device</code>, <em>optional</em>, defaults to <code>self.device</code>) &#x2014;
The device to process the images on. If unset, the device is inferred from the input images.`,name:"device"},{anchor:"transformers.Gemma3ImageProcessorFast.do_pan_and_scan",description:`<strong>do_pan_and_scan</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether to apply <code>pan_and_scan</code> to images.`,name:"do_pan_and_scan"},{anchor:"transformers.Gemma3ImageProcessorFast.pan_and_scan_min_crop_size",description:`<strong>pan_and_scan_min_crop_size</strong> (<code>int</code>, <em>optional</em>) &#x2014;
Minimum size of each crop in pan and scan.`,name:"pan_and_scan_min_crop_size"},{anchor:"transformers.Gemma3ImageProcessorFast.pan_and_scan_max_num_crops",description:`<strong>pan_and_scan_max_num_crops</strong> (<code>int</code>, <em>optional</em>) &#x2014;
Maximum number of crops per image in pan and scan.`,name:"pan_and_scan_max_num_crops"},{anchor:"transformers.Gemma3ImageProcessorFast.pan_and_scan_min_ratio_to_activate",description:`<strong>pan_and_scan_min_ratio_to_activate</strong> (<code>float</code>, <em>optional</em>) &#x2014;
Minimum aspect ratio to activate pan and scan.`,name:"pan_and_scan_min_ratio_to_activate"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/gemma3/image_processing_gemma3_fast.py#L70"}}),Ze=new j({props:{name:"pan_and_scan_batched",anchor:"transformers.Gemma3ImageProcessorFast.pan_and_scan_batched",parameters:[{name:"images",val:": torch.Tensor"},{name:"pan_and_scan_min_crop_size",val:": int"},{name:"pan_and_scan_max_num_crops",val:": int"},{name:"pan_and_scan_min_ratio_to_activate",val:": float"}],parametersDescription:[{anchor:"transformers.Gemma3ImageProcessorFast.pan_and_scan_batched.image",description:`<strong>image</strong> (<code>torch.Tensor</code>) &#x2014;
Image to resize.`,name:"image"},{anchor:"transformers.Gemma3ImageProcessorFast.pan_and_scan_batched.pan_and_scan_min_crop_size",description:`<strong>pan_and_scan_min_crop_size</strong> (<code>int</code>, <em>optional</em>) &#x2014;
Minimum size of each crop in pan and scan.`,name:"pan_and_scan_min_crop_size"},{anchor:"transformers.Gemma3ImageProcessorFast.pan_and_scan_batched.pan_and_scan_max_num_crops",description:`<strong>pan_and_scan_max_num_crops</strong> (<code>int</code>, <em>optional</em>) &#x2014;
Maximum number of crops per image in pan and scan.`,name:"pan_and_scan_max_num_crops"},{anchor:"transformers.Gemma3ImageProcessorFast.pan_and_scan_batched.pan_and_scan_min_ratio_to_activate",description:`<strong>pan_and_scan_min_ratio_to_activate</strong> (<code>float</code>, <em>optional</em>) &#x2014;
Minimum aspect ratio to activate pan and scan.`,name:"pan_and_scan_min_ratio_to_activate"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/gemma3/image_processing_gemma3_fast.py#L102"}}),Fe=new j({props:{name:"preprocess",anchor:"transformers.Gemma3ImageProcessorFast.preprocess",parameters:[{name:"images",val:": typing.Union[ForwardRef('PIL.Image.Image'), numpy.ndarray, ForwardRef('torch.Tensor'), list['PIL.Image.Image'], list[numpy.ndarray], list['torch.Tensor']]"},{name:"**kwargs",val:": typing_extensions.Unpack[transformers.models.gemma3.image_processing_gemma3_fast.Gemma3FastImageProcessorKwargs]"}],parametersDescription:[{anchor:"transformers.Gemma3ImageProcessorFast.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.Gemma3ImageProcessorFast.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.Gemma3ImageProcessorFast.preprocess.size",description:`<strong>size</strong> (<code>Dict[str, int]</code>, <em>optional</em>, defaults to <code>self.size</code>) &#x2014;
Describes the maximum input dimensions to the model.`,name:"size"},{anchor:"transformers.Gemma3ImageProcessorFast.preprocess.resample",description:`<strong>resample</strong> (<code>PILImageResampling</code> or <code>InterpolationMode</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.Gemma3ImageProcessorFast.preprocess.do_center_crop",description:`<strong>do_center_crop</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>self.do_center_crop</code>) &#x2014;
Whether to center crop the image.`,name:"do_center_crop"},{anchor:"transformers.Gemma3ImageProcessorFast.preprocess.crop_size",description:`<strong>crop_size</strong> (<code>Dict[str, int]</code>, <em>optional</em>, defaults to <code>self.crop_size</code>) &#x2014;
Size of the output image after applying <code>center_crop</code>.`,name:"crop_size"},{anchor:"transformers.Gemma3ImageProcessorFast.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.Gemma3ImageProcessorFast.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.Gemma3ImageProcessorFast.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.Gemma3ImageProcessorFast.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.Gemma3ImageProcessorFast.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.Gemma3ImageProcessorFast.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.Gemma3ImageProcessorFast.preprocess.return_tensors",description:"<strong>return_tensors</strong> (<code>str</code> or <code>TensorType</code>, <em>optional</em>, defaults to <code>self.return_tensors</code>) &#x2014;\nReturns stacked tensors if set to `pt, otherwise returns a list of tensors.",name:"return_tensors"},{anchor:"transformers.Gemma3ImageProcessorFast.preprocess.data_format",description:`<strong>data_format</strong> (<code>ChannelDimension</code> or <code>str</code>, <em>optional</em>, defaults to <code>self.data_format</code>) &#x2014;
Only <code>ChannelDimension.FIRST</code> is supported. Added for compatibility with slow processors.`,name:"data_format"},{anchor:"transformers.Gemma3ImageProcessorFast.preprocess.input_data_format",description:`<strong>input_data_format</strong> (<code>ChannelDimension</code> or <code>str</code>, <em>optional</em>, defaults to <code>self.input_data_format</code>) &#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"},{anchor:"transformers.Gemma3ImageProcessorFast.preprocess.device",description:`<strong>device</strong> (<code>torch.device</code>, <em>optional</em>, defaults to <code>self.device</code>) &#x2014;
The device to process the images on. If unset, the device is inferred from the input images.
do_pan_and_scan (<code>bool</code>, <em>optional</em>):
Whether to apply <code>pan_and_scan</code> to images.
pan_and_scan_min_crop_size (<code>int</code>, <em>optional</em>):
Minimum size of each crop in pan and scan.
pan_and_scan_max_num_crops (<code>int</code>, <em>optional</em>):
Maximum number of crops per image in pan and scan.
pan_and_scan_min_ratio_to_activate (<code>float</code>, <em>optional</em>):
Minimum aspect ratio to activate pan and scan.`,name:"device"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/gemma3/image_processing_gemma3_fast.py#L187"}}),Re=new Q({props:{title:"Gemma3Processor",local:"transformers.Gemma3Processor",headingTag:"h2"}}),Be=new j({props:{name:"class transformers.Gemma3Processor",anchor:"transformers.Gemma3Processor",parameters:[{name:"image_processor",val:""},{name:"tokenizer",val:""},{name:"chat_template",val:" = None"},{name:"image_seq_length",val:": int = 256"},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/gemma3/processing_gemma3.py#L51"}}),Ne=new j({props:{name:"batch_decode",anchor:"transformers.Gemma3Processor.batch_decode",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/gemma3/processing_gemma3.py#L151"}}),Ee=new j({props:{name:"decode",anchor:"transformers.Gemma3Processor.decode",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/gemma3/processing_gemma3.py#L159"}}),Pe=new Q({props:{title:"Gemma3TextConfig",local:"transformers.Gemma3TextConfig",headingTag:"h2"}}),Ae=new j({props:{name:"class transformers.Gemma3TextConfig",anchor:"transformers.Gemma3TextConfig",parameters:[{name:"vocab_size",val:" = 262208"},{name:"hidden_size",val:" = 2304"},{name:"intermediate_size",val:" = 9216"},{name:"num_hidden_layers",val:" = 26"},{name:"num_attention_heads",val:" = 8"},{name:"num_key_value_heads",val:" = 4"},{name:"head_dim",val:" = 256"},{name:"hidden_activation",val:" = 'gelu_pytorch_tanh'"},{name:"max_position_embeddings",val:" = 131072"},{name:"initializer_range",val:" = 0.02"},{name:"rms_norm_eps",val:" = 1e-06"},{name:"use_cache",val:" = True"},{name:"pad_token_id",val:" = 0"},{name:"eos_token_id",val:" = 1"},{name:"bos_token_id",val:" = 2"},{name:"tie_word_embeddings",val:" = True"},{name:"rope_theta",val:" = 1000000.0"},{name:"attention_bias",val:" = False"},{name:"attention_dropout",val:" = 0.0"},{name:"query_pre_attn_scalar",val:" = 256"},{name:"sliding_window",val:" = 4096"},{name:"final_logit_softcapping",val:" = None"},{name:"attn_logit_softcapping",val:" = None"},{name:"cache_implementation",val:" = 'hybrid'"},{name:"rope_scaling",val:" = None"},{name:"rope_local_base_freq",val:" = 10000.0"},{name:"sliding_window_pattern",val:" = 6"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.Gemma3TextConfig.vocab_size",description:`<strong>vocab_size</strong> (<code>int</code>, <em>optional</em>, defaults to 262208) &#x2014;
Vocabulary size of the Gemma3Text model. Defines the number of different tokens that can be represented by the
<code>inputs_ids</code> passed when calling <a href="/docs/transformers/main/en/model_doc/gemma3#transformers.Gemma3TextModel">Gemma3TextModel</a>`,name:"vocab_size"},{anchor:"transformers.Gemma3TextConfig.hidden_size",description:`<strong>hidden_size</strong> (<code>int</code>, <em>optional</em>, defaults to 2304) &#x2014;
Dimension of the hidden representations.`,name:"hidden_size"},{anchor:"transformers.Gemma3TextConfig.intermediate_size",description:`<strong>intermediate_size</strong> (<code>int</code>, <em>optional</em>, defaults to 9216) &#x2014;
Dimension of the MLP representations.`,name:"intermediate_size"},{anchor:"transformers.Gemma3TextConfig.num_hidden_layers",description:`<strong>num_hidden_layers</strong> (<code>int</code>, <em>optional</em>, defaults to 26) &#x2014;
Number of hidden layers in the Transformer decoder.`,name:"num_hidden_layers"},{anchor:"transformers.Gemma3TextConfig.num_attention_heads",description:`<strong>num_attention_heads</strong> (<code>int</code>, <em>optional</em>, defaults to 8) &#x2014;
Number of attention heads for each attention layer in the Transformer decoder.`,name:"num_attention_heads"},{anchor:"transformers.Gemma3TextConfig.num_key_value_heads",description:`<strong>num_key_value_heads</strong> (<code>int</code>, <em>optional</em>, defaults to 4) &#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</code> 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 <a href="https://arxiv.org/pdf/2305.13245.pdf" rel="nofollow">this
paper</a>. If it is not specified, will default to
<code>num_attention_heads</code>.`,name:"num_key_value_heads"},{anchor:"transformers.Gemma3TextConfig.head_dim",description:`<strong>head_dim</strong> (<code>int</code>, <em>optional</em>, defaults to 256) &#x2014;
The attention head dimension.`,name:"head_dim"},{anchor:"transformers.Gemma3TextConfig.hidden_activation",description:`<strong>hidden_activation</strong> (<code>str</code> or <code>function</code>, <em>optional</em>, defaults to <code>&quot;gelu_pytorch_tanh&quot;</code>) &#x2014;
The non-linear activation function (function or string) in the decoder. Will default to <code>&quot;gelu_pytorch_tanh&quot;</code>
if not specified. <code>&quot;gelu_pytorch_tanh&quot;</code> uses an approximation of the <code>&quot;gelu&quot;</code> activation function.`,name:"hidden_activation"},{anchor:"transformers.Gemma3TextConfig.max_position_embeddings",description:`<strong>max_position_embeddings</strong> (<code>int</code>, <em>optional</em>, defaults to 131072) &#x2014;
The maximum sequence length that this model might ever be used with.`,name:"max_position_embeddings"},{anchor:"transformers.Gemma3TextConfig.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"},{anchor:"transformers.Gemma3TextConfig.rms_norm_eps",description:`<strong>rms_norm_eps</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-06) &#x2014;
The epsilon used by the rms normalization layers.`,name:"rms_norm_eps"},{anchor:"transformers.Gemma3TextConfig.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.Gemma3TextConfig.pad_token_id",description:`<strong>pad_token_id</strong> (<code>int</code>, <em>optional</em>, defaults to 0) &#x2014;
Padding token id.`,name:"pad_token_id"},{anchor:"transformers.Gemma3TextConfig.eos_token_id",description:`<strong>eos_token_id</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
End of stream token id.`,name:"eos_token_id"},{anchor:"transformers.Gemma3TextConfig.bos_token_id",description:`<strong>bos_token_id</strong> (<code>int</code>, <em>optional</em>, defaults to 2) &#x2014;
Beginning of stream token id.`,name:"bos_token_id"},{anchor:"transformers.Gemma3TextConfig.tie_word_embeddings",description:`<strong>tie_word_embeddings</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to tie weight embeddings`,name:"tie_word_embeddings"},{anchor:"transformers.Gemma3TextConfig.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.Gemma3TextConfig.attention_bias",description:`<strong>attention_bias</strong> (<code>bool</code>, defaults to <code>False</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.Gemma3TextConfig.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"},{anchor:"transformers.Gemma3TextConfig.query_pre_attn_scalar",description:`<strong>query_pre_attn_scalar</strong> (<code>float</code>, <em>optional</em>, defaults to 256) &#x2014;
Scaling factor used on the attention scores`,name:"query_pre_attn_scalar"},{anchor:"transformers.Gemma3TextConfig.sliding_window",description:`<strong>sliding_window</strong> (<code>int</code>, <em>optional</em>, defaults to 4096) &#x2014; in Gemma3Text, every other layer uses sliding window attention. This is the
size of the sliding window.`,name:"sliding_window"},{anchor:"transformers.Gemma3TextConfig.final_logit_softcapping",description:`<strong>final_logit_softcapping</strong> (<code>float</code>, <em>optional</em>) &#x2014;
Scaling factor when applying tanh softcapping on the logits.`,name:"final_logit_softcapping"},{anchor:"transformers.Gemma3TextConfig.attn_logit_softcapping",description:`<strong>attn_logit_softcapping</strong> (<code>float</code>, <em>optional</em>) &#x2014;
Scaling factor when applying tanh softcapping on the attention scores.`,name:"attn_logit_softcapping"},{anchor:"transformers.Gemma3TextConfig.cache_implementation",description:"<strong>cache_implementation</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;hybrid&quot;</code>) &#x2014; the cache type to be used with <code>generate</code>.",name:"cache_implementation"},{anchor:"transformers.Gemma3TextConfig.rope_scaling",description:`<strong>rope_scaling</strong> (<code>Dict</code>, <em>optional</em>) &#x2014;
Dictionary containing the scaling configuration for the RoPE embeddings used in gloabl attention. 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.Gemma3TextConfig.rope_local_base_freq",description:`<strong>rope_local_base_freq</strong> (float, <em>optional</em>, defaults to 10000.0) &#x2014;
The base period of the RoPE embeddings for local attention.`,name:"rope_local_base_freq"},{anchor:"transformers.Gemma3TextConfig.sliding_window_pattern",description:`<strong>sliding_window_pattern</strong> (<code>int</code>, <em>optional</em>, defaults to 6) &#x2014;
Pattern for the sliding window attention.`,name:"sliding_window_pattern"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/gemma3/configuration_gemma3.py#L33"}}),ae=new Jt({props:{anchor:"transformers.Gemma3TextConfig.example",$$slots:{default:[ma]},$$scope:{ctx:J}}}),Ve=new Q({props:{title:"Gemma3Config",local:"transformers.Gemma3Config",headingTag:"h2"}}),Le=new j({props:{name:"class transformers.Gemma3Config",anchor:"transformers.Gemma3Config",parameters:[{name:"text_config",val:": typing.Union[transformers.models.gemma3.configuration_gemma3.Gemma3TextConfig, typing.Dict[str, typing.Any], NoneType] = None"},{name:"vision_config",val:": typing.Union[transformers.models.siglip.configuration_siglip.SiglipVisionConfig, typing.Dict[str, typing.Any], NoneType] = None"},{name:"mm_tokens_per_image",val:": int = 256"},{name:"boi_token_index",val:": int = 255999"},{name:"eoi_token_index",val:": int = 256000"},{name:"image_token_index",val:": int = 262144"},{name:"initializer_range",val:": float = 0.02"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.Gemma3Config.text_config",description:`<strong>text_config</strong> (<code>Union[Gemma3TextConfig, dict]</code>, <em>optional</em>) &#x2014;
The config object of the text backbone.`,name:"text_config"},{anchor:"transformers.Gemma3Config.vision_config",description:`<strong>vision_config</strong> (<code>Union[AutoConfig, dict]</code>,  <em>optional</em>) &#x2014;
Custom vision config or dict.`,name:"vision_config"},{anchor:"transformers.Gemma3Config.mm_tokens_per_image",description:`<strong>mm_tokens_per_image</strong> (<code>int</code>, <em>optional</em>, defaults to 256) &#x2014;
The number of tokens per image embedding.`,name:"mm_tokens_per_image"},{anchor:"transformers.Gemma3Config.boi_token_index",description:`<strong>boi_token_index</strong> (<code>int</code>, <em>optional</em>, defaults to 255999) &#x2014;
The begin-of-image token index to wrap the image prompt.`,name:"boi_token_index"},{anchor:"transformers.Gemma3Config.eoi_token_index",description:`<strong>eoi_token_index</strong> (<code>int</code>, <em>optional</em>, defaults to 256000) &#x2014;
The end-of-image token index to wrap the image prompt.`,name:"eoi_token_index"},{anchor:"transformers.Gemma3Config.image_token_index",description:`<strong>image_token_index</strong> (<code>int</code>, <em>optional</em>, defaults to 262144) &#x2014;
The image token index to encode the image prompt.`,name:"image_token_index"},{anchor:"transformers.Gemma3Config.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/gemma3/configuration_gemma3.py#L238"}}),se=new Jt({props:{anchor:"transformers.Gemma3Config.example",$$slots:{default:[pa]},$$scope:{ctx:J}}}),Xe=new Q({props:{title:"Gemma3TextModel",local:"transformers.Gemma3TextModel",headingTag:"h2"}}),Qe=new j({props:{name:"class transformers.Gemma3TextModel",anchor:"transformers.Gemma3TextModel",parameters:[{name:"config",val:": Gemma3TextConfig"}],parametersDescription:[{anchor:"transformers.Gemma3TextModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/gemma3#transformers.Gemma3Config">Gemma3Config</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.Gemma3TextModel.config",description:"<strong>config</strong> &#x2014; Gemma3TextConfig",name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/gemma3/modeling_gemma3.py#L603"}}),Se=new j({props:{name:"forward",anchor:"transformers.Gemma3TextModel.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.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.HybridCache] = 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:"cache_position",val:": typing.Optional[torch.LongTensor] = None"},{name:"last_cache_position",val:": typing.Optional[int] = None"},{name:"**flash_attn_kwargs",val:": typing_extensions.Unpack[transformers.modeling_flash_attention_utils.FlashAttentionKwargs]"}],parametersDescription:[{anchor:"transformers.Gemma3TextModel.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.Gemma3TextModel.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.Gemma3TextModel.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.Gemma3TextModel.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>It is a <a href="/docs/transformers/main/en/internal/generation_utils#transformers.Cache">Cache</a> instance. For more details, see our <a href="https://huggingface.co/docs/transformers/en/kv_cache" rel="nofollow">kv cache guide</a>.</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.Gemma3TextModel.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.Gemma3TextModel.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.Gemma3TextModel.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.Gemma3TextModel.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.Gemma3TextModel.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.Gemma3TextModel.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/gemma3/modeling_gemma3.py#L649"}}),re=new wt({props:{$$slots:{default:[ga]},$$scope:{ctx:J}}}),He=new Q({props:{title:"Gemma3ForCausalLM",local:"transformers.Gemma3ForCausalLM",headingTag:"h2"}}),Ye=new j({props:{name:"class transformers.Gemma3ForCausalLM",anchor:"transformers.Gemma3ForCausalLM",parameters:[{name:"config",val:": Gemma3TextConfig"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/gemma3/modeling_gemma3.py#L876"}}),De=new j({props:{name:"forward",anchor:"transformers.Gemma3ForCausalLM.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.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.HybridCache] = 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:"cache_position",val:": typing.Optional[torch.LongTensor] = None"},{name:"logits_to_keep",val:": typing.Union[int, torch.Tensor] = 0"},{name:"**loss_kwargs",val:""}],parametersDescription:[{anchor:"transformers.Gemma3ForCausalLM.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.Gemma3ForCausalLM.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.Gemma3ForCausalLM.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.Gemma3ForCausalLM.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>It is a <a href="/docs/transformers/main/en/internal/generation_utils#transformers.Cache">Cache</a> instance. For more details, see our <a href="https://huggingface.co/docs/transformers/en/kv_cache" rel="nofollow">kv cache guide</a>.</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.Gemma3ForCausalLM.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.Gemma3ForCausalLM.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.Gemma3ForCausalLM.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.Gemma3ForCausalLM.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.Gemma3ForCausalLM.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.Gemma3ForCausalLM.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.Gemma3ForCausalLM.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
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>.`,name:"labels"},{anchor:"transformers.Gemma3ForCausalLM.forward.logits_to_keep",description:`<strong>logits_to_keep</strong> (<code>int</code> or <code>torch.Tensor</code>, <em>optional</em>) &#x2014;
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:"logits_to_keep"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/gemma3/modeling_gemma3.py#L910",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/gemma3#transformers.Gemma3Config"
>Gemma3Config</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>
`}}),ie=new wt({props:{$$slots:{default:[ha]},$$scope:{ctx:J}}}),le=new Jt({props:{anchor:"transformers.Gemma3ForCausalLM.forward.example",$$slots:{default:[fa]},$$scope:{ctx:J}}}),Oe=new Q({props:{title:"Gemma3ForConditionalGeneration",local:"transformers.Gemma3ForConditionalGeneration",headingTag:"h2"}}),Ke=new j({props:{name:"class transformers.Gemma3ForConditionalGeneration",anchor:"transformers.Gemma3ForConditionalGeneration",parameters:[{name:"config",val:": Gemma3Config"}],parametersDescription:[{anchor:"transformers.Gemma3ForConditionalGeneration.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/gemma3#transformers.Gemma3Config">Gemma3Config</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/gemma3/modeling_gemma3.py#L1099"}}),eo=new j({props:{name:"forward",anchor:"transformers.Gemma3ForConditionalGeneration.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"pixel_values",val:": typing.Optional[torch.FloatTensor] = 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[typing.List[torch.FloatTensor], transformers.cache_utils.Cache, NoneType] = None"},{name:"token_type_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"cache_position",val:": typing.Optional[torch.LongTensor] = 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:"logits_to_keep",val:": typing.Union[int, torch.Tensor] = 0"},{name:"**lm_kwargs",val:""}],parametersDescription:[{anchor:"transformers.Gemma3ForConditionalGeneration.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.Gemma3ForConditionalGeneration.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.Gemma3ForConditionalGeneration.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.Gemma3ForConditionalGeneration.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>It is a <a href="/docs/transformers/main/en/internal/generation_utils#transformers.Cache">Cache</a> instance. For more details, see our <a href="https://huggingface.co/docs/transformers/en/kv_cache" rel="nofollow">kv cache guide</a>.</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.Gemma3ForConditionalGeneration.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.Gemma3ForConditionalGeneration.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.Gemma3ForConditionalGeneration.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.Gemma3ForConditionalGeneration.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.Gemma3ForConditionalGeneration.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.Gemma3ForConditionalGeneration.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.Gemma3ForConditionalGeneration.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Labels for computing the masked language modeling loss. Indices should either be in <code>[0, ..., config.text_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.text_config.vocab_size]</code>.`,name:"labels"},{anchor:"transformers.Gemma3ForConditionalGeneration.forward.logits_to_keep",description:`<strong>logits_to_keep</strong> (<code>int</code> or <code>torch.Tensor</code>, <em>optional</em>) &#x2014;
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:"logits_to_keep"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/gemma3/modeling_gemma3.py#L1220",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <code>transformers.models.gemma3.modeling_gemma3.Gemma3CausalLMOutputWithPast</code> 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/gemma3#transformers.Gemma3Config"
>Gemma3Config</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.text_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>
<li>
<p><strong>image_hidden_states</strong> (<code>torch.FloatTensor</code>, <em>optional</em>) — A <code>torch.FloatTensor</code> of size <code>(batch_size, sequence_length, hidden_size)</code>.
image_hidden_states of the model produced by the vision encoder after projecting last hidden state.</p>
</li>
</ul>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>transformers.models.gemma3.modeling_gemma3.Gemma3CausalLMOutputWithPast</code> or <code>tuple(torch.FloatTensor)</code></p>
`}}),ce=new wt({props:{$$slots:{default:[ua]},$$scope:{ctx:J}}}),de=new Jt({props:{anchor:"transformers.Gemma3ForConditionalGeneration.forward.example",$$slots:{default:[_a]},$$scope:{ctx:J}}}),oo=new aa({props:{source:"https://github.com/huggingface/transformers/blob/main/docs/source/en/model_doc/gemma3.md"}}),{c(){o=c("meta"),y=r(),t=c("p"),M=r(),w=c("div"),w.innerHTML=m,T=r(),p(v.$$.fragment),he=r(),A=c("p"),A.innerHTML=Ro,No=r(),fe=c("p"),fe.textContent=_n,Eo=r(),ue=c("p"),ue.innerHTML=yn,Po=r(),p(H.$$.fragment),Ao=r(),_e=c("p"),_e.innerHTML=Mn,Vo=r(),p(Y.$$.fragment),Lo=r(),ye=c("p"),ye.innerHTML=Tn,Xo=r(),Me=c("p"),Me.innerHTML=bn,Qo=r(),p(Te.$$.fragment),So=r(),be=c("p"),be.innerHTML=wn,Ho=r(),p(we.$$.fragment),Yo=r(),D=c("div"),D.innerHTML=Jn,Do=r(),p(Je.$$.fragment),Oo=r(),C=c("ul"),co=c("li"),co.innerHTML=In,It=r(),Ie=c("li"),mo=c("p"),mo.textContent=vn,vt=r(),p(ve.$$.fragment),Ut=r(),po=c("li"),po.innerHTML=Un,jt=r(),go=c("li"),go.innerHTML=jn,Ct=r(),Ue=c("li"),ho=c("p"),ho.innerHTML=Cn,Gt=r(),p(je.$$.fragment),xt=r(),Ce=c("li"),fo=c("p"),fo.innerHTML=Gn,$t=r(),p(Ge.$$.fragment),Ko=r(),p(xe.$$.fragment),et=r(),k=c("div"),p($e.$$.fragment),kt=r(),uo=c("p"),uo.textContent=xn,zt=r(),O=c("div"),p(ke.$$.fragment),qt=r(),_o=c("p"),_o.textContent=$n,Wt=r(),K=c("div"),p(ze.$$.fragment),Zt=r(),yo=c("p"),yo.textContent=kn,ot=r(),p(qe.$$.fragment),tt=r(),z=c("div"),p(We.$$.fragment),Ft=r(),Mo=c("p"),Mo.innerHTML=zn,Rt=r(),ee=c("div"),p(Ze.$$.fragment),Bt=r(),To=c("p"),To.textContent=qn,Nt=r(),oe=c("div"),p(Fe.$$.fragment),Et=r(),bo=c("p"),bo.textContent=Wn,nt=r(),p(Re.$$.fragment),at=r(),B=c("div"),p(Be.$$.fragment),Pt=r(),te=c("div"),p(Ne.$$.fragment),At=r(),wo=c("p"),wo.innerHTML=Zn,Vt=r(),ne=c("div"),p(Ee.$$.fragment),Lt=r(),Jo=c("p"),Jo.innerHTML=Fn,st=r(),p(Pe.$$.fragment),rt=r(),W=c("div"),p(Ae.$$.fragment),Xt=r(),Io=c("p"),Io.innerHTML=Rn,Qt=r(),p(ae.$$.fragment),St=ea(`
rope_local_base_freq (float, *optional*, defaults to 10000.0):
The base period of the RoPE embeddings for local attention.
sliding_window_pattern (\`int\`, *optional*, defaults to 6):
Pattern for the sliding window attention.`),it=r(),p(Ve.$$.fragment),lt=r(),G=c("div"),p(Le.$$.fragment),Ht=r(),vo=c("p"),vo.innerHTML=Bn,Yt=r(),Uo=c("p"),Uo.innerHTML=Nn,Dt=r(),jo=c("p"),jo.innerHTML=En,Ot=r(),p(se.$$.fragment),ct=r(),p(Xe.$$.fragment),dt=r(),x=c("div"),p(Qe.$$.fragment),Kt=r(),Co=c("p"),Co.innerHTML=Pn,en=r(),Go=c("p"),Go.innerHTML=An,on=r(),xo=c("p"),xo.innerHTML=Vn,tn=r(),V=c("div"),p(Se.$$.fragment),nn=r(),$o=c("p"),$o.innerHTML=Ln,an=r(),p(re.$$.fragment),mt=r(),p(He.$$.fragment),pt=r(),S=c("div"),p(Ye.$$.fragment),sn=r(),Z=c("div"),p(De.$$.fragment),rn=r(),ko=c("p"),ko.innerHTML=Xn,ln=r(),p(ie.$$.fragment),cn=r(),p(le.$$.fragment),gt=r(),p(Oe.$$.fragment),ht=r(),q=c("div"),p(Ke.$$.fragment),dn=r(),zo=c("p"),zo.innerHTML=Qn,mn=r(),qo=c("p"),qo.innerHTML=Sn,pn=r(),F=c("div"),p(eo.$$.fragment),gn=r(),Wo=c("p"),Wo.innerHTML=Hn,hn=r(),p(ce.$$.fragment),fn=r(),p(de.$$.fragment),ft=r(),p(oo.$$.fragment),ut=r(),Bo=c("p"),this.h()},l(e){const n=oa("svelte-u9bgzb",document.head);o=d(n,"META",{name:!0,content:!0}),n.forEach(a),y=i(e),t=d(e,"P",{}),I(t).forEach(a),M=i(e),w=d(e,"DIV",{style:!0,"data-svelte-h":!0}),b(w)!=="svelte-ithiq1"&&(w.innerHTML=m),T=i(e),g(v.$$.fragment,e),he=i(e),A=d(e,"P",{"data-svelte-h":!0}),b(A)!=="svelte-1a4ix7"&&(A.innerHTML=Ro),No=i(e),fe=d(e,"P",{"data-svelte-h":!0}),b(fe)!=="svelte-1ky12wo"&&(fe.textContent=_n),Eo=i(e),ue=d(e,"P",{"data-svelte-h":!0}),b(ue)!=="svelte-1fxl983"&&(ue.innerHTML=yn),Po=i(e),g(H.$$.fragment,e),Ao=i(e),_e=d(e,"P",{"data-svelte-h":!0}),b(_e)!=="svelte-25ere2"&&(_e.innerHTML=Mn),Vo=i(e),g(Y.$$.fragment,e),Lo=i(e),ye=d(e,"P",{"data-svelte-h":!0}),b(ye)!=="svelte-nf5ooi"&&(ye.innerHTML=Tn),Xo=i(e),Me=d(e,"P",{"data-svelte-h":!0}),b(Me)!=="svelte-w36i1c"&&(Me.innerHTML=bn),Qo=i(e),g(Te.$$.fragment,e),So=i(e),be=d(e,"P",{"data-svelte-h":!0}),b(be)!=="svelte-w3z5ks"&&(be.innerHTML=wn),Ho=i(e),g(we.$$.fragment,e),Yo=i(e),D=d(e,"DIV",{class:!0,"data-svelte-h":!0}),b(D)!=="svelte-1ymje3b"&&(D.innerHTML=Jn),Do=i(e),g(Je.$$.fragment,e),Oo=i(e),C=d(e,"UL",{});var $=I(C);co=d($,"LI",{"data-svelte-h":!0}),b(co)!=="svelte-v3ebu9"&&(co.innerHTML=In),It=i($),Ie=d($,"LI",{});var to=I(Ie);mo=d(to,"P",{"data-svelte-h":!0}),b(mo)!=="svelte-1mvssnm"&&(mo.textContent=vn),vt=i(to),g(ve.$$.fragment,to),to.forEach(a),Ut=i($),po=d($,"LI",{"data-svelte-h":!0}),b(po)!=="svelte-d7vme7"&&(po.innerHTML=Un),jt=i($),go=d($,"LI",{"data-svelte-h":!0}),b(go)!=="svelte-1ki5kuo"&&(go.innerHTML=jn),Ct=i($),Ue=d($,"LI",{});var no=I(Ue);ho=d(no,"P",{"data-svelte-h":!0}),b(ho)!=="svelte-1sn6840"&&(ho.innerHTML=Cn),Gt=i(no),g(je.$$.fragment,no),no.forEach(a),xt=i($),Ce=d($,"LI",{});var ao=I(Ce);fo=d(ao,"P",{"data-svelte-h":!0}),b(fo)!=="svelte-18whvnd"&&(fo.innerHTML=Gn),$t=i(ao),g(Ge.$$.fragment,ao),ao.forEach(a),$.forEach(a),Ko=i(e),g(xe.$$.fragment,e),et=i(e),k=d(e,"DIV",{class:!0});var N=I(k);g($e.$$.fragment,N),kt=i(N),uo=d(N,"P",{"data-svelte-h":!0}),b(uo)!=="svelte-19glyt2"&&(uo.textContent=xn),zt=i(N),O=d(N,"DIV",{class:!0});var so=I(O);g(ke.$$.fragment,so),qt=i(so),_o=d(so,"P",{"data-svelte-h":!0}),b(_o)!=="svelte-1by6k5g"&&(_o.textContent=$n),so.forEach(a),Wt=i(N),K=d(N,"DIV",{class:!0});var ro=I(K);g(ze.$$.fragment,ro),Zt=i(ro),yo=d(ro,"P",{"data-svelte-h":!0}),b(yo)!=="svelte-1x3yxsa"&&(yo.textContent=kn),ro.forEach(a),N.forEach(a),ot=i(e),g(qe.$$.fragment,e),tt=i(e),z=d(e,"DIV",{class:!0});var E=I(z);g(We.$$.fragment,E),Ft=i(E),Mo=d(E,"P",{"data-svelte-h":!0}),b(Mo)!=="svelte-cu96je"&&(Mo.innerHTML=zn),Rt=i(E),ee=d(E,"DIV",{class:!0});var io=I(ee);g(Ze.$$.fragment,io),Bt=i(io),To=d(io,"P",{"data-svelte-h":!0}),b(To)!=="svelte-igk8ew"&&(To.textContent=qn),io.forEach(a),Nt=i(E),oe=d(E,"DIV",{class:!0});var yt=I(oe);g(Fe.$$.fragment,yt),Et=i(yt),bo=d(yt,"P",{"data-svelte-h":!0}),b(bo)!=="svelte-1x3yxsa"&&(bo.textContent=Wn),yt.forEach(a),E.forEach(a),nt=i(e),g(Re.$$.fragment,e),at=i(e),B=d(e,"DIV",{class:!0});var Zo=I(B);g(Be.$$.fragment,Zo),Pt=i(Zo),te=d(Zo,"DIV",{class:!0});var Mt=I(te);g(Ne.$$.fragment,Mt),At=i(Mt),wo=d(Mt,"P",{"data-svelte-h":!0}),b(wo)!=="svelte-4dbgxy"&&(wo.innerHTML=Zn),Mt.forEach(a),Vt=i(Zo),ne=d(Zo,"DIV",{class:!0});var Tt=I(ne);g(Ee.$$.fragment,Tt),Lt=i(Tt),Jo=d(Tt,"P",{"data-svelte-h":!0}),b(Jo)!=="svelte-1ha4zc4"&&(Jo.innerHTML=Fn),Tt.forEach(a),Zo.forEach(a),st=i(e),g(Pe.$$.fragment,e),rt=i(e),W=d(e,"DIV",{class:!0});var lo=I(W);g(Ae.$$.fragment,lo),Xt=i(lo),Io=d(lo,"P",{"data-svelte-h":!0}),b(Io)!=="svelte-4zoso9"&&(Io.innerHTML=Rn),Qt=i(lo),g(ae.$$.fragment,lo),St=ta(lo,`
rope_local_base_freq (float, *optional*, defaults to 10000.0):
The base period of the RoPE embeddings for local attention.
sliding_window_pattern (\`int\`, *optional*, defaults to 6):
Pattern for the sliding window attention.`),lo.forEach(a),it=i(e),g(Ve.$$.fragment,e),lt=i(e),G=d(e,"DIV",{class:!0});var L=I(G);g(Le.$$.fragment,L),Ht=i(L),vo=d(L,"P",{"data-svelte-h":!0}),b(vo)!=="svelte-69s57z"&&(vo.innerHTML=Bn),Yt=i(L),Uo=d(L,"P",{"data-svelte-h":!0}),b(Uo)!=="svelte-1wi79wt"&&(Uo.innerHTML=Nn),Dt=i(L),jo=d(L,"P",{"data-svelte-h":!0}),b(jo)!=="svelte-o55m63"&&(jo.innerHTML=En),Ot=i(L),g(se.$$.fragment,L),L.forEach(a),ct=i(e),g(Xe.$$.fragment,e),dt=i(e),x=d(e,"DIV",{class:!0});var X=I(x);g(Qe.$$.fragment,X),Kt=i(X),Co=d(X,"P",{"data-svelte-h":!0}),b(Co)!=="svelte-zfgqxb"&&(Co.innerHTML=Pn),en=i(X),Go=d(X,"P",{"data-svelte-h":!0}),b(Go)!=="svelte-hswkmf"&&(Go.innerHTML=An),on=i(X),xo=d(X,"P",{"data-svelte-h":!0}),b(xo)!=="svelte-18nczt8"&&(xo.innerHTML=Vn),tn=i(X),V=d(X,"DIV",{class:!0});var Fo=I(V);g(Se.$$.fragment,Fo),nn=i(Fo),$o=d(Fo,"P",{"data-svelte-h":!0}),b($o)!=="svelte-167jlyh"&&($o.innerHTML=Ln),an=i(Fo),g(re.$$.fragment,Fo),Fo.forEach(a),X.forEach(a),mt=i(e),g(He.$$.fragment,e),pt=i(e),S=d(e,"DIV",{class:!0});var bt=I(S);g(Ye.$$.fragment,bt),sn=i(bt),Z=d(bt,"DIV",{class:!0});var me=I(Z);g(De.$$.fragment,me),rn=i(me),ko=d(me,"P",{"data-svelte-h":!0}),b(ko)!=="svelte-1l73tj9"&&(ko.innerHTML=Xn),ln=i(me),g(ie.$$.fragment,me),cn=i(me),g(le.$$.fragment,me),me.forEach(a),bt.forEach(a),gt=i(e),g(Oe.$$.fragment,e),ht=i(e),q=d(e,"DIV",{class:!0});var pe=I(q);g(Ke.$$.fragment,pe),dn=i(pe),zo=d(pe,"P",{"data-svelte-h":!0}),b(zo)!=="svelte-t424vd"&&(zo.innerHTML=Qn),mn=i(pe),qo=d(pe,"P",{"data-svelte-h":!0}),b(qo)!=="svelte-hswkmf"&&(qo.innerHTML=Sn),pn=i(pe),F=d(pe,"DIV",{class:!0});var ge=I(F);g(eo.$$.fragment,ge),gn=i(ge),Wo=d(ge,"P",{"data-svelte-h":!0}),b(Wo)!=="svelte-yg3f7j"&&(Wo.innerHTML=Hn),hn=i(ge),g(ce.$$.fragment,ge),fn=i(ge),g(de.$$.fragment,ge),ge.forEach(a),pe.forEach(a),ft=i(e),g(oo.$$.fragment,e),ut=i(e),Bo=d(e,"P",{}),I(Bo).forEach(a),this.h()},h(){U(o,"name","hf:doc:metadata"),U(o,"content",Ma),na(w,"float","right"),U(D,"class","flex justify-center"),U(O,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),U(K,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),U(k,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),U(ee,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),U(oe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),U(z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),U(te,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),U(ne,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),U(B,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),U(W,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),U(G,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),U(V,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),U(x,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),U(Z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),U(S,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),U(F,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),U(q,"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,n){s(document.head,o),l(e,y,n),l(e,t,n),l(e,M,n),l(e,w,n),l(e,T,n),h(v,e,n),l(e,he,n),l(e,A,n),l(e,No,n),l(e,fe,n),l(e,Eo,n),l(e,ue,n),l(e,Po,n),h(H,e,n),l(e,Ao,n),l(e,_e,n),l(e,Vo,n),h(Y,e,n),l(e,Lo,n),l(e,ye,n),l(e,Xo,n),l(e,Me,n),l(e,Qo,n),h(Te,e,n),l(e,So,n),l(e,be,n),l(e,Ho,n),h(we,e,n),l(e,Yo,n),l(e,D,n),l(e,Do,n),h(Je,e,n),l(e,Oo,n),l(e,C,n),s(C,co),s(C,It),s(C,Ie),s(Ie,mo),s(Ie,vt),h(ve,Ie,null),s(C,Ut),s(C,po),s(C,jt),s(C,go),s(C,Ct),s(C,Ue),s(Ue,ho),s(Ue,Gt),h(je,Ue,null),s(C,xt),s(C,Ce),s(Ce,fo),s(Ce,$t),h(Ge,Ce,null),l(e,Ko,n),h(xe,e,n),l(e,et,n),l(e,k,n),h($e,k,null),s(k,kt),s(k,uo),s(k,zt),s(k,O),h(ke,O,null),s(O,qt),s(O,_o),s(k,Wt),s(k,K),h(ze,K,null),s(K,Zt),s(K,yo),l(e,ot,n),h(qe,e,n),l(e,tt,n),l(e,z,n),h(We,z,null),s(z,Ft),s(z,Mo),s(z,Rt),s(z,ee),h(Ze,ee,null),s(ee,Bt),s(ee,To),s(z,Nt),s(z,oe),h(Fe,oe,null),s(oe,Et),s(oe,bo),l(e,nt,n),h(Re,e,n),l(e,at,n),l(e,B,n),h(Be,B,null),s(B,Pt),s(B,te),h(Ne,te,null),s(te,At),s(te,wo),s(B,Vt),s(B,ne),h(Ee,ne,null),s(ne,Lt),s(ne,Jo),l(e,st,n),h(Pe,e,n),l(e,rt,n),l(e,W,n),h(Ae,W,null),s(W,Xt),s(W,Io),s(W,Qt),h(ae,W,null),s(W,St),l(e,it,n),h(Ve,e,n),l(e,lt,n),l(e,G,n),h(Le,G,null),s(G,Ht),s(G,vo),s(G,Yt),s(G,Uo),s(G,Dt),s(G,jo),s(G,Ot),h(se,G,null),l(e,ct,n),h(Xe,e,n),l(e,dt,n),l(e,x,n),h(Qe,x,null),s(x,Kt),s(x,Co),s(x,en),s(x,Go),s(x,on),s(x,xo),s(x,tn),s(x,V),h(Se,V,null),s(V,nn),s(V,$o),s(V,an),h(re,V,null),l(e,mt,n),h(He,e,n),l(e,pt,n),l(e,S,n),h(Ye,S,null),s(S,sn),s(S,Z),h(De,Z,null),s(Z,rn),s(Z,ko),s(Z,ln),h(ie,Z,null),s(Z,cn),h(le,Z,null),l(e,gt,n),h(Oe,e,n),l(e,ht,n),l(e,q,n),h(Ke,q,null),s(q,dn),s(q,zo),s(q,mn),s(q,qo),s(q,pn),s(q,F),h(eo,F,null),s(F,gn),s(F,Wo),s(F,hn),h(ce,F,null),s(F,fn),h(de,F,null),l(e,ft,n),h(oo,e,n),l(e,ut,n),l(e,Bo,n),_t=!0},p(e,[n]){const $={};n&2&&($.$$scope={dirty:n,ctx:e}),H.$set($);const to={};n&2&&(to.$$scope={dirty:n,ctx:e}),Y.$set(to);const no={};n&2&&(no.$$scope={dirty:n,ctx:e}),ae.$set(no);const ao={};n&2&&(ao.$$scope={dirty:n,ctx:e}),se.$set(ao);const N={};n&2&&(N.$$scope={dirty:n,ctx:e}),re.$set(N);const so={};n&2&&(so.$$scope={dirty:n,ctx:e}),ie.$set(so);const ro={};n&2&&(ro.$$scope={dirty:n,ctx:e}),le.$set(ro);const E={};n&2&&(E.$$scope={dirty:n,ctx:e}),ce.$set(E);const io={};n&2&&(io.$$scope={dirty:n,ctx:e}),de.$set(io)},i(e){_t||(f(v.$$.fragment,e),f(H.$$.fragment,e),f(Y.$$.fragment,e),f(Te.$$.fragment,e),f(we.$$.fragment,e),f(Je.$$.fragment,e),f(ve.$$.fragment,e),f(je.$$.fragment,e),f(Ge.$$.fragment,e),f(xe.$$.fragment,e),f($e.$$.fragment,e),f(ke.$$.fragment,e),f(ze.$$.fragment,e),f(qe.$$.fragment,e),f(We.$$.fragment,e),f(Ze.$$.fragment,e),f(Fe.$$.fragment,e),f(Re.$$.fragment,e),f(Be.$$.fragment,e),f(Ne.$$.fragment,e),f(Ee.$$.fragment,e),f(Pe.$$.fragment,e),f(Ae.$$.fragment,e),f(ae.$$.fragment,e),f(Ve.$$.fragment,e),f(Le.$$.fragment,e),f(se.$$.fragment,e),f(Xe.$$.fragment,e),f(Qe.$$.fragment,e),f(Se.$$.fragment,e),f(re.$$.fragment,e),f(He.$$.fragment,e),f(Ye.$$.fragment,e),f(De.$$.fragment,e),f(ie.$$.fragment,e),f(le.$$.fragment,e),f(Oe.$$.fragment,e),f(Ke.$$.fragment,e),f(eo.$$.fragment,e),f(ce.$$.fragment,e),f(de.$$.fragment,e),f(oo.$$.fragment,e),_t=!0)},o(e){u(v.$$.fragment,e),u(H.$$.fragment,e),u(Y.$$.fragment,e),u(Te.$$.fragment,e),u(we.$$.fragment,e),u(Je.$$.fragment,e),u(ve.$$.fragment,e),u(je.$$.fragment,e),u(Ge.$$.fragment,e),u(xe.$$.fragment,e),u($e.$$.fragment,e),u(ke.$$.fragment,e),u(ze.$$.fragment,e),u(qe.$$.fragment,e),u(We.$$.fragment,e),u(Ze.$$.fragment,e),u(Fe.$$.fragment,e),u(Re.$$.fragment,e),u(Be.$$.fragment,e),u(Ne.$$.fragment,e),u(Ee.$$.fragment,e),u(Pe.$$.fragment,e),u(Ae.$$.fragment,e),u(ae.$$.fragment,e),u(Ve.$$.fragment,e),u(Le.$$.fragment,e),u(se.$$.fragment,e),u(Xe.$$.fragment,e),u(Qe.$$.fragment,e),u(Se.$$.fragment,e),u(re.$$.fragment,e),u(He.$$.fragment,e),u(Ye.$$.fragment,e),u(De.$$.fragment,e),u(ie.$$.fragment,e),u(le.$$.fragment,e),u(Oe.$$.fragment,e),u(Ke.$$.fragment,e),u(eo.$$.fragment,e),u(ce.$$.fragment,e),u(de.$$.fragment,e),u(oo.$$.fragment,e),_t=!1},d(e){e&&(a(y),a(t),a(M),a(w),a(T),a(he),a(A),a(No),a(fe),a(Eo),a(ue),a(Po),a(Ao),a(_e),a(Vo),a(Lo),a(ye),a(Xo),a(Me),a(Qo),a(So),a(be),a(Ho),a(Yo),a(D),a(Do),a(Oo),a(C),a(Ko),a(et),a(k),a(ot),a(tt),a(z),a(nt),a(at),a(B),a(st),a(rt),a(W),a(it),a(lt),a(G),a(ct),a(dt),a(x),a(mt),a(pt),a(S),a(gt),a(ht),a(q),a(ft),a(ut),a(Bo)),a(o),_(v,e),_(H,e),_(Y,e),_(Te,e),_(we,e),_(Je,e),_(ve),_(je),_(Ge),_(xe,e),_($e),_(ke),_(ze),_(qe,e),_(We),_(Ze),_(Fe),_(Re,e),_(Be),_(Ne),_(Ee),_(Pe,e),_(Ae),_(ae),_(Ve,e),_(Le),_(se),_(Xe,e),_(Qe),_(Se),_(re),_(He,e),_(Ye),_(De),_(ie),_(le),_(Oe,e),_(Ke),_(eo),_(ce),_(de),_(oo,e)}}}const Ma='{"title":"Gemma 3","local":"gemma-3","sections":[{"title":"Notes","local":"notes","sections":[],"depth":2},{"title":"Gemma3ImageProcessor","local":"transformers.Gemma3ImageProcessor","sections":[],"depth":2},{"title":"Gemma3ImageProcessorFast","local":"transformers.Gemma3ImageProcessorFast","sections":[],"depth":2},{"title":"Gemma3Processor","local":"transformers.Gemma3Processor","sections":[],"depth":2},{"title":"Gemma3TextConfig","local":"transformers.Gemma3TextConfig","sections":[],"depth":2},{"title":"Gemma3Config","local":"transformers.Gemma3Config","sections":[],"depth":2},{"title":"Gemma3TextModel","local":"transformers.Gemma3TextModel","sections":[],"depth":2},{"title":"Gemma3ForCausalLM","local":"transformers.Gemma3ForCausalLM","sections":[],"depth":2},{"title":"Gemma3ForConditionalGeneration","local":"transformers.Gemma3ForConditionalGeneration","sections":[],"depth":2}],"depth":1}';function Ta(J){return Dn(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Ga extends On{constructor(o){super(),Kn(this,o,Ta,ya,Yn,{})}}export{Ga as component};
