import{s as zt,f as Wt,o as It,n as ht}from"../chunks/scheduler.25b97de1.js";import{S as Ft,i as Bt,g as m,s as a,r as d,A as Vt,h as c,f as n,c as o,j as R,u as p,x as y,k as C,y as l,a as s,v as g,d as h,t as f,w as u}from"../chunks/index.d9030fc9.js";import{T as Rt}from"../chunks/Tip.baa67368.js";import{D as ve}from"../chunks/Docstring.ffac8efa.js";import{C as $e}from"../chunks/CodeBlock.e6cd0d95.js";import{E as xt}from"../chunks/ExampleCodeBlock.22dfe688.js";import{H as j,E as Ht}from"../chunks/EditOnGithub.91d95064.js";function Nt(P){let r,G="Example:",_,b,M;return b=new $e({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFBhbGlHZW1tYUZvckNvbmRpdGlvbmFsR2VuZXJhdGlvbiUyQyUyMFBhbGlHZW1tYUNvbmZpZyUyQyUyMFNpZ2xpcFZpc2lvbkNvbmZpZyUyQyUyMEdlbW1hQ29uZmlnJTBBJTBBJTIzJTIwSW5pdGlhbGl6aW5nJTIwYSUyMFNpZ2xpcC1saWtlJTIwdmlzaW9uJTIwY29uZmlnJTBBdmlzaW9uX2NvbmZpZyUyMCUzRCUyMFNpZ2xpcFZpc2lvbkNvbmZpZygpJTBBJTBBJTIzJTIwSW5pdGlhbGl6aW5nJTIwYSUyMFBhbGlHZW1tYSUyMGNvbmZpZyUwQXRleHRfY29uZmlnJTIwJTNEJTIwR2VtbWFDb25maWcoKSUwQSUwQSUyMyUyMEluaXRpYWxpemluZyUyMGElMjBQYWxpR2VtbWElMjBwYWxpZ2VtbWEtM2ItMjI0JTIwc3R5bGUlMjBjb25maWd1cmF0aW9uJTBBY29uZmlndXJhdGlvbiUyMCUzRCUyMFBhbGlHZW1tYUNvbmZpZyh2aXNpb25fY29uZmlnJTJDJTIwdGV4dF9jb25maWcpJTBBJTBBJTIzJTIwSW5pdGlhbGl6aW5nJTIwYSUyMG1vZGVsJTIwZnJvbSUyMHRoZSUyMHBhbGlnZW1tYS0zYi0yMjQlMjBzdHlsZSUyMGNvbmZpZ3VyYXRpb24lMEFtb2RlbCUyMCUzRCUyMFBhbGlHZW1tYUZvckNvbmRpdGlvbmFsR2VuZXJhdGlvbihjb25maWd1cmF0aW9uKSUwQSUwQSUyMyUyMEFjY2Vzc2luZyUyMHRoZSUyMG1vZGVsJTIwY29uZmlndXJhdGlvbiUwQWNvbmZpZ3VyYXRpb24lMjAlM0QlMjBtb2RlbC5jb25maWc=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> PaliGemmaForConditionalGeneration, PaliGemmaConfig, SiglipVisionConfig, GemmaConfig

<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 PaliGemma config</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>text_config = GemmaConfig()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a PaliGemma paligemma-3b-224 style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = PaliGemmaConfig(vision_config, text_config)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a model from the paligemma-3b-224 style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = PaliGemmaForConditionalGeneration(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(){r=m("p"),r.textContent=G,_=a(),d(b.$$.fragment)},l(i){r=c(i,"P",{"data-svelte-h":!0}),y(r)!=="svelte-11lpom8"&&(r.textContent=G),_=o(i),p(b.$$.fragment,i)},m(i,T){s(i,r,T),s(i,_,T),g(b,i,T),M=!0},p:ht,i(i){M||(h(b.$$.fragment,i),M=!0)},o(i){f(b.$$.fragment,i),M=!1},d(i){i&&(n(r),n(_)),u(b,i)}}}function Xt(P){let r,G=`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(){r=m("p"),r.innerHTML=G},l(_){r=c(_,"P",{"data-svelte-h":!0}),y(r)!=="svelte-fincs2"&&(r.innerHTML=G)},m(_,b){s(_,r,b)},p:ht,d(_){_&&n(r)}}}function Et(P){let r,G="Example:",_,b,M;return b=new $e({props:{code:"ZnJvbSUyMFBJTCUyMGltcG9ydCUyMEltYWdlJTBBaW1wb3J0JTIwcmVxdWVzdHMlMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b1Byb2Nlc3NvciUyQyUyMFBhbGlHZW1tYUZvckNvbmRpdGlvbmFsR2VuZXJhdGlvbiUwQSUwQW1vZGVsJTIwJTNEJTIwUGFsaUdlbW1hRm9yQ29uZGl0aW9uYWxHZW5lcmF0aW9uLmZyb21fcHJldHJhaW5lZCglMjJnb29nbGUlMkZQYWxpR2VtbWEtdGVzdC0yMjRweC1oZiUyMiklMEFwcm9jZXNzb3IlMjAlM0QlMjBBdXRvUHJvY2Vzc29yLmZyb21fcHJldHJhaW5lZCglMjJnb29nbGUlMkZQYWxpR2VtbWEtdGVzdC0yMjRweC1oZiUyMiklMEElMEFwcm9tcHQlMjAlM0QlMjAlMjJhbnN3ZXIlMjBlbiUyMFdoZXJlJTIwaXMlMjB0aGUlMjBjb3clMjBzdGFuZGluZyUzRiUyMiUwQXVybCUyMCUzRCUyMCUyMmh0dHBzJTNBJTJGJTJGaHVnZ2luZ2ZhY2UuY28lMkZndi1oZiUyRlBhbGlHZW1tYS10ZXN0LTIyNHB4LWhmJTJGcmVzb2x2ZSUyRm1haW4lMkZjb3dfYmVhY2hfMS5wbmclMjIlMEFpbWFnZSUyMCUzRCUyMEltYWdlLm9wZW4ocmVxdWVzdHMuZ2V0KHVybCUyQyUyMHN0cmVhbSUzRFRydWUpLnJhdyklMEElMEFpbnB1dHMlMjAlM0QlMjBwcm9jZXNzb3IoaW1hZ2VzJTNEaW1hZ2UlMkMlMjB0ZXh0JTNEcHJvbXB0JTJDJTIwJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMiklMEElMEElMjMlMjBHZW5lcmF0ZSUwQWdlbmVyYXRlX2lkcyUyMCUzRCUyMG1vZGVsLmdlbmVyYXRlKCoqaW5wdXRzJTJDJTIwbWF4X2xlbmd0aCUzRDMwKSUwQXByb2Nlc3Nvci5iYXRjaF9kZWNvZGUoZ2VuZXJhdGVfaWRzJTJDJTIwc2tpcF9zcGVjaWFsX3Rva2VucyUzRFRydWUlMkMlMjBjbGVhbl91cF90b2tlbml6YXRpb25fc3BhY2VzJTNERmFsc2UpJTVCMCU1RA==",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, PaliGemmaForConditionalGeneration

<span class="hljs-meta">&gt;&gt;&gt; </span>model = PaliGemmaForConditionalGeneration.from_pretrained(<span class="hljs-string">&quot;google/PaliGemma-test-224px-hf&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>processor = AutoProcessor.from_pretrained(<span class="hljs-string">&quot;google/PaliGemma-test-224px-hf&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>prompt = <span class="hljs-string">&quot;answer en Where is the cow standing?&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>url = <span class="hljs-string">&quot;https://huggingface.co/gv-hf/PaliGemma-test-224px-hf/resolve/main/cow_beach_1.png&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>image = Image.<span class="hljs-built_in">open</span>(requests.get(url, stream=<span class="hljs-literal">True</span>).raw)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = processor(images=image, text=prompt,  return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)

<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, max_length=<span class="hljs-number">30</span>)
<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;answer en Where is the cow standing?\\nbeach&quot;</span>`,wrap:!1}}),{c(){r=m("p"),r.textContent=G,_=a(),d(b.$$.fragment)},l(i){r=c(i,"P",{"data-svelte-h":!0}),y(r)!=="svelte-11lpom8"&&(r.textContent=G),_=o(i),p(b.$$.fragment,i)},m(i,T){s(i,r,T),s(i,_,T),g(b,i,T),M=!0},p:ht,i(i){M||(h(b.$$.fragment,i),M=!0)},o(i){f(b.$$.fragment,i),M=!1},d(i){i&&(n(r),n(_)),u(b,i)}}}function St(P){let r,G,_,b,M,i,T,Je,H,ft='The PaliGemma model was proposed in <a href="https://huggingface.co/blog/paligemma" rel="nofollow">PaliGemma – Google’s Cutting-Edge Open Vision Language Model</a> by Google. It is a 3B vision-language model composed by a <a href="siglip">SigLIP</a> vision encoder and a <a href="gemma">Gemma</a> language decoder linked by a multimodal linear projection. It cuts an image into a fixed number of VIT tokens and prepends it to an optional prompt. One particularity is that the model uses full block attention on all the image tokens plus the input text tokens. It comes in 3 resolutions, 224x224, 448x448 and 896x896 with 3 base models, with 55 fine-tuned versions for different tasks, and 2 mix models.',ke,Z,ut,Ue,N,bt='PaliGemma architecture. Taken from the <a href="https://huggingface.co/blog/paligemma">blog post.</a>',Ce,X,_t='This model was contributed by <a href="https://huggingface.co/Molbap" rel="nofollow">Molbap</a>.',je,E,Pe,S,yt="<li>PaliGemma is not meant for conversational use, and it works best when fine-tuning to a specific use case. Some downstream tasks on which PaliGemma can be fine-tuned include image captioning, visual question answering (VQA), object detection, referring expression segmentation and document understanding.</li> <li>One can use <code>PaliGemmaProcessor</code> to prepare images, text and optional labels for the model. When fine-tuning a PaliGemma model, the <code>suffix</code> argument can be passed to the processor which creates the <code>labels</code> for the model:</li>",Ze,L,xe,q,ze,Y,Mt='The model can accept a single or multiple images. According to the <a href="https://arxiv.org/abs/2407.07726v1" rel="nofollow">paper</a>, the checkpoint PaliGemma can transfer to tasks which take multiple images as input. NLVR2 is one such task, which asks one question about two images, and requires looking at both to give the correct answer. Here’s an example code for single and multi image inference.',We,Q,Ie,A,Fe,D,Be,K,Ve,O,Re,ee,Tt="A list of official Hugging Face and community (indicated by 🌎) resources to help you get started with PaliGemma. If you’re interested in submitting a resource to be included here, please feel free to open a Pull Request and we’ll review it! The resource should ideally demonstrate something new instead of duplicating an existing resource.",He,te,wt='<li>A blog post introducing all the features of PaliGemma can be found <a href="https://huggingface.co/blog/paligemma" rel="nofollow">here</a>.</li> <li>Demo notebooks on how to fine-tune PaliGemma for VQA with the Trainer API along with inference can be found <a href="https://github.com/huggingface/notebooks/tree/main/examples/paligemma" rel="nofollow">here</a>.</li> <li>Demo notebooks on how to fine-tune PaliGemma on a custom dataset (receipt image -&gt; JSON) along with inference can be found <a href="https://github.com/NielsRogge/Transformers-Tutorials/tree/master/PaliGemma" rel="nofollow">here</a>. 🌎</li>',Ne,ne,Xe,w,ae,Ke,ge,vt=`This is the configuration class to store the configuration of a <a href="/docs/transformers/main/en/model_doc/paligemma#transformers.PaliGemmaForConditionalGeneration">PaliGemmaForConditionalGeneration</a>. It is used to instantiate an
PaliGemmamodel 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.`,Oe,he,Gt='e.g. <a href="https://huggingface.co/paligemma-hf/paligemma-2b" rel="nofollow">paligemma-hf/paligemma-2b</a>',et,fe,$t=`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.`,tt,x,Ee,oe,Se,v,se,nt,ue,Jt="Constructs a PaliGemma processor which wraps a PaliGemma image processor and a PaliGemma tokenizer into a single processor.",at,be,kt=`<a href="/docs/transformers/main/en/model_doc/paligemma#transformers.PaliGemmaProcessor">PaliGemmaProcessor</a> offers all the functionalities of <a href="/docs/transformers/main/en/model_doc/siglip#transformers.SiglipImageProcessor">SiglipImageProcessor</a> and <a href="/docs/transformers/main/en/model_doc/llama2#transformers.LlamaTokenizerFast">LlamaTokenizerFast</a>. See the
<code>__call__()</code> and <a href="/docs/transformers/main/en/model_doc/paligemma#transformers.PaliGemmaProcessor.decode">decode()</a> for more information.`,ot,z,ie,st,_e,Ut=`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.`,it,W,re,rt,ye,Ct=`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.`,Le,le,qe,$,me,lt,Me,jt=`The PALIGEMMA 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.)`,mt,Te,Pt=`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.`,ct,U,ce,dt,we,Zt='The <a href="/docs/transformers/main/en/model_doc/paligemma#transformers.PaliGemmaForConditionalGeneration">PaliGemmaForConditionalGeneration</a> forward method, overrides the <code>__call__</code> special method.',pt,I,gt,F,Ye,de,Qe,Ge,Ae;return M=new j({props:{title:"PaliGemma",local:"paligemma",headingTag:"h1"}}),T=new j({props:{title:"Overview",local:"overview",headingTag:"h2"}}),E=new j({props:{title:"Usage tips",local:"usage-tips",headingTag:"h2"}}),L=new $e({props:{code:"cHJvbXB0JTIwJTNEJTIwJTIyV2hhdCUyMGlzJTIwb24lMjB0aGUlMjBmbG93ZXIlM0YlMjIlMEFhbnN3ZXIlMjAlM0QlMjAlMjJhJTIwYmVlJTIyJTBBaW5wdXRzJTIwJTNEJTIwcHJvY2Vzc29yKGltYWdlcyUzRHJhd19pbWFnZSUyQyUyMHRleHQlM0Rwcm9tcHQlMkMlMjBzdWZmaXglM0RhbnN3ZXIlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKQ==",highlighted:`prompt = <span class="hljs-string">&quot;What is on the flower?&quot;</span>
answer = <span class="hljs-string">&quot;a bee&quot;</span>
inputs = processor(images=raw_image, text=prompt, suffix=answer, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)`,wrap:!1}}),q=new j({props:{title:"Usage Example",local:"usage-example",headingTag:"h2"}}),Q=new j({props:{title:"Single-image Inference",local:"single-image-inference",headingTag:"h3"}}),A=new $e({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Qcm9jZXNzb3IlMkMlMjBQYWxpR2VtbWFGb3JDb25kaXRpb25hbEdlbmVyYXRpb24lMEElMEFtb2RlbF9pZCUyMCUzRCUyMCUyMmdvb2dsZSUyRnBhbGlnZW1tYS0zYi1taXgtMjI0JTIyJTBBbW9kZWwlMjAlM0QlMjBQYWxpR2VtbWFGb3JDb25kaXRpb25hbEdlbmVyYXRpb24uZnJvbV9wcmV0cmFpbmVkKG1vZGVsX2lkKSUwQXByb2Nlc3NvciUyMCUzRCUyMEF1dG9Qcm9jZXNzb3IuZnJvbV9wcmV0cmFpbmVkKG1vZGVsX2lkKSUwQSUwQXByb21wdCUyMCUzRCUyMCUyMldoYXQlMjBpcyUyMG9uJTIwdGhlJTIwZmxvd2VyJTNGJTIyJTBBaW1hZ2VfZmlsZSUyMCUzRCUyMCUyMmh0dHBzJTNBJTJGJTJGaHVnZ2luZ2ZhY2UuY28lMkZkYXRhc2V0cyUyRmh1Z2dpbmdmYWNlJTJGZG9jdW1lbnRhdGlvbi1pbWFnZXMlMkZyZXNvbHZlJTJGbWFpbiUyRmJlZS5qcGclM0Zkb3dubG9hZCUzRHRydWUlMjIlMEFyYXdfaW1hZ2UlMjAlM0QlMjBJbWFnZS5vcGVuKHJlcXVlc3RzLmdldChpbWFnZV9maWxlJTJDJTIwc3RyZWFtJTNEVHJ1ZSkucmF3KSUwQWlucHV0cyUyMCUzRCUyMHByb2Nlc3NvcihyYXdfaW1hZ2UlMkMlMjBwcm9tcHQlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKSUwQW91dHB1dCUyMCUzRCUyMG1vZGVsLmdlbmVyYXRlKCoqaW5wdXRzJTJDJTIwbWF4X25ld190b2tlbnMlM0QyMCklMEElMEFwcmludChwcm9jZXNzb3IuZGVjb2RlKG91dHB1dCU1QjAlNUQlMkMlMjBza2lwX3NwZWNpYWxfdG9rZW5zJTNEVHJ1ZSklNUJpbnB1dHMuaW5wdXRfaWRzLnNoYXBlJTVCMSU1RCUzQSUyMCU1RCk=",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoProcessor, PaliGemmaForConditionalGeneration

model_id = <span class="hljs-string">&quot;google/paligemma-3b-mix-224&quot;</span>
model = PaliGemmaForConditionalGeneration.from_pretrained(model_id)
processor = AutoProcessor.from_pretrained(model_id)

prompt = <span class="hljs-string">&quot;What is on the flower?&quot;</span>
image_file = <span class="hljs-string">&quot;https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/bee.jpg?download=true&quot;</span>
raw_image = Image.<span class="hljs-built_in">open</span>(requests.get(image_file, stream=<span class="hljs-literal">True</span>).raw)
inputs = processor(raw_image, prompt, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)
output = model.generate(**inputs, max_new_tokens=<span class="hljs-number">20</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>)[inputs.input_ids.shape[<span class="hljs-number">1</span>]: ])`,wrap:!1}}),D=new j({props:{title:"Multi-image Inference",local:"multi-image-inference",headingTag:"h3"}}),K=new $e({props:{code:"bW9kZWxfaWQlMjAlM0QlMjAlMjJnb29nbGUlMkZwYWxpZ2VtbWEtM2ItZnQtbmx2cjItNDQ4JTIyJTIwJTIwJTIzJTIwY2hlY2twb2ludCUyMHR1bmVkJTIwZm9yJTIwbXVsdGlwbGUlMjBpbWFnZXMlMEFtb2RlbCUyMCUzRCUyMFBhbGlHZW1tYUZvckNvbmRpdGlvbmFsR2VuZXJhdGlvbi5mcm9tX3ByZXRyYWluZWQobW9kZWxfaWQpJTBBcHJvY2Vzc29yJTIwJTNEJTIwUGFsaUdlbW1hUHJvY2Vzc29yLmZyb21fcHJldHJhaW5lZChtb2RlbF9pZCklMEElMEFwcm9tcHQlMjAlM0QlMjAlMjJhbnN3ZXIlMjBlbiUyMFdoaWNoJTIwb2YlMjB0aGUlMjB0d28lMjBwaWN0dXJlcyUyMHNob3dzJTIwYSUyMHNub3dtYW4lMkMlMjBmaXJzdCUyMG9yJTIwc2Vjb25kJTNGJTIyJTBBc3RvcF9zaWduX2ltYWdlJTIwJTNEJTIwSW1hZ2Uub3BlbiglMEElMjAlMjAlMjAlMjByZXF1ZXN0cy5nZXQoJTIyaHR0cHMlM0ElMkYlMkZ3d3cuaWxhbmtlbG1hbi5vcmclMkZzdG9wc2lnbnMlMkZhdXN0cmFsaWEuanBnJTIyJTJDJTIwc3RyZWFtJTNEVHJ1ZSkucmF3JTBBKSUwQXNub3dfaW1hZ2UlMjAlM0QlMjBJbWFnZS5vcGVuKCUwQSUyMCUyMCUyMCUyMHJlcXVlc3RzLmdldCglMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjJodHRwcyUzQSUyRiUyRmh1Z2dpbmdmYWNlLmNvJTJGbWljcm9zb2Z0JTJGa29zbW9zLTItcGF0Y2gxNC0yMjQlMkZyZXNvbHZlJTJGbWFpbiUyRnNub3dtYW4uanBnJTIyJTJDJTIwc3RyZWFtJTNEVHJ1ZSUwQSUyMCUyMCUyMCUyMCkucmF3JTBBKSUwQSUwQWlucHV0cyUyMCUzRCUyMHByb2Nlc3NvcihpbWFnZXMlM0QlNUIlNUJzbm93X2ltYWdlJTJDJTIwc3RvcF9zaWduX2ltYWdlJTVEJTVEJTJDJTIwdGV4dCUzRHByb21wdCUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpJTBBJTBBb3V0cHV0JTIwJTNEJTIwbW9kZWwuZ2VuZXJhdGUoKippbnB1dHMlMkMlMjBtYXhfbmV3X3Rva2VucyUzRDIwKSUwQXByaW50KHByb2Nlc3Nvci5kZWNvZGUob3V0cHV0JTVCMCU1RCUyQyUyMHNraXBfc3BlY2lhbF90b2tlbnMlM0RUcnVlKSU1QmlucHV0cy5pbnB1dF9pZHMuc2hhcGUlNUIxJTVEJTNBJTIwJTVEKSUwQQ==",highlighted:`model_id = <span class="hljs-string">&quot;google/paligemma-3b-ft-nlvr2-448&quot;</span>  <span class="hljs-comment"># checkpoint tuned for multiple images</span>
model = PaliGemmaForConditionalGeneration.from_pretrained(model_id)
processor = PaliGemmaProcessor.from_pretrained(model_id)

prompt = <span class="hljs-string">&quot;answer en Which of the two pictures shows a snowman, first or second?&quot;</span>
stop_sign_image = Image.<span class="hljs-built_in">open</span>(
    requests.get(<span class="hljs-string">&quot;https://www.ilankelman.org/stopsigns/australia.jpg&quot;</span>, stream=<span class="hljs-literal">True</span>).raw
)
snow_image = Image.<span class="hljs-built_in">open</span>(
    requests.get(
        <span class="hljs-string">&quot;https://huggingface.co/microsoft/kosmos-2-patch14-224/resolve/main/snowman.jpg&quot;</span>, stream=<span class="hljs-literal">True</span>
    ).raw
)

inputs = processor(images=[[snow_image, stop_sign_image]], text=prompt, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)

output = model.generate(**inputs, max_new_tokens=<span class="hljs-number">20</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>)[inputs.input_ids.shape[<span class="hljs-number">1</span>]: ])
`,wrap:!1}}),O=new j({props:{title:"Resources",local:"resources",headingTag:"h2"}}),ne=new j({props:{title:"PaliGemmaConfig",local:"transformers.PaliGemmaConfig",headingTag:"h2"}}),ae=new ve({props:{name:"class transformers.PaliGemmaConfig",anchor:"transformers.PaliGemmaConfig",parameters:[{name:"vision_config",val:" = None"},{name:"text_config",val:" = None"},{name:"ignore_index",val:" = -100"},{name:"image_token_index",val:" = 256000"},{name:"vocab_size",val:" = 257152"},{name:"projection_dim",val:" = 2048"},{name:"hidden_size",val:" = 2048"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.PaliGemmaConfig.vision_config",description:`<strong>vision_config</strong> (<code>PaliGemmaVisionConfig</code>,  <em>optional</em>) &#x2014;
Custom vision config or dict`,name:"vision_config"},{anchor:"transformers.PaliGemmaConfig.text_config",description:`<strong>text_config</strong> (<code>Union[AutoConfig, dict]</code>, <em>optional</em>) &#x2014;
The config object of the text backbone. Can be any of <code>LlamaConfig</code> or <code>MistralConfig</code>.`,name:"text_config"},{anchor:"transformers.PaliGemmaConfig.ignore_index",description:`<strong>ignore_index</strong> (<code>int</code>, <em>optional</em>, defaults to -100) &#x2014;
The ignore index for the loss function.`,name:"ignore_index"},{anchor:"transformers.PaliGemmaConfig.image_token_index",description:`<strong>image_token_index</strong> (<code>int</code>, <em>optional</em>, defaults to 256000) &#x2014;
The image token index to encode the image prompt.`,name:"image_token_index"},{anchor:"transformers.PaliGemmaConfig.vocab_size",description:`<strong>vocab_size</strong> (<code>int</code>, <em>optional</em>, defaults to 257152) &#x2014;
Vocabulary size of the PaliGemmamodel. 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/paligemma#transformers.PaliGemmaForConditionalGeneration">~PaliGemmaForConditionalGeneration</a>`,name:"vocab_size"},{anchor:"transformers.PaliGemmaConfig.projection_dim",description:`<strong>projection_dim</strong> (<code>int</code>, <em>optional</em>, defaults to 2048) &#x2014;
Dimension of the multimodal projection space.`,name:"projection_dim"},{anchor:"transformers.PaliGemmaConfig.hidden_size",description:`<strong>hidden_size</strong> (<code>int</code>, <em>optional</em>, defaults to 2048) &#x2014;
Dimension of the hidden layer of the Language model.`,name:"hidden_size"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/paligemma/configuration_paligemma.py#L26"}}),x=new xt({props:{anchor:"transformers.PaliGemmaConfig.example",$$slots:{default:[Nt]},$$scope:{ctx:P}}}),oe=new j({props:{title:"PaliGemmaProcessor",local:"transformers.PaliGemmaProcessor",headingTag:"h2"}}),se=new ve({props:{name:"class transformers.PaliGemmaProcessor",anchor:"transformers.PaliGemmaProcessor",parameters:[{name:"image_processor",val:" = None"},{name:"tokenizer",val:" = None"},{name:"chat_template",val:" = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.PaliGemmaProcessor.image_processor",description:`<strong>image_processor</strong> (<a href="/docs/transformers/main/en/model_doc/siglip#transformers.SiglipImageProcessor">SiglipImageProcessor</a>, <em>optional</em>) &#x2014;
The image processor is a required input.`,name:"image_processor"},{anchor:"transformers.PaliGemmaProcessor.tokenizer",description:`<strong>tokenizer</strong> (<a href="/docs/transformers/main/en/model_doc/llama2#transformers.LlamaTokenizerFast">LlamaTokenizerFast</a>, <em>optional</em>) &#x2014;
The tokenizer is a required input.`,name:"tokenizer"},{anchor:"transformers.PaliGemmaProcessor.chat_template",description:`<strong>chat_template</strong> (<code>str</code>, <em>optional</em>) &#x2014; A Jinja template which will be used to convert lists of messages
in a chat into a tokenizable string.`,name:"chat_template"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/paligemma/processing_paligemma.py#L126"}}),ie=new ve({props:{name:"batch_decode",anchor:"transformers.PaliGemmaProcessor.batch_decode",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/paligemma/processing_paligemma.py#L338"}}),re=new ve({props:{name:"decode",anchor:"transformers.PaliGemmaProcessor.decode",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/paligemma/processing_paligemma.py#L346"}}),le=new j({props:{title:"PaliGemmaForConditionalGeneration",local:"transformers.PaliGemmaForConditionalGeneration",headingTag:"h2"}}),me=new ve({props:{name:"class transformers.PaliGemmaForConditionalGeneration",anchor:"transformers.PaliGemmaForConditionalGeneration",parameters:[{name:"config",val:": PaliGemmaConfig"}],parametersDescription:[{anchor:"transformers.PaliGemmaForConditionalGeneration.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/paligemma#transformers.PaliGemmaConfig">PaliGemmaConfig</a> or <code>PaliGemmaVisionConfig</code>) &#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/paligemma/modeling_paligemma.py#L295"}}),ce=new ve({props:{name:"forward",anchor:"transformers.PaliGemmaForConditionalGeneration.forward",parameters:[{name:"input_ids",val:": LongTensor = None"},{name:"pixel_values",val:": 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[transformers.cache_utils.Cache, typing.List[torch.FloatTensor], 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:"return_dict",val:": typing.Optional[bool] = None"},{name:"num_logits_to_keep",val:": int = 0"}],parametersDescription:[{anchor:"transformers.PaliGemmaForConditionalGeneration.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.PaliGemmaForConditionalGeneration.forward.pixel_values",description:'<strong>pixel_values</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, image_size, image_size)) -- The tensors corresponding to the input images. Pixel values can be obtained using [AutoImageProcessor](/docs/transformers/main/en/model_doc/auto#transformers.AutoImageProcessor). See [SiglipImageProcessor.__call__()](/docs/transformers/main/en/model_doc/imagegpt#transformers.ImageGPTFeatureExtractor.__call__) for details ([]</code>PaliGemmaProcessor`] uses\n<a href="/docs/transformers/main/en/model_doc/siglip#transformers.SiglipImageProcessor">SiglipImageProcessor</a> for processing images).',name:"pixel_values"},{anchor:"transformers.PaliGemmaForConditionalGeneration.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>decoder_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.PaliGemmaForConditionalGeneration.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>. <a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.PaliGemmaForConditionalGeneration.forward.past_key_values",description:`<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>) &#x2014;
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>) and 2 additional tensors of shape
<code>(batch_size, num_heads, encoder_sequence_length, embed_size_per_head)</code>.</p>
<p>Contains pre-computed hidden-states (key and values in the self-attention blocks and in the cross-attention
blocks) that can be used (see <code>past_key_values</code> input) to speed up sequential decoding.</p>
<p>If <code>past_key_values</code> are used, the user can optionally input only the last <code>decoder_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>decoder_input_ids</code> of shape <code>(batch_size, sequence_length)</code>.`,name:"past_key_values"},{anchor:"transformers.PaliGemmaForConditionalGeneration.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.PaliGemmaForConditionalGeneration.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.PaliGemmaForConditionalGeneration.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.PaliGemmaForConditionalGeneration.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.PaliGemmaForConditionalGeneration.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.PaliGemmaForConditionalGeneration.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.PaliGemmaForConditionalGeneration.forward.Args",description:`<strong>Args</strong> &#x2014;
labels (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>):
Labels for computing the masked language modeling loss. Indices should either be in <code>[0, ..., config.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>.</p>
<p>num_logits_to_keep (<code>int</code>, <em>optional</em>):
Calculate logits for the last <code>num_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.`,name:"Args"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/paligemma/modeling_paligemma.py#L420",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <code>transformers.models.paligemma.modeling_paligemma.PaliGemmaCausalLMOutputWithPast</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/paligemma#transformers.PaliGemmaConfig"
>PaliGemmaConfig</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, num_images, 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.paligemma.modeling_paligemma.PaliGemmaCausalLMOutputWithPast</code> or <code>tuple(torch.FloatTensor)</code></p>
`}}),I=new Rt({props:{$$slots:{default:[Xt]},$$scope:{ctx:P}}}),F=new xt({props:{anchor:"transformers.PaliGemmaForConditionalGeneration.forward.example",$$slots:{default:[Et]},$$scope:{ctx:P}}}),de=new Ht({props:{source:"https://github.com/huggingface/transformers/blob/main/docs/source/en/model_doc/paligemma.md"}}),{c(){r=m("meta"),G=a(),_=m("p"),b=a(),d(M.$$.fragment),i=a(),d(T.$$.fragment),Je=a(),H=m("p"),H.innerHTML=ft,ke=a(),Z=m("img"),Ue=a(),N=m("small"),N.innerHTML=bt,Ce=a(),X=m("p"),X.innerHTML=_t,je=a(),d(E.$$.fragment),Pe=a(),S=m("ul"),S.innerHTML=yt,Ze=a(),d(L.$$.fragment),xe=a(),d(q.$$.fragment),ze=a(),Y=m("p"),Y.innerHTML=Mt,We=a(),d(Q.$$.fragment),Ie=a(),d(A.$$.fragment),Fe=a(),d(D.$$.fragment),Be=a(),d(K.$$.fragment),Ve=a(),d(O.$$.fragment),Re=a(),ee=m("p"),ee.textContent=Tt,He=a(),te=m("ul"),te.innerHTML=wt,Ne=a(),d(ne.$$.fragment),Xe=a(),w=m("div"),d(ae.$$.fragment),Ke=a(),ge=m("p"),ge.innerHTML=vt,Oe=a(),he=m("p"),he.innerHTML=Gt,et=a(),fe=m("p"),fe.innerHTML=$t,tt=a(),d(x.$$.fragment),Ee=a(),d(oe.$$.fragment),Se=a(),v=m("div"),d(se.$$.fragment),nt=a(),ue=m("p"),ue.textContent=Jt,at=a(),be=m("p"),be.innerHTML=kt,ot=a(),z=m("div"),d(ie.$$.fragment),st=a(),_e=m("p"),_e.innerHTML=Ut,it=a(),W=m("div"),d(re.$$.fragment),rt=a(),ye=m("p"),ye.innerHTML=Ct,Le=a(),d(le.$$.fragment),qe=a(),$=m("div"),d(me.$$.fragment),lt=a(),Me=m("p"),Me.innerHTML=jt,mt=a(),Te=m("p"),Te.innerHTML=Pt,ct=a(),U=m("div"),d(ce.$$.fragment),dt=a(),we=m("p"),we.innerHTML=Zt,pt=a(),d(I.$$.fragment),gt=a(),d(F.$$.fragment),Ye=a(),d(de.$$.fragment),Qe=a(),Ge=m("p"),this.h()},l(e){const t=Vt("svelte-u9bgzb",document.head);r=c(t,"META",{name:!0,content:!0}),t.forEach(n),G=o(e),_=c(e,"P",{}),R(_).forEach(n),b=o(e),p(M.$$.fragment,e),i=o(e),p(T.$$.fragment,e),Je=o(e),H=c(e,"P",{"data-svelte-h":!0}),y(H)!=="svelte-1ymlx0s"&&(H.innerHTML=ft),ke=o(e),Z=c(e,"IMG",{src:!0,alt:!0,width:!0}),Ue=o(e),N=c(e,"SMALL",{"data-svelte-h":!0}),y(N)!=="svelte-so6sdv"&&(N.innerHTML=bt),Ce=o(e),X=c(e,"P",{"data-svelte-h":!0}),y(X)!=="svelte-1t8caf5"&&(X.innerHTML=_t),je=o(e),p(E.$$.fragment,e),Pe=o(e),S=c(e,"UL",{"data-svelte-h":!0}),y(S)!=="svelte-173k966"&&(S.innerHTML=yt),Ze=o(e),p(L.$$.fragment,e),xe=o(e),p(q.$$.fragment,e),ze=o(e),Y=c(e,"P",{"data-svelte-h":!0}),y(Y)!=="svelte-y474mm"&&(Y.innerHTML=Mt),We=o(e),p(Q.$$.fragment,e),Ie=o(e),p(A.$$.fragment,e),Fe=o(e),p(D.$$.fragment,e),Be=o(e),p(K.$$.fragment,e),Ve=o(e),p(O.$$.fragment,e),Re=o(e),ee=c(e,"P",{"data-svelte-h":!0}),y(ee)!=="svelte-q42lou"&&(ee.textContent=Tt),He=o(e),te=c(e,"UL",{"data-svelte-h":!0}),y(te)!=="svelte-1508ys2"&&(te.innerHTML=wt),Ne=o(e),p(ne.$$.fragment,e),Xe=o(e),w=c(e,"DIV",{class:!0});var J=R(w);p(ae.$$.fragment,J),Ke=o(J),ge=c(J,"P",{"data-svelte-h":!0}),y(ge)!=="svelte-1622r4j"&&(ge.innerHTML=vt),Oe=o(J),he=c(J,"P",{"data-svelte-h":!0}),y(he)!=="svelte-4qnv67"&&(he.innerHTML=Gt),et=o(J),fe=c(J,"P",{"data-svelte-h":!0}),y(fe)!=="svelte-o55m63"&&(fe.innerHTML=$t),tt=o(J),p(x.$$.fragment,J),J.forEach(n),Ee=o(e),p(oe.$$.fragment,e),Se=o(e),v=c(e,"DIV",{class:!0});var k=R(v);p(se.$$.fragment,k),nt=o(k),ue=c(k,"P",{"data-svelte-h":!0}),y(ue)!=="svelte-8qftvs"&&(ue.textContent=Jt),at=o(k),be=c(k,"P",{"data-svelte-h":!0}),y(be)!=="svelte-1f2clxs"&&(be.innerHTML=kt),ot=o(k),z=c(k,"DIV",{class:!0});var pe=R(z);p(ie.$$.fragment,pe),st=o(pe),_e=c(pe,"P",{"data-svelte-h":!0}),y(_e)!=="svelte-4dbgxy"&&(_e.innerHTML=Ut),pe.forEach(n),it=o(k),W=c(k,"DIV",{class:!0});var De=R(W);p(re.$$.fragment,De),rt=o(De),ye=c(De,"P",{"data-svelte-h":!0}),y(ye)!=="svelte-1ha4zc4"&&(ye.innerHTML=Ct),De.forEach(n),k.forEach(n),Le=o(e),p(le.$$.fragment,e),qe=o(e),$=c(e,"DIV",{class:!0});var B=R($);p(me.$$.fragment,B),lt=o(B),Me=c(B,"P",{"data-svelte-h":!0}),y(Me)!=="svelte-1u2i5mm"&&(Me.innerHTML=jt),mt=o(B),Te=c(B,"P",{"data-svelte-h":!0}),y(Te)!=="svelte-hswkmf"&&(Te.innerHTML=Pt),ct=o(B),U=c(B,"DIV",{class:!0});var V=R(U);p(ce.$$.fragment,V),dt=o(V),we=c(V,"P",{"data-svelte-h":!0}),y(we)!=="svelte-1q4duri"&&(we.innerHTML=Zt),pt=o(V),p(I.$$.fragment,V),gt=o(V),p(F.$$.fragment,V),V.forEach(n),B.forEach(n),Ye=o(e),p(de.$$.fragment,e),Qe=o(e),Ge=c(e,"P",{}),R(Ge).forEach(n),this.h()},h(){C(r,"name","hf:doc:metadata"),C(r,"content",Lt),Wt(Z.src,ut="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/blog/paligemma/paligemma_arch.png")||C(Z,"src",ut),C(Z,"alt","drawing"),C(Z,"width","600"),C(w,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),C(z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),C(W,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),C(v,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),C(U,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),C($,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(e,t){l(document.head,r),s(e,G,t),s(e,_,t),s(e,b,t),g(M,e,t),s(e,i,t),g(T,e,t),s(e,Je,t),s(e,H,t),s(e,ke,t),s(e,Z,t),s(e,Ue,t),s(e,N,t),s(e,Ce,t),s(e,X,t),s(e,je,t),g(E,e,t),s(e,Pe,t),s(e,S,t),s(e,Ze,t),g(L,e,t),s(e,xe,t),g(q,e,t),s(e,ze,t),s(e,Y,t),s(e,We,t),g(Q,e,t),s(e,Ie,t),g(A,e,t),s(e,Fe,t),g(D,e,t),s(e,Be,t),g(K,e,t),s(e,Ve,t),g(O,e,t),s(e,Re,t),s(e,ee,t),s(e,He,t),s(e,te,t),s(e,Ne,t),g(ne,e,t),s(e,Xe,t),s(e,w,t),g(ae,w,null),l(w,Ke),l(w,ge),l(w,Oe),l(w,he),l(w,et),l(w,fe),l(w,tt),g(x,w,null),s(e,Ee,t),g(oe,e,t),s(e,Se,t),s(e,v,t),g(se,v,null),l(v,nt),l(v,ue),l(v,at),l(v,be),l(v,ot),l(v,z),g(ie,z,null),l(z,st),l(z,_e),l(v,it),l(v,W),g(re,W,null),l(W,rt),l(W,ye),s(e,Le,t),g(le,e,t),s(e,qe,t),s(e,$,t),g(me,$,null),l($,lt),l($,Me),l($,mt),l($,Te),l($,ct),l($,U),g(ce,U,null),l(U,dt),l(U,we),l(U,pt),g(I,U,null),l(U,gt),g(F,U,null),s(e,Ye,t),g(de,e,t),s(e,Qe,t),s(e,Ge,t),Ae=!0},p(e,[t]){const J={};t&2&&(J.$$scope={dirty:t,ctx:e}),x.$set(J);const k={};t&2&&(k.$$scope={dirty:t,ctx:e}),I.$set(k);const pe={};t&2&&(pe.$$scope={dirty:t,ctx:e}),F.$set(pe)},i(e){Ae||(h(M.$$.fragment,e),h(T.$$.fragment,e),h(E.$$.fragment,e),h(L.$$.fragment,e),h(q.$$.fragment,e),h(Q.$$.fragment,e),h(A.$$.fragment,e),h(D.$$.fragment,e),h(K.$$.fragment,e),h(O.$$.fragment,e),h(ne.$$.fragment,e),h(ae.$$.fragment,e),h(x.$$.fragment,e),h(oe.$$.fragment,e),h(se.$$.fragment,e),h(ie.$$.fragment,e),h(re.$$.fragment,e),h(le.$$.fragment,e),h(me.$$.fragment,e),h(ce.$$.fragment,e),h(I.$$.fragment,e),h(F.$$.fragment,e),h(de.$$.fragment,e),Ae=!0)},o(e){f(M.$$.fragment,e),f(T.$$.fragment,e),f(E.$$.fragment,e),f(L.$$.fragment,e),f(q.$$.fragment,e),f(Q.$$.fragment,e),f(A.$$.fragment,e),f(D.$$.fragment,e),f(K.$$.fragment,e),f(O.$$.fragment,e),f(ne.$$.fragment,e),f(ae.$$.fragment,e),f(x.$$.fragment,e),f(oe.$$.fragment,e),f(se.$$.fragment,e),f(ie.$$.fragment,e),f(re.$$.fragment,e),f(le.$$.fragment,e),f(me.$$.fragment,e),f(ce.$$.fragment,e),f(I.$$.fragment,e),f(F.$$.fragment,e),f(de.$$.fragment,e),Ae=!1},d(e){e&&(n(G),n(_),n(b),n(i),n(Je),n(H),n(ke),n(Z),n(Ue),n(N),n(Ce),n(X),n(je),n(Pe),n(S),n(Ze),n(xe),n(ze),n(Y),n(We),n(Ie),n(Fe),n(Be),n(Ve),n(Re),n(ee),n(He),n(te),n(Ne),n(Xe),n(w),n(Ee),n(Se),n(v),n(Le),n(qe),n($),n(Ye),n(Qe),n(Ge)),n(r),u(M,e),u(T,e),u(E,e),u(L,e),u(q,e),u(Q,e),u(A,e),u(D,e),u(K,e),u(O,e),u(ne,e),u(ae),u(x),u(oe,e),u(se),u(ie),u(re),u(le,e),u(me),u(ce),u(I),u(F),u(de,e)}}}const Lt='{"title":"PaliGemma","local":"paligemma","sections":[{"title":"Overview","local":"overview","sections":[],"depth":2},{"title":"Usage tips","local":"usage-tips","sections":[],"depth":2},{"title":"Usage Example","local":"usage-example","sections":[{"title":"Single-image Inference","local":"single-image-inference","sections":[],"depth":3},{"title":"Multi-image Inference","local":"multi-image-inference","sections":[],"depth":3}],"depth":2},{"title":"Resources","local":"resources","sections":[],"depth":2},{"title":"PaliGemmaConfig","local":"transformers.PaliGemmaConfig","sections":[],"depth":2},{"title":"PaliGemmaProcessor","local":"transformers.PaliGemmaProcessor","sections":[],"depth":2},{"title":"PaliGemmaForConditionalGeneration","local":"transformers.PaliGemmaForConditionalGeneration","sections":[],"depth":2}],"depth":1}';function qt(P){return It(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class tn extends Ft{constructor(r){super(),Bt(this,r,qt,St,zt,{})}}export{tn as component};
