import{s as Ks,o as ea,n as F}from"../chunks/scheduler.25b97de1.js";import{S as ta,i as na,g as c,s as r,r as h,A as oa,h as p,f as a,c as i,j as k,u as g,x as w,k as L,y as l,a as d,v as u,d as f,t as _,w as b}from"../chunks/index.d9030fc9.js";import{T as rt}from"../chunks/Tip.baa67368.js";import{D as z}from"../chunks/Docstring.ffac8efa.js";import{C as fe}from"../chunks/CodeBlock.e6cd0d95.js";import{F as sa,M as zs}from"../chunks/Markdown.7217f838.js";import{E as He}from"../chunks/ExampleCodeBlock.22dfe688.js";import{P as aa}from"../chunks/PipelineTag.5f100392.js";import{H as O,E as ra}from"../chunks/EditOnGithub.91d95064.js";function ia(C){let e,m='For small batch sizes, you might notice a slowdown in your model when using flash attention. Refer to the section <a href="#Expected-speedups-with-Flash-Attention-and-SDPA">Expected speedups with Flash Attention and SDPA</a> below and select an appropriate attention implementation.';return{c(){e=c("p"),e.innerHTML=m},l(o){e=p(o,"P",{"data-svelte-h":!0}),w(e)!=="svelte-1n9pgew"&&(e.innerHTML=m)},m(o,s){d(o,e,s)},p:F,d(o){o&&a(e)}}}function la(C){let e,m="Example:",o,s,M;return s=new fe({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMENMSVBDb25maWclMkMlMjBDTElQTW9kZWwlMEElMEElMjMlMjBJbml0aWFsaXppbmclMjBhJTIwQ0xJUENvbmZpZyUyMHdpdGglMjBvcGVuYWklMkZjbGlwLXZpdC1iYXNlLXBhdGNoMzIlMjBzdHlsZSUyMGNvbmZpZ3VyYXRpb24lMEFjb25maWd1cmF0aW9uJTIwJTNEJTIwQ0xJUENvbmZpZygpJTBBJTBBJTIzJTIwSW5pdGlhbGl6aW5nJTIwYSUyMENMSVBNb2RlbCUyMCh3aXRoJTIwcmFuZG9tJTIwd2VpZ2h0cyklMjBmcm9tJTIwdGhlJTIwb3BlbmFpJTJGY2xpcC12aXQtYmFzZS1wYXRjaDMyJTIwc3R5bGUlMjBjb25maWd1cmF0aW9uJTBBbW9kZWwlMjAlM0QlMjBDTElQTW9kZWwoY29uZmlndXJhdGlvbiklMEElMEElMjMlMjBBY2Nlc3NpbmclMjB0aGUlMjBtb2RlbCUyMGNvbmZpZ3VyYXRpb24lMEFjb25maWd1cmF0aW9uJTIwJTNEJTIwbW9kZWwuY29uZmlnJTBBJTBBJTIzJTIwV2UlMjBjYW4lMjBhbHNvJTIwaW5pdGlhbGl6ZSUyMGElMjBDTElQQ29uZmlnJTIwZnJvbSUyMGElMjBDTElQVGV4dENvbmZpZyUyMGFuZCUyMGElMjBDTElQVmlzaW9uQ29uZmlnJTBBZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMENMSVBUZXh0Q29uZmlnJTJDJTIwQ0xJUFZpc2lvbkNvbmZpZyUwQSUwQSUyMyUyMEluaXRpYWxpemluZyUyMGElMjBDTElQVGV4dCUyMGFuZCUyMENMSVBWaXNpb24lMjBjb25maWd1cmF0aW9uJTBBY29uZmlnX3RleHQlMjAlM0QlMjBDTElQVGV4dENvbmZpZygpJTBBY29uZmlnX3Zpc2lvbiUyMCUzRCUyMENMSVBWaXNpb25Db25maWcoKSUwQSUwQWNvbmZpZyUyMCUzRCUyMENMSVBDb25maWcuZnJvbV90ZXh0X3Zpc2lvbl9jb25maWdzKGNvbmZpZ190ZXh0JTJDJTIwY29uZmlnX3Zpc2lvbik=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> CLIPConfig, CLIPModel

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a CLIPConfig with openai/clip-vit-base-patch32 style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = CLIPConfig()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a CLIPModel (with random weights) from the openai/clip-vit-base-patch32 style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = CLIPModel(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

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># We can also initialize a CLIPConfig from a CLIPTextConfig and a CLIPVisionConfig</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> CLIPTextConfig, CLIPVisionConfig

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a CLIPText and CLIPVision configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>config_text = CLIPTextConfig()
<span class="hljs-meta">&gt;&gt;&gt; </span>config_vision = CLIPVisionConfig()

<span class="hljs-meta">&gt;&gt;&gt; </span>config = CLIPConfig.from_text_vision_configs(config_text, config_vision)`,wrap:!1}}),{c(){e=c("p"),e.textContent=m,o=r(),h(s.$$.fragment)},l(n){e=p(n,"P",{"data-svelte-h":!0}),w(e)!=="svelte-11lpom8"&&(e.textContent=m),o=i(n),g(s.$$.fragment,n)},m(n,$){d(n,e,$),d(n,o,$),u(s,n,$),M=!0},p:F,i(n){M||(f(s.$$.fragment,n),M=!0)},o(n){_(s.$$.fragment,n),M=!1},d(n){n&&(a(e),a(o)),b(s,n)}}}function da(C){let e,m="Example:",o,s,M;return s=new fe({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMENMSVBUZXh0Q29uZmlnJTJDJTIwQ0xJUFRleHRNb2RlbCUwQSUwQSUyMyUyMEluaXRpYWxpemluZyUyMGElMjBDTElQVGV4dENvbmZpZyUyMHdpdGglMjBvcGVuYWklMkZjbGlwLXZpdC1iYXNlLXBhdGNoMzIlMjBzdHlsZSUyMGNvbmZpZ3VyYXRpb24lMEFjb25maWd1cmF0aW9uJTIwJTNEJTIwQ0xJUFRleHRDb25maWcoKSUwQSUwQSUyMyUyMEluaXRpYWxpemluZyUyMGElMjBDTElQVGV4dE1vZGVsJTIwKHdpdGglMjByYW5kb20lMjB3ZWlnaHRzKSUyMGZyb20lMjB0aGUlMjBvcGVuYWklMkZjbGlwLXZpdC1iYXNlLXBhdGNoMzIlMjBzdHlsZSUyMGNvbmZpZ3VyYXRpb24lMEFtb2RlbCUyMCUzRCUyMENMSVBUZXh0TW9kZWwoY29uZmlndXJhdGlvbiklMEElMEElMjMlMjBBY2Nlc3NpbmclMjB0aGUlMjBtb2RlbCUyMGNvbmZpZ3VyYXRpb24lMEFjb25maWd1cmF0aW9uJTIwJTNEJTIwbW9kZWwuY29uZmln",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> CLIPTextConfig, CLIPTextModel

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a CLIPTextConfig with openai/clip-vit-base-patch32 style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = CLIPTextConfig()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a CLIPTextModel (with random weights) from the openai/clip-vit-base-patch32 style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = CLIPTextModel(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(){e=c("p"),e.textContent=m,o=r(),h(s.$$.fragment)},l(n){e=p(n,"P",{"data-svelte-h":!0}),w(e)!=="svelte-11lpom8"&&(e.textContent=m),o=i(n),g(s.$$.fragment,n)},m(n,$){d(n,e,$),d(n,o,$),u(s,n,$),M=!0},p:F,i(n){M||(f(s.$$.fragment,n),M=!0)},o(n){_(s.$$.fragment,n),M=!1},d(n){n&&(a(e),a(o)),b(s,n)}}}function ca(C){let e,m="Example:",o,s,M;return s=new fe({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMENMSVBWaXNpb25Db25maWclMkMlMjBDTElQVmlzaW9uTW9kZWwlMEElMEElMjMlMjBJbml0aWFsaXppbmclMjBhJTIwQ0xJUFZpc2lvbkNvbmZpZyUyMHdpdGglMjBvcGVuYWklMkZjbGlwLXZpdC1iYXNlLXBhdGNoMzIlMjBzdHlsZSUyMGNvbmZpZ3VyYXRpb24lMEFjb25maWd1cmF0aW9uJTIwJTNEJTIwQ0xJUFZpc2lvbkNvbmZpZygpJTBBJTBBJTIzJTIwSW5pdGlhbGl6aW5nJTIwYSUyMENMSVBWaXNpb25Nb2RlbCUyMCh3aXRoJTIwcmFuZG9tJTIwd2VpZ2h0cyklMjBmcm9tJTIwdGhlJTIwb3BlbmFpJTJGY2xpcC12aXQtYmFzZS1wYXRjaDMyJTIwc3R5bGUlMjBjb25maWd1cmF0aW9uJTBBbW9kZWwlMjAlM0QlMjBDTElQVmlzaW9uTW9kZWwoY29uZmlndXJhdGlvbiklMEElMEElMjMlMjBBY2Nlc3NpbmclMjB0aGUlMjBtb2RlbCUyMGNvbmZpZ3VyYXRpb24lMEFjb25maWd1cmF0aW9uJTIwJTNEJTIwbW9kZWwuY29uZmln",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> CLIPVisionConfig, CLIPVisionModel

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a CLIPVisionConfig with openai/clip-vit-base-patch32 style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = CLIPVisionConfig()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a CLIPVisionModel (with random weights) from the openai/clip-vit-base-patch32 style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = CLIPVisionModel(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(){e=c("p"),e.textContent=m,o=r(),h(s.$$.fragment)},l(n){e=p(n,"P",{"data-svelte-h":!0}),w(e)!=="svelte-11lpom8"&&(e.textContent=m),o=i(n),g(s.$$.fragment,n)},m(n,$){d(n,e,$),d(n,o,$),u(s,n,$),M=!0},p:F,i(n){M||(f(s.$$.fragment,n),M=!0)},o(n){_(s.$$.fragment,n),M=!1},d(n){n&&(a(e),a(o)),b(s,n)}}}function pa(C){let e,m=`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(){e=c("p"),e.innerHTML=m},l(o){e=p(o,"P",{"data-svelte-h":!0}),w(e)!=="svelte-fincs2"&&(e.innerHTML=m)},m(o,s){d(o,e,s)},p:F,d(o){o&&a(e)}}}function ma(C){let e,m="Examples:",o,s,M;return s=new fe({props:{code:"ZnJvbSUyMFBJTCUyMGltcG9ydCUyMEltYWdlJTBBaW1wb3J0JTIwcmVxdWVzdHMlMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b1Byb2Nlc3NvciUyQyUyMENMSVBNb2RlbCUwQSUwQW1vZGVsJTIwJTNEJTIwQ0xJUE1vZGVsLmZyb21fcHJldHJhaW5lZCglMjJvcGVuYWklMkZjbGlwLXZpdC1iYXNlLXBhdGNoMzIlMjIpJTBBcHJvY2Vzc29yJTIwJTNEJTIwQXV0b1Byb2Nlc3Nvci5mcm9tX3ByZXRyYWluZWQoJTIyb3BlbmFpJTJGY2xpcC12aXQtYmFzZS1wYXRjaDMyJTIyKSUwQSUwQXVybCUyMCUzRCUyMCUyMmh0dHAlM0ElMkYlMkZpbWFnZXMuY29jb2RhdGFzZXQub3JnJTJGdmFsMjAxNyUyRjAwMDAwMDAzOTc2OS5qcGclMjIlMEFpbWFnZSUyMCUzRCUyMEltYWdlLm9wZW4ocmVxdWVzdHMuZ2V0KHVybCUyQyUyMHN0cmVhbSUzRFRydWUpLnJhdyklMEElMEFpbnB1dHMlMjAlM0QlMjBwcm9jZXNzb3IoJTBBJTIwJTIwJTIwJTIwdGV4dCUzRCU1QiUyMmElMjBwaG90byUyMG9mJTIwYSUyMGNhdCUyMiUyQyUyMCUyMmElMjBwaG90byUyMG9mJTIwYSUyMGRvZyUyMiU1RCUyQyUyMGltYWdlcyUzRGltYWdlJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMiUyQyUyMHBhZGRpbmclM0RUcnVlJTBBKSUwQSUwQW91dHB1dHMlMjAlM0QlMjBtb2RlbCgqKmlucHV0cyklMEFsb2dpdHNfcGVyX2ltYWdlJTIwJTNEJTIwb3V0cHV0cy5sb2dpdHNfcGVyX2ltYWdlJTIwJTIwJTIzJTIwdGhpcyUyMGlzJTIwdGhlJTIwaW1hZ2UtdGV4dCUyMHNpbWlsYXJpdHklMjBzY29yZSUwQXByb2JzJTIwJTNEJTIwbG9naXRzX3Blcl9pbWFnZS5zb2Z0bWF4KGRpbSUzRDEpJTIwJTIwJTIzJTIwd2UlMjBjYW4lMjB0YWtlJTIwdGhlJTIwc29mdG1heCUyMHRvJTIwZ2V0JTIwdGhlJTIwbGFiZWwlMjBwcm9iYWJpbGl0aWVz",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, CLIPModel

<span class="hljs-meta">&gt;&gt;&gt; </span>model = CLIPModel.from_pretrained(<span class="hljs-string">&quot;openai/clip-vit-base-patch32&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>processor = AutoProcessor.from_pretrained(<span class="hljs-string">&quot;openai/clip-vit-base-patch32&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>url = <span class="hljs-string">&quot;http://images.cocodataset.org/val2017/000000039769.jpg&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(
<span class="hljs-meta">... </span>    text=[<span class="hljs-string">&quot;a photo of a cat&quot;</span>, <span class="hljs-string">&quot;a photo of a dog&quot;</span>], images=image, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>, padding=<span class="hljs-literal">True</span>
<span class="hljs-meta">... </span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**inputs)
<span class="hljs-meta">&gt;&gt;&gt; </span>logits_per_image = outputs.logits_per_image  <span class="hljs-comment"># this is the image-text similarity score</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>probs = logits_per_image.softmax(dim=<span class="hljs-number">1</span>)  <span class="hljs-comment"># we can take the softmax to get the label probabilities</span>`,wrap:!1}}),{c(){e=c("p"),e.textContent=m,o=r(),h(s.$$.fragment)},l(n){e=p(n,"P",{"data-svelte-h":!0}),w(e)!=="svelte-kvfsh7"&&(e.textContent=m),o=i(n),g(s.$$.fragment,n)},m(n,$){d(n,e,$),d(n,o,$),u(s,n,$),M=!0},p:F,i(n){M||(f(s.$$.fragment,n),M=!0)},o(n){_(s.$$.fragment,n),M=!1},d(n){n&&(a(e),a(o)),b(s,n)}}}function ha(C){let e,m=`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(){e=c("p"),e.innerHTML=m},l(o){e=p(o,"P",{"data-svelte-h":!0}),w(e)!=="svelte-fincs2"&&(e.innerHTML=m)},m(o,s){d(o,e,s)},p:F,d(o){o&&a(e)}}}function ga(C){let e,m="Examples:",o,s,M;return s=new fe({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBDTElQTW9kZWwlMEElMEFtb2RlbCUyMCUzRCUyMENMSVBNb2RlbC5mcm9tX3ByZXRyYWluZWQoJTIyb3BlbmFpJTJGY2xpcC12aXQtYmFzZS1wYXRjaDMyJTIyKSUwQXRva2VuaXplciUyMCUzRCUyMEF1dG9Ub2tlbml6ZXIuZnJvbV9wcmV0cmFpbmVkKCUyMm9wZW5haSUyRmNsaXAtdml0LWJhc2UtcGF0Y2gzMiUyMiklMEElMEFpbnB1dHMlMjAlM0QlMjB0b2tlbml6ZXIoJTVCJTIyYSUyMHBob3RvJTIwb2YlMjBhJTIwY2F0JTIyJTJDJTIwJTIyYSUyMHBob3RvJTIwb2YlMjBhJTIwZG9nJTIyJTVEJTJDJTIwcGFkZGluZyUzRFRydWUlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKSUwQXRleHRfZmVhdHVyZXMlMjAlM0QlMjBtb2RlbC5nZXRfdGV4dF9mZWF0dXJlcygqKmlucHV0cyk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, CLIPModel

<span class="hljs-meta">&gt;&gt;&gt; </span>model = CLIPModel.from_pretrained(<span class="hljs-string">&quot;openai/clip-vit-base-patch32&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;openai/clip-vit-base-patch32&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer([<span class="hljs-string">&quot;a photo of a cat&quot;</span>, <span class="hljs-string">&quot;a photo of a dog&quot;</span>], padding=<span class="hljs-literal">True</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>text_features = model.get_text_features(**inputs)`,wrap:!1}}),{c(){e=c("p"),e.textContent=m,o=r(),h(s.$$.fragment)},l(n){e=p(n,"P",{"data-svelte-h":!0}),w(e)!=="svelte-kvfsh7"&&(e.textContent=m),o=i(n),g(s.$$.fragment,n)},m(n,$){d(n,e,$),d(n,o,$),u(s,n,$),M=!0},p:F,i(n){M||(f(s.$$.fragment,n),M=!0)},o(n){_(s.$$.fragment,n),M=!1},d(n){n&&(a(e),a(o)),b(s,n)}}}function ua(C){let e,m=`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(){e=c("p"),e.innerHTML=m},l(o){e=p(o,"P",{"data-svelte-h":!0}),w(e)!=="svelte-fincs2"&&(e.innerHTML=m)},m(o,s){d(o,e,s)},p:F,d(o){o&&a(e)}}}function fa(C){let e,m="Examples:",o,s,M;return s=new fe({props:{code:"ZnJvbSUyMFBJTCUyMGltcG9ydCUyMEltYWdlJTBBaW1wb3J0JTIwcmVxdWVzdHMlMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b1Byb2Nlc3NvciUyQyUyMENMSVBNb2RlbCUwQSUwQW1vZGVsJTIwJTNEJTIwQ0xJUE1vZGVsLmZyb21fcHJldHJhaW5lZCglMjJvcGVuYWklMkZjbGlwLXZpdC1iYXNlLXBhdGNoMzIlMjIpJTBBcHJvY2Vzc29yJTIwJTNEJTIwQXV0b1Byb2Nlc3Nvci5mcm9tX3ByZXRyYWluZWQoJTIyb3BlbmFpJTJGY2xpcC12aXQtYmFzZS1wYXRjaDMyJTIyKSUwQSUwQXVybCUyMCUzRCUyMCUyMmh0dHAlM0ElMkYlMkZpbWFnZXMuY29jb2RhdGFzZXQub3JnJTJGdmFsMjAxNyUyRjAwMDAwMDAzOTc2OS5qcGclMjIlMEFpbWFnZSUyMCUzRCUyMEltYWdlLm9wZW4ocmVxdWVzdHMuZ2V0KHVybCUyQyUyMHN0cmVhbSUzRFRydWUpLnJhdyklMEElMEFpbnB1dHMlMjAlM0QlMjBwcm9jZXNzb3IoaW1hZ2VzJTNEaW1hZ2UlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKSUwQSUwQWltYWdlX2ZlYXR1cmVzJTIwJTNEJTIwbW9kZWwuZ2V0X2ltYWdlX2ZlYXR1cmVzKCoqaW5wdXRzKQ==",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, CLIPModel

<span class="hljs-meta">&gt;&gt;&gt; </span>model = CLIPModel.from_pretrained(<span class="hljs-string">&quot;openai/clip-vit-base-patch32&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>processor = AutoProcessor.from_pretrained(<span class="hljs-string">&quot;openai/clip-vit-base-patch32&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>url = <span class="hljs-string">&quot;http://images.cocodataset.org/val2017/000000039769.jpg&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, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>image_features = model.get_image_features(**inputs)`,wrap:!1}}),{c(){e=c("p"),e.textContent=m,o=r(),h(s.$$.fragment)},l(n){e=p(n,"P",{"data-svelte-h":!0}),w(e)!=="svelte-kvfsh7"&&(e.textContent=m),o=i(n),g(s.$$.fragment,n)},m(n,$){d(n,e,$),d(n,o,$),u(s,n,$),M=!0},p:F,i(n){M||(f(s.$$.fragment,n),M=!0)},o(n){_(s.$$.fragment,n),M=!1},d(n){n&&(a(e),a(o)),b(s,n)}}}function _a(C){let e,m=`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(){e=c("p"),e.innerHTML=m},l(o){e=p(o,"P",{"data-svelte-h":!0}),w(e)!=="svelte-fincs2"&&(e.innerHTML=m)},m(o,s){d(o,e,s)},p:F,d(o){o&&a(e)}}}function ba(C){let e,m="Examples:",o,s,M;return s=new fe({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBDTElQVGV4dE1vZGVsJTBBJTBBbW9kZWwlMjAlM0QlMjBDTElQVGV4dE1vZGVsLmZyb21fcHJldHJhaW5lZCglMjJvcGVuYWklMkZjbGlwLXZpdC1iYXNlLXBhdGNoMzIlMjIpJTBBdG9rZW5pemVyJTIwJTNEJTIwQXV0b1Rva2VuaXplci5mcm9tX3ByZXRyYWluZWQoJTIyb3BlbmFpJTJGY2xpcC12aXQtYmFzZS1wYXRjaDMyJTIyKSUwQSUwQWlucHV0cyUyMCUzRCUyMHRva2VuaXplciglNUIlMjJhJTIwcGhvdG8lMjBvZiUyMGElMjBjYXQlMjIlMkMlMjAlMjJhJTIwcGhvdG8lMjBvZiUyMGElMjBkb2clMjIlNUQlMkMlMjBwYWRkaW5nJTNEVHJ1ZSUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpJTBBJTBBb3V0cHV0cyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzKSUwQWxhc3RfaGlkZGVuX3N0YXRlJTIwJTNEJTIwb3V0cHV0cy5sYXN0X2hpZGRlbl9zdGF0ZSUwQXBvb2xlZF9vdXRwdXQlMjAlM0QlMjBvdXRwdXRzLnBvb2xlcl9vdXRwdXQlMjAlMjAlMjMlMjBwb29sZWQlMjAoRU9TJTIwdG9rZW4pJTIwc3RhdGVz",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, CLIPTextModel

<span class="hljs-meta">&gt;&gt;&gt; </span>model = CLIPTextModel.from_pretrained(<span class="hljs-string">&quot;openai/clip-vit-base-patch32&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;openai/clip-vit-base-patch32&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer([<span class="hljs-string">&quot;a photo of a cat&quot;</span>, <span class="hljs-string">&quot;a photo of a dog&quot;</span>], padding=<span class="hljs-literal">True</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**inputs)
<span class="hljs-meta">&gt;&gt;&gt; </span>last_hidden_state = outputs.last_hidden_state
<span class="hljs-meta">&gt;&gt;&gt; </span>pooled_output = outputs.pooler_output  <span class="hljs-comment"># pooled (EOS token) states</span>`,wrap:!1}}),{c(){e=c("p"),e.textContent=m,o=r(),h(s.$$.fragment)},l(n){e=p(n,"P",{"data-svelte-h":!0}),w(e)!=="svelte-kvfsh7"&&(e.textContent=m),o=i(n),g(s.$$.fragment,n)},m(n,$){d(n,e,$),d(n,o,$),u(s,n,$),M=!0},p:F,i(n){M||(f(s.$$.fragment,n),M=!0)},o(n){_(s.$$.fragment,n),M=!1},d(n){n&&(a(e),a(o)),b(s,n)}}}function Ta(C){let e,m=`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(){e=c("p"),e.innerHTML=m},l(o){e=p(o,"P",{"data-svelte-h":!0}),w(e)!=="svelte-fincs2"&&(e.innerHTML=m)},m(o,s){d(o,e,s)},p:F,d(o){o&&a(e)}}}function Ma(C){let e,m="Examples:",o,s,M;return s=new fe({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBDTElQVGV4dE1vZGVsV2l0aFByb2plY3Rpb24lMEElMEFtb2RlbCUyMCUzRCUyMENMSVBUZXh0TW9kZWxXaXRoUHJvamVjdGlvbi5mcm9tX3ByZXRyYWluZWQoJTIyb3BlbmFpJTJGY2xpcC12aXQtYmFzZS1wYXRjaDMyJTIyKSUwQXRva2VuaXplciUyMCUzRCUyMEF1dG9Ub2tlbml6ZXIuZnJvbV9wcmV0cmFpbmVkKCUyMm9wZW5haSUyRmNsaXAtdml0LWJhc2UtcGF0Y2gzMiUyMiklMEElMEFpbnB1dHMlMjAlM0QlMjB0b2tlbml6ZXIoJTVCJTIyYSUyMHBob3RvJTIwb2YlMjBhJTIwY2F0JTIyJTJDJTIwJTIyYSUyMHBob3RvJTIwb2YlMjBhJTIwZG9nJTIyJTVEJTJDJTIwcGFkZGluZyUzRFRydWUlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKSUwQSUwQW91dHB1dHMlMjAlM0QlMjBtb2RlbCgqKmlucHV0cyklMEF0ZXh0X2VtYmVkcyUyMCUzRCUyMG91dHB1dHMudGV4dF9lbWJlZHM=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, CLIPTextModelWithProjection

<span class="hljs-meta">&gt;&gt;&gt; </span>model = CLIPTextModelWithProjection.from_pretrained(<span class="hljs-string">&quot;openai/clip-vit-base-patch32&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;openai/clip-vit-base-patch32&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer([<span class="hljs-string">&quot;a photo of a cat&quot;</span>, <span class="hljs-string">&quot;a photo of a dog&quot;</span>], padding=<span class="hljs-literal">True</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**inputs)
<span class="hljs-meta">&gt;&gt;&gt; </span>text_embeds = outputs.text_embeds`,wrap:!1}}),{c(){e=c("p"),e.textContent=m,o=r(),h(s.$$.fragment)},l(n){e=p(n,"P",{"data-svelte-h":!0}),w(e)!=="svelte-kvfsh7"&&(e.textContent=m),o=i(n),g(s.$$.fragment,n)},m(n,$){d(n,e,$),d(n,o,$),u(s,n,$),M=!0},p:F,i(n){M||(f(s.$$.fragment,n),M=!0)},o(n){_(s.$$.fragment,n),M=!1},d(n){n&&(a(e),a(o)),b(s,n)}}}function ya(C){let e,m=`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(){e=c("p"),e.innerHTML=m},l(o){e=p(o,"P",{"data-svelte-h":!0}),w(e)!=="svelte-fincs2"&&(e.innerHTML=m)},m(o,s){d(o,e,s)},p:F,d(o){o&&a(e)}}}function wa(C){let e,m="Examples:",o,s,M;return s=new fe({props:{code:"ZnJvbSUyMFBJTCUyMGltcG9ydCUyMEltYWdlJTBBaW1wb3J0JTIwcmVxdWVzdHMlMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b1Byb2Nlc3NvciUyQyUyMENMSVBWaXNpb25Nb2RlbFdpdGhQcm9qZWN0aW9uJTBBJTBBbW9kZWwlMjAlM0QlMjBDTElQVmlzaW9uTW9kZWxXaXRoUHJvamVjdGlvbi5mcm9tX3ByZXRyYWluZWQoJTIyb3BlbmFpJTJGY2xpcC12aXQtYmFzZS1wYXRjaDMyJTIyKSUwQXByb2Nlc3NvciUyMCUzRCUyMEF1dG9Qcm9jZXNzb3IuZnJvbV9wcmV0cmFpbmVkKCUyMm9wZW5haSUyRmNsaXAtdml0LWJhc2UtcGF0Y2gzMiUyMiklMEElMEF1cmwlMjAlM0QlMjAlMjJodHRwJTNBJTJGJTJGaW1hZ2VzLmNvY29kYXRhc2V0Lm9yZyUyRnZhbDIwMTclMkYwMDAwMDAwMzk3NjkuanBnJTIyJTBBaW1hZ2UlMjAlM0QlMjBJbWFnZS5vcGVuKHJlcXVlc3RzLmdldCh1cmwlMkMlMjBzdHJlYW0lM0RUcnVlKS5yYXcpJTBBJTBBaW5wdXRzJTIwJTNEJTIwcHJvY2Vzc29yKGltYWdlcyUzRGltYWdlJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMiklMEElMEFvdXRwdXRzJTIwJTNEJTIwbW9kZWwoKippbnB1dHMpJTBBaW1hZ2VfZW1iZWRzJTIwJTNEJTIwb3V0cHV0cy5pbWFnZV9lbWJlZHM=",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, CLIPVisionModelWithProjection

<span class="hljs-meta">&gt;&gt;&gt; </span>model = CLIPVisionModelWithProjection.from_pretrained(<span class="hljs-string">&quot;openai/clip-vit-base-patch32&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>processor = AutoProcessor.from_pretrained(<span class="hljs-string">&quot;openai/clip-vit-base-patch32&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>url = <span class="hljs-string">&quot;http://images.cocodataset.org/val2017/000000039769.jpg&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, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**inputs)
<span class="hljs-meta">&gt;&gt;&gt; </span>image_embeds = outputs.image_embeds`,wrap:!1}}),{c(){e=c("p"),e.textContent=m,o=r(),h(s.$$.fragment)},l(n){e=p(n,"P",{"data-svelte-h":!0}),w(e)!=="svelte-kvfsh7"&&(e.textContent=m),o=i(n),g(s.$$.fragment,n)},m(n,$){d(n,e,$),d(n,o,$),u(s,n,$),M=!0},p:F,i(n){M||(f(s.$$.fragment,n),M=!0)},o(n){_(s.$$.fragment,n),M=!1},d(n){n&&(a(e),a(o)),b(s,n)}}}function Ia(C){let e,m=`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(){e=c("p"),e.innerHTML=m},l(o){e=p(o,"P",{"data-svelte-h":!0}),w(e)!=="svelte-fincs2"&&(e.innerHTML=m)},m(o,s){d(o,e,s)},p:F,d(o){o&&a(e)}}}function $a(C){let e,m="Examples:",o,s,M;return s=new fe({props:{code:"ZnJvbSUyMFBJTCUyMGltcG9ydCUyMEltYWdlJTBBaW1wb3J0JTIwcmVxdWVzdHMlMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b1Byb2Nlc3NvciUyQyUyMENMSVBWaXNpb25Nb2RlbCUwQSUwQW1vZGVsJTIwJTNEJTIwQ0xJUFZpc2lvbk1vZGVsLmZyb21fcHJldHJhaW5lZCglMjJvcGVuYWklMkZjbGlwLXZpdC1iYXNlLXBhdGNoMzIlMjIpJTBBcHJvY2Vzc29yJTIwJTNEJTIwQXV0b1Byb2Nlc3Nvci5mcm9tX3ByZXRyYWluZWQoJTIyb3BlbmFpJTJGY2xpcC12aXQtYmFzZS1wYXRjaDMyJTIyKSUwQSUwQXVybCUyMCUzRCUyMCUyMmh0dHAlM0ElMkYlMkZpbWFnZXMuY29jb2RhdGFzZXQub3JnJTJGdmFsMjAxNyUyRjAwMDAwMDAzOTc2OS5qcGclMjIlMEFpbWFnZSUyMCUzRCUyMEltYWdlLm9wZW4ocmVxdWVzdHMuZ2V0KHVybCUyQyUyMHN0cmVhbSUzRFRydWUpLnJhdyklMEElMEFpbnB1dHMlMjAlM0QlMjBwcm9jZXNzb3IoaW1hZ2VzJTNEaW1hZ2UlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKSUwQSUwQW91dHB1dHMlMjAlM0QlMjBtb2RlbCgqKmlucHV0cyklMEFsYXN0X2hpZGRlbl9zdGF0ZSUyMCUzRCUyMG91dHB1dHMubGFzdF9oaWRkZW5fc3RhdGUlMEFwb29sZWRfb3V0cHV0JTIwJTNEJTIwb3V0cHV0cy5wb29sZXJfb3V0cHV0JTIwJTIwJTIzJTIwcG9vbGVkJTIwQ0xTJTIwc3RhdGVz",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, CLIPVisionModel

<span class="hljs-meta">&gt;&gt;&gt; </span>model = CLIPVisionModel.from_pretrained(<span class="hljs-string">&quot;openai/clip-vit-base-patch32&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>processor = AutoProcessor.from_pretrained(<span class="hljs-string">&quot;openai/clip-vit-base-patch32&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>url = <span class="hljs-string">&quot;http://images.cocodataset.org/val2017/000000039769.jpg&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, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**inputs)
<span class="hljs-meta">&gt;&gt;&gt; </span>last_hidden_state = outputs.last_hidden_state
<span class="hljs-meta">&gt;&gt;&gt; </span>pooled_output = outputs.pooler_output  <span class="hljs-comment"># pooled CLS states</span>`,wrap:!1}}),{c(){e=c("p"),e.textContent=m,o=r(),h(s.$$.fragment)},l(n){e=p(n,"P",{"data-svelte-h":!0}),w(e)!=="svelte-kvfsh7"&&(e.textContent=m),o=i(n),g(s.$$.fragment,n)},m(n,$){d(n,e,$),d(n,o,$),u(s,n,$),M=!0},p:F,i(n){M||(f(s.$$.fragment,n),M=!0)},o(n){_(s.$$.fragment,n),M=!1},d(n){n&&(a(e),a(o)),b(s,n)}}}function va(C){let e,m=`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(){e=c("p"),e.innerHTML=m},l(o){e=p(o,"P",{"data-svelte-h":!0}),w(e)!=="svelte-fincs2"&&(e.innerHTML=m)},m(o,s){d(o,e,s)},p:F,d(o){o&&a(e)}}}function Ca(C){let e,m="Example:",o,s,M;return s=new fe({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9JbWFnZVByb2Nlc3NvciUyQyUyMENMSVBGb3JJbWFnZUNsYXNzaWZpY2F0aW9uJTBBaW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGF0YXNldHMlMjBpbXBvcnQlMjBsb2FkX2RhdGFzZXQlMEElMEFkYXRhc2V0JTIwJTNEJTIwbG9hZF9kYXRhc2V0KCUyMmh1Z2dpbmdmYWNlJTJGY2F0cy1pbWFnZSUyMiUyQyUyMHRydXN0X3JlbW90ZV9jb2RlJTNEVHJ1ZSklMEFpbWFnZSUyMCUzRCUyMGRhdGFzZXQlNUIlMjJ0ZXN0JTIyJTVEJTVCJTIyaW1hZ2UlMjIlNUQlNUIwJTVEJTBBJTBBaW1hZ2VfcHJvY2Vzc29yJTIwJTNEJTIwQXV0b0ltYWdlUHJvY2Vzc29yLmZyb21fcHJldHJhaW5lZCglMjJvcGVuYWklMkZjbGlwLXZpdC1iYXNlLXBhdGNoMzIlMjIpJTBBbW9kZWwlMjAlM0QlMjBDTElQRm9ySW1hZ2VDbGFzc2lmaWNhdGlvbi5mcm9tX3ByZXRyYWluZWQoJTIyb3BlbmFpJTJGY2xpcC12aXQtYmFzZS1wYXRjaDMyJTIyKSUwQSUwQWlucHV0cyUyMCUzRCUyMGltYWdlX3Byb2Nlc3NvcihpbWFnZSUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpJTBBJTBBd2l0aCUyMHRvcmNoLm5vX2dyYWQoKSUzQSUwQSUyMCUyMCUyMCUyMGxvZ2l0cyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzKS5sb2dpdHMlMEElMEElMjMlMjBtb2RlbCUyMHByZWRpY3RzJTIwb25lJTIwb2YlMjB0aGUlMjAxMDAwJTIwSW1hZ2VOZXQlMjBjbGFzc2VzJTBBcHJlZGljdGVkX2xhYmVsJTIwJTNEJTIwbG9naXRzLmFyZ21heCgtMSkuaXRlbSgpJTBBcHJpbnQobW9kZWwuY29uZmlnLmlkMmxhYmVsJTVCcHJlZGljdGVkX2xhYmVsJTVEKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoImageProcessor, CLIPForImageClassification
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> datasets <span class="hljs-keyword">import</span> load_dataset

<span class="hljs-meta">&gt;&gt;&gt; </span>dataset = load_dataset(<span class="hljs-string">&quot;huggingface/cats-image&quot;</span>, trust_remote_code=<span class="hljs-literal">True</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>image = dataset[<span class="hljs-string">&quot;test&quot;</span>][<span class="hljs-string">&quot;image&quot;</span>][<span class="hljs-number">0</span>]

<span class="hljs-meta">&gt;&gt;&gt; </span>image_processor = AutoImageProcessor.from_pretrained(<span class="hljs-string">&quot;openai/clip-vit-base-patch32&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = CLIPForImageClassification.from_pretrained(<span class="hljs-string">&quot;openai/clip-vit-base-patch32&quot;</span>)

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

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">with</span> torch.no_grad():
<span class="hljs-meta">... </span>    logits = model(**inputs).logits

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># model predicts one of the 1000 ImageNet classes</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>predicted_label = logits.argmax(-<span class="hljs-number">1</span>).item()
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(model.config.id2label[predicted_label])
LABEL_0`,wrap:!1}}),{c(){e=c("p"),e.textContent=m,o=r(),h(s.$$.fragment)},l(n){e=p(n,"P",{"data-svelte-h":!0}),w(e)!=="svelte-11lpom8"&&(e.textContent=m),o=i(n),g(s.$$.fragment,n)},m(n,$){d(n,e,$),d(n,o,$),u(s,n,$),M=!0},p:F,i(n){M||(f(s.$$.fragment,n),M=!0)},o(n){_(s.$$.fragment,n),M=!1},d(n){n&&(a(e),a(o)),b(s,n)}}}function xa(C){let e,m,o,s,M,n,$=`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.)`,Ke,V,et=`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.`,tt,U,_e,ee,J,We='The <a href="/docs/transformers/main/en/model_doc/clip#transformers.CLIPModel">CLIPModel</a> forward method, overrides the <code>__call__</code> special method.',nt,X,it,pe,Ze,K,ve,te,Ce,xe='The <a href="/docs/transformers/main/en/model_doc/clip#transformers.CLIPModel">CLIPModel</a> forward method, overrides the <code>__call__</code> special method.',ft,be,Pe,ye,Ee,G,Te,R,je,ke='The <a href="/docs/transformers/main/en/model_doc/clip#transformers.CLIPModel">CLIPModel</a> forward method, overrides the <code>__call__</code> special method.',lt,we,qe,q,Ie,Le,ie,W,Xe,ne,Se,xt=`The text model from CLIP without any head or projection 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.)`,N,Je,ze=`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.`,Ye,D,ot,le,me,dt='The <a href="/docs/transformers/main/en/model_doc/clip#transformers.CLIPTextModel">CLIPTextModel</a> forward method, overrides the <code>__call__</code> special method.',he,S,_t,H,ct,Qe,B,Y,oe,pt,Be,st="CLIP Text Model with a projection layer on top (a linear layer on top of the pooled output).",de,ge,mt=`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.)`,ue,v,j=`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.`,ce,Z,se,ae,Me,$e='The <a href="/docs/transformers/main/en/model_doc/clip#transformers.CLIPTextModelWithProjection">CLIPTextModelWithProjection</a> forward method, overrides the <code>__call__</code> special method.',re,I,P,A,De,Ue,Pt,Q,Fe,Ae,Ve,bt="CLIP Vision Model with a projection layer on top (a linear layer on top of the pooled output).",nn,Zt,No=`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.)`,Ln,Bt,Rn=`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,jt,Rt,sn,Cn,qn='The <a href="/docs/transformers/main/en/model_doc/clip#transformers.CLIPVisionModelWithProjection">CLIPVisionModelWithProjection</a> forward method, overrides the <code>__call__</code> special method.',an,rn,Jn,yt,Sn,qt,St,wt,Yt,ln,xn,Yn=`The vision model from CLIP without any head or projection 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.)`,dn,cn,ht=`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,It,Vt,_o,Tn,Pn='The <a href="/docs/transformers/main/en/model_doc/clip#transformers.CLIPVisionModel">CLIPVisionModel</a> forward method, overrides the <code>__call__</code> special method.',bo,Qt,Dt,At,Et,kt,zn,Ge,Mn,Un,Gt,Qn=`CLIP vision encoder with an image classification head on top (a linear layer on top of the pooled final hidden states of
the patch tokens) e.g. for ImageNet.`,Tt,Nt,To=`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.)`,yn,jn,Mo=`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.`,wn,Lt,mn,Ot,hn,In='The <a href="/docs/transformers/main/en/model_doc/clip#transformers.CLIPForImageClassification">CLIPForImageClassification</a> forward method, overrides the <code>__call__</code> special method.',Fn,Ne,gn,Kt,un;return e=new O({props:{title:"CLIPModel",local:"transformers.CLIPModel",headingTag:"h2"}}),s=new z({props:{name:"class transformers.CLIPModel",anchor:"transformers.CLIPModel",parameters:[{name:"config",val:": CLIPConfig"}],parametersDescription:[{anchor:"transformers.CLIPModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/clip#transformers.CLIPConfig">CLIPConfig</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/clip/modeling_clip.py#L1180"}}),_e=new z({props:{name:"forward",anchor:"transformers.CLIPModel.forward",parameters:[{name:"input_ids",val:": Optional = None"},{name:"pixel_values",val:": Optional = None"},{name:"attention_mask",val:": Optional = None"},{name:"position_ids",val:": Optional = None"},{name:"return_loss",val:": Optional = None"},{name:"output_attentions",val:": Optional = None"},{name:"output_hidden_states",val:": Optional = None"},{name:"interpolate_pos_encoding",val:": bool = False"},{name:"return_dict",val:": Optional = None"}],parametersDescription:[{anchor:"transformers.CLIPModel.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.CLIPModel.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>`,name:"attention_mask"},{anchor:"transformers.CLIPModel.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.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.CLIPModel.forward.pixel_values",description:`<strong>pixel_values</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
Pixel values. Padding will be ignored by default should you provide it. Pixel values can be obtained using
<a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <a href="/docs/transformers/main/en/model_doc/imagegpt#transformers.ImageGPTFeatureExtractor.__call__">CLIPImageProcessor.<strong>call</strong>()</a> for details.`,name:"pixel_values"},{anchor:"transformers.CLIPModel.forward.return_loss",description:`<strong>return_loss</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the contrastive loss.`,name:"return_loss"},{anchor:"transformers.CLIPModel.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.CLIPModel.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.CLIPModel.forward.interpolate_pos_encoding",description:`<strong>interpolate_pos_encoding</strong> (<code>bool</code>, <em>optional</em>, defaults <code>False</code>) &#x2014;
Whether to interpolate the pre-trained position encodings.`,name:"interpolate_pos_encoding"},{anchor:"transformers.CLIPModel.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"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/clip/modeling_clip.py#L1318",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <code>transformers.models.clip.modeling_clip.CLIPOutput</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 (<code>&lt;class 'transformers.models.clip.configuration_clip.CLIPConfig'&gt;</code>) and inputs.</p>
<ul>
<li><strong>loss</strong> (<code>torch.FloatTensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>return_loss</code> is <code>True</code>) — Contrastive loss for image-text similarity.</li>
<li><strong>logits_per_image</strong> (<code>torch.FloatTensor</code> of shape <code>(image_batch_size, text_batch_size)</code>) — The scaled dot product scores between <code>image_embeds</code> and <code>text_embeds</code>. This represents the image-text
similarity scores.</li>
<li><strong>logits_per_text</strong> (<code>torch.FloatTensor</code> of shape <code>(text_batch_size, image_batch_size)</code>) — The scaled dot product scores between <code>text_embeds</code> and <code>image_embeds</code>. This represents the text-image
similarity scores.</li>
<li><strong>text_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, output_dim</code>) — The text embeddings obtained by applying the projection layer to the pooled output of <a
  href="/docs/transformers/main/en/model_doc/clip#transformers.CLIPTextModel"
>CLIPTextModel</a>.</li>
<li><strong>image_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, output_dim</code>) — The image embeddings obtained by applying the projection layer to the pooled output of <a
  href="/docs/transformers/main/en/model_doc/clip#transformers.CLIPVisionModel"
>CLIPVisionModel</a>.</li>
<li><strong>text_model_output</strong> (<code>BaseModelOutputWithPooling</code>) — The output of the <a
  href="/docs/transformers/main/en/model_doc/clip#transformers.CLIPTextModel"
>CLIPTextModel</a>.</li>
<li><strong>vision_model_output</strong> (<code>BaseModelOutputWithPooling</code>) — The output of the <a
  href="/docs/transformers/main/en/model_doc/clip#transformers.CLIPVisionModel"
>CLIPVisionModel</a>.</li>
</ul>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>transformers.models.clip.modeling_clip.CLIPOutput</code> or <code>tuple(torch.FloatTensor)</code></p>
`}}),X=new rt({props:{$$slots:{default:[pa]},$$scope:{ctx:C}}}),pe=new He({props:{anchor:"transformers.CLIPModel.forward.example",$$slots:{default:[ma]},$$scope:{ctx:C}}}),ve=new z({props:{name:"get_text_features",anchor:"transformers.CLIPModel.get_text_features",parameters:[{name:"input_ids",val:": Optional = None"},{name:"attention_mask",val:": Optional = None"},{name:"position_ids",val:": Optional = None"},{name:"output_attentions",val:": Optional = None"},{name:"output_hidden_states",val:": Optional = None"},{name:"return_dict",val:": Optional = None"}],parametersDescription:[{anchor:"transformers.CLIPModel.get_text_features.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.CLIPModel.get_text_features.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>`,name:"attention_mask"},{anchor:"transformers.CLIPModel.get_text_features.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.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.CLIPModel.get_text_features.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.CLIPModel.get_text_features.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.CLIPModel.get_text_features.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"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/clip/modeling_clip.py#L1220",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>The text embeddings obtained by
applying the projection layer to the pooled output of <a
  href="/docs/transformers/main/en/model_doc/clip#transformers.CLIPTextModel"
>CLIPTextModel</a>.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p>text_features (<code>torch.FloatTensor</code> of shape <code>(batch_size, output_dim</code>)</p>
`}}),be=new rt({props:{$$slots:{default:[ha]},$$scope:{ctx:C}}}),ye=new He({props:{anchor:"transformers.CLIPModel.get_text_features.example",$$slots:{default:[ga]},$$scope:{ctx:C}}}),Te=new z({props:{name:"get_image_features",anchor:"transformers.CLIPModel.get_image_features",parameters:[{name:"pixel_values",val:": Optional = None"},{name:"output_attentions",val:": Optional = None"},{name:"output_hidden_states",val:": Optional = None"},{name:"interpolate_pos_encoding",val:": bool = False"},{name:"return_dict",val:": Optional = None"}],parametersDescription:[{anchor:"transformers.CLIPModel.get_image_features.pixel_values",description:`<strong>pixel_values</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
Pixel values. Padding will be ignored by default should you provide it. Pixel values can be obtained using
<a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <a href="/docs/transformers/main/en/model_doc/imagegpt#transformers.ImageGPTFeatureExtractor.__call__">CLIPImageProcessor.<strong>call</strong>()</a> for details.`,name:"pixel_values"},{anchor:"transformers.CLIPModel.get_image_features.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.CLIPModel.get_image_features.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.CLIPModel.get_image_features.interpolate_pos_encoding",description:`<strong>interpolate_pos_encoding</strong> (<code>bool</code>, <em>optional</em>, defaults <code>False</code>) &#x2014;
Whether to interpolate the pre-trained position encodings.`,name:"interpolate_pos_encoding"},{anchor:"transformers.CLIPModel.get_image_features.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"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/clip/modeling_clip.py#L1267",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>The image embeddings obtained by
applying the projection layer to the pooled output of <a
  href="/docs/transformers/main/en/model_doc/clip#transformers.CLIPVisionModel"
>CLIPVisionModel</a>.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p>image_features (<code>torch.FloatTensor</code> of shape <code>(batch_size, output_dim</code>)</p>
`}}),we=new rt({props:{$$slots:{default:[ua]},$$scope:{ctx:C}}}),q=new He({props:{anchor:"transformers.CLIPModel.get_image_features.example",$$slots:{default:[fa]},$$scope:{ctx:C}}}),Le=new O({props:{title:"CLIPTextModel",local:"transformers.CLIPTextModel",headingTag:"h2"}}),Xe=new z({props:{name:"class transformers.CLIPTextModel",anchor:"transformers.CLIPTextModel",parameters:[{name:"config",val:": CLIPTextConfig"}],parametersDescription:[{anchor:"transformers.CLIPTextModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/clip#transformers.CLIPConfig">CLIPConfig</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/clip/modeling_clip.py#L999"}}),ot=new z({props:{name:"forward",anchor:"transformers.CLIPTextModel.forward",parameters:[{name:"input_ids",val:": Optional = None"},{name:"attention_mask",val:": Optional = None"},{name:"position_ids",val:": Optional = None"},{name:"output_attentions",val:": Optional = None"},{name:"output_hidden_states",val:": Optional = None"},{name:"return_dict",val:": Optional = None"}],parametersDescription:[{anchor:"transformers.CLIPTextModel.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.CLIPTextModel.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>`,name:"attention_mask"},{anchor:"transformers.CLIPTextModel.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.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.CLIPTextModel.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.CLIPTextModel.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.CLIPTextModel.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"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/clip/modeling_clip.py#L1020",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPooling"
>transformers.modeling_outputs.BaseModelOutputWithPooling</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 (<code>&lt;class 'transformers.models.clip.configuration_clip.CLIPTextConfig'&gt;</code>) and inputs.</p>
<ul>
<li>
<p><strong>last_hidden_state</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>) — Sequence of hidden-states at the output of the last layer of the model.</p>
</li>
<li>
<p><strong>pooler_output</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, hidden_size)</code>) — Last layer hidden-state of the first token of the sequence (classification token) after further processing
through the layers used for the auxiliary pretraining task. E.g. for BERT-family of models, this returns
the classification token after processing through a linear layer and a tanh activation function. The linear
layer weights are trained from the next sentence prediction (classification) objective during pretraining.</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.BaseModelOutputWithPooling"
>transformers.modeling_outputs.BaseModelOutputWithPooling</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),S=new rt({props:{$$slots:{default:[_a]},$$scope:{ctx:C}}}),H=new He({props:{anchor:"transformers.CLIPTextModel.forward.example",$$slots:{default:[ba]},$$scope:{ctx:C}}}),Qe=new O({props:{title:"CLIPTextModelWithProjection",local:"transformers.CLIPTextModelWithProjection",headingTag:"h2"}}),oe=new z({props:{name:"class transformers.CLIPTextModelWithProjection",anchor:"transformers.CLIPTextModelWithProjection",parameters:[{name:"config",val:": CLIPTextConfig"}],parametersDescription:[{anchor:"transformers.CLIPTextModelWithProjection.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/clip#transformers.CLIPConfig">CLIPConfig</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/clip/modeling_clip.py#L1416"}}),se=new z({props:{name:"forward",anchor:"transformers.CLIPTextModelWithProjection.forward",parameters:[{name:"input_ids",val:": Optional = None"},{name:"attention_mask",val:": Optional = None"},{name:"position_ids",val:": Optional = None"},{name:"output_attentions",val:": Optional = None"},{name:"output_hidden_states",val:": Optional = None"},{name:"return_dict",val:": Optional = None"}],parametersDescription:[{anchor:"transformers.CLIPTextModelWithProjection.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.CLIPTextModelWithProjection.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>`,name:"attention_mask"},{anchor:"transformers.CLIPTextModelWithProjection.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.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.CLIPTextModelWithProjection.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.CLIPTextModelWithProjection.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.CLIPTextModelWithProjection.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"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/clip/modeling_clip.py#L1444",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <code>transformers.models.clip.modeling_clip.CLIPTextModelOutput</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 (<code>&lt;class 'transformers.models.clip.configuration_clip.CLIPTextConfig'&gt;</code>) and inputs.</p>
<ul>
<li>
<p><strong>text_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, output_dim)</code> <em>optional</em> returned when model is initialized with <code>with_projection=True</code>) — The text embeddings obtained by applying the projection layer to the pooler_output.</p>
</li>
<li>
<p><strong>last_hidden_state</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>) — Sequence of hidden-states at the output of the last layer of the model.</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><code>transformers.models.clip.modeling_clip.CLIPTextModelOutput</code> or <code>tuple(torch.FloatTensor)</code></p>
`}}),I=new rt({props:{$$slots:{default:[Ta]},$$scope:{ctx:C}}}),A=new He({props:{anchor:"transformers.CLIPTextModelWithProjection.forward.example",$$slots:{default:[Ma]},$$scope:{ctx:C}}}),Ue=new O({props:{title:"CLIPVisionModelWithProjection",local:"transformers.CLIPVisionModelWithProjection",headingTag:"h2"}}),Fe=new z({props:{name:"class transformers.CLIPVisionModelWithProjection",anchor:"transformers.CLIPVisionModelWithProjection",parameters:[{name:"config",val:": CLIPVisionConfig"}],parametersDescription:[{anchor:"transformers.CLIPVisionModelWithProjection.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/clip#transformers.CLIPConfig">CLIPConfig</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/clip/modeling_clip.py#L1498"}}),Rt=new z({props:{name:"forward",anchor:"transformers.CLIPVisionModelWithProjection.forward",parameters:[{name:"pixel_values",val:": Optional = None"},{name:"output_attentions",val:": Optional = None"},{name:"output_hidden_states",val:": Optional = None"},{name:"interpolate_pos_encoding",val:": bool = False"},{name:"return_dict",val:": Optional = None"}],parametersDescription:[{anchor:"transformers.CLIPVisionModelWithProjection.forward.pixel_values",description:`<strong>pixel_values</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
Pixel values. Padding will be ignored by default should you provide it. Pixel values can be obtained using
<a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <a href="/docs/transformers/main/en/model_doc/imagegpt#transformers.ImageGPTFeatureExtractor.__call__">CLIPImageProcessor.<strong>call</strong>()</a> for details.`,name:"pixel_values"},{anchor:"transformers.CLIPVisionModelWithProjection.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.CLIPVisionModelWithProjection.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.CLIPVisionModelWithProjection.forward.interpolate_pos_encoding",description:`<strong>interpolate_pos_encoding</strong> (<code>bool</code>, <em>optional</em>, defaults <code>False</code>) &#x2014;
Whether to interpolate the pre-trained position encodings.`,name:"interpolate_pos_encoding"},{anchor:"transformers.CLIPVisionModelWithProjection.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"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/clip/modeling_clip.py#L1522",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <code>transformers.models.clip.modeling_clip.CLIPVisionModelOutput</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 (<code>&lt;class 'transformers.models.clip.configuration_clip.CLIPVisionConfig'&gt;</code>) and inputs.</p>
<ul>
<li>
<p><strong>image_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, output_dim)</code> <em>optional</em> returned when model is initialized with <code>with_projection=True</code>) — The image embeddings obtained by applying the projection layer to the pooler_output.</p>
</li>
<li>
<p><strong>last_hidden_state</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>) — Sequence of hidden-states at the output of the last layer of the model.</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><code>transformers.models.clip.modeling_clip.CLIPVisionModelOutput</code> or <code>tuple(torch.FloatTensor)</code></p>
`}}),rn=new rt({props:{$$slots:{default:[ya]},$$scope:{ctx:C}}}),yt=new He({props:{anchor:"transformers.CLIPVisionModelWithProjection.forward.example",$$slots:{default:[wa]},$$scope:{ctx:C}}}),qt=new O({props:{title:"CLIPVisionModel",local:"transformers.CLIPVisionModel",headingTag:"h2"}}),Yt=new z({props:{name:"class transformers.CLIPVisionModel",anchor:"transformers.CLIPVisionModel",parameters:[{name:"config",val:": CLIPVisionConfig"}],parametersDescription:[{anchor:"transformers.CLIPVisionModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/clip#transformers.CLIPConfig">CLIPConfig</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/clip/modeling_clip.py#L1119"}}),Vt=new z({props:{name:"forward",anchor:"transformers.CLIPVisionModel.forward",parameters:[{name:"pixel_values",val:": Optional = None"},{name:"output_attentions",val:": Optional = None"},{name:"output_hidden_states",val:": Optional = None"},{name:"interpolate_pos_encoding",val:": bool = False"},{name:"return_dict",val:": Optional = None"}],parametersDescription:[{anchor:"transformers.CLIPVisionModel.forward.pixel_values",description:`<strong>pixel_values</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
Pixel values. Padding will be ignored by default should you provide it. Pixel values can be obtained using
<a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <a href="/docs/transformers/main/en/model_doc/imagegpt#transformers.ImageGPTFeatureExtractor.__call__">CLIPImageProcessor.<strong>call</strong>()</a> for details.`,name:"pixel_values"},{anchor:"transformers.CLIPVisionModel.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.CLIPVisionModel.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.CLIPVisionModel.forward.interpolate_pos_encoding",description:`<strong>interpolate_pos_encoding</strong> (<code>bool</code>, <em>optional</em>, defaults <code>False</code>) &#x2014;
Whether to interpolate the pre-trained position encodings.`,name:"interpolate_pos_encoding"},{anchor:"transformers.CLIPVisionModel.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"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/clip/modeling_clip.py#L1137",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPooling"
>transformers.modeling_outputs.BaseModelOutputWithPooling</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 (<code>&lt;class 'transformers.models.clip.configuration_clip.CLIPVisionConfig'&gt;</code>) and inputs.</p>
<ul>
<li>
<p><strong>last_hidden_state</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>) — Sequence of hidden-states at the output of the last layer of the model.</p>
</li>
<li>
<p><strong>pooler_output</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, hidden_size)</code>) — Last layer hidden-state of the first token of the sequence (classification token) after further processing
through the layers used for the auxiliary pretraining task. E.g. for BERT-family of models, this returns
the classification token after processing through a linear layer and a tanh activation function. The linear
layer weights are trained from the next sentence prediction (classification) objective during pretraining.</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.BaseModelOutputWithPooling"
>transformers.modeling_outputs.BaseModelOutputWithPooling</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Qt=new rt({props:{$$slots:{default:[Ia]},$$scope:{ctx:C}}}),At=new He({props:{anchor:"transformers.CLIPVisionModel.forward.example",$$slots:{default:[$a]},$$scope:{ctx:C}}}),kt=new O({props:{title:"CLIPForImageClassification",local:"transformers.CLIPForImageClassification",headingTag:"h2"}}),Mn=new z({props:{name:"class transformers.CLIPForImageClassification",anchor:"transformers.CLIPForImageClassification",parameters:[{name:"config",val:": CLIPConfig"}],parametersDescription:[{anchor:"transformers.CLIPForImageClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/clip#transformers.CLIPConfig">CLIPConfig</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/clip/modeling_clip.py#L1579"}}),mn=new z({props:{name:"forward",anchor:"transformers.CLIPForImageClassification.forward",parameters:[{name:"pixel_values",val:": Optional = None"},{name:"labels",val:": Optional = None"},{name:"output_attentions",val:": Optional = None"},{name:"output_hidden_states",val:": Optional = None"},{name:"return_dict",val:": Optional = None"}],parametersDescription:[{anchor:"transformers.CLIPForImageClassification.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.CLIPForImageClassification.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>`,name:"attention_mask"},{anchor:"transformers.CLIPForImageClassification.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.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.CLIPForImageClassification.forward.pixel_values",description:`<strong>pixel_values</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
Pixel values. Padding will be ignored by default should you provide it. Pixel values can be obtained using
<a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <a href="/docs/transformers/main/en/model_doc/imagegpt#transformers.ImageGPTFeatureExtractor.__call__">CLIPImageProcessor.<strong>call</strong>()</a> for details.`,name:"pixel_values"},{anchor:"transformers.CLIPForImageClassification.forward.return_loss",description:`<strong>return_loss</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the contrastive loss.`,name:"return_loss"},{anchor:"transformers.CLIPForImageClassification.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.CLIPForImageClassification.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.CLIPForImageClassification.forward.interpolate_pos_encoding",description:`<strong>interpolate_pos_encoding</strong> (<code>bool</code>, <em>optional</em>, defaults <code>False</code>) &#x2014;
Whether to interpolate the pre-trained position encodings.`,name:"interpolate_pos_encoding"},{anchor:"transformers.CLIPForImageClassification.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.CLIPForImageClassification.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) &#x2014;
Labels for computing the image classification/regression loss. Indices should be in <code>[0, ..., config.num_labels - 1]</code>. If <code>config.num_labels == 1</code> a regression loss is computed (Mean-Square loss), If
<code>config.num_labels &gt; 1</code> a classification loss is computed (Cross-Entropy).`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/clip/modeling_clip.py#L1604",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.ImageClassifierOutput"
>transformers.modeling_outputs.ImageClassifierOutput</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/clip#transformers.CLIPConfig"
>CLIPConfig</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) — Classification (or regression if config.num_labels==1) loss.</p>
</li>
<li>
<p><strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, config.num_labels)</code>) — Classification (or regression if config.num_labels==1) scores (before SoftMax).</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 stage) of shape <code>(batch_size, sequence_length, hidden_size)</code>. Hidden-states
(also called feature maps) of the model at the output of each stage.</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, patch_size, 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.ImageClassifierOutput"
>transformers.modeling_outputs.ImageClassifierOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Ne=new rt({props:{$$slots:{default:[va]},$$scope:{ctx:C}}}),Kt=new He({props:{anchor:"transformers.CLIPForImageClassification.forward.example",$$slots:{default:[Ca]},$$scope:{ctx:C}}}),{c(){h(e.$$.fragment),m=r(),o=c("div"),h(s.$$.fragment),M=r(),n=c("p"),n.innerHTML=$,Ke=r(),V=c("p"),V.innerHTML=et,tt=r(),U=c("div"),h(_e.$$.fragment),ee=r(),J=c("p"),J.innerHTML=We,nt=r(),h(X.$$.fragment),it=r(),h(pe.$$.fragment),Ze=r(),K=c("div"),h(ve.$$.fragment),te=r(),Ce=c("p"),Ce.innerHTML=xe,ft=r(),h(be.$$.fragment),Pe=r(),h(ye.$$.fragment),Ee=r(),G=c("div"),h(Te.$$.fragment),R=r(),je=c("p"),je.innerHTML=ke,lt=r(),h(we.$$.fragment),qe=r(),h(q.$$.fragment),Ie=r(),h(Le.$$.fragment),ie=r(),W=c("div"),h(Xe.$$.fragment),ne=r(),Se=c("p"),Se.innerHTML=xt,N=r(),Je=c("p"),Je.innerHTML=ze,Ye=r(),D=c("div"),h(ot.$$.fragment),le=r(),me=c("p"),me.innerHTML=dt,he=r(),h(S.$$.fragment),_t=r(),h(H.$$.fragment),ct=r(),h(Qe.$$.fragment),B=r(),Y=c("div"),h(oe.$$.fragment),pt=r(),Be=c("p"),Be.textContent=st,de=r(),ge=c("p"),ge.innerHTML=mt,ue=r(),v=c("p"),v.innerHTML=j,ce=r(),Z=c("div"),h(se.$$.fragment),ae=r(),Me=c("p"),Me.innerHTML=$e,re=r(),h(I.$$.fragment),P=r(),h(A.$$.fragment),De=r(),h(Ue.$$.fragment),Pt=r(),Q=c("div"),h(Fe.$$.fragment),Ae=r(),Ve=c("p"),Ve.textContent=bt,nn=r(),Zt=c("p"),Zt.innerHTML=No,Ln=r(),Bt=c("p"),Bt.innerHTML=Rn,on=r(),jt=c("div"),h(Rt.$$.fragment),sn=r(),Cn=c("p"),Cn.innerHTML=qn,an=r(),h(rn.$$.fragment),Jn=r(),h(yt.$$.fragment),Sn=r(),h(qt.$$.fragment),St=r(),wt=c("div"),h(Yt.$$.fragment),ln=r(),xn=c("p"),xn.innerHTML=Yn,dn=r(),cn=c("p"),cn.innerHTML=ht,pn=r(),It=c("div"),h(Vt.$$.fragment),_o=r(),Tn=c("p"),Tn.innerHTML=Pn,bo=r(),h(Qt.$$.fragment),Dt=r(),h(At.$$.fragment),Et=r(),h(kt.$$.fragment),zn=r(),Ge=c("div"),h(Mn.$$.fragment),Un=r(),Gt=c("p"),Gt.textContent=Qn,Tt=r(),Nt=c("p"),Nt.innerHTML=To,yn=r(),jn=c("p"),jn.innerHTML=Mo,wn=r(),Lt=c("div"),h(mn.$$.fragment),Ot=r(),hn=c("p"),hn.innerHTML=In,Fn=r(),h(Ne.$$.fragment),gn=r(),h(Kt.$$.fragment),this.h()},l(T){g(e.$$.fragment,T),m=i(T),o=p(T,"DIV",{class:!0});var x=k(o);g(s.$$.fragment,x),M=i(x),n=p(x,"P",{"data-svelte-h":!0}),w(n)!=="svelte-6pahdo"&&(n.innerHTML=$),Ke=i(x),V=p(x,"P",{"data-svelte-h":!0}),w(V)!=="svelte-hswkmf"&&(V.innerHTML=et),tt=i(x),U=p(x,"DIV",{class:!0});var gt=k(U);g(_e.$$.fragment,gt),ee=i(gt),J=p(gt,"P",{"data-svelte-h":!0}),w(J)!=="svelte-dju4ul"&&(J.innerHTML=We),nt=i(gt),g(X.$$.fragment,gt),it=i(gt),g(pe.$$.fragment,gt),gt.forEach(a),Ze=i(x),K=p(x,"DIV",{class:!0});var Ht=k(K);g(ve.$$.fragment,Ht),te=i(Ht),Ce=p(Ht,"P",{"data-svelte-h":!0}),w(Ce)!=="svelte-dju4ul"&&(Ce.innerHTML=xe),ft=i(Ht),g(be.$$.fragment,Ht),Pe=i(Ht),g(ye.$$.fragment,Ht),Ht.forEach(a),Ee=i(x),G=p(x,"DIV",{class:!0});var Jt=k(G);g(Te.$$.fragment,Jt),R=i(Jt),je=p(Jt,"P",{"data-svelte-h":!0}),w(je)!=="svelte-dju4ul"&&(je.innerHTML=ke),lt=i(Jt),g(we.$$.fragment,Jt),qe=i(Jt),g(q.$$.fragment,Jt),Jt.forEach(a),x.forEach(a),Ie=i(T),g(Le.$$.fragment,T),ie=i(T),W=p(T,"DIV",{class:!0});var Oe=k(W);g(Xe.$$.fragment,Oe),ne=i(Oe),Se=p(Oe,"P",{"data-svelte-h":!0}),w(Se)!=="svelte-1ywp5an"&&(Se.innerHTML=xt),N=i(Oe),Je=p(Oe,"P",{"data-svelte-h":!0}),w(Je)!=="svelte-hswkmf"&&(Je.innerHTML=ze),Ye=i(Oe),D=p(Oe,"DIV",{class:!0});var $t=k(D);g(ot.$$.fragment,$t),le=i($t),me=p($t,"P",{"data-svelte-h":!0}),w(me)!=="svelte-1jdb4x5"&&(me.innerHTML=dt),he=i($t),g(S.$$.fragment,$t),_t=i($t),g(H.$$.fragment,$t),$t.forEach(a),Oe.forEach(a),ct=i(T),g(Qe.$$.fragment,T),B=i(T),Y=p(T,"DIV",{class:!0});var Re=k(Y);g(oe.$$.fragment,Re),pt=i(Re),Be=p(Re,"P",{"data-svelte-h":!0}),w(Be)!=="svelte-1gij27p"&&(Be.textContent=st),de=i(Re),ge=p(Re,"P",{"data-svelte-h":!0}),w(ge)!=="svelte-6pahdo"&&(ge.innerHTML=mt),ue=i(Re),v=p(Re,"P",{"data-svelte-h":!0}),w(v)!=="svelte-hswkmf"&&(v.innerHTML=j),ce=i(Re),Z=p(Re,"DIV",{class:!0});var vt=k(Z);g(se.$$.fragment,vt),ae=i(vt),Me=p(vt,"P",{"data-svelte-h":!0}),w(Me)!=="svelte-1k38ys1"&&(Me.innerHTML=$e),re=i(vt),g(I.$$.fragment,vt),P=i(vt),g(A.$$.fragment,vt),vt.forEach(a),Re.forEach(a),De=i(T),g(Ue.$$.fragment,T),Pt=i(T),Q=p(T,"DIV",{class:!0});var E=k(Q);g(Fe.$$.fragment,E),Ae=i(E),Ve=p(E,"P",{"data-svelte-h":!0}),w(Ve)!=="svelte-sjom46"&&(Ve.textContent=bt),nn=i(E),Zt=p(E,"P",{"data-svelte-h":!0}),w(Zt)!=="svelte-6pahdo"&&(Zt.innerHTML=No),Ln=i(E),Bt=p(E,"P",{"data-svelte-h":!0}),w(Bt)!=="svelte-hswkmf"&&(Bt.innerHTML=Rn),on=i(E),jt=p(E,"DIV",{class:!0});var at=k(jt);g(Rt.$$.fragment,at),sn=i(at),Cn=p(at,"P",{"data-svelte-h":!0}),w(Cn)!=="svelte-1jkt5qh"&&(Cn.innerHTML=qn),an=i(at),g(rn.$$.fragment,at),Jn=i(at),g(yt.$$.fragment,at),at.forEach(a),E.forEach(a),Sn=i(T),g(qt.$$.fragment,T),St=i(T),wt=p(T,"DIV",{class:!0});var zt=k(wt);g(Yt.$$.fragment,zt),ln=i(zt),xn=p(zt,"P",{"data-svelte-h":!0}),w(xn)!=="svelte-1ygagle"&&(xn.innerHTML=Yn),dn=i(zt),cn=p(zt,"P",{"data-svelte-h":!0}),w(cn)!=="svelte-hswkmf"&&(cn.innerHTML=ht),pn=i(zt),It=p(zt,"DIV",{class:!0});var ut=k(It);g(Vt.$$.fragment,ut),_o=i(ut),Tn=p(ut,"P",{"data-svelte-h":!0}),w(Tn)!=="svelte-1s7036x"&&(Tn.innerHTML=Pn),bo=i(ut),g(Qt.$$.fragment,ut),Dt=i(ut),g(At.$$.fragment,ut),ut.forEach(a),zt.forEach(a),Et=i(T),g(kt.$$.fragment,T),zn=i(T),Ge=p(T,"DIV",{class:!0});var Ct=k(Ge);g(Mn.$$.fragment,Ct),Un=i(Ct),Gt=p(Ct,"P",{"data-svelte-h":!0}),w(Gt)!=="svelte-fhevdc"&&(Gt.textContent=Qn),Tt=i(Ct),Nt=p(Ct,"P",{"data-svelte-h":!0}),w(Nt)!=="svelte-6pahdo"&&(Nt.innerHTML=To),yn=i(Ct),jn=p(Ct,"P",{"data-svelte-h":!0}),w(jn)!=="svelte-hswkmf"&&(jn.innerHTML=Mo),wn=i(Ct),Lt=p(Ct,"DIV",{class:!0});var Ut=k(Lt);g(mn.$$.fragment,Ut),Ot=i(Ut),hn=p(Ut,"P",{"data-svelte-h":!0}),w(hn)!=="svelte-1yuv3jh"&&(hn.innerHTML=In),Fn=i(Ut),g(Ne.$$.fragment,Ut),gn=i(Ut),g(Kt.$$.fragment,Ut),Ut.forEach(a),Ct.forEach(a),this.h()},h(){L(U,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),L(K,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),L(G,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),L(o,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),L(D,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),L(W,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),L(Z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),L(Y,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),L(jt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),L(Q,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),L(It,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),L(wt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),L(Lt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),L(Ge,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(T,x){u(e,T,x),d(T,m,x),d(T,o,x),u(s,o,null),l(o,M),l(o,n),l(o,Ke),l(o,V),l(o,tt),l(o,U),u(_e,U,null),l(U,ee),l(U,J),l(U,nt),u(X,U,null),l(U,it),u(pe,U,null),l(o,Ze),l(o,K),u(ve,K,null),l(K,te),l(K,Ce),l(K,ft),u(be,K,null),l(K,Pe),u(ye,K,null),l(o,Ee),l(o,G),u(Te,G,null),l(G,R),l(G,je),l(G,lt),u(we,G,null),l(G,qe),u(q,G,null),d(T,Ie,x),u(Le,T,x),d(T,ie,x),d(T,W,x),u(Xe,W,null),l(W,ne),l(W,Se),l(W,N),l(W,Je),l(W,Ye),l(W,D),u(ot,D,null),l(D,le),l(D,me),l(D,he),u(S,D,null),l(D,_t),u(H,D,null),d(T,ct,x),u(Qe,T,x),d(T,B,x),d(T,Y,x),u(oe,Y,null),l(Y,pt),l(Y,Be),l(Y,de),l(Y,ge),l(Y,ue),l(Y,v),l(Y,ce),l(Y,Z),u(se,Z,null),l(Z,ae),l(Z,Me),l(Z,re),u(I,Z,null),l(Z,P),u(A,Z,null),d(T,De,x),u(Ue,T,x),d(T,Pt,x),d(T,Q,x),u(Fe,Q,null),l(Q,Ae),l(Q,Ve),l(Q,nn),l(Q,Zt),l(Q,Ln),l(Q,Bt),l(Q,on),l(Q,jt),u(Rt,jt,null),l(jt,sn),l(jt,Cn),l(jt,an),u(rn,jt,null),l(jt,Jn),u(yt,jt,null),d(T,Sn,x),u(qt,T,x),d(T,St,x),d(T,wt,x),u(Yt,wt,null),l(wt,ln),l(wt,xn),l(wt,dn),l(wt,cn),l(wt,pn),l(wt,It),u(Vt,It,null),l(It,_o),l(It,Tn),l(It,bo),u(Qt,It,null),l(It,Dt),u(At,It,null),d(T,Et,x),u(kt,T,x),d(T,zn,x),d(T,Ge,x),u(Mn,Ge,null),l(Ge,Un),l(Ge,Gt),l(Ge,Tt),l(Ge,Nt),l(Ge,yn),l(Ge,jn),l(Ge,wn),l(Ge,Lt),u(mn,Lt,null),l(Lt,Ot),l(Lt,hn),l(Lt,Fn),u(Ne,Lt,null),l(Lt,gn),u(Kt,Lt,null),un=!0},p(T,x){const gt={};x&2&&(gt.$$scope={dirty:x,ctx:T}),X.$set(gt);const Ht={};x&2&&(Ht.$$scope={dirty:x,ctx:T}),pe.$set(Ht);const Jt={};x&2&&(Jt.$$scope={dirty:x,ctx:T}),be.$set(Jt);const Oe={};x&2&&(Oe.$$scope={dirty:x,ctx:T}),ye.$set(Oe);const $t={};x&2&&($t.$$scope={dirty:x,ctx:T}),we.$set($t);const Re={};x&2&&(Re.$$scope={dirty:x,ctx:T}),q.$set(Re);const vt={};x&2&&(vt.$$scope={dirty:x,ctx:T}),S.$set(vt);const E={};x&2&&(E.$$scope={dirty:x,ctx:T}),H.$set(E);const at={};x&2&&(at.$$scope={dirty:x,ctx:T}),I.$set(at);const zt={};x&2&&(zt.$$scope={dirty:x,ctx:T}),A.$set(zt);const ut={};x&2&&(ut.$$scope={dirty:x,ctx:T}),rn.$set(ut);const Ct={};x&2&&(Ct.$$scope={dirty:x,ctx:T}),yt.$set(Ct);const Ut={};x&2&&(Ut.$$scope={dirty:x,ctx:T}),Qt.$set(Ut);const kn={};x&2&&(kn.$$scope={dirty:x,ctx:T}),At.$set(kn);const Ho={};x&2&&(Ho.$$scope={dirty:x,ctx:T}),Ne.$set(Ho);const yo={};x&2&&(yo.$$scope={dirty:x,ctx:T}),Kt.$set(yo)},i(T){un||(f(e.$$.fragment,T),f(s.$$.fragment,T),f(_e.$$.fragment,T),f(X.$$.fragment,T),f(pe.$$.fragment,T),f(ve.$$.fragment,T),f(be.$$.fragment,T),f(ye.$$.fragment,T),f(Te.$$.fragment,T),f(we.$$.fragment,T),f(q.$$.fragment,T),f(Le.$$.fragment,T),f(Xe.$$.fragment,T),f(ot.$$.fragment,T),f(S.$$.fragment,T),f(H.$$.fragment,T),f(Qe.$$.fragment,T),f(oe.$$.fragment,T),f(se.$$.fragment,T),f(I.$$.fragment,T),f(A.$$.fragment,T),f(Ue.$$.fragment,T),f(Fe.$$.fragment,T),f(Rt.$$.fragment,T),f(rn.$$.fragment,T),f(yt.$$.fragment,T),f(qt.$$.fragment,T),f(Yt.$$.fragment,T),f(Vt.$$.fragment,T),f(Qt.$$.fragment,T),f(At.$$.fragment,T),f(kt.$$.fragment,T),f(Mn.$$.fragment,T),f(mn.$$.fragment,T),f(Ne.$$.fragment,T),f(Kt.$$.fragment,T),un=!0)},o(T){_(e.$$.fragment,T),_(s.$$.fragment,T),_(_e.$$.fragment,T),_(X.$$.fragment,T),_(pe.$$.fragment,T),_(ve.$$.fragment,T),_(be.$$.fragment,T),_(ye.$$.fragment,T),_(Te.$$.fragment,T),_(we.$$.fragment,T),_(q.$$.fragment,T),_(Le.$$.fragment,T),_(Xe.$$.fragment,T),_(ot.$$.fragment,T),_(S.$$.fragment,T),_(H.$$.fragment,T),_(Qe.$$.fragment,T),_(oe.$$.fragment,T),_(se.$$.fragment,T),_(I.$$.fragment,T),_(A.$$.fragment,T),_(Ue.$$.fragment,T),_(Fe.$$.fragment,T),_(Rt.$$.fragment,T),_(rn.$$.fragment,T),_(yt.$$.fragment,T),_(qt.$$.fragment,T),_(Yt.$$.fragment,T),_(Vt.$$.fragment,T),_(Qt.$$.fragment,T),_(At.$$.fragment,T),_(kt.$$.fragment,T),_(Mn.$$.fragment,T),_(mn.$$.fragment,T),_(Ne.$$.fragment,T),_(Kt.$$.fragment,T),un=!1},d(T){T&&(a(m),a(o),a(Ie),a(ie),a(W),a(ct),a(B),a(Y),a(De),a(Pt),a(Q),a(Sn),a(St),a(wt),a(Et),a(zn),a(Ge)),b(e,T),b(s),b(_e),b(X),b(pe),b(ve),b(be),b(ye),b(Te),b(we),b(q),b(Le,T),b(Xe),b(ot),b(S),b(H),b(Qe,T),b(oe),b(se),b(I),b(A),b(Ue,T),b(Fe),b(Rt),b(rn),b(yt),b(qt,T),b(Yt),b(Vt),b(Qt),b(At),b(kt,T),b(Mn),b(mn),b(Ne),b(Kt)}}}function Pa(C){let e,m;return e=new zs({props:{$$slots:{default:[xa]},$$scope:{ctx:C}}}),{c(){h(e.$$.fragment)},l(o){g(e.$$.fragment,o)},m(o,s){u(e,o,s),m=!0},p(o,s){const M={};s&2&&(M.$$scope={dirty:s,ctx:o}),e.$set(M)},i(o){m||(f(e.$$.fragment,o),m=!0)},o(o){_(e.$$.fragment,o),m=!1},d(o){b(e,o)}}}function ja(C){let e,m="TensorFlow models and layers in <code>transformers</code> accept two formats as input:",o,s,M="<li>having all inputs as keyword arguments (like PyTorch models), or</li> <li>having all inputs as a list, tuple or dict in the first positional argument.</li>",n,$,Ke=`The reason the second format is supported is that Keras methods prefer this format when passing inputs to models
and layers. Because of this support, when using methods like <code>model.fit()</code> things should “just work” for you - just
pass your inputs and labels in any format that <code>model.fit()</code> supports! If, however, you want to use the second
format outside of Keras methods like <code>fit()</code> and <code>predict()</code>, such as when creating your own layers or models with
the Keras <code>Functional</code> API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`,V,et,tt=`<li>a single Tensor with <code>input_ids</code> only and nothing else: <code>model(input_ids)</code></li> <li>a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
<code>model([input_ids, attention_mask])</code> or <code>model([input_ids, attention_mask, token_type_ids])</code></li> <li>a dictionary with one or several input Tensors associated to the input names given in the docstring:
<code>model({&quot;input_ids&quot;: input_ids, &quot;token_type_ids&quot;: token_type_ids})</code></li>`,U,_e,ee=`Note that when creating models and layers with
<a href="https://keras.io/guides/making_new_layers_and_models_via_subclassing/" rel="nofollow">subclassing</a> then you don’t need to worry
about any of this, as you can just pass inputs like you would to any other Python function!`;return{c(){e=c("p"),e.innerHTML=m,o=r(),s=c("ul"),s.innerHTML=M,n=r(),$=c("p"),$.innerHTML=Ke,V=r(),et=c("ul"),et.innerHTML=tt,U=r(),_e=c("p"),_e.innerHTML=ee},l(J){e=p(J,"P",{"data-svelte-h":!0}),w(e)!=="svelte-1ajbfxg"&&(e.innerHTML=m),o=i(J),s=p(J,"UL",{"data-svelte-h":!0}),w(s)!=="svelte-qm1t26"&&(s.innerHTML=M),n=i(J),$=p(J,"P",{"data-svelte-h":!0}),w($)!=="svelte-1v9qsc5"&&($.innerHTML=Ke),V=i(J),et=p(J,"UL",{"data-svelte-h":!0}),w(et)!=="svelte-15scerc"&&(et.innerHTML=tt),U=i(J),_e=p(J,"P",{"data-svelte-h":!0}),w(_e)!=="svelte-1an3odd"&&(_e.innerHTML=ee)},m(J,We){d(J,e,We),d(J,o,We),d(J,s,We),d(J,n,We),d(J,$,We),d(J,V,We),d(J,et,We),d(J,U,We),d(J,_e,We)},p:F,d(J){J&&(a(e),a(o),a(s),a(n),a($),a(V),a(et),a(U),a(_e))}}}function ka(C){let e,m=`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(){e=c("p"),e.innerHTML=m},l(o){e=p(o,"P",{"data-svelte-h":!0}),w(e)!=="svelte-fincs2"&&(e.innerHTML=m)},m(o,s){d(o,e,s)},p:F,d(o){o&&a(e)}}}function La(C){let e,m="Examples:",o,s,M;return s=new fe({props:{code:"aW1wb3J0JTIwdGVuc29yZmxvdyUyMGFzJTIwdGYlMEFmcm9tJTIwUElMJTIwaW1wb3J0JTIwSW1hZ2UlMEFpbXBvcnQlMjByZXF1ZXN0cyUwQWZyb20lMjB0cmFuc2Zvcm1lcnMlMjBpbXBvcnQlMjBBdXRvUHJvY2Vzc29yJTJDJTIwVEZDTElQTW9kZWwlMEElMEFtb2RlbCUyMCUzRCUyMFRGQ0xJUE1vZGVsLmZyb21fcHJldHJhaW5lZCglMjJvcGVuYWklMkZjbGlwLXZpdC1iYXNlLXBhdGNoMzIlMjIpJTBBcHJvY2Vzc29yJTIwJTNEJTIwQXV0b1Byb2Nlc3Nvci5mcm9tX3ByZXRyYWluZWQoJTIyb3BlbmFpJTJGY2xpcC12aXQtYmFzZS1wYXRjaDMyJTIyKSUwQSUwQXVybCUyMCUzRCUyMCUyMmh0dHAlM0ElMkYlMkZpbWFnZXMuY29jb2RhdGFzZXQub3JnJTJGdmFsMjAxNyUyRjAwMDAwMDAzOTc2OS5qcGclMjIlMEFpbWFnZSUyMCUzRCUyMEltYWdlLm9wZW4ocmVxdWVzdHMuZ2V0KHVybCUyQyUyMHN0cmVhbSUzRFRydWUpLnJhdyklMEElMEFpbnB1dHMlMjAlM0QlMjBwcm9jZXNzb3IoJTBBJTIwJTIwJTIwJTIwdGV4dCUzRCU1QiUyMmElMjBwaG90byUyMG9mJTIwYSUyMGNhdCUyMiUyQyUyMCUyMmElMjBwaG90byUyMG9mJTIwYSUyMGRvZyUyMiU1RCUyQyUyMGltYWdlcyUzRGltYWdlJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJ0ZiUyMiUyQyUyMHBhZGRpbmclM0RUcnVlJTBBKSUwQSUwQW91dHB1dHMlMjAlM0QlMjBtb2RlbCgqKmlucHV0cyklMEFsb2dpdHNfcGVyX2ltYWdlJTIwJTNEJTIwb3V0cHV0cy5sb2dpdHNfcGVyX2ltYWdlJTIwJTIwJTIzJTIwdGhpcyUyMGlzJTIwdGhlJTIwaW1hZ2UtdGV4dCUyMHNpbWlsYXJpdHklMjBzY29yZSUwQXByb2JzJTIwJTNEJTIwdGYubm4uc29mdG1heChsb2dpdHNfcGVyX2ltYWdlJTJDJTIwYXhpcyUzRDEpJTIwJTIwJTIzJTIwd2UlMjBjYW4lMjB0YWtlJTIwdGhlJTIwc29mdG1heCUyMHRvJTIwZ2V0JTIwdGhlJTIwbGFiZWwlMjBwcm9iYWJpbGl0aWVz",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> tensorflow <span class="hljs-keyword">as</span> tf
<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, TFCLIPModel

<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFCLIPModel.from_pretrained(<span class="hljs-string">&quot;openai/clip-vit-base-patch32&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>processor = AutoProcessor.from_pretrained(<span class="hljs-string">&quot;openai/clip-vit-base-patch32&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>url = <span class="hljs-string">&quot;http://images.cocodataset.org/val2017/000000039769.jpg&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(
<span class="hljs-meta">... </span>    text=[<span class="hljs-string">&quot;a photo of a cat&quot;</span>, <span class="hljs-string">&quot;a photo of a dog&quot;</span>], images=image, return_tensors=<span class="hljs-string">&quot;tf&quot;</span>, padding=<span class="hljs-literal">True</span>
<span class="hljs-meta">... </span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**inputs)
<span class="hljs-meta">&gt;&gt;&gt; </span>logits_per_image = outputs.logits_per_image  <span class="hljs-comment"># this is the image-text similarity score</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>probs = tf.nn.softmax(logits_per_image, axis=<span class="hljs-number">1</span>)  <span class="hljs-comment"># we can take the softmax to get the label probabilities</span>`,wrap:!1}}),{c(){e=c("p"),e.textContent=m,o=r(),h(s.$$.fragment)},l(n){e=p(n,"P",{"data-svelte-h":!0}),w(e)!=="svelte-kvfsh7"&&(e.textContent=m),o=i(n),g(s.$$.fragment,n)},m(n,$){d(n,e,$),d(n,o,$),u(s,n,$),M=!0},p:F,i(n){M||(f(s.$$.fragment,n),M=!0)},o(n){_(s.$$.fragment,n),M=!1},d(n){n&&(a(e),a(o)),b(s,n)}}}function Ja(C){let e,m=`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(){e=c("p"),e.innerHTML=m},l(o){e=p(o,"P",{"data-svelte-h":!0}),w(e)!=="svelte-fincs2"&&(e.innerHTML=m)},m(o,s){d(o,e,s)},p:F,d(o){o&&a(e)}}}function za(C){let e,m="Examples:",o,s,M;return s=new fe({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBURkNMSVBNb2RlbCUwQSUwQW1vZGVsJTIwJTNEJTIwVEZDTElQTW9kZWwuZnJvbV9wcmV0cmFpbmVkKCUyMm9wZW5haSUyRmNsaXAtdml0LWJhc2UtcGF0Y2gzMiUyMiklMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJvcGVuYWklMkZjbGlwLXZpdC1iYXNlLXBhdGNoMzIlMjIpJTBBJTBBaW5wdXRzJTIwJTNEJTIwdG9rZW5pemVyKCU1QiUyMmElMjBwaG90byUyMG9mJTIwYSUyMGNhdCUyMiUyQyUyMCUyMmElMjBwaG90byUyMG9mJTIwYSUyMGRvZyUyMiU1RCUyQyUyMHBhZGRpbmclM0RUcnVlJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJ0ZiUyMiklMEF0ZXh0X2ZlYXR1cmVzJTIwJTNEJTIwbW9kZWwuZ2V0X3RleHRfZmVhdHVyZXMoKippbnB1dHMp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, TFCLIPModel

<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFCLIPModel.from_pretrained(<span class="hljs-string">&quot;openai/clip-vit-base-patch32&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;openai/clip-vit-base-patch32&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer([<span class="hljs-string">&quot;a photo of a cat&quot;</span>, <span class="hljs-string">&quot;a photo of a dog&quot;</span>], padding=<span class="hljs-literal">True</span>, return_tensors=<span class="hljs-string">&quot;tf&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>text_features = model.get_text_features(**inputs)`,wrap:!1}}),{c(){e=c("p"),e.textContent=m,o=r(),h(s.$$.fragment)},l(n){e=p(n,"P",{"data-svelte-h":!0}),w(e)!=="svelte-kvfsh7"&&(e.textContent=m),o=i(n),g(s.$$.fragment,n)},m(n,$){d(n,e,$),d(n,o,$),u(s,n,$),M=!0},p:F,i(n){M||(f(s.$$.fragment,n),M=!0)},o(n){_(s.$$.fragment,n),M=!1},d(n){n&&(a(e),a(o)),b(s,n)}}}function Ua(C){let e,m=`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(){e=c("p"),e.innerHTML=m},l(o){e=p(o,"P",{"data-svelte-h":!0}),w(e)!=="svelte-fincs2"&&(e.innerHTML=m)},m(o,s){d(o,e,s)},p:F,d(o){o&&a(e)}}}function Fa(C){let e,m="Examples:",o,s,M;return s=new fe({props:{code:"ZnJvbSUyMFBJTCUyMGltcG9ydCUyMEltYWdlJTBBaW1wb3J0JTIwcmVxdWVzdHMlMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b1Byb2Nlc3NvciUyQyUyMFRGQ0xJUE1vZGVsJTBBJTBBbW9kZWwlMjAlM0QlMjBURkNMSVBNb2RlbC5mcm9tX3ByZXRyYWluZWQoJTIyb3BlbmFpJTJGY2xpcC12aXQtYmFzZS1wYXRjaDMyJTIyKSUwQXByb2Nlc3NvciUyMCUzRCUyMEF1dG9Qcm9jZXNzb3IuZnJvbV9wcmV0cmFpbmVkKCUyMm9wZW5haSUyRmNsaXAtdml0LWJhc2UtcGF0Y2gzMiUyMiklMEElMEF1cmwlMjAlM0QlMjAlMjJodHRwJTNBJTJGJTJGaW1hZ2VzLmNvY29kYXRhc2V0Lm9yZyUyRnZhbDIwMTclMkYwMDAwMDAwMzk3NjkuanBnJTIyJTBBaW1hZ2UlMjAlM0QlMjBJbWFnZS5vcGVuKHJlcXVlc3RzLmdldCh1cmwlMkMlMjBzdHJlYW0lM0RUcnVlKS5yYXcpJTBBJTBBaW5wdXRzJTIwJTNEJTIwcHJvY2Vzc29yKGltYWdlcyUzRGltYWdlJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJ0ZiUyMiklMEElMEFpbWFnZV9mZWF0dXJlcyUyMCUzRCUyMG1vZGVsLmdldF9pbWFnZV9mZWF0dXJlcygqKmlucHV0cyk=",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, TFCLIPModel

<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFCLIPModel.from_pretrained(<span class="hljs-string">&quot;openai/clip-vit-base-patch32&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>processor = AutoProcessor.from_pretrained(<span class="hljs-string">&quot;openai/clip-vit-base-patch32&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>url = <span class="hljs-string">&quot;http://images.cocodataset.org/val2017/000000039769.jpg&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, return_tensors=<span class="hljs-string">&quot;tf&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>image_features = model.get_image_features(**inputs)`,wrap:!1}}),{c(){e=c("p"),e.textContent=m,o=r(),h(s.$$.fragment)},l(n){e=p(n,"P",{"data-svelte-h":!0}),w(e)!=="svelte-kvfsh7"&&(e.textContent=m),o=i(n),g(s.$$.fragment,n)},m(n,$){d(n,e,$),d(n,o,$),u(s,n,$),M=!0},p:F,i(n){M||(f(s.$$.fragment,n),M=!0)},o(n){_(s.$$.fragment,n),M=!1},d(n){n&&(a(e),a(o)),b(s,n)}}}function Wa(C){let e,m=`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(){e=c("p"),e.innerHTML=m},l(o){e=p(o,"P",{"data-svelte-h":!0}),w(e)!=="svelte-fincs2"&&(e.innerHTML=m)},m(o,s){d(o,e,s)},p:F,d(o){o&&a(e)}}}function Za(C){let e,m="Examples:",o,s,M;return s=new fe({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBURkNMSVBUZXh0TW9kZWwlMEElMEFtb2RlbCUyMCUzRCUyMFRGQ0xJUFRleHRNb2RlbC5mcm9tX3ByZXRyYWluZWQoJTIyb3BlbmFpJTJGY2xpcC12aXQtYmFzZS1wYXRjaDMyJTIyKSUwQXRva2VuaXplciUyMCUzRCUyMEF1dG9Ub2tlbml6ZXIuZnJvbV9wcmV0cmFpbmVkKCUyMm9wZW5haSUyRmNsaXAtdml0LWJhc2UtcGF0Y2gzMiUyMiklMEElMEFpbnB1dHMlMjAlM0QlMjB0b2tlbml6ZXIoJTVCJTIyYSUyMHBob3RvJTIwb2YlMjBhJTIwY2F0JTIyJTJDJTIwJTIyYSUyMHBob3RvJTIwb2YlMjBhJTIwZG9nJTIyJTVEJTJDJTIwcGFkZGluZyUzRFRydWUlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnRmJTIyKSUwQSUwQW91dHB1dHMlMjAlM0QlMjBtb2RlbCgqKmlucHV0cyklMEFsYXN0X2hpZGRlbl9zdGF0ZSUyMCUzRCUyMG91dHB1dHMubGFzdF9oaWRkZW5fc3RhdGUlMEFwb29sZWRfb3V0cHV0JTIwJTNEJTIwb3V0cHV0cy5wb29sZXJfb3V0cHV0JTIwJTIwJTIzJTIwcG9vbGVkJTIwKEVPUyUyMHRva2VuKSUyMHN0YXRlcw==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, TFCLIPTextModel

<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFCLIPTextModel.from_pretrained(<span class="hljs-string">&quot;openai/clip-vit-base-patch32&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;openai/clip-vit-base-patch32&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer([<span class="hljs-string">&quot;a photo of a cat&quot;</span>, <span class="hljs-string">&quot;a photo of a dog&quot;</span>], padding=<span class="hljs-literal">True</span>, return_tensors=<span class="hljs-string">&quot;tf&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**inputs)
<span class="hljs-meta">&gt;&gt;&gt; </span>last_hidden_state = outputs.last_hidden_state
<span class="hljs-meta">&gt;&gt;&gt; </span>pooled_output = outputs.pooler_output  <span class="hljs-comment"># pooled (EOS token) states</span>`,wrap:!1}}),{c(){e=c("p"),e.textContent=m,o=r(),h(s.$$.fragment)},l(n){e=p(n,"P",{"data-svelte-h":!0}),w(e)!=="svelte-kvfsh7"&&(e.textContent=m),o=i(n),g(s.$$.fragment,n)},m(n,$){d(n,e,$),d(n,o,$),u(s,n,$),M=!0},p:F,i(n){M||(f(s.$$.fragment,n),M=!0)},o(n){_(s.$$.fragment,n),M=!1},d(n){n&&(a(e),a(o)),b(s,n)}}}function Ba(C){let e,m=`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(){e=c("p"),e.innerHTML=m},l(o){e=p(o,"P",{"data-svelte-h":!0}),w(e)!=="svelte-fincs2"&&(e.innerHTML=m)},m(o,s){d(o,e,s)},p:F,d(o){o&&a(e)}}}function Va(C){let e,m="Examples:",o,s,M;return s=new fe({props:{code:"ZnJvbSUyMFBJTCUyMGltcG9ydCUyMEltYWdlJTBBaW1wb3J0JTIwcmVxdWVzdHMlMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b1Byb2Nlc3NvciUyQyUyMFRGQ0xJUFZpc2lvbk1vZGVsJTBBJTBBbW9kZWwlMjAlM0QlMjBURkNMSVBWaXNpb25Nb2RlbC5mcm9tX3ByZXRyYWluZWQoJTIyb3BlbmFpJTJGY2xpcC12aXQtYmFzZS1wYXRjaDMyJTIyKSUwQXByb2Nlc3NvciUyMCUzRCUyMEF1dG9Qcm9jZXNzb3IuZnJvbV9wcmV0cmFpbmVkKCUyMm9wZW5haSUyRmNsaXAtdml0LWJhc2UtcGF0Y2gzMiUyMiklMEElMEF1cmwlMjAlM0QlMjAlMjJodHRwJTNBJTJGJTJGaW1hZ2VzLmNvY29kYXRhc2V0Lm9yZyUyRnZhbDIwMTclMkYwMDAwMDAwMzk3NjkuanBnJTIyJTBBaW1hZ2UlMjAlM0QlMjBJbWFnZS5vcGVuKHJlcXVlc3RzLmdldCh1cmwlMkMlMjBzdHJlYW0lM0RUcnVlKS5yYXcpJTBBJTBBaW5wdXRzJTIwJTNEJTIwcHJvY2Vzc29yKGltYWdlcyUzRGltYWdlJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJ0ZiUyMiklMEElMEFvdXRwdXRzJTIwJTNEJTIwbW9kZWwoKippbnB1dHMpJTBBbGFzdF9oaWRkZW5fc3RhdGUlMjAlM0QlMjBvdXRwdXRzLmxhc3RfaGlkZGVuX3N0YXRlJTBBcG9vbGVkX291dHB1dCUyMCUzRCUyMG91dHB1dHMucG9vbGVyX291dHB1dCUyMCUyMCUyMyUyMHBvb2xlZCUyMENMUyUyMHN0YXRlcw==",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, TFCLIPVisionModel

<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFCLIPVisionModel.from_pretrained(<span class="hljs-string">&quot;openai/clip-vit-base-patch32&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>processor = AutoProcessor.from_pretrained(<span class="hljs-string">&quot;openai/clip-vit-base-patch32&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>url = <span class="hljs-string">&quot;http://images.cocodataset.org/val2017/000000039769.jpg&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, return_tensors=<span class="hljs-string">&quot;tf&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**inputs)
<span class="hljs-meta">&gt;&gt;&gt; </span>last_hidden_state = outputs.last_hidden_state
<span class="hljs-meta">&gt;&gt;&gt; </span>pooled_output = outputs.pooler_output  <span class="hljs-comment"># pooled CLS states</span>`,wrap:!1}}),{c(){e=c("p"),e.textContent=m,o=r(),h(s.$$.fragment)},l(n){e=p(n,"P",{"data-svelte-h":!0}),w(e)!=="svelte-kvfsh7"&&(e.textContent=m),o=i(n),g(s.$$.fragment,n)},m(n,$){d(n,e,$),d(n,o,$),u(s,n,$),M=!0},p:F,i(n){M||(f(s.$$.fragment,n),M=!0)},o(n){_(s.$$.fragment,n),M=!1},d(n){n&&(a(e),a(o)),b(s,n)}}}function Ga(C){let e,m,o,s,M,n,$=`This model inherits from <a href="/docs/transformers/main/en/main_classes/model#transformers.TFPreTrainedModel">TFPreTrainedModel</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.)`,Ke,V,et=`This model is also a <a href="https://www.tensorflow.org/api_docs/python/tf/keras/Model" rel="nofollow">keras.Model</a> subclass. Use it
as a regular TF 2.0 Keras Model and refer to the TF 2.0 documentation for all matter related to general usage and
behavior.`,tt,U,_e,ee,J,We,nt,X='The <a href="/docs/transformers/main/en/model_doc/clip#transformers.TFCLIPModel">TFCLIPModel</a> forward method, overrides the <code>__call__</code> special method.',it,pe,Ze,K,ve,te,Ce,xe,ft,be='The <a href="/docs/transformers/main/en/model_doc/clip#transformers.TFCLIPModel">TFCLIPModel</a> forward method, overrides the <code>__call__</code> special method.',Pe,ye,Ee,G,Te,R,je,ke,lt,we='The <a href="/docs/transformers/main/en/model_doc/clip#transformers.TFCLIPModel">TFCLIPModel</a> forward method, overrides the <code>__call__</code> special method.',qe,q,Ie,Le,ie,W,Xe,ne,Se,xt,N,Je,ze,Ye,D='The <a href="/docs/transformers/main/en/model_doc/clip#transformers.TFCLIPTextModel">TFCLIPTextModel</a> forward method, overrides the <code>__call__</code> special method.',ot,le,me,dt,he,S,_t,H,ct,Qe,B,Y,oe,pt,Be='The <a href="/docs/transformers/main/en/model_doc/clip#transformers.TFCLIPVisionModel">TFCLIPVisionModel</a> forward method, overrides the <code>__call__</code> special method.',st,de,ge,mt,ue;return e=new O({props:{title:"TFCLIPModel",local:"transformers.TFCLIPModel",headingTag:"h2"}}),s=new z({props:{name:"class transformers.TFCLIPModel",anchor:"transformers.TFCLIPModel",parameters:[{name:"config",val:": CLIPConfig"},{name:"*inputs",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TFCLIPModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/clip#transformers.CLIPConfig">CLIPConfig</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.TFPreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/clip/modeling_tf_clip.py#L1300"}}),U=new rt({props:{$$slots:{default:[ja]},$$scope:{ctx:C}}}),J=new z({props:{name:"call",anchor:"transformers.TFCLIPModel.call",parameters:[{name:"input_ids",val:": TFModelInputType | None = None"},{name:"pixel_values",val:": TFModelInputType | None = None"},{name:"attention_mask",val:": np.ndarray | tf.Tensor | None = None"},{name:"position_ids",val:": np.ndarray | tf.Tensor | None = None"},{name:"return_loss",val:": Optional[bool] = None"},{name:"output_attentions",val:": Optional[bool] = None"},{name:"output_hidden_states",val:": Optional[bool] = None"},{name:"return_dict",val:": Optional[bool] = None"},{name:"training",val:": bool = False"}],parametersDescription:[{anchor:"transformers.TFCLIPModel.call.input_ids",description:`<strong>input_ids</strong> (<code>np.ndarray</code>, <code>tf.Tensor</code>, <code>List[tf.Tensor]</code> \`<code>Dict[str, tf.Tensor]</code> or <code>Dict[str, np.ndarray]</code> and each example must have the shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</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.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> and
<a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.TFCLIPModel.call.pixel_values",description:`<strong>pixel_values</strong> (<code>np.ndarray</code>, <code>tf.Tensor</code>, <code>List[tf.Tensor]</code> <code>Dict[str, tf.Tensor]</code> or <code>Dict[str, np.ndarray]</code> and each example must have the shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
Pixel values. Pixel values can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See
<a href="/docs/transformers/main/en/model_doc/imagegpt#transformers.ImageGPTFeatureExtractor.__call__">CLIPImageProcessor.<strong>call</strong>()</a> for details.`,name:"pixel_values"},{anchor:"transformers.TFCLIPModel.call.attention_mask",description:`<strong>attention_mask</strong> (<code>np.ndarray</code> or <code>tf.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>`,name:"attention_mask"},{anchor:"transformers.TFCLIPModel.call.position_ids",description:`<strong>position_ids</strong> (<code>np.ndarray</code> or <code>tf.Tensor</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.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.TFCLIPModel.call.return_loss",description:`<strong>return_loss</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the contrastive loss.`,name:"return_loss"},{anchor:"transformers.TFCLIPModel.call.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. This argument can be used only in eager mode, in graph mode the value in the
config will be used instead.`,name:"output_attentions"},{anchor:"transformers.TFCLIPModel.call.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. This argument can be used only in eager mode, in graph mode the value in the config will be
used instead.`,name:"output_hidden_states"},{anchor:"transformers.TFCLIPModel.call.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. This argument can be used in
eager mode, in graph mode the value will always be set to True.`,name:"return_dict"},{anchor:"transformers.TFCLIPModel.call.training",description:`<strong>training</strong> (<code>bool</code>, <em>optional</em>, defaults to \`False&#x201C;) &#x2014;
Whether or not to use the model in training mode (some modules like dropout modules have different
behaviors between training and evaluation).`,name:"training"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/clip/modeling_tf_clip.py#L1391",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <code>transformers.models.clip.modeling_tf_clip.TFCLIPOutput</code> or a tuple of <code>tf.Tensor</code> (if
<code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various elements depending on the
configuration (<code>&lt;class 'transformers.models.clip.configuration_clip.CLIPConfig'&gt;</code>) and inputs.</p>
<ul>
<li><strong>loss</strong> (<code>tf.Tensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>return_loss</code> is <code>True</code>) — Contrastive loss for image-text similarity.</li>
<li><strong>logits_per_image:(<code>tf.Tensor</code></strong> of shape <code>(image_batch_size, text_batch_size)</code>) — The scaled dot product scores between <code>image_embeds</code> and <code>text_embeds</code>. This represents the image-text
similarity scores.</li>
<li><strong>logits_per_text:(<code>tf.Tensor</code></strong> of shape <code>(text_batch_size, image_batch_size)</code>) — The scaled dot product scores between <code>text_embeds</code> and <code>image_embeds</code>. This represents the text-image
similarity scores.</li>
<li><strong>text_embeds(<code>tf.Tensor</code></strong> of shape <code>(batch_size, output_dim</code>) — The text embeddings obtained by applying the projection layer to the pooled output of <a
  href="/docs/transformers/main/en/model_doc/clip#transformers.TFCLIPTextModel"
>TFCLIPTextModel</a>.</li>
<li><strong>image_embeds(<code>tf.Tensor</code></strong> of shape <code>(batch_size, output_dim</code>) — The image embeddings obtained by applying the projection layer to the pooled output of
<a
  href="/docs/transformers/main/en/model_doc/clip#transformers.TFCLIPVisionModel"
>TFCLIPVisionModel</a>.</li>
<li><strong>text_model_output(<code>~modeling_tf_utils.TFBaseModelOutputWithPooling</code>):</strong>
The output of the <a
  href="/docs/transformers/main/en/model_doc/clip#transformers.TFCLIPTextModel"
>TFCLIPTextModel</a>.</li>
<li><strong>vision_model_output(<code>~modeling_tf_utils.TFBaseModelOutputWithPooling</code>):</strong>
The output of the <a
  href="/docs/transformers/main/en/model_doc/clip#transformers.TFCLIPVisionModel"
>TFCLIPVisionModel</a>.</li>
</ul>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>transformers.models.clip.modeling_tf_clip.TFCLIPOutput</code> or <code>tuple(tf.Tensor)</code></p>
`}}),pe=new rt({props:{$$slots:{default:[ka]},$$scope:{ctx:C}}}),K=new He({props:{anchor:"transformers.TFCLIPModel.call.example",$$slots:{default:[La]},$$scope:{ctx:C}}}),Ce=new z({props:{name:"get_text_features",anchor:"transformers.TFCLIPModel.get_text_features",parameters:[{name:"input_ids",val:": TFModelInputType | None = None"},{name:"attention_mask",val:": np.ndarray | tf.Tensor | None = None"},{name:"position_ids",val:": np.ndarray | tf.Tensor | None = None"},{name:"output_attentions",val:": Optional[bool] = None"},{name:"output_hidden_states",val:": Optional[bool] = None"},{name:"return_dict",val:": Optional[bool] = None"},{name:"training",val:": bool = False"}],parametersDescription:[{anchor:"transformers.TFCLIPModel.get_text_features.input_ids",description:`<strong>input_ids</strong> (<code>np.ndarray</code>, <code>tf.Tensor</code>, <code>List[tf.Tensor]</code> \`<code>Dict[str, tf.Tensor]</code> or <code>Dict[str, np.ndarray]</code> and each example must have the shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</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.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> and
<a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.TFCLIPModel.get_text_features.attention_mask",description:`<strong>attention_mask</strong> (<code>np.ndarray</code> or <code>tf.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>`,name:"attention_mask"},{anchor:"transformers.TFCLIPModel.get_text_features.position_ids",description:`<strong>position_ids</strong> (<code>np.ndarray</code> or <code>tf.Tensor</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.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.TFCLIPModel.get_text_features.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. This argument can be used only in eager mode, in graph mode the value in the
config will be used instead.`,name:"output_attentions"},{anchor:"transformers.TFCLIPModel.get_text_features.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. This argument can be used only in eager mode, in graph mode the value in the config will be
used instead.`,name:"output_hidden_states"},{anchor:"transformers.TFCLIPModel.get_text_features.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. This argument can be used in
eager mode, in graph mode the value will always be set to True.`,name:"return_dict"},{anchor:"transformers.TFCLIPModel.get_text_features.training",description:`<strong>training</strong> (<code>bool</code>, <em>optional</em>, defaults to \`False&#x201C;) &#x2014;
Whether or not to use the model in training mode (some modules like dropout modules have different
behaviors between training and evaluation).`,name:"training"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/clip/modeling_tf_clip.py#L1309",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>The text embeddings obtained by applying
the projection layer to the pooled output of <a
  href="/docs/transformers/main/en/model_doc/clip#transformers.TFCLIPTextModel"
>TFCLIPTextModel</a>.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p>text_features (<code>tf.Tensor</code> of shape <code>(batch_size, output_dim</code>)</p>
`}}),ye=new rt({props:{$$slots:{default:[Ja]},$$scope:{ctx:C}}}),G=new He({props:{anchor:"transformers.TFCLIPModel.get_text_features.example",$$slots:{default:[za]},$$scope:{ctx:C}}}),je=new z({props:{name:"get_image_features",anchor:"transformers.TFCLIPModel.get_image_features",parameters:[{name:"pixel_values",val:": TFModelInputType | None = None"},{name:"output_attentions",val:": Optional[bool] = None"},{name:"output_hidden_states",val:": Optional[bool] = None"},{name:"return_dict",val:": Optional[bool] = None"},{name:"training",val:": bool = False"}],parametersDescription:[{anchor:"transformers.TFCLIPModel.get_image_features.pixel_values",description:`<strong>pixel_values</strong> (<code>np.ndarray</code>, <code>tf.Tensor</code>, <code>List[tf.Tensor]</code> \`<code>Dict[str, tf.Tensor]</code> or <code>Dict[str, np.ndarray]</code> and each example must have the shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
Pixel values. Pixel values can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See
<a href="/docs/transformers/main/en/model_doc/imagegpt#transformers.ImageGPTFeatureExtractor.__call__">CLIPImageProcessor.<strong>call</strong>()</a> for details. output_attentions (<code>bool</code>, <em>optional</em>): Whether or not to
return the attentions tensors of all attention layers. See <code>attentions</code> under returned tensors for more
detail. This argument can be used only in eager mode, in graph mode the value in the config will be used
instead.`,name:"pixel_values"},{anchor:"transformers.TFCLIPModel.get_image_features.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. This argument can be used only in eager mode, in graph mode the value in the config will be
used instead.`,name:"output_hidden_states"},{anchor:"transformers.TFCLIPModel.get_image_features.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. This argument can be used in
eager mode, in graph mode the value will always be set to True.`,name:"return_dict"},{anchor:"transformers.TFCLIPModel.get_image_features.training",description:`<strong>training</strong> (<code>bool</code>, <em>optional</em>, defaults to \`False&#x201C;) &#x2014;
Whether or not to use the model in training mode (some modules like dropout modules have different
behaviors between training and evaluation).`,name:"training"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/clip/modeling_tf_clip.py#L1349",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>The image embeddings obtained by applying
the projection layer to the pooled output of <a
  href="/docs/transformers/main/en/model_doc/clip#transformers.TFCLIPVisionModel"
>TFCLIPVisionModel</a>.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p>image_features (<code>tf.Tensor</code> of shape <code>(batch_size, output_dim</code>)</p>
`}}),q=new rt({props:{$$slots:{default:[Ua]},$$scope:{ctx:C}}}),Le=new He({props:{anchor:"transformers.TFCLIPModel.get_image_features.example",$$slots:{default:[Fa]},$$scope:{ctx:C}}}),W=new O({props:{title:"TFCLIPTextModel",local:"transformers.TFCLIPTextModel",headingTag:"h2"}}),Se=new z({props:{name:"class transformers.TFCLIPTextModel",anchor:"transformers.TFCLIPTextModel",parameters:[{name:"config",val:": CLIPTextConfig"},{name:"*inputs",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/clip/modeling_tf_clip.py#L1178"}}),Je=new z({props:{name:"call",anchor:"transformers.TFCLIPTextModel.call",parameters:[{name:"input_ids",val:": TFModelInputType | None = None"},{name:"attention_mask",val:": np.ndarray | tf.Tensor | None = None"},{name:"position_ids",val:": np.ndarray | tf.Tensor | None = None"},{name:"output_attentions",val:": Optional[bool] = None"},{name:"output_hidden_states",val:": Optional[bool] = None"},{name:"return_dict",val:": Optional[bool] = None"},{name:"training",val:": Optional[bool] = False"}],parametersDescription:[{anchor:"transformers.TFCLIPTextModel.call.input_ids",description:`<strong>input_ids</strong> (<code>np.ndarray</code>, <code>tf.Tensor</code>, <code>List[tf.Tensor]</code> \`<code>Dict[str, tf.Tensor]</code> or <code>Dict[str, np.ndarray]</code> and each example must have the shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</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.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> and
<a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.TFCLIPTextModel.call.attention_mask",description:`<strong>attention_mask</strong> (<code>np.ndarray</code> or <code>tf.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>`,name:"attention_mask"},{anchor:"transformers.TFCLIPTextModel.call.position_ids",description:`<strong>position_ids</strong> (<code>np.ndarray</code> or <code>tf.Tensor</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.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.TFCLIPTextModel.call.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. This argument can be used only in eager mode, in graph mode the value in the
config will be used instead.`,name:"output_attentions"},{anchor:"transformers.TFCLIPTextModel.call.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. This argument can be used only in eager mode, in graph mode the value in the config will be
used instead.`,name:"output_hidden_states"},{anchor:"transformers.TFCLIPTextModel.call.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. This argument can be used in
eager mode, in graph mode the value will always be set to True.`,name:"return_dict"},{anchor:"transformers.TFCLIPTextModel.call.training",description:`<strong>training</strong> (<code>bool</code>, <em>optional</em>, defaults to \`False&#x201C;) &#x2014;
Whether or not to use the model in training mode (some modules like dropout modules have different
behaviors between training and evaluation).`,name:"training"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/clip/modeling_tf_clip.py#L1186",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_tf_outputs.TFBaseModelOutputWithPooling"
>transformers.modeling_tf_outputs.TFBaseModelOutputWithPooling</a> or a tuple of <code>tf.Tensor</code> (if
<code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various elements depending on the
configuration (<code>&lt;class 'transformers.models.clip.configuration_clip.CLIPTextConfig'&gt;</code>) and inputs.</p>
<ul>
<li>
<p><strong>last_hidden_state</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>) — Sequence of hidden-states at the output of the last layer of the model.</p>
</li>
<li>
<p><strong>pooler_output</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, hidden_size)</code>) — Last layer hidden-state of the first token of the sequence (classification token) further processed by a
Linear layer and a Tanh activation function. The Linear layer weights are trained from the next sentence
prediction (classification) objective during pretraining.</p>
<p>This output is usually <em>not</em> a good summary of the semantic content of the input, you’re often better with
averaging or pooling the sequence of hidden-states for the whole input sequence.</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(tf.Tensor)</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>tf.Tensor</code> (one for the output of the embeddings + 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 initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) — Tuple of <code>tf.Tensor</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_tf_outputs.TFBaseModelOutputWithPooling"
>transformers.modeling_tf_outputs.TFBaseModelOutputWithPooling</a> or <code>tuple(tf.Tensor)</code></p>
`}}),le=new rt({props:{$$slots:{default:[Wa]},$$scope:{ctx:C}}}),dt=new He({props:{anchor:"transformers.TFCLIPTextModel.call.example",$$slots:{default:[Za]},$$scope:{ctx:C}}}),S=new O({props:{title:"TFCLIPVisionModel",local:"transformers.TFCLIPVisionModel",headingTag:"h2"}}),ct=new z({props:{name:"class transformers.TFCLIPVisionModel",anchor:"transformers.TFCLIPVisionModel",parameters:[{name:"config",val:": CLIPVisionConfig"},{name:"*inputs",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/clip/modeling_tf_clip.py#L1238"}}),Y=new z({props:{name:"call",anchor:"transformers.TFCLIPVisionModel.call",parameters:[{name:"pixel_values",val:": TFModelInputType | None = None"},{name:"output_attentions",val:": Optional[bool] = None"},{name:"output_hidden_states",val:": Optional[bool] = None"},{name:"return_dict",val:": Optional[bool] = None"},{name:"training",val:": Optional[bool] = False"}],parametersDescription:[{anchor:"transformers.TFCLIPVisionModel.call.pixel_values",description:`<strong>pixel_values</strong> (<code>np.ndarray</code>, <code>tf.Tensor</code>, <code>List[tf.Tensor]</code> \`<code>Dict[str, tf.Tensor]</code> or <code>Dict[str, np.ndarray]</code> and each example must have the shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
Pixel values. Pixel values can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See
<a href="/docs/transformers/main/en/model_doc/imagegpt#transformers.ImageGPTFeatureExtractor.__call__">CLIPImageProcessor.<strong>call</strong>()</a> for details. output_attentions (<code>bool</code>, <em>optional</em>): Whether or not to
return the attentions tensors of all attention layers. See <code>attentions</code> under returned tensors for more
detail. This argument can be used only in eager mode, in graph mode the value in the config will be used
instead.`,name:"pixel_values"},{anchor:"transformers.TFCLIPVisionModel.call.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. This argument can be used only in eager mode, in graph mode the value in the config will be
used instead.`,name:"output_hidden_states"},{anchor:"transformers.TFCLIPVisionModel.call.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. This argument can be used in
eager mode, in graph mode the value will always be set to True.`,name:"return_dict"},{anchor:"transformers.TFCLIPVisionModel.call.training",description:`<strong>training</strong> (<code>bool</code>, <em>optional</em>, defaults to \`False&#x201C;) &#x2014;
Whether or not to use the model in training mode (some modules like dropout modules have different
behaviors between training and evaluation).`,name:"training"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/clip/modeling_tf_clip.py#L1247",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_tf_outputs.TFBaseModelOutputWithPooling"
>transformers.modeling_tf_outputs.TFBaseModelOutputWithPooling</a> or a tuple of <code>tf.Tensor</code> (if
<code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various elements depending on the
configuration (<code>&lt;class 'transformers.models.clip.configuration_clip.CLIPVisionConfig'&gt;</code>) and inputs.</p>
<ul>
<li>
<p><strong>last_hidden_state</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>) — Sequence of hidden-states at the output of the last layer of the model.</p>
</li>
<li>
<p><strong>pooler_output</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, hidden_size)</code>) — Last layer hidden-state of the first token of the sequence (classification token) further processed by a
Linear layer and a Tanh activation function. The Linear layer weights are trained from the next sentence
prediction (classification) objective during pretraining.</p>
<p>This output is usually <em>not</em> a good summary of the semantic content of the input, you’re often better with
averaging or pooling the sequence of hidden-states for the whole input sequence.</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(tf.Tensor)</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>tf.Tensor</code> (one for the output of the embeddings + 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 initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) — Tuple of <code>tf.Tensor</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_tf_outputs.TFBaseModelOutputWithPooling"
>transformers.modeling_tf_outputs.TFBaseModelOutputWithPooling</a> or <code>tuple(tf.Tensor)</code></p>
`}}),de=new rt({props:{$$slots:{default:[Ba]},$$scope:{ctx:C}}}),mt=new He({props:{anchor:"transformers.TFCLIPVisionModel.call.example",$$slots:{default:[Va]},$$scope:{ctx:C}}}),{c(){h(e.$$.fragment),m=r(),o=c("div"),h(s.$$.fragment),M=r(),n=c("p"),n.innerHTML=$,Ke=r(),V=c("p"),V.innerHTML=et,tt=r(),h(U.$$.fragment),_e=r(),ee=c("div"),h(J.$$.fragment),We=r(),nt=c("p"),nt.innerHTML=X,it=r(),h(pe.$$.fragment),Ze=r(),h(K.$$.fragment),ve=r(),te=c("div"),h(Ce.$$.fragment),xe=r(),ft=c("p"),ft.innerHTML=be,Pe=r(),h(ye.$$.fragment),Ee=r(),h(G.$$.fragment),Te=r(),R=c("div"),h(je.$$.fragment),ke=r(),lt=c("p"),lt.innerHTML=we,qe=r(),h(q.$$.fragment),Ie=r(),h(Le.$$.fragment),ie=r(),h(W.$$.fragment),Xe=r(),ne=c("div"),h(Se.$$.fragment),xt=r(),N=c("div"),h(Je.$$.fragment),ze=r(),Ye=c("p"),Ye.innerHTML=D,ot=r(),h(le.$$.fragment),me=r(),h(dt.$$.fragment),he=r(),h(S.$$.fragment),_t=r(),H=c("div"),h(ct.$$.fragment),Qe=r(),B=c("div"),h(Y.$$.fragment),oe=r(),pt=c("p"),pt.innerHTML=Be,st=r(),h(de.$$.fragment),ge=r(),h(mt.$$.fragment),this.h()},l(v){g(e.$$.fragment,v),m=i(v),o=p(v,"DIV",{class:!0});var j=k(o);g(s.$$.fragment,j),M=i(j),n=p(j,"P",{"data-svelte-h":!0}),w(n)!=="svelte-1qaxm70"&&(n.innerHTML=$),Ke=i(j),V=p(j,"P",{"data-svelte-h":!0}),w(V)!=="svelte-1be7e3c"&&(V.innerHTML=et),tt=i(j),g(U.$$.fragment,j),_e=i(j),ee=p(j,"DIV",{class:!0});var ce=k(ee);g(J.$$.fragment,ce),We=i(ce),nt=p(ce,"P",{"data-svelte-h":!0}),w(nt)!=="svelte-yva0k9"&&(nt.innerHTML=X),it=i(ce),g(pe.$$.fragment,ce),Ze=i(ce),g(K.$$.fragment,ce),ce.forEach(a),ve=i(j),te=p(j,"DIV",{class:!0});var Z=k(te);g(Ce.$$.fragment,Z),xe=i(Z),ft=p(Z,"P",{"data-svelte-h":!0}),w(ft)!=="svelte-yva0k9"&&(ft.innerHTML=be),Pe=i(Z),g(ye.$$.fragment,Z),Ee=i(Z),g(G.$$.fragment,Z),Z.forEach(a),Te=i(j),R=p(j,"DIV",{class:!0});var se=k(R);g(je.$$.fragment,se),ke=i(se),lt=p(se,"P",{"data-svelte-h":!0}),w(lt)!=="svelte-yva0k9"&&(lt.innerHTML=we),qe=i(se),g(q.$$.fragment,se),Ie=i(se),g(Le.$$.fragment,se),se.forEach(a),j.forEach(a),ie=i(v),g(W.$$.fragment,v),Xe=i(v),ne=p(v,"DIV",{class:!0});var ae=k(ne);g(Se.$$.fragment,ae),xt=i(ae),N=p(ae,"DIV",{class:!0});var Me=k(N);g(Je.$$.fragment,Me),ze=i(Me),Ye=p(Me,"P",{"data-svelte-h":!0}),w(Ye)!=="svelte-1a8mdod"&&(Ye.innerHTML=D),ot=i(Me),g(le.$$.fragment,Me),me=i(Me),g(dt.$$.fragment,Me),Me.forEach(a),ae.forEach(a),he=i(v),g(S.$$.fragment,v),_t=i(v),H=p(v,"DIV",{class:!0});var $e=k(H);g(ct.$$.fragment,$e),Qe=i($e),B=p($e,"DIV",{class:!0});var re=k(B);g(Y.$$.fragment,re),oe=i(re),pt=p(re,"P",{"data-svelte-h":!0}),w(pt)!=="svelte-eh6g6d"&&(pt.innerHTML=Be),st=i(re),g(de.$$.fragment,re),ge=i(re),g(mt.$$.fragment,re),re.forEach(a),$e.forEach(a),this.h()},h(){L(ee,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),L(te,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),L(R,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),L(o,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),L(N,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),L(ne,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),L(B,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),L(H,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(v,j){u(e,v,j),d(v,m,j),d(v,o,j),u(s,o,null),l(o,M),l(o,n),l(o,Ke),l(o,V),l(o,tt),u(U,o,null),l(o,_e),l(o,ee),u(J,ee,null),l(ee,We),l(ee,nt),l(ee,it),u(pe,ee,null),l(ee,Ze),u(K,ee,null),l(o,ve),l(o,te),u(Ce,te,null),l(te,xe),l(te,ft),l(te,Pe),u(ye,te,null),l(te,Ee),u(G,te,null),l(o,Te),l(o,R),u(je,R,null),l(R,ke),l(R,lt),l(R,qe),u(q,R,null),l(R,Ie),u(Le,R,null),d(v,ie,j),u(W,v,j),d(v,Xe,j),d(v,ne,j),u(Se,ne,null),l(ne,xt),l(ne,N),u(Je,N,null),l(N,ze),l(N,Ye),l(N,ot),u(le,N,null),l(N,me),u(dt,N,null),d(v,he,j),u(S,v,j),d(v,_t,j),d(v,H,j),u(ct,H,null),l(H,Qe),l(H,B),u(Y,B,null),l(B,oe),l(B,pt),l(B,st),u(de,B,null),l(B,ge),u(mt,B,null),ue=!0},p(v,j){const ce={};j&2&&(ce.$$scope={dirty:j,ctx:v}),U.$set(ce);const Z={};j&2&&(Z.$$scope={dirty:j,ctx:v}),pe.$set(Z);const se={};j&2&&(se.$$scope={dirty:j,ctx:v}),K.$set(se);const ae={};j&2&&(ae.$$scope={dirty:j,ctx:v}),ye.$set(ae);const Me={};j&2&&(Me.$$scope={dirty:j,ctx:v}),G.$set(Me);const $e={};j&2&&($e.$$scope={dirty:j,ctx:v}),q.$set($e);const re={};j&2&&(re.$$scope={dirty:j,ctx:v}),Le.$set(re);const I={};j&2&&(I.$$scope={dirty:j,ctx:v}),le.$set(I);const P={};j&2&&(P.$$scope={dirty:j,ctx:v}),dt.$set(P);const A={};j&2&&(A.$$scope={dirty:j,ctx:v}),de.$set(A);const De={};j&2&&(De.$$scope={dirty:j,ctx:v}),mt.$set(De)},i(v){ue||(f(e.$$.fragment,v),f(s.$$.fragment,v),f(U.$$.fragment,v),f(J.$$.fragment,v),f(pe.$$.fragment,v),f(K.$$.fragment,v),f(Ce.$$.fragment,v),f(ye.$$.fragment,v),f(G.$$.fragment,v),f(je.$$.fragment,v),f(q.$$.fragment,v),f(Le.$$.fragment,v),f(W.$$.fragment,v),f(Se.$$.fragment,v),f(Je.$$.fragment,v),f(le.$$.fragment,v),f(dt.$$.fragment,v),f(S.$$.fragment,v),f(ct.$$.fragment,v),f(Y.$$.fragment,v),f(de.$$.fragment,v),f(mt.$$.fragment,v),ue=!0)},o(v){_(e.$$.fragment,v),_(s.$$.fragment,v),_(U.$$.fragment,v),_(J.$$.fragment,v),_(pe.$$.fragment,v),_(K.$$.fragment,v),_(Ce.$$.fragment,v),_(ye.$$.fragment,v),_(G.$$.fragment,v),_(je.$$.fragment,v),_(q.$$.fragment,v),_(Le.$$.fragment,v),_(W.$$.fragment,v),_(Se.$$.fragment,v),_(Je.$$.fragment,v),_(le.$$.fragment,v),_(dt.$$.fragment,v),_(S.$$.fragment,v),_(ct.$$.fragment,v),_(Y.$$.fragment,v),_(de.$$.fragment,v),_(mt.$$.fragment,v),ue=!1},d(v){v&&(a(m),a(o),a(ie),a(Xe),a(ne),a(he),a(_t),a(H)),b(e,v),b(s),b(U),b(J),b(pe),b(K),b(Ce),b(ye),b(G),b(je),b(q),b(Le),b(W,v),b(Se),b(Je),b(le),b(dt),b(S,v),b(ct),b(Y),b(de),b(mt)}}}function Na(C){let e,m;return e=new zs({props:{$$slots:{default:[Ga]},$$scope:{ctx:C}}}),{c(){h(e.$$.fragment)},l(o){g(e.$$.fragment,o)},m(o,s){u(e,o,s),m=!0},p(o,s){const M={};s&2&&(M.$$scope={dirty:s,ctx:o}),e.$set(M)},i(o){m||(f(e.$$.fragment,o),m=!0)},o(o){_(e.$$.fragment,o),m=!1},d(o){b(e,o)}}}function Ha(C){let e,m=`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(){e=c("p"),e.innerHTML=m},l(o){e=p(o,"P",{"data-svelte-h":!0}),w(e)!=="svelte-fincs2"&&(e.innerHTML=m)},m(o,s){d(o,e,s)},p:F,d(o){o&&a(e)}}}function Ea(C){let e,m="Example:",o,s,M;return s=new fe({props:{code:"aW1wb3J0JTIwamF4JTBBZnJvbSUyMFBJTCUyMGltcG9ydCUyMEltYWdlJTBBaW1wb3J0JTIwcmVxdWVzdHMlMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b1Byb2Nlc3NvciUyQyUyMEZsYXhDTElQTW9kZWwlMEElMEFtb2RlbCUyMCUzRCUyMEZsYXhDTElQTW9kZWwuZnJvbV9wcmV0cmFpbmVkKCUyMm9wZW5haSUyRmNsaXAtdml0LWJhc2UtcGF0Y2gzMiUyMiklMEFwcm9jZXNzb3IlMjAlM0QlMjBBdXRvUHJvY2Vzc29yLmZyb21fcHJldHJhaW5lZCglMjJvcGVuYWklMkZjbGlwLXZpdC1iYXNlLXBhdGNoMzIlMjIpJTBBJTBBdXJsJTIwJTNEJTIwJTIyaHR0cCUzQSUyRiUyRmltYWdlcy5jb2NvZGF0YXNldC5vcmclMkZ2YWwyMDE3JTJGMDAwMDAwMDM5NzY5LmpwZyUyMiUwQWltYWdlJTIwJTNEJTIwSW1hZ2Uub3BlbihyZXF1ZXN0cy5nZXQodXJsJTJDJTIwc3RyZWFtJTNEVHJ1ZSkucmF3KSUwQSUwQWlucHV0cyUyMCUzRCUyMHByb2Nlc3NvciglMEElMjAlMjAlMjAlMjB0ZXh0JTNEJTVCJTIyYSUyMHBob3RvJTIwb2YlMjBhJTIwY2F0JTIyJTJDJTIwJTIyYSUyMHBob3RvJTIwb2YlMjBhJTIwZG9nJTIyJTVEJTJDJTIwaW1hZ2VzJTNEaW1hZ2UlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMm5wJTIyJTJDJTIwcGFkZGluZyUzRFRydWUlMEEpJTBBJTBBb3V0cHV0cyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzKSUwQWxvZ2l0c19wZXJfaW1hZ2UlMjAlM0QlMjBvdXRwdXRzLmxvZ2l0c19wZXJfaW1hZ2UlMjAlMjAlMjMlMjB0aGlzJTIwaXMlMjB0aGUlMjBpbWFnZS10ZXh0JTIwc2ltaWxhcml0eSUyMHNjb3JlJTBBcHJvYnMlMjAlM0QlMjBqYXgubm4uc29mdG1heChsb2dpdHNfcGVyX2ltYWdlJTJDJTIwYXhpcyUzRDEpJTIwJTIwJTIzJTIwd2UlMjBjYW4lMjB0YWtlJTIwdGhlJTIwc29mdG1heCUyMHRvJTIwZ2V0JTIwdGhlJTIwbGFiZWwlMjBwcm9iYWJpbGl0aWVz",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> jax
<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, FlaxCLIPModel

<span class="hljs-meta">&gt;&gt;&gt; </span>model = FlaxCLIPModel.from_pretrained(<span class="hljs-string">&quot;openai/clip-vit-base-patch32&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>processor = AutoProcessor.from_pretrained(<span class="hljs-string">&quot;openai/clip-vit-base-patch32&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>url = <span class="hljs-string">&quot;http://images.cocodataset.org/val2017/000000039769.jpg&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(
<span class="hljs-meta">... </span>    text=[<span class="hljs-string">&quot;a photo of a cat&quot;</span>, <span class="hljs-string">&quot;a photo of a dog&quot;</span>], images=image, return_tensors=<span class="hljs-string">&quot;np&quot;</span>, padding=<span class="hljs-literal">True</span>
<span class="hljs-meta">... </span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**inputs)
<span class="hljs-meta">&gt;&gt;&gt; </span>logits_per_image = outputs.logits_per_image  <span class="hljs-comment"># this is the image-text similarity score</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>probs = jax.nn.softmax(logits_per_image, axis=<span class="hljs-number">1</span>)  <span class="hljs-comment"># we can take the softmax to get the label probabilities</span>`,wrap:!1}}),{c(){e=c("p"),e.textContent=m,o=r(),h(s.$$.fragment)},l(n){e=p(n,"P",{"data-svelte-h":!0}),w(e)!=="svelte-11lpom8"&&(e.textContent=m),o=i(n),g(s.$$.fragment,n)},m(n,$){d(n,e,$),d(n,o,$),u(s,n,$),M=!0},p:F,i(n){M||(f(s.$$.fragment,n),M=!0)},o(n){_(s.$$.fragment,n),M=!1},d(n){n&&(a(e),a(o)),b(s,n)}}}function Xa(C){let e,m="Examples:",o,s,M;return s=new fe({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBGbGF4Q0xJUE1vZGVsJTBBJTBBbW9kZWwlMjAlM0QlMjBGbGF4Q0xJUE1vZGVsLmZyb21fcHJldHJhaW5lZCglMjJvcGVuYWklMkZjbGlwLXZpdC1iYXNlLXBhdGNoMzIlMjIpJTBBdG9rZW5pemVyJTIwJTNEJTIwQXV0b1Rva2VuaXplci5mcm9tX3ByZXRyYWluZWQoJTIyb3BlbmFpJTJGY2xpcC12aXQtYmFzZS1wYXRjaDMyJTIyKSUwQSUwQWlucHV0cyUyMCUzRCUyMHRva2VuaXplciglNUIlMjJhJTIwcGhvdG8lMjBvZiUyMGElMjBjYXQlMjIlMkMlMjAlMjJhJTIwcGhvdG8lMjBvZiUyMGElMjBkb2clMjIlNUQlMkMlMjBwYWRkaW5nJTNEVHJ1ZSUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIybnAlMjIpJTBBdGV4dF9mZWF0dXJlcyUyMCUzRCUyMG1vZGVsLmdldF90ZXh0X2ZlYXR1cmVzKCoqaW5wdXRzKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, FlaxCLIPModel

<span class="hljs-meta">&gt;&gt;&gt; </span>model = FlaxCLIPModel.from_pretrained(<span class="hljs-string">&quot;openai/clip-vit-base-patch32&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;openai/clip-vit-base-patch32&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer([<span class="hljs-string">&quot;a photo of a cat&quot;</span>, <span class="hljs-string">&quot;a photo of a dog&quot;</span>], padding=<span class="hljs-literal">True</span>, return_tensors=<span class="hljs-string">&quot;np&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>text_features = model.get_text_features(**inputs)`,wrap:!1}}),{c(){e=c("p"),e.textContent=m,o=r(),h(s.$$.fragment)},l(n){e=p(n,"P",{"data-svelte-h":!0}),w(e)!=="svelte-kvfsh7"&&(e.textContent=m),o=i(n),g(s.$$.fragment,n)},m(n,$){d(n,e,$),d(n,o,$),u(s,n,$),M=!0},p:F,i(n){M||(f(s.$$.fragment,n),M=!0)},o(n){_(s.$$.fragment,n),M=!1},d(n){n&&(a(e),a(o)),b(s,n)}}}function Ra(C){let e,m="Examples:",o,s,M;return s=new fe({props:{code:"ZnJvbSUyMFBJTCUyMGltcG9ydCUyMEltYWdlJTBBaW1wb3J0JTIwcmVxdWVzdHMlMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b1Byb2Nlc3NvciUyQyUyMEZsYXhDTElQTW9kZWwlMEElMEFtb2RlbCUyMCUzRCUyMEZsYXhDTElQTW9kZWwuZnJvbV9wcmV0cmFpbmVkKCUyMm9wZW5haSUyRmNsaXAtdml0LWJhc2UtcGF0Y2gzMiUyMiklMEFwcm9jZXNzb3IlMjAlM0QlMjBBdXRvUHJvY2Vzc29yLmZyb21fcHJldHJhaW5lZCglMjJvcGVuYWklMkZjbGlwLXZpdC1iYXNlLXBhdGNoMzIlMjIpJTBBJTBBdXJsJTIwJTNEJTIwJTIyaHR0cCUzQSUyRiUyRmltYWdlcy5jb2NvZGF0YXNldC5vcmclMkZ2YWwyMDE3JTJGMDAwMDAwMDM5NzY5LmpwZyUyMiUwQWltYWdlJTIwJTNEJTIwSW1hZ2Uub3BlbihyZXF1ZXN0cy5nZXQodXJsJTJDJTIwc3RyZWFtJTNEVHJ1ZSkucmF3KSUwQSUwQWlucHV0cyUyMCUzRCUyMHByb2Nlc3NvcihpbWFnZXMlM0RpbWFnZSUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIybnAlMjIpJTBBJTBBaW1hZ2VfZmVhdHVyZXMlMjAlM0QlMjBtb2RlbC5nZXRfaW1hZ2VfZmVhdHVyZXMoKippbnB1dHMp",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, FlaxCLIPModel

<span class="hljs-meta">&gt;&gt;&gt; </span>model = FlaxCLIPModel.from_pretrained(<span class="hljs-string">&quot;openai/clip-vit-base-patch32&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>processor = AutoProcessor.from_pretrained(<span class="hljs-string">&quot;openai/clip-vit-base-patch32&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>url = <span class="hljs-string">&quot;http://images.cocodataset.org/val2017/000000039769.jpg&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, return_tensors=<span class="hljs-string">&quot;np&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>image_features = model.get_image_features(**inputs)`,wrap:!1}}),{c(){e=c("p"),e.textContent=m,o=r(),h(s.$$.fragment)},l(n){e=p(n,"P",{"data-svelte-h":!0}),w(e)!=="svelte-kvfsh7"&&(e.textContent=m),o=i(n),g(s.$$.fragment,n)},m(n,$){d(n,e,$),d(n,o,$),u(s,n,$),M=!0},p:F,i(n){M||(f(s.$$.fragment,n),M=!0)},o(n){_(s.$$.fragment,n),M=!1},d(n){n&&(a(e),a(o)),b(s,n)}}}function qa(C){let e,m=`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(){e=c("p"),e.innerHTML=m},l(o){e=p(o,"P",{"data-svelte-h":!0}),w(e)!=="svelte-fincs2"&&(e.innerHTML=m)},m(o,s){d(o,e,s)},p:F,d(o){o&&a(e)}}}function Sa(C){let e,m="Example:",o,s,M;return s=new fe({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBGbGF4Q0xJUFRleHRNb2RlbCUwQSUwQW1vZGVsJTIwJTNEJTIwRmxheENMSVBUZXh0TW9kZWwuZnJvbV9wcmV0cmFpbmVkKCUyMm9wZW5haSUyRmNsaXAtdml0LWJhc2UtcGF0Y2gzMiUyMiklMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJvcGVuYWklMkZjbGlwLXZpdC1iYXNlLXBhdGNoMzIlMjIpJTBBJTBBaW5wdXRzJTIwJTNEJTIwdG9rZW5pemVyKCU1QiUyMmElMjBwaG90byUyMG9mJTIwYSUyMGNhdCUyMiUyQyUyMCUyMmElMjBwaG90byUyMG9mJTIwYSUyMGRvZyUyMiU1RCUyQyUyMHBhZGRpbmclM0RUcnVlJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJucCUyMiklMEElMEFvdXRwdXRzJTIwJTNEJTIwbW9kZWwoKippbnB1dHMpJTBBbGFzdF9oaWRkZW5fc3RhdGUlMjAlM0QlMjBvdXRwdXRzLmxhc3RfaGlkZGVuX3N0YXRlJTBBcG9vbGVyX291dHB1dCUyMCUzRCUyMG91dHB1dHMucG9vbGVyX291dHB1dCUyMCUyMCUyMyUyMHBvb2xlZCUyMChFT1MlMjB0b2tlbiklMjBzdGF0ZXM=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, FlaxCLIPTextModel

<span class="hljs-meta">&gt;&gt;&gt; </span>model = FlaxCLIPTextModel.from_pretrained(<span class="hljs-string">&quot;openai/clip-vit-base-patch32&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;openai/clip-vit-base-patch32&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer([<span class="hljs-string">&quot;a photo of a cat&quot;</span>, <span class="hljs-string">&quot;a photo of a dog&quot;</span>], padding=<span class="hljs-literal">True</span>, return_tensors=<span class="hljs-string">&quot;np&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**inputs)
<span class="hljs-meta">&gt;&gt;&gt; </span>last_hidden_state = outputs.last_hidden_state
<span class="hljs-meta">&gt;&gt;&gt; </span>pooler_output = outputs.pooler_output  <span class="hljs-comment"># pooled (EOS token) states</span>`,wrap:!1}}),{c(){e=c("p"),e.textContent=m,o=r(),h(s.$$.fragment)},l(n){e=p(n,"P",{"data-svelte-h":!0}),w(e)!=="svelte-11lpom8"&&(e.textContent=m),o=i(n),g(s.$$.fragment,n)},m(n,$){d(n,e,$),d(n,o,$),u(s,n,$),M=!0},p:F,i(n){M||(f(s.$$.fragment,n),M=!0)},o(n){_(s.$$.fragment,n),M=!1},d(n){n&&(a(e),a(o)),b(s,n)}}}function Ya(C){let e,m=`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(){e=c("p"),e.innerHTML=m},l(o){e=p(o,"P",{"data-svelte-h":!0}),w(e)!=="svelte-fincs2"&&(e.innerHTML=m)},m(o,s){d(o,e,s)},p:F,d(o){o&&a(e)}}}function Qa(C){let e,m="Example:",o,s,M;return s=new fe({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBGbGF4Q0xJUFRleHRNb2RlbFdpdGhQcm9qZWN0aW9uJTBBJTBBbW9kZWwlMjAlM0QlMjBGbGF4Q0xJUFRleHRNb2RlbFdpdGhQcm9qZWN0aW9uLmZyb21fcHJldHJhaW5lZCglMjJvcGVuYWklMkZjbGlwLXZpdC1iYXNlLXBhdGNoMzIlMjIpJTBBdG9rZW5pemVyJTIwJTNEJTIwQXV0b1Rva2VuaXplci5mcm9tX3ByZXRyYWluZWQoJTIyb3BlbmFpJTJGY2xpcC12aXQtYmFzZS1wYXRjaDMyJTIyKSUwQSUwQWlucHV0cyUyMCUzRCUyMHRva2VuaXplciglNUIlMjJhJTIwcGhvdG8lMjBvZiUyMGElMjBjYXQlMjIlMkMlMjAlMjJhJTIwcGhvdG8lMjBvZiUyMGElMjBkb2clMjIlNUQlMkMlMjBwYWRkaW5nJTNEVHJ1ZSUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIybnAlMjIpJTBBJTBBb3V0cHV0cyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzKSUwQXRleHRfZW1iZWRzJTIwJTNEJTIwb3V0cHV0cy50ZXh0X2VtYmVkcw==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, FlaxCLIPTextModelWithProjection

<span class="hljs-meta">&gt;&gt;&gt; </span>model = FlaxCLIPTextModelWithProjection.from_pretrained(<span class="hljs-string">&quot;openai/clip-vit-base-patch32&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;openai/clip-vit-base-patch32&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer([<span class="hljs-string">&quot;a photo of a cat&quot;</span>, <span class="hljs-string">&quot;a photo of a dog&quot;</span>], padding=<span class="hljs-literal">True</span>, return_tensors=<span class="hljs-string">&quot;np&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**inputs)
<span class="hljs-meta">&gt;&gt;&gt; </span>text_embeds = outputs.text_embeds`,wrap:!1}}),{c(){e=c("p"),e.textContent=m,o=r(),h(s.$$.fragment)},l(n){e=p(n,"P",{"data-svelte-h":!0}),w(e)!=="svelte-11lpom8"&&(e.textContent=m),o=i(n),g(s.$$.fragment,n)},m(n,$){d(n,e,$),d(n,o,$),u(s,n,$),M=!0},p:F,i(n){M||(f(s.$$.fragment,n),M=!0)},o(n){_(s.$$.fragment,n),M=!1},d(n){n&&(a(e),a(o)),b(s,n)}}}function Da(C){let e,m=`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(){e=c("p"),e.innerHTML=m},l(o){e=p(o,"P",{"data-svelte-h":!0}),w(e)!=="svelte-fincs2"&&(e.innerHTML=m)},m(o,s){d(o,e,s)},p:F,d(o){o&&a(e)}}}function Aa(C){let e,m="Example:",o,s,M;return s=new fe({props:{code:"ZnJvbSUyMFBJTCUyMGltcG9ydCUyMEltYWdlJTBBaW1wb3J0JTIwcmVxdWVzdHMlMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b1Byb2Nlc3NvciUyQyUyMEZsYXhDTElQVmlzaW9uTW9kZWwlMEElMEFtb2RlbCUyMCUzRCUyMEZsYXhDTElQVmlzaW9uTW9kZWwuZnJvbV9wcmV0cmFpbmVkKCUyMm9wZW5haSUyRmNsaXAtdml0LWJhc2UtcGF0Y2gzMiUyMiklMEFwcm9jZXNzb3IlMjAlM0QlMjBBdXRvUHJvY2Vzc29yLmZyb21fcHJldHJhaW5lZCglMjJvcGVuYWklMkZjbGlwLXZpdC1iYXNlLXBhdGNoMzIlMjIpJTBBJTBBdXJsJTIwJTNEJTIwJTIyaHR0cCUzQSUyRiUyRmltYWdlcy5jb2NvZGF0YXNldC5vcmclMkZ2YWwyMDE3JTJGMDAwMDAwMDM5NzY5LmpwZyUyMiUwQWltYWdlJTIwJTNEJTIwSW1hZ2Uub3BlbihyZXF1ZXN0cy5nZXQodXJsJTJDJTIwc3RyZWFtJTNEVHJ1ZSkucmF3KSUwQSUwQWlucHV0cyUyMCUzRCUyMHByb2Nlc3NvcihpbWFnZXMlM0RpbWFnZSUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIybnAlMjIpJTBBJTBBb3V0cHV0cyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzKSUwQWxhc3RfaGlkZGVuX3N0YXRlJTIwJTNEJTIwb3V0cHV0cy5sYXN0X2hpZGRlbl9zdGF0ZSUwQXBvb2xlcl9vdXRwdXQlMjAlM0QlMjBvdXRwdXRzLnBvb2xlcl9vdXRwdXQlMjAlMjAlMjMlMjBwb29sZWQlMjBDTFMlMjBzdGF0ZXM=",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, FlaxCLIPVisionModel

<span class="hljs-meta">&gt;&gt;&gt; </span>model = FlaxCLIPVisionModel.from_pretrained(<span class="hljs-string">&quot;openai/clip-vit-base-patch32&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>processor = AutoProcessor.from_pretrained(<span class="hljs-string">&quot;openai/clip-vit-base-patch32&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>url = <span class="hljs-string">&quot;http://images.cocodataset.org/val2017/000000039769.jpg&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, return_tensors=<span class="hljs-string">&quot;np&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**inputs)
<span class="hljs-meta">&gt;&gt;&gt; </span>last_hidden_state = outputs.last_hidden_state
<span class="hljs-meta">&gt;&gt;&gt; </span>pooler_output = outputs.pooler_output  <span class="hljs-comment"># pooled CLS states</span>`,wrap:!1}}),{c(){e=c("p"),e.textContent=m,o=r(),h(s.$$.fragment)},l(n){e=p(n,"P",{"data-svelte-h":!0}),w(e)!=="svelte-11lpom8"&&(e.textContent=m),o=i(n),g(s.$$.fragment,n)},m(n,$){d(n,e,$),d(n,o,$),u(s,n,$),M=!0},p:F,i(n){M||(f(s.$$.fragment,n),M=!0)},o(n){_(s.$$.fragment,n),M=!1},d(n){n&&(a(e),a(o)),b(s,n)}}}function Oa(C){let e,m,o,s,M,n,$=`This model inherits from <a href="/docs/transformers/main/en/main_classes/model#transformers.FlaxPreTrainedModel">FlaxPreTrainedModel</a>. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading, saving and converting weights from PyTorch models)`,Ke,V,et=`This model is also a
<a href="https://flax.readthedocs.io/en/latest/api_reference/flax.linen/module.html" rel="nofollow">flax.linen.Module</a> subclass. Use it as
a regular Flax linen Module and refer to the Flax documentation for all matter related to general usage and
behavior.`,tt,U,_e="Finally, this model supports inherent JAX features such as:",ee,J,We='<li><a href="https://jax.readthedocs.io/en/latest/jax.html#just-in-time-compilation-jit" rel="nofollow">Just-In-Time (JIT) compilation</a></li> <li><a href="https://jax.readthedocs.io/en/latest/jax.html#automatic-differentiation" rel="nofollow">Automatic Differentiation</a></li> <li><a href="https://jax.readthedocs.io/en/latest/jax.html#vectorization-vmap" rel="nofollow">Vectorization</a></li> <li><a href="https://jax.readthedocs.io/en/latest/jax.html#parallelization-pmap" rel="nofollow">Parallelization</a></li>',nt,X,it,pe,Ze,K="The <code>FlaxCLIPPreTrainedModel</code> forward method, overrides the <code>__call__</code> special method.",ve,te,Ce,xe,ft,be,Pe,ye,Ee,G,Te,R,je,ke,lt,we,qe,q,Ie,Le,ie,W,Xe,ne,Se="The <code>FlaxCLIPTextPreTrainedModel</code> forward method, overrides the <code>__call__</code> special method.",xt,N,Je,ze,Ye,D,ot,le,me,dt,he,S,_t,H,ct="The <code>FlaxCLIPTextPreTrainedModel</code> forward method, overrides the <code>__call__</code> special method.",Qe,B,Y,oe,pt,Be,st,de,ge,mt,ue,v,j,ce,Z="The <code>FlaxCLIPVisionPreTrainedModel</code> forward method, overrides the <code>__call__</code> special method.",se,ae,Me,$e,re;return e=new O({props:{title:"FlaxCLIPModel",local:"transformers.FlaxCLIPModel",headingTag:"h2"}}),s=new z({props:{name:"class transformers.FlaxCLIPModel",anchor:"transformers.FlaxCLIPModel",parameters:[{name:"config",val:": CLIPConfig"},{name:"input_shape",val:": Optional = None"},{name:"seed",val:": int = 0"},{name:"dtype",val:": dtype = <class 'jax.numpy.float32'>"},{name:"_do_init",val:": bool = True"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.FlaxCLIPModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/clip#transformers.CLIPConfig">CLIPConfig</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.FlaxPreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"},{anchor:"transformers.FlaxCLIPModel.dtype",description:`<strong>dtype</strong> (<code>jax.numpy.dtype</code>, <em>optional</em>, defaults to <code>jax.numpy.float32</code>) &#x2014;
The data type of the computation. Can be one of <code>jax.numpy.float32</code>, <code>jax.numpy.float16</code> (on GPUs) and
<code>jax.numpy.bfloat16</code> (on TPUs).</p>
<p>This can be used to enable mixed-precision training or half-precision inference on GPUs or TPUs. If
specified all the computation will be performed with the given <code>dtype</code>.</p>
<p><strong>Note that this only specifies the dtype of the computation and does not influence the dtype of model
parameters.</strong></p>
<p>If you wish to change the dtype of the model parameters, see <a href="/docs/transformers/main/en/main_classes/model#transformers.FlaxPreTrainedModel.to_fp16">to_fp16()</a> and
<a href="/docs/transformers/main/en/main_classes/model#transformers.FlaxPreTrainedModel.to_bf16">to_bf16()</a>.`,name:"dtype"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/clip/modeling_flax_clip.py#L1262"}}),it=new z({props:{name:"__call__",anchor:"transformers.FlaxCLIPModel.__call__",parameters:[{name:"input_ids",val:""},{name:"pixel_values",val:""},{name:"attention_mask",val:" = None"},{name:"position_ids",val:" = None"},{name:"params",val:": dict = None"},{name:"dropout_rng",val:": PRNGKey = None"},{name:"train",val:": bool = False"},{name:"output_attentions",val:": Optional = None"},{name:"output_hidden_states",val:": Optional = None"},{name:"return_dict",val:": Optional = None"}],parametersDescription:[{anchor:"transformers.FlaxCLIPModel.__call__.input_ids",description:`<strong>input_ids</strong> (<code>numpy.ndarray</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.FlaxCLIPModel.__call__.attention_mask",description:`<strong>attention_mask</strong> (<code>numpy.ndarray</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>`,name:"attention_mask"},{anchor:"transformers.FlaxCLIPModel.__call__.position_ids",description:`<strong>position_ids</strong> (<code>numpy.ndarray</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.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.FlaxCLIPModel.__call__.pixel_values",description:`<strong>pixel_values</strong> (<code>numpy.ndarray</code> of shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
Pixel values. Padding will be ignored by default should you provide it. Pixel values can be obtained using
<a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <a href="/docs/transformers/main/en/model_doc/imagegpt#transformers.ImageGPTFeatureExtractor.__call__">CLIPImageProcessor.<strong>call</strong>()</a> for details.`,name:"pixel_values"},{anchor:"transformers.FlaxCLIPModel.__call__.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.FlaxCLIPModel.__call__.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.FlaxCLIPModel.__call__.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"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/clip/modeling_flax_clip.py#L820",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <code>transformers.models.clip.modeling_flax_clip.FlaxCLIPOutput</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 (<code>&lt;class 'transformers.models.clip.configuration_clip.CLIPConfig'&gt;</code>) and inputs.</p>
<ul>
<li><strong>logits_per_image:(<code>jnp.ndarray</code></strong> of shape <code>(image_batch_size, text_batch_size)</code>) — The scaled dot product scores between <code>image_embeds</code> and <code>text_embeds</code>. This represents the image-text
similarity scores.</li>
<li><strong>logits_per_text:(<code>jnp.ndarray</code></strong> of shape <code>(text_batch_size, image_batch_size)</code>) — The scaled dot product scores between <code>text_embeds</code> and <code>image_embeds</code>. This represents the text-image
similarity scores.</li>
<li><strong>text_embeds(<code>jnp.ndarray</code></strong> of shape <code>(batch_size, output_dim</code>) — The text embeddings obtained by applying the projection layer to the pooled output of
<a
  href="/docs/transformers/main/en/model_doc/clip#transformers.FlaxCLIPTextModel"
>FlaxCLIPTextModel</a>.</li>
<li><strong>image_embeds(<code>jnp.ndarray</code></strong> of shape <code>(batch_size, output_dim</code>) — The image embeddings obtained by applying the projection layer to the pooled output of
<a
  href="/docs/transformers/main/en/model_doc/clip#transformers.FlaxCLIPVisionModel"
>FlaxCLIPVisionModel</a>.</li>
<li><strong>text_model_output(<code>FlaxBaseModelOutputWithPooling</code>):</strong>
The output of the <a
  href="/docs/transformers/main/en/model_doc/clip#transformers.FlaxCLIPTextModel"
>FlaxCLIPTextModel</a>.</li>
<li><strong>vision_model_output(<code>FlaxBaseModelOutputWithPooling</code>):</strong>
The output of the <a
  href="/docs/transformers/main/en/model_doc/clip#transformers.FlaxCLIPVisionModel"
>FlaxCLIPVisionModel</a>.</li>
</ul>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>transformers.models.clip.modeling_flax_clip.FlaxCLIPOutput</code> or <code>tuple(torch.FloatTensor)</code></p>
`}}),te=new rt({props:{$$slots:{default:[Ha]},$$scope:{ctx:C}}}),xe=new He({props:{anchor:"transformers.FlaxCLIPModel.__call__.example",$$slots:{default:[Ea]},$$scope:{ctx:C}}}),Pe=new z({props:{name:"get_text_features",anchor:"transformers.FlaxCLIPModel.get_text_features",parameters:[{name:"input_ids",val:""},{name:"attention_mask",val:" = None"},{name:"position_ids",val:" = None"},{name:"params",val:": dict = None"},{name:"dropout_rng",val:": PRNGKey = None"},{name:"train",val:" = False"}],parametersDescription:[{anchor:"transformers.FlaxCLIPModel.get_text_features.input_ids",description:`<strong>input_ids</strong> (<code>numpy.ndarray</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"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/clip/modeling_flax_clip.py#L865",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>The text embeddings obtained by applying
the projection layer to the pooled output of <a
  href="/docs/transformers/main/en/model_doc/clip#transformers.FlaxCLIPTextModel"
>FlaxCLIPTextModel</a>.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p>text_features (<code>jnp.ndarray</code> of shape <code>(batch_size, output_dim</code>)</p>
`}}),Ee=new He({props:{anchor:"transformers.FlaxCLIPModel.get_text_features.example",$$slots:{default:[Xa]},$$scope:{ctx:C}}}),R=new z({props:{name:"get_image_features",anchor:"transformers.FlaxCLIPModel.get_image_features",parameters:[{name:"pixel_values",val:""},{name:"params",val:": dict = None"},{name:"dropout_rng",val:": PRNGKey = None"},{name:"train",val:" = False"}],parametersDescription:[{anchor:"transformers.FlaxCLIPModel.get_image_features.pixel_values",description:`<strong>pixel_values</strong> (<code>numpy.ndarray</code> of shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
Pixel values. Padding will be ignored by default should you provide it. Pixel values can be obtained
using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <a href="/docs/transformers/main/en/model_doc/imagegpt#transformers.ImageGPTFeatureExtractor.__call__">CLIPImageProcessor.<strong>call</strong>()</a> for details.`,name:"pixel_values"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/clip/modeling_flax_clip.py#L932",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>The image embeddings obtained by
applying the projection layer to the pooled output of <a
  href="/docs/transformers/main/en/model_doc/clip#transformers.FlaxCLIPVisionModel"
>FlaxCLIPVisionModel</a></p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p>image_features (<code>jnp.ndarray</code> of shape <code>(batch_size, output_dim</code>)</p>
`}}),ke=new He({props:{anchor:"transformers.FlaxCLIPModel.get_image_features.example",$$slots:{default:[Ra]},$$scope:{ctx:C}}}),we=new O({props:{title:"FlaxCLIPTextModel",local:"transformers.FlaxCLIPTextModel",headingTag:"h2"}}),Ie=new z({props:{name:"class transformers.FlaxCLIPTextModel",anchor:"transformers.FlaxCLIPTextModel",parameters:[{name:"config",val:": CLIPTextConfig"},{name:"input_shape",val:" = (1, 1)"},{name:"seed",val:": int = 0"},{name:"dtype",val:": dtype = <class 'jax.numpy.float32'>"},{name:"_do_init",val:": bool = True"},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/clip/modeling_flax_clip.py#L1012"}}),W=new z({props:{name:"__call__",anchor:"transformers.FlaxCLIPTextModel.__call__",parameters:[{name:"input_ids",val:""},{name:"attention_mask",val:" = None"},{name:"position_ids",val:" = None"},{name:"params",val:": dict = None"},{name:"dropout_rng",val:": PRNGKey = None"},{name:"train",val:": bool = False"},{name:"output_attentions",val:": Optional = None"},{name:"output_hidden_states",val:": Optional = None"},{name:"return_dict",val:": Optional = None"}],parametersDescription:[{anchor:"transformers.FlaxCLIPTextModel.__call__.input_ids",description:`<strong>input_ids</strong> (<code>numpy.ndarray</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.FlaxCLIPTextModel.__call__.attention_mask",description:`<strong>attention_mask</strong> (<code>numpy.ndarray</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>`,name:"attention_mask"},{anchor:"transformers.FlaxCLIPTextModel.__call__.position_ids",description:`<strong>position_ids</strong> (<code>numpy.ndarray</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.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.FlaxCLIPTextModel.__call__.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.FlaxCLIPTextModel.__call__.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.FlaxCLIPTextModel.__call__.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"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/clip/modeling_flax_clip.py#L665",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_flax_outputs.FlaxBaseModelOutputWithPooling"
>transformers.modeling_flax_outputs.FlaxBaseModelOutputWithPooling</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 (<code>&lt;class 'transformers.models.clip.configuration_clip.CLIPTextConfig'&gt;</code>) and inputs.</p>
<ul>
<li>
<p><strong>last_hidden_state</strong> (<code>jnp.ndarray</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>) — Sequence of hidden-states at the output of the last layer of the model.</p>
</li>
<li>
<p><strong>pooler_output</strong> (<code>jnp.ndarray</code> of shape <code>(batch_size, hidden_size)</code>) — Last layer hidden-state of the first token of the sequence (classification token) further processed by a
Linear layer and a Tanh activation function. The Linear layer weights are trained from the next sentence
prediction (classification) objective during pretraining.</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(jnp.ndarray)</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>jnp.ndarray</code> (one for the output of the embeddings + 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 initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(jnp.ndarray)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) — Tuple of <code>jnp.ndarray</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_flax_outputs.FlaxBaseModelOutputWithPooling"
>transformers.modeling_flax_outputs.FlaxBaseModelOutputWithPooling</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),N=new rt({props:{$$slots:{default:[qa]},$$scope:{ctx:C}}}),ze=new He({props:{anchor:"transformers.FlaxCLIPTextModel.__call__.example",$$slots:{default:[Sa]},$$scope:{ctx:C}}}),D=new O({props:{title:"FlaxCLIPTextModelWithProjection",local:"transformers.FlaxCLIPTextModelWithProjection",headingTag:"h2"}}),me=new z({props:{name:"class transformers.FlaxCLIPTextModelWithProjection",anchor:"transformers.FlaxCLIPTextModelWithProjection",parameters:[{name:"config",val:": CLIPTextConfig"},{name:"input_shape",val:" = (1, 1)"},{name:"seed",val:": int = 0"},{name:"dtype",val:": dtype = <class 'jax.numpy.float32'>"},{name:"_do_init",val:": bool = True"},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/clip/modeling_flax_clip.py#L1083"}}),S=new z({props:{name:"__call__",anchor:"transformers.FlaxCLIPTextModelWithProjection.__call__",parameters:[{name:"input_ids",val:""},{name:"attention_mask",val:" = None"},{name:"position_ids",val:" = None"},{name:"params",val:": dict = None"},{name:"dropout_rng",val:": PRNGKey = None"},{name:"train",val:": bool = False"},{name:"output_attentions",val:": Optional = None"},{name:"output_hidden_states",val:": Optional = None"},{name:"return_dict",val:": Optional = None"}],parametersDescription:[{anchor:"transformers.FlaxCLIPTextModelWithProjection.__call__.input_ids",description:`<strong>input_ids</strong> (<code>numpy.ndarray</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.FlaxCLIPTextModelWithProjection.__call__.attention_mask",description:`<strong>attention_mask</strong> (<code>numpy.ndarray</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>`,name:"attention_mask"},{anchor:"transformers.FlaxCLIPTextModelWithProjection.__call__.position_ids",description:`<strong>position_ids</strong> (<code>numpy.ndarray</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.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.FlaxCLIPTextModelWithProjection.__call__.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.FlaxCLIPTextModelWithProjection.__call__.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.FlaxCLIPTextModelWithProjection.__call__.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"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/clip/modeling_flax_clip.py#L665",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <code>transformers.models.clip.modeling_flax_clip.FlaxCLIPTextModelOutput</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 (<code>&lt;class 'transformers.models.clip.configuration_clip.CLIPTextConfig'&gt;</code>) and inputs.</p>
<ul>
<li>
<p><strong>text_embeds</strong> (<code>jnp.ndarray</code> of shape <code>(batch_size, output_dim</code>) — The text embeddings obtained by applying the projection layer to the pooled output of
<a
  href="/docs/transformers/main/en/model_doc/clip#transformers.FlaxCLIPTextModel"
>FlaxCLIPTextModel</a>.</p>
</li>
<li>
<p><strong>last_hidden_state</strong> (<code>jnp.ndarray</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>) — Sequence of hidden-states at the output of the last layer of the model.</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(jnp.ndarray)</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>jnp.ndarray</code> (one for the output of the embeddings + 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 initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(jnp.ndarray)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) — Tuple of <code>jnp.ndarray</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><code>transformers.models.clip.modeling_flax_clip.FlaxCLIPTextModelOutput</code> or <code>tuple(torch.FloatTensor)</code></p>
`}}),B=new rt({props:{$$slots:{default:[Ya]},$$scope:{ctx:C}}}),oe=new He({props:{anchor:"transformers.FlaxCLIPTextModelWithProjection.__call__.example",$$slots:{default:[Qa]},$$scope:{ctx:C}}}),Be=new O({props:{title:"FlaxCLIPVisionModel",local:"transformers.FlaxCLIPVisionModel",headingTag:"h2"}}),ge=new z({props:{name:"class transformers.FlaxCLIPVisionModel",anchor:"transformers.FlaxCLIPVisionModel",parameters:[{name:"config",val:": CLIPVisionConfig"},{name:"input_shape",val:": Optional = None"},{name:"seed",val:": int = 0"},{name:"dtype",val:": dtype = <class 'jax.numpy.float32'>"},{name:"_do_init",val:": bool = True"},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/clip/modeling_flax_clip.py#L1137"}}),v=new z({props:{name:"__call__",anchor:"transformers.FlaxCLIPVisionModel.__call__",parameters:[{name:"pixel_values",val:""},{name:"params",val:": dict = None"},{name:"dropout_rng",val:": PRNGKey = None"},{name:"train",val:": bool = False"},{name:"output_attentions",val:": Optional = None"},{name:"output_hidden_states",val:": Optional = None"},{name:"return_dict",val:": Optional = None"}],parametersDescription:[{anchor:"transformers.FlaxCLIPVisionModel.__call__.pixel_values",description:`<strong>pixel_values</strong> (<code>numpy.ndarray</code> of shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
Pixel values. Padding will be ignored by default should you provide it. Pixel values can be obtained using
<a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <a href="/docs/transformers/main/en/model_doc/imagegpt#transformers.ImageGPTFeatureExtractor.__call__">CLIPImageProcessor.<strong>call</strong>()</a> for details.`,name:"pixel_values"},{anchor:"transformers.FlaxCLIPVisionModel.__call__.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.FlaxCLIPVisionModel.__call__.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.FlaxCLIPVisionModel.__call__.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"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/clip/modeling_flax_clip.py#L745",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_flax_outputs.FlaxBaseModelOutputWithPooling"
>transformers.modeling_flax_outputs.FlaxBaseModelOutputWithPooling</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 (<code>&lt;class 'transformers.models.clip.configuration_clip.CLIPVisionConfig'&gt;</code>) and inputs.</p>
<ul>
<li>
<p><strong>last_hidden_state</strong> (<code>jnp.ndarray</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>) — Sequence of hidden-states at the output of the last layer of the model.</p>
</li>
<li>
<p><strong>pooler_output</strong> (<code>jnp.ndarray</code> of shape <code>(batch_size, hidden_size)</code>) — Last layer hidden-state of the first token of the sequence (classification token) further processed by a
Linear layer and a Tanh activation function. The Linear layer weights are trained from the next sentence
prediction (classification) objective during pretraining.</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(jnp.ndarray)</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>jnp.ndarray</code> (one for the output of the embeddings + 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 initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(jnp.ndarray)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) — Tuple of <code>jnp.ndarray</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_flax_outputs.FlaxBaseModelOutputWithPooling"
>transformers.modeling_flax_outputs.FlaxBaseModelOutputWithPooling</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),ae=new rt({props:{$$slots:{default:[Da]},$$scope:{ctx:C}}}),$e=new He({props:{anchor:"transformers.FlaxCLIPVisionModel.__call__.example",$$slots:{default:[Aa]},$$scope:{ctx:C}}}),{c(){h(e.$$.fragment),m=r(),o=c("div"),h(s.$$.fragment),M=r(),n=c("p"),n.innerHTML=$,Ke=r(),V=c("p"),V.innerHTML=et,tt=r(),U=c("p"),U.textContent=_e,ee=r(),J=c("ul"),J.innerHTML=We,nt=r(),X=c("div"),h(it.$$.fragment),pe=r(),Ze=c("p"),Ze.innerHTML=K,ve=r(),h(te.$$.fragment),Ce=r(),h(xe.$$.fragment),ft=r(),be=c("div"),h(Pe.$$.fragment),ye=r(),h(Ee.$$.fragment),G=r(),Te=c("div"),h(R.$$.fragment),je=r(),h(ke.$$.fragment),lt=r(),h(we.$$.fragment),qe=r(),q=c("div"),h(Ie.$$.fragment),Le=r(),ie=c("div"),h(W.$$.fragment),Xe=r(),ne=c("p"),ne.innerHTML=Se,xt=r(),h(N.$$.fragment),Je=r(),h(ze.$$.fragment),Ye=r(),h(D.$$.fragment),ot=r(),le=c("div"),h(me.$$.fragment),dt=r(),he=c("div"),h(S.$$.fragment),_t=r(),H=c("p"),H.innerHTML=ct,Qe=r(),h(B.$$.fragment),Y=r(),h(oe.$$.fragment),pt=r(),h(Be.$$.fragment),st=r(),de=c("div"),h(ge.$$.fragment),mt=r(),ue=c("div"),h(v.$$.fragment),j=r(),ce=c("p"),ce.innerHTML=Z,se=r(),h(ae.$$.fragment),Me=r(),h($e.$$.fragment),this.h()},l(I){g(e.$$.fragment,I),m=i(I),o=p(I,"DIV",{class:!0});var P=k(o);g(s.$$.fragment,P),M=i(P),n=p(P,"P",{"data-svelte-h":!0}),w(n)!=="svelte-3daxed"&&(n.innerHTML=$),Ke=i(P),V=p(P,"P",{"data-svelte-h":!0}),w(V)!=="svelte-10nfsf3"&&(V.innerHTML=et),tt=i(P),U=p(P,"P",{"data-svelte-h":!0}),w(U)!=="svelte-1pplc4a"&&(U.textContent=_e),ee=i(P),J=p(P,"UL",{"data-svelte-h":!0}),w(J)!=="svelte-1w7z84m"&&(J.innerHTML=We),nt=i(P),X=p(P,"DIV",{class:!0});var A=k(X);g(it.$$.fragment,A),pe=i(A),Ze=p(A,"P",{"data-svelte-h":!0}),w(Ze)!=="svelte-qhvesh"&&(Ze.innerHTML=K),ve=i(A),g(te.$$.fragment,A),Ce=i(A),g(xe.$$.fragment,A),A.forEach(a),ft=i(P),be=p(P,"DIV",{class:!0});var De=k(be);g(Pe.$$.fragment,De),ye=i(De),g(Ee.$$.fragment,De),De.forEach(a),G=i(P),Te=p(P,"DIV",{class:!0});var Ue=k(Te);g(R.$$.fragment,Ue),je=i(Ue),g(ke.$$.fragment,Ue),Ue.forEach(a),P.forEach(a),lt=i(I),g(we.$$.fragment,I),qe=i(I),q=p(I,"DIV",{class:!0});var Pt=k(q);g(Ie.$$.fragment,Pt),Le=i(Pt),ie=p(Pt,"DIV",{class:!0});var Q=k(ie);g(W.$$.fragment,Q),Xe=i(Q),ne=p(Q,"P",{"data-svelte-h":!0}),w(ne)!=="svelte-1v5d1sw"&&(ne.innerHTML=Se),xt=i(Q),g(N.$$.fragment,Q),Je=i(Q),g(ze.$$.fragment,Q),Q.forEach(a),Pt.forEach(a),Ye=i(I),g(D.$$.fragment,I),ot=i(I),le=p(I,"DIV",{class:!0});var Fe=k(le);g(me.$$.fragment,Fe),dt=i(Fe),he=p(Fe,"DIV",{class:!0});var Ae=k(he);g(S.$$.fragment,Ae),_t=i(Ae),H=p(Ae,"P",{"data-svelte-h":!0}),w(H)!=="svelte-1v5d1sw"&&(H.innerHTML=ct),Qe=i(Ae),g(B.$$.fragment,Ae),Y=i(Ae),g(oe.$$.fragment,Ae),Ae.forEach(a),Fe.forEach(a),pt=i(I),g(Be.$$.fragment,I),st=i(I),de=p(I,"DIV",{class:!0});var Ve=k(de);g(ge.$$.fragment,Ve),mt=i(Ve),ue=p(Ve,"DIV",{class:!0});var bt=k(ue);g(v.$$.fragment,bt),j=i(bt),ce=p(bt,"P",{"data-svelte-h":!0}),w(ce)!=="svelte-tkfbrd"&&(ce.innerHTML=Z),se=i(bt),g(ae.$$.fragment,bt),Me=i(bt),g($e.$$.fragment,bt),bt.forEach(a),Ve.forEach(a),this.h()},h(){L(X,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),L(be,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),L(Te,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),L(o,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),L(ie,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),L(q,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),L(he,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),L(le,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),L(ue,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),L(de,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(I,P){u(e,I,P),d(I,m,P),d(I,o,P),u(s,o,null),l(o,M),l(o,n),l(o,Ke),l(o,V),l(o,tt),l(o,U),l(o,ee),l(o,J),l(o,nt),l(o,X),u(it,X,null),l(X,pe),l(X,Ze),l(X,ve),u(te,X,null),l(X,Ce),u(xe,X,null),l(o,ft),l(o,be),u(Pe,be,null),l(be,ye),u(Ee,be,null),l(o,G),l(o,Te),u(R,Te,null),l(Te,je),u(ke,Te,null),d(I,lt,P),u(we,I,P),d(I,qe,P),d(I,q,P),u(Ie,q,null),l(q,Le),l(q,ie),u(W,ie,null),l(ie,Xe),l(ie,ne),l(ie,xt),u(N,ie,null),l(ie,Je),u(ze,ie,null),d(I,Ye,P),u(D,I,P),d(I,ot,P),d(I,le,P),u(me,le,null),l(le,dt),l(le,he),u(S,he,null),l(he,_t),l(he,H),l(he,Qe),u(B,he,null),l(he,Y),u(oe,he,null),d(I,pt,P),u(Be,I,P),d(I,st,P),d(I,de,P),u(ge,de,null),l(de,mt),l(de,ue),u(v,ue,null),l(ue,j),l(ue,ce),l(ue,se),u(ae,ue,null),l(ue,Me),u($e,ue,null),re=!0},p(I,P){const A={};P&2&&(A.$$scope={dirty:P,ctx:I}),te.$set(A);const De={};P&2&&(De.$$scope={dirty:P,ctx:I}),xe.$set(De);const Ue={};P&2&&(Ue.$$scope={dirty:P,ctx:I}),Ee.$set(Ue);const Pt={};P&2&&(Pt.$$scope={dirty:P,ctx:I}),ke.$set(Pt);const Q={};P&2&&(Q.$$scope={dirty:P,ctx:I}),N.$set(Q);const Fe={};P&2&&(Fe.$$scope={dirty:P,ctx:I}),ze.$set(Fe);const Ae={};P&2&&(Ae.$$scope={dirty:P,ctx:I}),B.$set(Ae);const Ve={};P&2&&(Ve.$$scope={dirty:P,ctx:I}),oe.$set(Ve);const bt={};P&2&&(bt.$$scope={dirty:P,ctx:I}),ae.$set(bt);const nn={};P&2&&(nn.$$scope={dirty:P,ctx:I}),$e.$set(nn)},i(I){re||(f(e.$$.fragment,I),f(s.$$.fragment,I),f(it.$$.fragment,I),f(te.$$.fragment,I),f(xe.$$.fragment,I),f(Pe.$$.fragment,I),f(Ee.$$.fragment,I),f(R.$$.fragment,I),f(ke.$$.fragment,I),f(we.$$.fragment,I),f(Ie.$$.fragment,I),f(W.$$.fragment,I),f(N.$$.fragment,I),f(ze.$$.fragment,I),f(D.$$.fragment,I),f(me.$$.fragment,I),f(S.$$.fragment,I),f(B.$$.fragment,I),f(oe.$$.fragment,I),f(Be.$$.fragment,I),f(ge.$$.fragment,I),f(v.$$.fragment,I),f(ae.$$.fragment,I),f($e.$$.fragment,I),re=!0)},o(I){_(e.$$.fragment,I),_(s.$$.fragment,I),_(it.$$.fragment,I),_(te.$$.fragment,I),_(xe.$$.fragment,I),_(Pe.$$.fragment,I),_(Ee.$$.fragment,I),_(R.$$.fragment,I),_(ke.$$.fragment,I),_(we.$$.fragment,I),_(Ie.$$.fragment,I),_(W.$$.fragment,I),_(N.$$.fragment,I),_(ze.$$.fragment,I),_(D.$$.fragment,I),_(me.$$.fragment,I),_(S.$$.fragment,I),_(B.$$.fragment,I),_(oe.$$.fragment,I),_(Be.$$.fragment,I),_(ge.$$.fragment,I),_(v.$$.fragment,I),_(ae.$$.fragment,I),_($e.$$.fragment,I),re=!1},d(I){I&&(a(m),a(o),a(lt),a(qe),a(q),a(Ye),a(ot),a(le),a(pt),a(st),a(de)),b(e,I),b(s),b(it),b(te),b(xe),b(Pe),b(Ee),b(R),b(ke),b(we,I),b(Ie),b(W),b(N),b(ze),b(D,I),b(me),b(S),b(B),b(oe),b(Be,I),b(ge),b(v),b(ae),b($e)}}}function Ka(C){let e,m;return e=new zs({props:{$$slots:{default:[Oa]},$$scope:{ctx:C}}}),{c(){h(e.$$.fragment)},l(o){g(e.$$.fragment,o)},m(o,s){u(e,o,s),m=!0},p(o,s){const M={};s&2&&(M.$$scope={dirty:s,ctx:o}),e.$set(M)},i(o){m||(f(e.$$.fragment,o),m=!0)},o(o){_(e.$$.fragment,o),m=!1},d(o){b(e,o)}}}function er(C){let e,m,o,s,M,n,$,Ke,V,et=`The CLIP model was proposed in <a href="https://arxiv.org/abs/2103.00020" rel="nofollow">Learning Transferable Visual Models From Natural Language Supervision</a> by Alec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh, Gabriel Goh,
Sandhini Agarwal, Girish Sastry, Amanda Askell, Pamela Mishkin, Jack Clark, Gretchen Krueger, Ilya Sutskever. CLIP
(Contrastive Language-Image Pre-Training) is a neural network trained on a variety of (image, text) pairs. It can be
instructed in natural language to predict the most relevant text snippet, given an image, without directly optimizing
for the task, similarly to the zero-shot capabilities of GPT-2 and 3.`,tt,U,_e="The abstract from the paper is the following:",ee,J,We=`<em>State-of-the-art computer vision systems are trained to predict a fixed set of predetermined object categories. This
restricted form of supervision limits their generality and usability since additional labeled data is needed to specify
any other visual concept. Learning directly from raw text about images is a promising alternative which leverages a
much broader source of supervision. We demonstrate that the simple pre-training task of predicting which caption goes
with which image is an efficient and scalable way to learn SOTA image representations from scratch on a dataset of 400
million (image, text) pairs collected from the internet. After pre-training, natural language is used to reference
learned visual concepts (or describe new ones) enabling zero-shot transfer of the model to downstream tasks. We study
the performance of this approach by benchmarking on over 30 different existing computer vision datasets, spanning tasks
such as OCR, action recognition in videos, geo-localization, and many types of fine-grained object classification. The
model transfers non-trivially to most tasks and is often competitive with a fully supervised baseline without the need
for any dataset specific training. For instance, we match the accuracy of the original ResNet-50 on ImageNet zero-shot
without needing to use any of the 1.28 million training examples it was trained on. We release our code and pre-trained
model weights at this https URL.</em>`,nt,X,it='This model was contributed by <a href="https://huggingface.co/valhalla" rel="nofollow">valhalla</a>. The original code can be found <a href="https://github.com/openai/CLIP" rel="nofollow">here</a>.',pe,Ze,K,ve,te=`CLIP is a multi-modal vision and language model. It can be used for image-text similarity and for zero-shot image
classification. CLIP uses a ViT like transformer to get visual features and a causal language model to get the text
features. Both the text and visual features are then projected to a latent space with identical dimension. The dot
product between the projected image and text features is then used as a similar score.`,Ce,xe,ft=`To feed images to the Transformer encoder, each image is split into a sequence of fixed-size non-overlapping patches,
which are then linearly embedded. A [CLS] token is added to serve as representation of an entire image. The authors
also add absolute position embeddings, and feed the resulting sequence of vectors to a standard Transformer encoder.
The <a href="/docs/transformers/main/en/model_doc/clip#transformers.CLIPImageProcessor">CLIPImageProcessor</a> can be used to resize (or rescale) and normalize images for the model.`,be,Pe,ye=`The <a href="/docs/transformers/main/en/model_doc/clip#transformers.CLIPTokenizer">CLIPTokenizer</a> is used to encode the text. The <a href="/docs/transformers/main/en/model_doc/clip#transformers.CLIPProcessor">CLIPProcessor</a> wraps
<a href="/docs/transformers/main/en/model_doc/clip#transformers.CLIPImageProcessor">CLIPImageProcessor</a> and <a href="/docs/transformers/main/en/model_doc/clip#transformers.CLIPTokenizer">CLIPTokenizer</a> into a single instance to both
encode the text and prepare the images. The following example shows how to get the image-text similarity scores using
<a href="/docs/transformers/main/en/model_doc/clip#transformers.CLIPProcessor">CLIPProcessor</a> and <a href="/docs/transformers/main/en/model_doc/clip#transformers.CLIPModel">CLIPModel</a>.`,Ee,G,Te,R,je,ke,lt="First, make sure to install the latest version of Flash Attention 2.",we,qe,q,Ie,Le="Make also sure that you have a hardware that is compatible with Flash-Attention 2. Read more about it in the official documentation of flash-attn repository. Make also sure to load your model in half-precision (e.g. <code>torch.float16</code>)",ie,W,Xe,ne,Se="To load and run a model using Flash Attention 2, refer to the snippet below:",xt,N,Je,ze,Ye,D,ot=`PyTorch includes a native scaled dot-product attention (SDPA) operator as part of <code>torch.nn.functional</code>. This function
encompasses several implementations that can be applied depending on the inputs and the hardware in use. See the
<a href="https://pytorch.org/docs/stable/generated/torch.nn.functional.scaled_dot_product_attention.html" rel="nofollow">official documentation</a>
or the <a href="https://huggingface.co/docs/transformers/main/en/perf_infer_gpu_one#pytorch-scaled-dot-product-attention" rel="nofollow">GPU Inference</a>
page for more information.`,le,me,dt=`SDPA is used by default for <code>torch&gt;=2.1.1</code> when an implementation is available, but you may also set
<code>attn_implementation=&quot;sdpa&quot;</code> in <code>from_pretrained()</code> to explicitly request SDPA to be used.`,he,S,_t,H,ct="For the best speedups, we recommend loading the model in half-precision (e.g. <code>torch.float16</code> or <code>torch.bfloat16</code>).",Qe,B,Y,oe,pt='On a local benchmark (NVIDIA A10G, PyTorch 2.3.1+cu121) with <code>float16</code>, we saw the following speedups during inference for <code>&quot;openai/clip-vit-large-patch14&quot;</code> checkpoint (<a href="https://gist.github.com/qubvel/ac691a54e54f9fae8144275f866a7ff8" rel="nofollow">code</a>):',Be,st,de,ge,mt='<thead><tr><th align="right">Num text labels</th> <th align="right">Eager (s/iter)</th> <th align="right">FA2 (s/iter)</th> <th align="right">FA2 speedup</th> <th align="right">SDPA (s/iter)</th> <th align="right">SDPA speedup</th></tr></thead> <tbody><tr><td align="right">4</td> <td align="right">0.009</td> <td align="right">0.012</td> <td align="right">0.737</td> <td align="right">0.007</td> <td align="right">1.269</td></tr> <tr><td align="right">16</td> <td align="right">0.009</td> <td align="right">0.014</td> <td align="right">0.659</td> <td align="right">0.008</td> <td align="right">1.187</td></tr> <tr><td align="right">32</td> <td align="right">0.018</td> <td align="right">0.021</td> <td align="right">0.862</td> <td align="right">0.016</td> <td align="right">1.142</td></tr> <tr><td align="right">64</td> <td align="right">0.034</td> <td align="right">0.034</td> <td align="right">1.001</td> <td align="right">0.03</td> <td align="right">1.163</td></tr> <tr><td align="right">128</td> <td align="right">0.063</td> <td align="right">0.058</td> <td align="right">1.09</td> <td align="right">0.054</td> <td align="right">1.174</td></tr></tbody>',ue,v,j='<img src="https://github.com/user-attachments/assets/e9826b43-4e66-4f4c-952b-af4d90bd38eb" alt="clip_text_model_viz_3"/>',ce,Z,se,ae,Me='<thead><tr><th align="right">Image batch size</th> <th align="right">Eager (s/iter)</th> <th align="right">FA2 (s/iter)</th> <th align="right">FA2 speedup</th> <th align="right">SDPA (s/iter)</th> <th align="right">SDPA speedup</th></tr></thead> <tbody><tr><td align="right">1</td> <td align="right">0.016</td> <td align="right">0.013</td> <td align="right">1.247</td> <td align="right">0.012</td> <td align="right">1.318</td></tr> <tr><td align="right">4</td> <td align="right">0.025</td> <td align="right">0.021</td> <td align="right">1.198</td> <td align="right">0.021</td> <td align="right">1.202</td></tr> <tr><td align="right">16</td> <td align="right">0.093</td> <td align="right">0.075</td> <td align="right">1.234</td> <td align="right">0.075</td> <td align="right">1.24</td></tr> <tr><td align="right">32</td> <td align="right">0.181</td> <td align="right">0.147</td> <td align="right">1.237</td> <td align="right">0.146</td> <td align="right">1.241</td></tr></tbody>',$e,re,I='<img src="https://github.com/user-attachments/assets/50a36206-e3b9-4adc-ac8e-926b8b071d63" alt="clip_image_model_viz_3"/>',P,A,De,Ue,Pt='<thead><tr><th align="right">Image batch size</th> <th align="right">Num text labels</th> <th align="right">Eager (s/iter)</th> <th align="right">FA2 (s/iter)</th> <th align="right">FA2 speedup</th> <th align="right">SDPA (s/iter)</th> <th align="right">SDPA speedup</th></tr></thead> <tbody><tr><td align="right">1</td> <td align="right">4</td> <td align="right">0.025</td> <td align="right">0.026</td> <td align="right">0.954</td> <td align="right">0.02</td> <td align="right">1.217</td></tr> <tr><td align="right">1</td> <td align="right">16</td> <td align="right">0.026</td> <td align="right">0.028</td> <td align="right">0.918</td> <td align="right">0.02</td> <td align="right">1.287</td></tr> <tr><td align="right">1</td> <td align="right">64</td> <td align="right">0.042</td> <td align="right">0.046</td> <td align="right">0.906</td> <td align="right">0.036</td> <td align="right">1.167</td></tr> <tr><td align="right">4</td> <td align="right">4</td> <td align="right">0.028</td> <td align="right">0.033</td> <td align="right">0.849</td> <td align="right">0.024</td> <td align="right">1.189</td></tr> <tr><td align="right">4</td> <td align="right">16</td> <td align="right">0.034</td> <td align="right">0.035</td> <td align="right">0.955</td> <td align="right">0.029</td> <td align="right">1.169</td></tr> <tr><td align="right">4</td> <td align="right">64</td> <td align="right">0.059</td> <td align="right">0.055</td> <td align="right">1.072</td> <td align="right">0.05</td> <td align="right">1.179</td></tr> <tr><td align="right">16</td> <td align="right">4</td> <td align="right">0.096</td> <td align="right">0.088</td> <td align="right">1.091</td> <td align="right">0.078</td> <td align="right">1.234</td></tr> <tr><td align="right">16</td> <td align="right">16</td> <td align="right">0.102</td> <td align="right">0.09</td> <td align="right">1.129</td> <td align="right">0.083</td> <td align="right">1.224</td></tr> <tr><td align="right">16</td> <td align="right">64</td> <td align="right">0.127</td> <td align="right">0.11</td> <td align="right">1.157</td> <td align="right">0.105</td> <td align="right">1.218</td></tr> <tr><td align="right">32</td> <td align="right">4</td> <td align="right">0.185</td> <td align="right">0.159</td> <td align="right">1.157</td> <td align="right">0.149</td> <td align="right">1.238</td></tr> <tr><td align="right">32</td> <td align="right">16</td> <td align="right">0.19</td> <td align="right">0.162</td> <td align="right">1.177</td> <td align="right">0.154</td> <td align="right">1.233</td></tr> <tr><td align="right">32</td> <td align="right">64</td> <td align="right">0.216</td> <td align="right">0.181</td> <td align="right">1.19</td> <td align="right">0.176</td> <td align="right">1.228</td></tr></tbody>',Q,Fe,Ae,Ve,bt="A list of official Hugging Face and community (indicated by 🌎) resources to help you get started with CLIP.",nn,Zt,No='<li><a href="https://huggingface.co/blog/fine-tune-clip-rsicd" rel="nofollow">Fine tuning CLIP with Remote Sensing (Satellite) images and captions</a>, a blog post about how to fine-tune CLIP with <a href="https://github.com/201528014227051/RSICD_optimal" rel="nofollow">RSICD dataset</a> and comparison of performance changes due to data augmentation.</li> <li>This <a href="https://github.com/huggingface/transformers/tree/main/examples/pytorch/contrastive-image-text" rel="nofollow">example script</a> shows how to train a CLIP-like vision-text dual encoder model using a pre-trained vision and text encoder using <a href="https://cocodataset.org/#home" rel="nofollow">COCO dataset</a>.</li>',Ln,Bt,Rn,on,jt='<li>A <a href="https://colab.research.google.com/drive/1tuoAC5F4sC7qid56Z0ap-stR3rwdk0ZV?usp=sharing" rel="nofollow">notebook</a> on how to use a pretrained CLIP for inference with beam search for image captioning. 🌎</li>',Rt,sn,Cn="<strong>Image retrieval</strong>",qn,an,rn='<li>A <a href="https://colab.research.google.com/drive/1bLVwVKpAndpEDHqjzxVPr_9nGrSbuOQd?usp=sharing" rel="nofollow">notebook</a> on image retrieval using pretrained CLIP and computing MRR(Mean Reciprocal Rank) score. 🌎</li> <li>A <a href="https://colab.research.google.com/github/deep-diver/image_search_with_natural_language/blob/main/notebooks/Image_Search_CLIP.ipynb" rel="nofollow">notebook</a> on image retrieval and showing the similarity score. 🌎</li> <li>A <a href="https://colab.research.google.com/drive/1xO-wC_m_GNzgjIBQ4a4znvQkvDoZJvH4?usp=sharing" rel="nofollow">notebook</a> on how to map images and texts to the same vector space using Multilingual CLIP. 🌎</li> <li>A <a href="https://colab.research.google.com/github/vivien000/clip-demo/blob/master/clip.ipynb#scrollTo=uzdFhRGqiWkR" rel="nofollow">notebook</a> on how to run CLIP on semantic image search using <a href="https://unsplash.com" rel="nofollow">Unsplash</a> and <a href="https://www.themoviedb.org/" rel="nofollow">TMDB</a> datasets. 🌎</li>',Jn,yt,Sn="<strong>Explainability</strong>",qt,St,wt='<li>A <a href="https://colab.research.google.com/github/hila-chefer/Transformer-MM-Explainability/blob/main/CLIP_explainability.ipynb" rel="nofollow">notebook</a> on how to visualize similarity between input token and image segment. 🌎</li>',Yt,ln,xn=`If you’re interested in submitting a resource to be included here, please feel free to open a Pull Request and we will review it.
The resource should ideally demonstrate something new instead of duplicating an existing resource.`,Yn,dn,cn,ht,pn,It,Vt,_o=`<a href="/docs/transformers/main/en/model_doc/clip#transformers.CLIPConfig">CLIPConfig</a> is the configuration class to store the configuration of a <a href="/docs/transformers/main/en/model_doc/clip#transformers.CLIPModel">CLIPModel</a>. It is used to instantiate
a CLIP model according to the specified arguments, defining the text model and vision model configs. Instantiating
a configuration with the defaults will yield a similar configuration to that of the CLIP
<a href="https://huggingface.co/openai/clip-vit-base-patch32" rel="nofollow">openai/clip-vit-base-patch32</a> architecture.`,Tn,Pn,bo=`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,Dt,At,Et,kt,zn,Ge,Mn=`Instantiate a <a href="/docs/transformers/main/en/model_doc/clip#transformers.CLIPConfig">CLIPConfig</a> (or a derived class) from clip text model configuration and clip vision model
configuration.`,Un,Gt,Qn,Tt,Nt,To,yn,jn=`This is the configuration class to store the configuration of a <a href="/docs/transformers/main/en/model_doc/clip#transformers.CLIPTextModel">CLIPTextModel</a>. It is used to instantiate a CLIP
text encoder according to the specified arguments, defining the model architecture. Instantiating a configuration
with the defaults will yield a similar configuration to that of the text encoder of the CLIP
<a href="https://huggingface.co/openai/clip-vit-base-patch32" rel="nofollow">openai/clip-vit-base-patch32</a> architecture.`,Mo,wn,Lt=`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.`,mn,Ot,hn,In,Fn,Ne,gn,Kt,un,T=`This is the configuration class to store the configuration of a <a href="/docs/transformers/main/en/model_doc/clip#transformers.CLIPVisionModel">CLIPVisionModel</a>. It is used to instantiate a
CLIP vision encoder according to the specified arguments, defining the model architecture. Instantiating a
configuration with the defaults will yield a similar configuration to that of the vision encoder of the CLIP
<a href="https://huggingface.co/openai/clip-vit-base-patch32" rel="nofollow">openai/clip-vit-base-patch32</a> architecture.`,x,gt,Ht=`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.`,Jt,Oe,$t,Re,vt,E,at,zt,ut,Ct="Construct a CLIP tokenizer. Based on byte-level Byte-Pair-Encoding.",Ut,kn,Ho=`This tokenizer inherits from <a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizer">PreTrainedTokenizer</a> which contains most of the main methods. Users should refer to
this superclass for more information regarding those methods.`,yo,en,Dn,ls,wo,Us=`Build model inputs from a sequence or a pair of sequence for sequence classification tasks by concatenating and
adding special tokens. A CLIP sequence has the following format:`,ds,Io,Fs="<li>single sequence: <code>&lt;|startoftext|&gt; X &lt;|endoftext|&gt;</code></li>",cs,$o,Ws="Pairs of sequences are not the expected use case, but they will be handled without a separator.",ps,Wn,An,ms,vo,Zs=`Retrieve sequence ids from a token list that has no special tokens added. This method is called when adding
special tokens using the tokenizer <code>prepare_for_model</code> method.`,hs,Zn,On,gs,Co,Bs=`Create a mask from the two sequences passed. CLIP does not make use of token type ids, therefore a list of
zeros is returned.`,us,xo,Kn,Xo,eo,Ro,Ft,to,fs,Po,Vs=`Construct a “fast” CLIP tokenizer (backed by HuggingFace’s <em>tokenizers</em> library). Based on byte-level
Byte-Pair-Encoding.`,_s,jo,Gs=`This tokenizer inherits from <a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast">PreTrainedTokenizerFast</a> which contains most of the main methods. Users should
refer to this superclass for more information regarding those methods.`,bs,tn,no,Ts,ko,Ns=`Build model inputs from a sequence or a pair of sequence for sequence classification tasks by concatenating and
adding special tokens. A CLIP sequence has the following format:`,Ms,Lo,Hs="<li>single sequence: <code>&lt;|startoftext|&gt; X &lt;|endoftext|&gt;</code></li>",ys,Jo,Es="Pairs of sequences are not the expected use case, but they will be handled without a separator.",ws,Bn,oo,Is,zo,Xs=`Create a mask from the two sequences passed. CLIP does not make use of token type ids, therefore a list of
zeros is returned.`,qo,so,So,fn,ao,$s,Uo,Rs="Constructs a CLIP image processor.",vs,Vn,ro,Cs,Fo,qs="Preprocess an image or batch of images.",Yo,io,Qo,lo,co,Do,po,Ao,Wt,mo,xs,Wo,Ss="Constructs a CLIP processor which wraps a CLIP image processor and a CLIP tokenizer into a single processor.",Ps,Zo,Ys=`<a href="/docs/transformers/main/en/model_doc/clip#transformers.CLIPProcessor">CLIPProcessor</a> offers all the functionalities of <a href="/docs/transformers/main/en/model_doc/clip#transformers.CLIPImageProcessor">CLIPImageProcessor</a> and <a href="/docs/transformers/main/en/model_doc/clip#transformers.CLIPTokenizerFast">CLIPTokenizerFast</a>. See the
<code>__call__()</code> and <a href="/docs/transformers/main/en/model_doc/clip#transformers.CLIPProcessor.decode">decode()</a> for more information.`,js,Gn,ho,ks,Bo,Qs=`This method forwards all its arguments to CLIPTokenizerFast’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.`,Ls,Nn,go,Js,Vo,Ds=`This method forwards all its arguments to CLIPTokenizerFast’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.`,Oo,Hn,Ko,uo,es,Eo,ts;return M=new O({props:{title:"CLIP",local:"clip",headingTag:"h1"}}),$=new O({props:{title:"Overview",local:"overview",headingTag:"h2"}}),Ze=new O({props:{title:"Usage tips and example",local:"usage-tips-and-example",headingTag:"h2"}}),G=new fe({props:{code:"ZnJvbSUyMFBJTCUyMGltcG9ydCUyMEltYWdlJTBBaW1wb3J0JTIwcmVxdWVzdHMlMEElMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQ0xJUFByb2Nlc3NvciUyQyUyMENMSVBNb2RlbCUwQSUwQW1vZGVsJTIwJTNEJTIwQ0xJUE1vZGVsLmZyb21fcHJldHJhaW5lZCglMjJvcGVuYWklMkZjbGlwLXZpdC1iYXNlLXBhdGNoMzIlMjIpJTBBcHJvY2Vzc29yJTIwJTNEJTIwQ0xJUFByb2Nlc3Nvci5mcm9tX3ByZXRyYWluZWQoJTIyb3BlbmFpJTJGY2xpcC12aXQtYmFzZS1wYXRjaDMyJTIyKSUwQSUwQXVybCUyMCUzRCUyMCUyMmh0dHAlM0ElMkYlMkZpbWFnZXMuY29jb2RhdGFzZXQub3JnJTJGdmFsMjAxNyUyRjAwMDAwMDAzOTc2OS5qcGclMjIlMEFpbWFnZSUyMCUzRCUyMEltYWdlLm9wZW4ocmVxdWVzdHMuZ2V0KHVybCUyQyUyMHN0cmVhbSUzRFRydWUpLnJhdyklMEElMEFpbnB1dHMlMjAlM0QlMjBwcm9jZXNzb3IodGV4dCUzRCU1QiUyMmElMjBwaG90byUyMG9mJTIwYSUyMGNhdCUyMiUyQyUyMCUyMmElMjBwaG90byUyMG9mJTIwYSUyMGRvZyUyMiU1RCUyQyUyMGltYWdlcyUzRGltYWdlJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMiUyQyUyMHBhZGRpbmclM0RUcnVlKSUwQSUwQW91dHB1dHMlMjAlM0QlMjBtb2RlbCgqKmlucHV0cyklMEFsb2dpdHNfcGVyX2ltYWdlJTIwJTNEJTIwb3V0cHV0cy5sb2dpdHNfcGVyX2ltYWdlJTIwJTIwJTIzJTIwdGhpcyUyMGlzJTIwdGhlJTIwaW1hZ2UtdGV4dCUyMHNpbWlsYXJpdHklMjBzY29yZSUwQXByb2JzJTIwJTNEJTIwbG9naXRzX3Blcl9pbWFnZS5zb2Z0bWF4KGRpbSUzRDEpJTIwJTIwJTIzJTIwd2UlMjBjYW4lMjB0YWtlJTIwdGhlJTIwc29mdG1heCUyMHRvJTIwZ2V0JTIwdGhlJTIwbGFiZWwlMjBwcm9iYWJpbGl0aWVz",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> CLIPProcessor, CLIPModel

<span class="hljs-meta">&gt;&gt;&gt; </span>model = CLIPModel.from_pretrained(<span class="hljs-string">&quot;openai/clip-vit-base-patch32&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>processor = CLIPProcessor.from_pretrained(<span class="hljs-string">&quot;openai/clip-vit-base-patch32&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>url = <span class="hljs-string">&quot;http://images.cocodataset.org/val2017/000000039769.jpg&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(text=[<span class="hljs-string">&quot;a photo of a cat&quot;</span>, <span class="hljs-string">&quot;a photo of a dog&quot;</span>], images=image, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>, padding=<span class="hljs-literal">True</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**inputs)
<span class="hljs-meta">&gt;&gt;&gt; </span>logits_per_image = outputs.logits_per_image  <span class="hljs-comment"># this is the image-text similarity score</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>probs = logits_per_image.softmax(dim=<span class="hljs-number">1</span>)  <span class="hljs-comment"># we can take the softmax to get the label probabilities</span>`,wrap:!1}}),R=new O({props:{title:"Combining CLIP and Flash Attention 2",local:"combining-clip-and-flash-attention-2",headingTag:"h3"}}),qe=new fe({props:{code:"cGlwJTIwaW5zdGFsbCUyMC1VJTIwZmxhc2gtYXR0biUyMC0tbm8tYnVpbGQtaXNvbGF0aW9u",highlighted:"pip install -U flash-attn --no-build-isolation",wrap:!1}}),W=new rt({props:{warning:!0,$$slots:{default:[ia]},$$scope:{ctx:C}}}),N=new fe({props:{code:"aW1wb3J0JTIwdG9yY2glMEFpbXBvcnQlMjByZXF1ZXN0cyUwQWZyb20lMjBQSUwlMjBpbXBvcnQlMjBJbWFnZSUwQSUwQWZyb20lMjB0cmFuc2Zvcm1lcnMlMjBpbXBvcnQlMjBDTElQUHJvY2Vzc29yJTJDJTIwQ0xJUE1vZGVsJTBBJTBBZGV2aWNlJTIwJTNEJTIwJTIyY3VkYSUyMiUwQXRvcmNoX2R0eXBlJTIwJTNEJTIwdG9yY2guZmxvYXQxNiUwQSUwQW1vZGVsJTIwJTNEJTIwQ0xJUE1vZGVsLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjAlMjJvcGVuYWklMkZjbGlwLXZpdC1iYXNlLXBhdGNoMzIlMjIlMkMlMEElMjAlMjAlMjAlMjBhdHRuX2ltcGxlbWVudGF0aW9uJTNEJTIyZmxhc2hfYXR0ZW50aW9uXzIlMjIlMkMlMEElMjAlMjAlMjAlMjBkZXZpY2VfbWFwJTNEZGV2aWNlJTJDJTBBJTIwJTIwJTIwJTIwdG9yY2hfZHR5cGUlM0R0b3JjaF9kdHlwZSUyQyUwQSklMEFwcm9jZXNzb3IlMjAlM0QlMjBDTElQUHJvY2Vzc29yLmZyb21fcHJldHJhaW5lZCglMjJvcGVuYWklMkZjbGlwLXZpdC1iYXNlLXBhdGNoMzIlMjIpJTBBJTBBdXJsJTIwJTNEJTIwJTIyaHR0cCUzQSUyRiUyRmltYWdlcy5jb2NvZGF0YXNldC5vcmclMkZ2YWwyMDE3JTJGMDAwMDAwMDM5NzY5LmpwZyUyMiUwQWltYWdlJTIwJTNEJTIwSW1hZ2Uub3BlbihyZXF1ZXN0cy5nZXQodXJsJTJDJTIwc3RyZWFtJTNEVHJ1ZSkucmF3KSUwQSUwQWlucHV0cyUyMCUzRCUyMHByb2Nlc3Nvcih0ZXh0JTNEJTVCJTIyYSUyMHBob3RvJTIwb2YlMjBhJTIwY2F0JTIyJTJDJTIwJTIyYSUyMHBob3RvJTIwb2YlMjBhJTIwZG9nJTIyJTVEJTJDJTIwaW1hZ2VzJTNEaW1hZ2UlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyJTJDJTIwcGFkZGluZyUzRFRydWUpJTBBaW5wdXRzLnRvKGRldmljZSklMEElMEF3aXRoJTIwdG9yY2gubm9fZ3JhZCgpJTNBJTBBJTIwJTIwJTIwJTIwd2l0aCUyMHRvcmNoLmF1dG9jYXN0KGRldmljZSklM0ElMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBvdXRwdXRzJTIwJTNEJTIwbW9kZWwoKippbnB1dHMpJTBBJTBBbG9naXRzX3Blcl9pbWFnZSUyMCUzRCUyMG91dHB1dHMubG9naXRzX3Blcl9pbWFnZSUyMCUyMCUyMyUyMHRoaXMlMjBpcyUyMHRoZSUyMGltYWdlLXRleHQlMjBzaW1pbGFyaXR5JTIwc2NvcmUlMEFwcm9icyUyMCUzRCUyMGxvZ2l0c19wZXJfaW1hZ2Uuc29mdG1heChkaW0lM0QxKSUyMCUyMCUyMyUyMHdlJTIwY2FuJTIwdGFrZSUyMHRoZSUyMHNvZnRtYXglMjB0byUyMGdldCUyMHRoZSUyMGxhYmVsJTIwcHJvYmFiaWxpdGllcyUwQXByaW50KHByb2JzKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> requests
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> PIL <span class="hljs-keyword">import</span> Image

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> CLIPProcessor, CLIPModel

<span class="hljs-meta">&gt;&gt;&gt; </span>device = <span class="hljs-string">&quot;cuda&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>torch_dtype = torch.float16

<span class="hljs-meta">&gt;&gt;&gt; </span>model = CLIPModel.from_pretrained(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;openai/clip-vit-base-patch32&quot;</span>,
<span class="hljs-meta">... </span>    attn_implementation=<span class="hljs-string">&quot;flash_attention_2&quot;</span>,
<span class="hljs-meta">... </span>    device_map=device,
<span class="hljs-meta">... </span>    torch_dtype=torch_dtype,
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>processor = CLIPProcessor.from_pretrained(<span class="hljs-string">&quot;openai/clip-vit-base-patch32&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>url = <span class="hljs-string">&quot;http://images.cocodataset.org/val2017/000000039769.jpg&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(text=[<span class="hljs-string">&quot;a photo of a cat&quot;</span>, <span class="hljs-string">&quot;a photo of a dog&quot;</span>], images=image, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>, padding=<span class="hljs-literal">True</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs.to(device)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">with</span> torch.no_grad():
<span class="hljs-meta">... </span>    <span class="hljs-keyword">with</span> torch.autocast(device):
<span class="hljs-meta">... </span>        outputs = model(**inputs)

<span class="hljs-meta">&gt;&gt;&gt; </span>logits_per_image = outputs.logits_per_image  <span class="hljs-comment"># this is the image-text similarity score</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>probs = logits_per_image.softmax(dim=<span class="hljs-number">1</span>)  <span class="hljs-comment"># we can take the softmax to get the label probabilities</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(probs)
tensor([[<span class="hljs-number">0.9946</span>, <span class="hljs-number">0.0052</span>]], device=<span class="hljs-string">&#x27;cuda:0&#x27;</span>, dtype=torch.float16)`,wrap:!1}}),ze=new O({props:{title:"Using Scaled Dot Product Attention (SDPA)",local:"using-scaled-dot-product-attention-sdpa",headingTag:"h3"}}),S=new fe({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMENMSVBNb2RlbCUwQSUwQW1vZGVsJTIwJTNEJTIwQ0xJUE1vZGVsLmZyb21fcHJldHJhaW5lZCglMjJvcGVuYWklMkZjbGlwLXZpdC1iYXNlLXBhdGNoMzIlMjIlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MTYlMkMlMjBhdHRuX2ltcGxlbWVudGF0aW9uJTNEJTIyc2RwYSUyMik=",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> CLIPModel

model = CLIPModel.from_pretrained(<span class="hljs-string">&quot;openai/clip-vit-base-patch32&quot;</span>, torch_dtype=torch.float16, attn_implementation=<span class="hljs-string">&quot;sdpa&quot;</span>)`,wrap:!1}}),B=new O({props:{title:"Expected speedups with Flash Attention and SDPA",local:"expected-speedups-with-flash-attention-and-sdpa",headingTag:"h3"}}),st=new O({props:{title:"CLIPTextModel",local:"cliptextmodel",headingTag:"h4"}}),Z=new O({props:{title:"CLIPVisionModel",local:"clipvisionmodel",headingTag:"h4"}}),A=new O({props:{title:"CLIPModel",local:"clipmodel",headingTag:"h4"}}),Fe=new O({props:{title:"Resources",local:"resources",headingTag:"h2"}}),Bt=new aa({props:{pipeline:"image-to-text"}}),dn=new O({props:{title:"CLIPConfig",local:"transformers.CLIPConfig",headingTag:"h2"}}),pn=new z({props:{name:"class transformers.CLIPConfig",anchor:"transformers.CLIPConfig",parameters:[{name:"text_config",val:" = None"},{name:"vision_config",val:" = None"},{name:"projection_dim",val:" = 512"},{name:"logit_scale_init_value",val:" = 2.6592"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.CLIPConfig.text_config",description:`<strong>text_config</strong> (<code>dict</code>, <em>optional</em>) &#x2014;
Dictionary of configuration options used to initialize <a href="/docs/transformers/main/en/model_doc/clip#transformers.CLIPTextConfig">CLIPTextConfig</a>.`,name:"text_config"},{anchor:"transformers.CLIPConfig.vision_config",description:`<strong>vision_config</strong> (<code>dict</code>, <em>optional</em>) &#x2014;
Dictionary of configuration options used to initialize <a href="/docs/transformers/main/en/model_doc/clip#transformers.CLIPVisionConfig">CLIPVisionConfig</a>.`,name:"vision_config"},{anchor:"transformers.CLIPConfig.projection_dim",description:`<strong>projection_dim</strong> (<code>int</code>, <em>optional</em>, defaults to 512) &#x2014;
Dimensionality of text and vision projection layers.`,name:"projection_dim"},{anchor:"transformers.CLIPConfig.logit_scale_init_value",description:`<strong>logit_scale_init_value</strong> (<code>float</code>, <em>optional</em>, defaults to 2.6592) &#x2014;
The initial value of the <em>logit_scale</em> parameter. Default is used as per the original CLIP implementation.`,name:"logit_scale_init_value"},{anchor:"transformers.CLIPConfig.kwargs",description:`<strong>kwargs</strong> (<em>optional</em>) &#x2014;
Dictionary of keyword arguments.`,name:"kwargs"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/clip/configuration_clip.py#L261"}}),Dt=new He({props:{anchor:"transformers.CLIPConfig.example",$$slots:{default:[la]},$$scope:{ctx:C}}}),kt=new z({props:{name:"from_text_vision_configs",anchor:"transformers.CLIPConfig.from_text_vision_configs",parameters:[{name:"text_config",val:": CLIPTextConfig"},{name:"vision_config",val:": CLIPVisionConfig"},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/clip/configuration_clip.py#L397",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>An instance of a configuration object</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><a
  href="/docs/transformers/main/en/model_doc/clip#transformers.CLIPConfig"
>CLIPConfig</a></p>
`}}),Gt=new O({props:{title:"CLIPTextConfig",local:"transformers.CLIPTextConfig",headingTag:"h2"}}),Nt=new z({props:{name:"class transformers.CLIPTextConfig",anchor:"transformers.CLIPTextConfig",parameters:[{name:"vocab_size",val:" = 49408"},{name:"hidden_size",val:" = 512"},{name:"intermediate_size",val:" = 2048"},{name:"projection_dim",val:" = 512"},{name:"num_hidden_layers",val:" = 12"},{name:"num_attention_heads",val:" = 8"},{name:"max_position_embeddings",val:" = 77"},{name:"hidden_act",val:" = 'quick_gelu'"},{name:"layer_norm_eps",val:" = 1e-05"},{name:"attention_dropout",val:" = 0.0"},{name:"initializer_range",val:" = 0.02"},{name:"initializer_factor",val:" = 1.0"},{name:"pad_token_id",val:" = 1"},{name:"bos_token_id",val:" = 49406"},{name:"eos_token_id",val:" = 49407"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.CLIPTextConfig.vocab_size",description:`<strong>vocab_size</strong> (<code>int</code>, <em>optional</em>, defaults to 49408) &#x2014;
Vocabulary size of the CLIP text 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/clip#transformers.CLIPModel">CLIPModel</a>.`,name:"vocab_size"},{anchor:"transformers.CLIPTextConfig.hidden_size",description:`<strong>hidden_size</strong> (<code>int</code>, <em>optional</em>, defaults to 512) &#x2014;
Dimensionality of the encoder layers and the pooler layer.`,name:"hidden_size"},{anchor:"transformers.CLIPTextConfig.intermediate_size",description:`<strong>intermediate_size</strong> (<code>int</code>, <em>optional</em>, defaults to 2048) &#x2014;
Dimensionality of the &#x201C;intermediate&#x201D; (i.e., feed-forward) layer in the Transformer encoder.`,name:"intermediate_size"},{anchor:"transformers.CLIPTextConfig.projection_dim",description:`<strong>projection_dim</strong> (<code>int</code>, <em>optional</em>, defaults to 512) &#x2014;
Dimensionality of text and vision projection layers.`,name:"projection_dim"},{anchor:"transformers.CLIPTextConfig.num_hidden_layers",description:`<strong>num_hidden_layers</strong> (<code>int</code>, <em>optional</em>, defaults to 12) &#x2014;
Number of hidden layers in the Transformer encoder.`,name:"num_hidden_layers"},{anchor:"transformers.CLIPTextConfig.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 encoder.`,name:"num_attention_heads"},{anchor:"transformers.CLIPTextConfig.max_position_embeddings",description:`<strong>max_position_embeddings</strong> (<code>int</code>, <em>optional</em>, defaults to 77) &#x2014;
The maximum sequence length that this model might ever be used with. Typically set this to something large
just in case (e.g., 512 or 1024 or 2048).`,name:"max_position_embeddings"},{anchor:"transformers.CLIPTextConfig.hidden_act",description:`<strong>hidden_act</strong> (<code>str</code> or <code>function</code>, <em>optional</em>, defaults to <code>&quot;quick_gelu&quot;</code>) &#x2014;
The non-linear activation function (function or string) in the encoder and pooler. If string, <code>&quot;gelu&quot;</code>,
<code>&quot;relu&quot;</code>, <code>&quot;selu&quot;</code> and <code>&quot;gelu_new&quot;</code> <code>&quot;quick_gelu&quot;</code> are supported.`,name:"hidden_act"},{anchor:"transformers.CLIPTextConfig.layer_norm_eps",description:`<strong>layer_norm_eps</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-05) &#x2014;
The epsilon used by the layer normalization layers.`,name:"layer_norm_eps"},{anchor:"transformers.CLIPTextConfig.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.CLIPTextConfig.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.CLIPTextConfig.initializer_factor",description:`<strong>initializer_factor</strong> (<code>float</code>, <em>optional</em>, defaults to 1.0) &#x2014;
A factor for initializing all weight matrices (should be kept to 1, used internally for initialization
testing).`,name:"initializer_factor"},{anchor:"transformers.CLIPTextConfig.pad_token_id",description:`<strong>pad_token_id</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
Padding token id.`,name:"pad_token_id"},{anchor:"transformers.CLIPTextConfig.bos_token_id",description:`<strong>bos_token_id</strong> (<code>int</code>, <em>optional</em>, defaults to 49406) &#x2014;
Beginning of stream token id.`,name:"bos_token_id"},{anchor:"transformers.CLIPTextConfig.eos_token_id",description:`<strong>eos_token_id</strong> (<code>int</code>, <em>optional</em>, defaults to 49407) &#x2014;
End of stream token id.`,name:"eos_token_id"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/clip/configuration_clip.py#L34"}}),Ot=new He({props:{anchor:"transformers.CLIPTextConfig.example",$$slots:{default:[da]},$$scope:{ctx:C}}}),In=new O({props:{title:"CLIPVisionConfig",local:"transformers.CLIPVisionConfig",headingTag:"h2"}}),gn=new z({props:{name:"class transformers.CLIPVisionConfig",anchor:"transformers.CLIPVisionConfig",parameters:[{name:"hidden_size",val:" = 768"},{name:"intermediate_size",val:" = 3072"},{name:"projection_dim",val:" = 512"},{name:"num_hidden_layers",val:" = 12"},{name:"num_attention_heads",val:" = 12"},{name:"num_channels",val:" = 3"},{name:"image_size",val:" = 224"},{name:"patch_size",val:" = 32"},{name:"hidden_act",val:" = 'quick_gelu'"},{name:"layer_norm_eps",val:" = 1e-05"},{name:"attention_dropout",val:" = 0.0"},{name:"initializer_range",val:" = 0.02"},{name:"initializer_factor",val:" = 1.0"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.CLIPVisionConfig.hidden_size",description:`<strong>hidden_size</strong> (<code>int</code>, <em>optional</em>, defaults to 768) &#x2014;
Dimensionality of the encoder layers and the pooler layer.`,name:"hidden_size"},{anchor:"transformers.CLIPVisionConfig.intermediate_size",description:`<strong>intermediate_size</strong> (<code>int</code>, <em>optional</em>, defaults to 3072) &#x2014;
Dimensionality of the &#x201C;intermediate&#x201D; (i.e., feed-forward) layer in the Transformer encoder.`,name:"intermediate_size"},{anchor:"transformers.CLIPVisionConfig.projection_dim",description:`<strong>projection_dim</strong> (<code>int</code>, <em>optional</em>, defaults to 512) &#x2014;
Dimensionality of text and vision projection layers.`,name:"projection_dim"},{anchor:"transformers.CLIPVisionConfig.num_hidden_layers",description:`<strong>num_hidden_layers</strong> (<code>int</code>, <em>optional</em>, defaults to 12) &#x2014;
Number of hidden layers in the Transformer encoder.`,name:"num_hidden_layers"},{anchor:"transformers.CLIPVisionConfig.num_attention_heads",description:`<strong>num_attention_heads</strong> (<code>int</code>, <em>optional</em>, defaults to 12) &#x2014;
Number of attention heads for each attention layer in the Transformer encoder.`,name:"num_attention_heads"},{anchor:"transformers.CLIPVisionConfig.num_channels",description:`<strong>num_channels</strong> (<code>int</code>, <em>optional</em>, defaults to 3) &#x2014;
The number of input channels.`,name:"num_channels"},{anchor:"transformers.CLIPVisionConfig.image_size",description:`<strong>image_size</strong> (<code>int</code>, <em>optional</em>, defaults to 224) &#x2014;
The size (resolution) of each image.`,name:"image_size"},{anchor:"transformers.CLIPVisionConfig.patch_size",description:`<strong>patch_size</strong> (<code>int</code>, <em>optional</em>, defaults to 32) &#x2014;
The size (resolution) of each patch.`,name:"patch_size"},{anchor:"transformers.CLIPVisionConfig.hidden_act",description:`<strong>hidden_act</strong> (<code>str</code> or <code>function</code>, <em>optional</em>, defaults to <code>&quot;quick_gelu&quot;</code>) &#x2014;
The non-linear activation function (function or string) in the encoder and pooler. If string, <code>&quot;gelu&quot;</code>,
<code>&quot;relu&quot;</code>, <code>&quot;selu&quot;</code> and <code>&quot;gelu_new&quot;</code> <code>&quot;quick_gelu&quot;</code> are supported.`,name:"hidden_act"},{anchor:"transformers.CLIPVisionConfig.layer_norm_eps",description:`<strong>layer_norm_eps</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-05) &#x2014;
The epsilon used by the layer normalization layers.`,name:"layer_norm_eps"},{anchor:"transformers.CLIPVisionConfig.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.CLIPVisionConfig.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.CLIPVisionConfig.initializer_factor",description:`<strong>initializer_factor</strong> (<code>float</code>, <em>optional</em>, defaults to 1.0) &#x2014;
A factor for initializing all weight matrices (should be kept to 1, used internally for initialization
testing).`,name:"initializer_factor"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/clip/configuration_clip.py#L152"}}),Oe=new He({props:{anchor:"transformers.CLIPVisionConfig.example",$$slots:{default:[ca]},$$scope:{ctx:C}}}),Re=new O({props:{title:"CLIPTokenizer",local:"transformers.CLIPTokenizer",headingTag:"h2"}}),at=new z({props:{name:"class transformers.CLIPTokenizer",anchor:"transformers.CLIPTokenizer",parameters:[{name:"vocab_file",val:""},{name:"merges_file",val:""},{name:"errors",val:" = 'replace'"},{name:"unk_token",val:" = '<|endoftext|>'"},{name:"bos_token",val:" = '<|startoftext|>'"},{name:"eos_token",val:" = '<|endoftext|>'"},{name:"pad_token",val:" = '<|endoftext|>'"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.CLIPTokenizer.vocab_file",description:`<strong>vocab_file</strong> (<code>str</code>) &#x2014;
Path to the vocabulary file.`,name:"vocab_file"},{anchor:"transformers.CLIPTokenizer.merges_file",description:`<strong>merges_file</strong> (<code>str</code>) &#x2014;
Path to the merges file.`,name:"merges_file"},{anchor:"transformers.CLIPTokenizer.errors",description:`<strong>errors</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;replace&quot;</code>) &#x2014;
Paradigm to follow when decoding bytes to UTF-8. See
<a href="https://docs.python.org/3/library/stdtypes.html#bytes.decode" rel="nofollow">bytes.decode</a> for more information.`,name:"errors"},{anchor:"transformers.CLIPTokenizer.unk_token",description:`<strong>unk_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&lt;|endoftext|&gt;&quot;</code>) &#x2014;
The unknown token. A token that is not in the vocabulary cannot be converted to an ID and is set to be this
token instead.`,name:"unk_token"},{anchor:"transformers.CLIPTokenizer.bos_token",description:`<strong>bos_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&lt;|startoftext|&gt;&quot;</code>) &#x2014;
The beginning of sequence token.`,name:"bos_token"},{anchor:"transformers.CLIPTokenizer.eos_token",description:`<strong>eos_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&lt;|endoftext|&gt;&quot;</code>) &#x2014;
The end of sequence token.`,name:"eos_token"},{anchor:"transformers.CLIPTokenizer.pad_token",description:`<strong>pad_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&lt;|endoftext|&gt;&quot;</code>) &#x2014;
The token used for padding, for example when batching sequences of different lengths.`,name:"pad_token"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/clip/tokenization_clip.py#L254"}}),Dn=new z({props:{name:"build_inputs_with_special_tokens",anchor:"transformers.CLIPTokenizer.build_inputs_with_special_tokens",parameters:[{name:"token_ids_0",val:": List"},{name:"token_ids_1",val:": Optional = None"}],parametersDescription:[{anchor:"transformers.CLIPTokenizer.build_inputs_with_special_tokens.token_ids_0",description:`<strong>token_ids_0</strong> (<code>List[int]</code>) &#x2014;
List of IDs to which the special tokens will be added.`,name:"token_ids_0"},{anchor:"transformers.CLIPTokenizer.build_inputs_with_special_tokens.token_ids_1",description:`<strong>token_ids_1</strong> (<code>List[int]</code>, <em>optional</em>) &#x2014;
Optional second list of IDs for sequence pairs.`,name:"token_ids_1"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/clip/tokenization_clip.py#L339",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>List of <a href="../glossary#input-ids">input IDs</a> with the appropriate special tokens.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>List[int]</code></p>
`}}),An=new z({props:{name:"get_special_tokens_mask",anchor:"transformers.CLIPTokenizer.get_special_tokens_mask",parameters:[{name:"token_ids_0",val:": List"},{name:"token_ids_1",val:": Optional = None"},{name:"already_has_special_tokens",val:": bool = False"}],parametersDescription:[{anchor:"transformers.CLIPTokenizer.get_special_tokens_mask.token_ids_0",description:`<strong>token_ids_0</strong> (<code>List[int]</code>) &#x2014;
List of IDs.`,name:"token_ids_0"},{anchor:"transformers.CLIPTokenizer.get_special_tokens_mask.token_ids_1",description:`<strong>token_ids_1</strong> (<code>List[int]</code>, <em>optional</em>) &#x2014;
Optional second list of IDs for sequence pairs.`,name:"token_ids_1"},{anchor:"transformers.CLIPTokenizer.get_special_tokens_mask.already_has_special_tokens",description:`<strong>already_has_special_tokens</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not the token list is already formatted with special tokens for the model.`,name:"already_has_special_tokens"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/clip/tokenization_clip.py#L366",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A list of integers in the range [0, 1]: 1 for a special token, 0 for a sequence token.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>List[int]</code></p>
`}}),On=new z({props:{name:"create_token_type_ids_from_sequences",anchor:"transformers.CLIPTokenizer.create_token_type_ids_from_sequences",parameters:[{name:"token_ids_0",val:": List"},{name:"token_ids_1",val:": Optional = None"}],parametersDescription:[{anchor:"transformers.CLIPTokenizer.create_token_type_ids_from_sequences.token_ids_0",description:`<strong>token_ids_0</strong> (<code>List[int]</code>) &#x2014;
List of IDs.`,name:"token_ids_0"},{anchor:"transformers.CLIPTokenizer.create_token_type_ids_from_sequences.token_ids_1",description:`<strong>token_ids_1</strong> (<code>List[int]</code>, <em>optional</em>) &#x2014;
Optional second list of IDs for sequence pairs.`,name:"token_ids_1"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/clip/tokenization_clip.py#L394",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>List of zeros.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>List[int]</code></p>
`}}),Kn=new z({props:{name:"save_vocabulary",anchor:"transformers.CLIPTokenizer.save_vocabulary",parameters:[{name:"save_directory",val:": str"},{name:"filename_prefix",val:": Optional = None"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/clip/tokenization_clip.py#L489"}}),eo=new O({props:{title:"CLIPTokenizerFast",local:"transformers.CLIPTokenizerFast",headingTag:"h2"}}),to=new z({props:{name:"class transformers.CLIPTokenizerFast",anchor:"transformers.CLIPTokenizerFast",parameters:[{name:"vocab_file",val:" = None"},{name:"merges_file",val:" = None"},{name:"tokenizer_file",val:" = None"},{name:"unk_token",val:" = '<|endoftext|>'"},{name:"bos_token",val:" = '<|startoftext|>'"},{name:"eos_token",val:" = '<|endoftext|>'"},{name:"pad_token",val:" = '<|endoftext|>'"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.CLIPTokenizerFast.vocab_file",description:`<strong>vocab_file</strong> (<code>str</code>, <em>optional</em>) &#x2014;
Path to the vocabulary file.`,name:"vocab_file"},{anchor:"transformers.CLIPTokenizerFast.merges_file",description:`<strong>merges_file</strong> (<code>str</code>, <em>optional</em>) &#x2014;
Path to the merges file.`,name:"merges_file"},{anchor:"transformers.CLIPTokenizerFast.tokenizer_file",description:`<strong>tokenizer_file</strong> (<code>str</code>, <em>optional</em>) &#x2014;
The path to a tokenizer file to use instead of the vocab file.`,name:"tokenizer_file"},{anchor:"transformers.CLIPTokenizerFast.unk_token",description:`<strong>unk_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&lt;|endoftext|&gt;&quot;</code>) &#x2014;
The unknown token. A token that is not in the vocabulary cannot be converted to an ID and is set to be this
token instead.`,name:"unk_token"},{anchor:"transformers.CLIPTokenizerFast.bos_token",description:`<strong>bos_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&lt;|startoftext|&gt;&quot;</code>) &#x2014;
The beginning of sequence token.`,name:"bos_token"},{anchor:"transformers.CLIPTokenizerFast.eos_token",description:`<strong>eos_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&lt;|endoftext|&gt;&quot;</code>) &#x2014;
The end of sequence token.`,name:"eos_token"},{anchor:"transformers.CLIPTokenizerFast.pad_token",description:`<strong>pad_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&lt;|endoftext|&gt;&quot;</code>) &#x2014;
The token used for padding, for example when batching sequences of different lengths.`,name:"pad_token"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/clip/tokenization_clip_fast.py#L31"}}),no=new z({props:{name:"build_inputs_with_special_tokens",anchor:"transformers.CLIPTokenizerFast.build_inputs_with_special_tokens",parameters:[{name:"token_ids_0",val:": List"},{name:"token_ids_1",val:": Optional = None"}],parametersDescription:[{anchor:"transformers.CLIPTokenizerFast.build_inputs_with_special_tokens.token_ids_0",description:`<strong>token_ids_0</strong> (<code>List[int]</code>) &#x2014;
List of IDs to which the special tokens will be added.`,name:"token_ids_0"},{anchor:"transformers.CLIPTokenizerFast.build_inputs_with_special_tokens.token_ids_1",description:`<strong>token_ids_1</strong> (<code>List[int]</code>, <em>optional</em>) &#x2014;
Optional second list of IDs for sequence pairs.`,name:"token_ids_1"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/clip/tokenization_clip_fast.py#L109",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>List of <a href="../glossary#input-ids">input IDs</a> with the appropriate special tokens.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>List[int]</code></p>
`}}),oo=new z({props:{name:"create_token_type_ids_from_sequences",anchor:"transformers.CLIPTokenizerFast.create_token_type_ids_from_sequences",parameters:[{name:"token_ids_0",val:": List"},{name:"token_ids_1",val:": Optional = None"}],parametersDescription:[{anchor:"transformers.CLIPTokenizerFast.create_token_type_ids_from_sequences.token_ids_0",description:`<strong>token_ids_0</strong> (<code>List[int]</code>) &#x2014;
List of IDs.`,name:"token_ids_0"},{anchor:"transformers.CLIPTokenizerFast.create_token_type_ids_from_sequences.token_ids_1",description:`<strong>token_ids_1</strong> (<code>List[int]</code>, <em>optional</em>) &#x2014;
Optional second list of IDs for sequence pairs.`,name:"token_ids_1"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/clip/tokenization_clip_fast.py#L136",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>List of zeros.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>List[int]</code></p>
`}}),so=new O({props:{title:"CLIPImageProcessor",local:"transformers.CLIPImageProcessor",headingTag:"h2"}}),ao=new z({props:{name:"class transformers.CLIPImageProcessor",anchor:"transformers.CLIPImageProcessor",parameters:[{name:"do_resize",val:": bool = True"},{name:"size",val:": Dict = None"},{name:"resample",val:": Resampling = <Resampling.BICUBIC: 3>"},{name:"do_center_crop",val:": bool = True"},{name:"crop_size",val:": Dict = None"},{name:"do_rescale",val:": bool = True"},{name:"rescale_factor",val:": Union = 0.00392156862745098"},{name:"do_normalize",val:": bool = True"},{name:"image_mean",val:": Union = None"},{name:"image_std",val:": Union = None"},{name:"do_convert_rgb",val:": bool = True"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.CLIPImageProcessor.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.CLIPImageProcessor.size",description:`<strong>size</strong> (<code>Dict[str, int]</code> <em>optional</em>, defaults to <code>{&quot;shortest_edge&quot; -- 224}</code>):
Size of the image after resizing. The shortest edge of the image is resized to size[&#x201C;shortest_edge&#x201D;], with
the longest edge resized to keep the input aspect ratio. Can be overridden by <code>size</code> in the <code>preprocess</code>
method.`,name:"size"},{anchor:"transformers.CLIPImageProcessor.resample",description:`<strong>resample</strong> (<code>PILImageResampling</code>, <em>optional</em>, defaults to <code>Resampling.BICUBIC</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.CLIPImageProcessor.do_center_crop",description:`<strong>do_center_crop</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</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.CLIPImageProcessor.crop_size",description:`<strong>crop_size</strong> (<code>Dict[str, int]</code> <em>optional</em>, defaults to 224) &#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.CLIPImageProcessor.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.CLIPImageProcessor.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.CLIPImageProcessor.do_normalize",description:`<strong>do_normalize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to normalize the image. Can be overridden by <code>do_normalize</code> in the <code>preprocess</code> method.`,name:"do_normalize"},{anchor:"transformers.CLIPImageProcessor.image_mean",description:`<strong>image_mean</strong> (<code>float</code> or <code>List[float]</code>, <em>optional</em>, defaults to <code>[0.48145466, 0.4578275, 0.40821073]</code>) &#x2014;
Mean to use if normalizing the image. This is a float or list of floats 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.CLIPImageProcessor.image_std",description:`<strong>image_std</strong> (<code>float</code> or <code>List[float]</code>, <em>optional</em>, defaults to <code>[0.26862954, 0.26130258, 0.27577711]</code>) &#x2014;
Standard deviation to use if normalizing the image. This is a float or list of floats 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.CLIPImageProcessor.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"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/clip/image_processing_clip.py#L52"}}),ro=new z({props:{name:"preprocess",anchor:"transformers.CLIPImageProcessor.preprocess",parameters:[{name:"images",val:": Union"},{name:"do_resize",val:": bool = None"},{name:"size",val:": Dict = None"},{name:"resample",val:": Resampling = None"},{name:"do_center_crop",val:": bool = None"},{name:"crop_size",val:": int = None"},{name:"do_rescale",val:": bool = None"},{name:"rescale_factor",val:": float = None"},{name:"do_normalize",val:": bool = None"},{name:"image_mean",val:": Union = None"},{name:"image_std",val:": Union = None"},{name:"do_convert_rgb",val:": bool = None"},{name:"return_tensors",val:": Union = None"},{name:"data_format",val:": Optional = <ChannelDimension.FIRST: 'channels_first'>"},{name:"input_data_format",val:": Union = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.CLIPImageProcessor.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.CLIPImageProcessor.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.CLIPImageProcessor.preprocess.size",description:`<strong>size</strong> (<code>Dict[str, int]</code>, <em>optional</em>, defaults to <code>self.size</code>) &#x2014;
Size of the image after resizing. Shortest edge of the image is resized to size[&#x201C;shortest_edge&#x201D;], with
the longest edge resized to keep the input aspect ratio.`,name:"size"},{anchor:"transformers.CLIPImageProcessor.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.CLIPImageProcessor.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.CLIPImageProcessor.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 center crop. Only has an effect if <code>do_center_crop</code> is set to <code>True</code>.`,name:"crop_size"},{anchor:"transformers.CLIPImageProcessor.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.CLIPImageProcessor.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.CLIPImageProcessor.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.CLIPImageProcessor.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.CLIPImageProcessor.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.CLIPImageProcessor.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.CLIPImageProcessor.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.CLIPImageProcessor.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.CLIPImageProcessor.preprocess.input_data_format",description:`<strong>input_data_format</strong> (<code>ChannelDimension</code> or <code>str</code>, <em>optional</em>) &#x2014;
The channel dimension format for the input image. If unset, the channel dimension format is inferred
from the input image. Can be one of:<ul>
<li><code>&quot;channels_first&quot;</code> or <code>ChannelDimension.FIRST</code>: image in (num_channels, height, width) format.</li>
<li><code>&quot;channels_last&quot;</code> or <code>ChannelDimension.LAST</code>: image in (height, width, num_channels) format.</li>
<li><code>&quot;none&quot;</code> or <code>ChannelDimension.NONE</code>: image in (height, width) format.</li>
</ul>`,name:"input_data_format"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/clip/image_processing_clip.py#L200"}}),io=new O({props:{title:"CLIPFeatureExtractor",local:"transformers.CLIPFeatureExtractor",headingTag:"h2"}}),co=new z({props:{name:"class transformers.CLIPFeatureExtractor",anchor:"transformers.CLIPFeatureExtractor",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/clip/feature_extraction_clip.py#L26"}}),po=new O({props:{title:"CLIPProcessor",local:"transformers.CLIPProcessor",headingTag:"h2"}}),mo=new z({props:{name:"class transformers.CLIPProcessor",anchor:"transformers.CLIPProcessor",parameters:[{name:"image_processor",val:" = None"},{name:"tokenizer",val:" = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.CLIPProcessor.image_processor",description:`<strong>image_processor</strong> (<a href="/docs/transformers/main/en/model_doc/clip#transformers.CLIPImageProcessor">CLIPImageProcessor</a>, <em>optional</em>) &#x2014;
The image processor is a required input.`,name:"image_processor"},{anchor:"transformers.CLIPProcessor.tokenizer",description:`<strong>tokenizer</strong> (<a href="/docs/transformers/main/en/model_doc/clip#transformers.CLIPTokenizerFast">CLIPTokenizerFast</a>, <em>optional</em>) &#x2014;
The tokenizer is a required input.`,name:"tokenizer"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/clip/processing_clip.py#L25"}}),ho=new z({props:{name:"batch_decode",anchor:"transformers.CLIPProcessor.batch_decode",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/clip/processing_clip.py#L119"}}),go=new z({props:{name:"decode",anchor:"transformers.CLIPProcessor.decode",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/clip/processing_clip.py#L126"}}),Hn=new sa({props:{pytorch:!0,tensorflow:!0,jax:!0,$$slots:{jax:[Ka],tensorflow:[Na],pytorch:[Pa]},$$scope:{ctx:C}}}),uo=new ra({props:{source:"https://github.com/huggingface/transformers/blob/main/docs/source/en/model_doc/clip.md"}}),{c(){e=c("meta"),m=r(),o=c("p"),s=r(),h(M.$$.fragment),n=r(),h($.$$.fragment),Ke=r(),V=c("p"),V.innerHTML=et,tt=r(),U=c("p"),U.textContent=_e,ee=r(),J=c("p"),J.innerHTML=We,nt=r(),X=c("p"),X.innerHTML=it,pe=r(),h(Ze.$$.fragment),K=r(),ve=c("p"),ve.textContent=te,Ce=r(),xe=c("p"),xe.innerHTML=ft,be=r(),Pe=c("p"),Pe.innerHTML=ye,Ee=r(),h(G.$$.fragment),Te=r(),h(R.$$.fragment),je=r(),ke=c("p"),ke.textContent=lt,we=r(),h(qe.$$.fragment),q=r(),Ie=c("p"),Ie.innerHTML=Le,ie=r(),h(W.$$.fragment),Xe=r(),ne=c("p"),ne.textContent=Se,xt=r(),h(N.$$.fragment),Je=r(),h(ze.$$.fragment),Ye=r(),D=c("p"),D.innerHTML=ot,le=r(),me=c("p"),me.innerHTML=dt,he=r(),h(S.$$.fragment),_t=r(),H=c("p"),H.innerHTML=ct,Qe=r(),h(B.$$.fragment),Y=r(),oe=c("p"),oe.innerHTML=pt,Be=r(),h(st.$$.fragment),de=r(),ge=c("table"),ge.innerHTML=mt,ue=r(),v=c("p"),v.innerHTML=j,ce=r(),h(Z.$$.fragment),se=r(),ae=c("table"),ae.innerHTML=Me,$e=r(),re=c("p"),re.innerHTML=I,P=r(),h(A.$$.fragment),De=r(),Ue=c("table"),Ue.innerHTML=Pt,Q=r(),h(Fe.$$.fragment),Ae=r(),Ve=c("p"),Ve.textContent=bt,nn=r(),Zt=c("ul"),Zt.innerHTML=No,Ln=r(),h(Bt.$$.fragment),Rn=r(),on=c("ul"),on.innerHTML=jt,Rt=r(),sn=c("p"),sn.innerHTML=Cn,qn=r(),an=c("ul"),an.innerHTML=rn,Jn=r(),yt=c("p"),yt.innerHTML=Sn,qt=r(),St=c("ul"),St.innerHTML=wt,Yt=r(),ln=c("p"),ln.textContent=xn,Yn=r(),h(dn.$$.fragment),cn=r(),ht=c("div"),h(pn.$$.fragment),It=r(),Vt=c("p"),Vt.innerHTML=_o,Tn=r(),Pn=c("p"),Pn.innerHTML=bo,Qt=r(),h(Dt.$$.fragment),At=r(),Et=c("div"),h(kt.$$.fragment),zn=r(),Ge=c("p"),Ge.innerHTML=Mn,Un=r(),h(Gt.$$.fragment),Qn=r(),Tt=c("div"),h(Nt.$$.fragment),To=r(),yn=c("p"),yn.innerHTML=jn,Mo=r(),wn=c("p"),wn.innerHTML=Lt,mn=r(),h(Ot.$$.fragment),hn=r(),h(In.$$.fragment),Fn=r(),Ne=c("div"),h(gn.$$.fragment),Kt=r(),un=c("p"),un.innerHTML=T,x=r(),gt=c("p"),gt.innerHTML=Ht,Jt=r(),h(Oe.$$.fragment),$t=r(),h(Re.$$.fragment),vt=r(),E=c("div"),h(at.$$.fragment),zt=r(),ut=c("p"),ut.textContent=Ct,Ut=r(),kn=c("p"),kn.innerHTML=Ho,yo=r(),en=c("div"),h(Dn.$$.fragment),ls=r(),wo=c("p"),wo.textContent=Us,ds=r(),Io=c("ul"),Io.innerHTML=Fs,cs=r(),$o=c("p"),$o.textContent=Ws,ps=r(),Wn=c("div"),h(An.$$.fragment),ms=r(),vo=c("p"),vo.innerHTML=Zs,hs=r(),Zn=c("div"),h(On.$$.fragment),gs=r(),Co=c("p"),Co.textContent=Bs,us=r(),xo=c("div"),h(Kn.$$.fragment),Xo=r(),h(eo.$$.fragment),Ro=r(),Ft=c("div"),h(to.$$.fragment),fs=r(),Po=c("p"),Po.innerHTML=Vs,_s=r(),jo=c("p"),jo.innerHTML=Gs,bs=r(),tn=c("div"),h(no.$$.fragment),Ts=r(),ko=c("p"),ko.textContent=Ns,Ms=r(),Lo=c("ul"),Lo.innerHTML=Hs,ys=r(),Jo=c("p"),Jo.textContent=Es,ws=r(),Bn=c("div"),h(oo.$$.fragment),Is=r(),zo=c("p"),zo.textContent=Xs,qo=r(),h(so.$$.fragment),So=r(),fn=c("div"),h(ao.$$.fragment),$s=r(),Uo=c("p"),Uo.textContent=Rs,vs=r(),Vn=c("div"),h(ro.$$.fragment),Cs=r(),Fo=c("p"),Fo.textContent=qs,Yo=r(),h(io.$$.fragment),Qo=r(),lo=c("div"),h(co.$$.fragment),Do=r(),h(po.$$.fragment),Ao=r(),Wt=c("div"),h(mo.$$.fragment),xs=r(),Wo=c("p"),Wo.textContent=Ss,Ps=r(),Zo=c("p"),Zo.innerHTML=Ys,js=r(),Gn=c("div"),h(ho.$$.fragment),ks=r(),Bo=c("p"),Bo.innerHTML=Qs,Ls=r(),Nn=c("div"),h(go.$$.fragment),Js=r(),Vo=c("p"),Vo.innerHTML=Ds,Oo=r(),h(Hn.$$.fragment),Ko=r(),h(uo.$$.fragment),es=r(),Eo=c("p"),this.h()},l(t){const y=oa("svelte-u9bgzb",document.head);e=p(y,"META",{name:!0,content:!0}),y.forEach(a),m=i(t),o=p(t,"P",{}),k(o).forEach(a),s=i(t),g(M.$$.fragment,t),n=i(t),g($.$$.fragment,t),Ke=i(t),V=p(t,"P",{"data-svelte-h":!0}),w(V)!=="svelte-1dawxo2"&&(V.innerHTML=et),tt=i(t),U=p(t,"P",{"data-svelte-h":!0}),w(U)!=="svelte-vfdo9a"&&(U.textContent=_e),ee=i(t),J=p(t,"P",{"data-svelte-h":!0}),w(J)!=="svelte-92368o"&&(J.innerHTML=We),nt=i(t),X=p(t,"P",{"data-svelte-h":!0}),w(X)!=="svelte-1mhh8m9"&&(X.innerHTML=it),pe=i(t),g(Ze.$$.fragment,t),K=i(t),ve=p(t,"P",{"data-svelte-h":!0}),w(ve)!=="svelte-1isb9vh"&&(ve.textContent=te),Ce=i(t),xe=p(t,"P",{"data-svelte-h":!0}),w(xe)!=="svelte-wgflzu"&&(xe.innerHTML=ft),be=i(t),Pe=p(t,"P",{"data-svelte-h":!0}),w(Pe)!=="svelte-1n3z1cf"&&(Pe.innerHTML=ye),Ee=i(t),g(G.$$.fragment,t),Te=i(t),g(R.$$.fragment,t),je=i(t),ke=p(t,"P",{"data-svelte-h":!0}),w(ke)!=="svelte-uqcw46"&&(ke.textContent=lt),we=i(t),g(qe.$$.fragment,t),q=i(t),Ie=p(t,"P",{"data-svelte-h":!0}),w(Ie)!=="svelte-awcq03"&&(Ie.innerHTML=Le),ie=i(t),g(W.$$.fragment,t),Xe=i(t),ne=p(t,"P",{"data-svelte-h":!0}),w(ne)!=="svelte-14hchid"&&(ne.textContent=Se),xt=i(t),g(N.$$.fragment,t),Je=i(t),g(ze.$$.fragment,t),Ye=i(t),D=p(t,"P",{"data-svelte-h":!0}),w(D)!=="svelte-1cid2pe"&&(D.innerHTML=ot),le=i(t),me=p(t,"P",{"data-svelte-h":!0}),w(me)!=="svelte-1x11lxg"&&(me.innerHTML=dt),he=i(t),g(S.$$.fragment,t),_t=i(t),H=p(t,"P",{"data-svelte-h":!0}),w(H)!=="svelte-djb2w0"&&(H.innerHTML=ct),Qe=i(t),g(B.$$.fragment,t),Y=i(t),oe=p(t,"P",{"data-svelte-h":!0}),w(oe)!=="svelte-hrpf5w"&&(oe.innerHTML=pt),Be=i(t),g(st.$$.fragment,t),de=i(t),ge=p(t,"TABLE",{"data-svelte-h":!0}),w(ge)!=="svelte-fn6zsc"&&(ge.innerHTML=mt),ue=i(t),v=p(t,"P",{"data-svelte-h":!0}),w(v)!=="svelte-9q1rgw"&&(v.innerHTML=j),ce=i(t),g(Z.$$.fragment,t),se=i(t),ae=p(t,"TABLE",{"data-svelte-h":!0}),w(ae)!=="svelte-1kumo4w"&&(ae.innerHTML=Me),$e=i(t),re=p(t,"P",{"data-svelte-h":!0}),w(re)!=="svelte-t11hog"&&(re.innerHTML=I),P=i(t),g(A.$$.fragment,t),De=i(t),Ue=p(t,"TABLE",{"data-svelte-h":!0}),w(Ue)!=="svelte-1klvovi"&&(Ue.innerHTML=Pt),Q=i(t),g(Fe.$$.fragment,t),Ae=i(t),Ve=p(t,"P",{"data-svelte-h":!0}),w(Ve)!=="svelte-dj9ohl"&&(Ve.textContent=bt),nn=i(t),Zt=p(t,"UL",{"data-svelte-h":!0}),w(Zt)!=="svelte-lh1ahn"&&(Zt.innerHTML=No),Ln=i(t),g(Bt.$$.fragment,t),Rn=i(t),on=p(t,"UL",{"data-svelte-h":!0}),w(on)!=="svelte-133vw9m"&&(on.innerHTML=jt),Rt=i(t),sn=p(t,"P",{"data-svelte-h":!0}),w(sn)!=="svelte-cl8ob8"&&(sn.innerHTML=Cn),qn=i(t),an=p(t,"UL",{"data-svelte-h":!0}),w(an)!=="svelte-ccx455"&&(an.innerHTML=rn),Jn=i(t),yt=p(t,"P",{"data-svelte-h":!0}),w(yt)!=="svelte-1k7b44k"&&(yt.innerHTML=Sn),qt=i(t),St=p(t,"UL",{"data-svelte-h":!0}),w(St)!=="svelte-1v0wgrx"&&(St.innerHTML=wt),Yt=i(t),ln=p(t,"P",{"data-svelte-h":!0}),w(ln)!=="svelte-1rggs50"&&(ln.textContent=xn),Yn=i(t),g(dn.$$.fragment,t),cn=i(t),ht=p(t,"DIV",{class:!0});var Xt=k(ht);g(pn.$$.fragment,Xt),It=i(Xt),Vt=p(Xt,"P",{"data-svelte-h":!0}),w(Vt)!=="svelte-ucer2z"&&(Vt.innerHTML=_o),Tn=i(Xt),Pn=p(Xt,"P",{"data-svelte-h":!0}),w(Pn)!=="svelte-o55m63"&&(Pn.innerHTML=bo),Qt=i(Xt),g(Dt.$$.fragment,Xt),At=i(Xt),Et=p(Xt,"DIV",{class:!0});var fo=k(Et);g(kt.$$.fragment,fo),zn=i(fo),Ge=p(fo,"P",{"data-svelte-h":!0}),w(Ge)!=="svelte-1q69na6"&&(Ge.innerHTML=Mn),fo.forEach(a),Xt.forEach(a),Un=i(t),g(Gt.$$.fragment,t),Qn=i(t),Tt=p(t,"DIV",{class:!0});var _n=k(Tt);g(Nt.$$.fragment,_n),To=i(_n),yn=p(_n,"P",{"data-svelte-h":!0}),w(yn)!=="svelte-ugzc46"&&(yn.innerHTML=jn),Mo=i(_n),wn=p(_n,"P",{"data-svelte-h":!0}),w(wn)!=="svelte-o55m63"&&(wn.innerHTML=Lt),mn=i(_n),g(Ot.$$.fragment,_n),_n.forEach(a),hn=i(t),g(In.$$.fragment,t),Fn=i(t),Ne=p(t,"DIV",{class:!0});var bn=k(Ne);g(gn.$$.fragment,bn),Kt=i(bn),un=p(bn,"P",{"data-svelte-h":!0}),w(un)!=="svelte-zrhy66"&&(un.innerHTML=T),x=i(bn),gt=p(bn,"P",{"data-svelte-h":!0}),w(gt)!=="svelte-o55m63"&&(gt.innerHTML=Ht),Jt=i(bn),g(Oe.$$.fragment,bn),bn.forEach(a),$t=i(t),g(Re.$$.fragment,t),vt=i(t),E=p(t,"DIV",{class:!0});var Mt=k(E);g(at.$$.fragment,Mt),zt=i(Mt),ut=p(Mt,"P",{"data-svelte-h":!0}),w(ut)!=="svelte-vz3r3l"&&(ut.textContent=Ct),Ut=i(Mt),kn=p(Mt,"P",{"data-svelte-h":!0}),w(kn)!=="svelte-1c3t5ty"&&(kn.innerHTML=Ho),yo=i(Mt),en=p(Mt,"DIV",{class:!0});var En=k(en);g(Dn.$$.fragment,En),ls=i(En),wo=p(En,"P",{"data-svelte-h":!0}),w(wo)!=="svelte-js0y4v"&&(wo.textContent=Us),ds=i(En),Io=p(En,"UL",{"data-svelte-h":!0}),w(Io)!=="svelte-uzwo54"&&(Io.innerHTML=Fs),cs=i(En),$o=p(En,"P",{"data-svelte-h":!0}),w($o)!=="svelte-1bzh7dh"&&($o.textContent=Ws),En.forEach(a),ps=i(Mt),Wn=p(Mt,"DIV",{class:!0});var ns=k(Wn);g(An.$$.fragment,ns),ms=i(ns),vo=p(ns,"P",{"data-svelte-h":!0}),w(vo)!=="svelte-1f4f5kp"&&(vo.innerHTML=Zs),ns.forEach(a),hs=i(Mt),Zn=p(Mt,"DIV",{class:!0});var os=k(Zn);g(On.$$.fragment,os),gs=i(os),Co=p(os,"P",{"data-svelte-h":!0}),w(Co)!=="svelte-1ctpnmt"&&(Co.textContent=Bs),os.forEach(a),us=i(Mt),xo=p(Mt,"DIV",{class:!0});var As=k(xo);g(Kn.$$.fragment,As),As.forEach(a),Mt.forEach(a),Xo=i(t),g(eo.$$.fragment,t),Ro=i(t),Ft=p(t,"DIV",{class:!0});var $n=k(Ft);g(to.$$.fragment,$n),fs=i($n),Po=p($n,"P",{"data-svelte-h":!0}),w(Po)!=="svelte-g8hwlw"&&(Po.innerHTML=Vs),_s=i($n),jo=p($n,"P",{"data-svelte-h":!0}),w(jo)!=="svelte-fh0aq"&&(jo.innerHTML=Gs),bs=i($n),tn=p($n,"DIV",{class:!0});var Xn=k(tn);g(no.$$.fragment,Xn),Ts=i(Xn),ko=p(Xn,"P",{"data-svelte-h":!0}),w(ko)!=="svelte-js0y4v"&&(ko.textContent=Ns),Ms=i(Xn),Lo=p(Xn,"UL",{"data-svelte-h":!0}),w(Lo)!=="svelte-uzwo54"&&(Lo.innerHTML=Hs),ys=i(Xn),Jo=p(Xn,"P",{"data-svelte-h":!0}),w(Jo)!=="svelte-1bzh7dh"&&(Jo.textContent=Es),Xn.forEach(a),ws=i($n),Bn=p($n,"DIV",{class:!0});var ss=k(Bn);g(oo.$$.fragment,ss),Is=i(ss),zo=p(ss,"P",{"data-svelte-h":!0}),w(zo)!=="svelte-1ctpnmt"&&(zo.textContent=Xs),ss.forEach(a),$n.forEach(a),qo=i(t),g(so.$$.fragment,t),So=i(t),fn=p(t,"DIV",{class:!0});var Go=k(fn);g(ao.$$.fragment,Go),$s=i(Go),Uo=p(Go,"P",{"data-svelte-h":!0}),w(Uo)!=="svelte-x48p92"&&(Uo.textContent=Rs),vs=i(Go),Vn=p(Go,"DIV",{class:!0});var as=k(Vn);g(ro.$$.fragment,as),Cs=i(as),Fo=p(as,"P",{"data-svelte-h":!0}),w(Fo)!=="svelte-1x3yxsa"&&(Fo.textContent=qs),as.forEach(a),Go.forEach(a),Yo=i(t),g(io.$$.fragment,t),Qo=i(t),lo=p(t,"DIV",{class:!0});var Os=k(lo);g(co.$$.fragment,Os),Os.forEach(a),Do=i(t),g(po.$$.fragment,t),Ao=i(t),Wt=p(t,"DIV",{class:!0});var vn=k(Wt);g(mo.$$.fragment,vn),xs=i(vn),Wo=p(vn,"P",{"data-svelte-h":!0}),w(Wo)!=="svelte-ofpncz"&&(Wo.textContent=Ss),Ps=i(vn),Zo=p(vn,"P",{"data-svelte-h":!0}),w(Zo)!=="svelte-1xevima"&&(Zo.innerHTML=Ys),js=i(vn),Gn=p(vn,"DIV",{class:!0});var rs=k(Gn);g(ho.$$.fragment,rs),ks=i(rs),Bo=p(rs,"P",{"data-svelte-h":!0}),w(Bo)!=="svelte-vahtpx"&&(Bo.innerHTML=Qs),rs.forEach(a),Ls=i(vn),Nn=p(vn,"DIV",{class:!0});var is=k(Nn);g(go.$$.fragment,is),Js=i(is),Vo=p(is,"P",{"data-svelte-h":!0}),w(Vo)!=="svelte-174p0in"&&(Vo.innerHTML=Ds),is.forEach(a),vn.forEach(a),Oo=i(t),g(Hn.$$.fragment,t),Ko=i(t),g(uo.$$.fragment,t),es=i(t),Eo=p(t,"P",{}),k(Eo).forEach(a),this.h()},h(){L(e,"name","hf:doc:metadata"),L(e,"content",tr),L(Et,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),L(ht,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),L(Tt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),L(Ne,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),L(en,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),L(Wn,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),L(Zn,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),L(xo,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),L(E,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),L(tn,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),L(Bn,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),L(Ft,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),L(Vn,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),L(fn,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),L(lo,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),L(Gn,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),L(Nn,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),L(Wt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(t,y){l(document.head,e),d(t,m,y),d(t,o,y),d(t,s,y),u(M,t,y),d(t,n,y),u($,t,y),d(t,Ke,y),d(t,V,y),d(t,tt,y),d(t,U,y),d(t,ee,y),d(t,J,y),d(t,nt,y),d(t,X,y),d(t,pe,y),u(Ze,t,y),d(t,K,y),d(t,ve,y),d(t,Ce,y),d(t,xe,y),d(t,be,y),d(t,Pe,y),d(t,Ee,y),u(G,t,y),d(t,Te,y),u(R,t,y),d(t,je,y),d(t,ke,y),d(t,we,y),u(qe,t,y),d(t,q,y),d(t,Ie,y),d(t,ie,y),u(W,t,y),d(t,Xe,y),d(t,ne,y),d(t,xt,y),u(N,t,y),d(t,Je,y),u(ze,t,y),d(t,Ye,y),d(t,D,y),d(t,le,y),d(t,me,y),d(t,he,y),u(S,t,y),d(t,_t,y),d(t,H,y),d(t,Qe,y),u(B,t,y),d(t,Y,y),d(t,oe,y),d(t,Be,y),u(st,t,y),d(t,de,y),d(t,ge,y),d(t,ue,y),d(t,v,y),d(t,ce,y),u(Z,t,y),d(t,se,y),d(t,ae,y),d(t,$e,y),d(t,re,y),d(t,P,y),u(A,t,y),d(t,De,y),d(t,Ue,y),d(t,Q,y),u(Fe,t,y),d(t,Ae,y),d(t,Ve,y),d(t,nn,y),d(t,Zt,y),d(t,Ln,y),u(Bt,t,y),d(t,Rn,y),d(t,on,y),d(t,Rt,y),d(t,sn,y),d(t,qn,y),d(t,an,y),d(t,Jn,y),d(t,yt,y),d(t,qt,y),d(t,St,y),d(t,Yt,y),d(t,ln,y),d(t,Yn,y),u(dn,t,y),d(t,cn,y),d(t,ht,y),u(pn,ht,null),l(ht,It),l(ht,Vt),l(ht,Tn),l(ht,Pn),l(ht,Qt),u(Dt,ht,null),l(ht,At),l(ht,Et),u(kt,Et,null),l(Et,zn),l(Et,Ge),d(t,Un,y),u(Gt,t,y),d(t,Qn,y),d(t,Tt,y),u(Nt,Tt,null),l(Tt,To),l(Tt,yn),l(Tt,Mo),l(Tt,wn),l(Tt,mn),u(Ot,Tt,null),d(t,hn,y),u(In,t,y),d(t,Fn,y),d(t,Ne,y),u(gn,Ne,null),l(Ne,Kt),l(Ne,un),l(Ne,x),l(Ne,gt),l(Ne,Jt),u(Oe,Ne,null),d(t,$t,y),u(Re,t,y),d(t,vt,y),d(t,E,y),u(at,E,null),l(E,zt),l(E,ut),l(E,Ut),l(E,kn),l(E,yo),l(E,en),u(Dn,en,null),l(en,ls),l(en,wo),l(en,ds),l(en,Io),l(en,cs),l(en,$o),l(E,ps),l(E,Wn),u(An,Wn,null),l(Wn,ms),l(Wn,vo),l(E,hs),l(E,Zn),u(On,Zn,null),l(Zn,gs),l(Zn,Co),l(E,us),l(E,xo),u(Kn,xo,null),d(t,Xo,y),u(eo,t,y),d(t,Ro,y),d(t,Ft,y),u(to,Ft,null),l(Ft,fs),l(Ft,Po),l(Ft,_s),l(Ft,jo),l(Ft,bs),l(Ft,tn),u(no,tn,null),l(tn,Ts),l(tn,ko),l(tn,Ms),l(tn,Lo),l(tn,ys),l(tn,Jo),l(Ft,ws),l(Ft,Bn),u(oo,Bn,null),l(Bn,Is),l(Bn,zo),d(t,qo,y),u(so,t,y),d(t,So,y),d(t,fn,y),u(ao,fn,null),l(fn,$s),l(fn,Uo),l(fn,vs),l(fn,Vn),u(ro,Vn,null),l(Vn,Cs),l(Vn,Fo),d(t,Yo,y),u(io,t,y),d(t,Qo,y),d(t,lo,y),u(co,lo,null),d(t,Do,y),u(po,t,y),d(t,Ao,y),d(t,Wt,y),u(mo,Wt,null),l(Wt,xs),l(Wt,Wo),l(Wt,Ps),l(Wt,Zo),l(Wt,js),l(Wt,Gn),u(ho,Gn,null),l(Gn,ks),l(Gn,Bo),l(Wt,Ls),l(Wt,Nn),u(go,Nn,null),l(Nn,Js),l(Nn,Vo),d(t,Oo,y),u(Hn,t,y),d(t,Ko,y),u(uo,t,y),d(t,es,y),d(t,Eo,y),ts=!0},p(t,[y]){const Xt={};y&2&&(Xt.$$scope={dirty:y,ctx:t}),W.$set(Xt);const fo={};y&2&&(fo.$$scope={dirty:y,ctx:t}),Dt.$set(fo);const _n={};y&2&&(_n.$$scope={dirty:y,ctx:t}),Ot.$set(_n);const bn={};y&2&&(bn.$$scope={dirty:y,ctx:t}),Oe.$set(bn);const Mt={};y&2&&(Mt.$$scope={dirty:y,ctx:t}),Hn.$set(Mt)},i(t){ts||(f(M.$$.fragment,t),f($.$$.fragment,t),f(Ze.$$.fragment,t),f(G.$$.fragment,t),f(R.$$.fragment,t),f(qe.$$.fragment,t),f(W.$$.fragment,t),f(N.$$.fragment,t),f(ze.$$.fragment,t),f(S.$$.fragment,t),f(B.$$.fragment,t),f(st.$$.fragment,t),f(Z.$$.fragment,t),f(A.$$.fragment,t),f(Fe.$$.fragment,t),f(Bt.$$.fragment,t),f(dn.$$.fragment,t),f(pn.$$.fragment,t),f(Dt.$$.fragment,t),f(kt.$$.fragment,t),f(Gt.$$.fragment,t),f(Nt.$$.fragment,t),f(Ot.$$.fragment,t),f(In.$$.fragment,t),f(gn.$$.fragment,t),f(Oe.$$.fragment,t),f(Re.$$.fragment,t),f(at.$$.fragment,t),f(Dn.$$.fragment,t),f(An.$$.fragment,t),f(On.$$.fragment,t),f(Kn.$$.fragment,t),f(eo.$$.fragment,t),f(to.$$.fragment,t),f(no.$$.fragment,t),f(oo.$$.fragment,t),f(so.$$.fragment,t),f(ao.$$.fragment,t),f(ro.$$.fragment,t),f(io.$$.fragment,t),f(co.$$.fragment,t),f(po.$$.fragment,t),f(mo.$$.fragment,t),f(ho.$$.fragment,t),f(go.$$.fragment,t),f(Hn.$$.fragment,t),f(uo.$$.fragment,t),ts=!0)},o(t){_(M.$$.fragment,t),_($.$$.fragment,t),_(Ze.$$.fragment,t),_(G.$$.fragment,t),_(R.$$.fragment,t),_(qe.$$.fragment,t),_(W.$$.fragment,t),_(N.$$.fragment,t),_(ze.$$.fragment,t),_(S.$$.fragment,t),_(B.$$.fragment,t),_(st.$$.fragment,t),_(Z.$$.fragment,t),_(A.$$.fragment,t),_(Fe.$$.fragment,t),_(Bt.$$.fragment,t),_(dn.$$.fragment,t),_(pn.$$.fragment,t),_(Dt.$$.fragment,t),_(kt.$$.fragment,t),_(Gt.$$.fragment,t),_(Nt.$$.fragment,t),_(Ot.$$.fragment,t),_(In.$$.fragment,t),_(gn.$$.fragment,t),_(Oe.$$.fragment,t),_(Re.$$.fragment,t),_(at.$$.fragment,t),_(Dn.$$.fragment,t),_(An.$$.fragment,t),_(On.$$.fragment,t),_(Kn.$$.fragment,t),_(eo.$$.fragment,t),_(to.$$.fragment,t),_(no.$$.fragment,t),_(oo.$$.fragment,t),_(so.$$.fragment,t),_(ao.$$.fragment,t),_(ro.$$.fragment,t),_(io.$$.fragment,t),_(co.$$.fragment,t),_(po.$$.fragment,t),_(mo.$$.fragment,t),_(ho.$$.fragment,t),_(go.$$.fragment,t),_(Hn.$$.fragment,t),_(uo.$$.fragment,t),ts=!1},d(t){t&&(a(m),a(o),a(s),a(n),a(Ke),a(V),a(tt),a(U),a(ee),a(J),a(nt),a(X),a(pe),a(K),a(ve),a(Ce),a(xe),a(be),a(Pe),a(Ee),a(Te),a(je),a(ke),a(we),a(q),a(Ie),a(ie),a(Xe),a(ne),a(xt),a(Je),a(Ye),a(D),a(le),a(me),a(he),a(_t),a(H),a(Qe),a(Y),a(oe),a(Be),a(de),a(ge),a(ue),a(v),a(ce),a(se),a(ae),a($e),a(re),a(P),a(De),a(Ue),a(Q),a(Ae),a(Ve),a(nn),a(Zt),a(Ln),a(Rn),a(on),a(Rt),a(sn),a(qn),a(an),a(Jn),a(yt),a(qt),a(St),a(Yt),a(ln),a(Yn),a(cn),a(ht),a(Un),a(Qn),a(Tt),a(hn),a(Fn),a(Ne),a($t),a(vt),a(E),a(Xo),a(Ro),a(Ft),a(qo),a(So),a(fn),a(Yo),a(Qo),a(lo),a(Do),a(Ao),a(Wt),a(Oo),a(Ko),a(es),a(Eo)),a(e),b(M,t),b($,t),b(Ze,t),b(G,t),b(R,t),b(qe,t),b(W,t),b(N,t),b(ze,t),b(S,t),b(B,t),b(st,t),b(Z,t),b(A,t),b(Fe,t),b(Bt,t),b(dn,t),b(pn),b(Dt),b(kt),b(Gt,t),b(Nt),b(Ot),b(In,t),b(gn),b(Oe),b(Re,t),b(at),b(Dn),b(An),b(On),b(Kn),b(eo,t),b(to),b(no),b(oo),b(so,t),b(ao),b(ro),b(io,t),b(co),b(po,t),b(mo),b(ho),b(go),b(Hn,t),b(uo,t)}}}const tr='{"title":"CLIP","local":"clip","sections":[{"title":"Overview","local":"overview","sections":[],"depth":2},{"title":"Usage tips and example","local":"usage-tips-and-example","sections":[{"title":"Combining CLIP and Flash Attention 2","local":"combining-clip-and-flash-attention-2","sections":[],"depth":3},{"title":"Using Scaled Dot Product Attention (SDPA)","local":"using-scaled-dot-product-attention-sdpa","sections":[],"depth":3},{"title":"Expected speedups with Flash Attention and SDPA","local":"expected-speedups-with-flash-attention-and-sdpa","sections":[{"title":"CLIPTextModel","local":"cliptextmodel","sections":[],"depth":4},{"title":"CLIPVisionModel","local":"clipvisionmodel","sections":[],"depth":4},{"title":"CLIPModel","local":"clipmodel","sections":[],"depth":4}],"depth":3}],"depth":2},{"title":"Resources","local":"resources","sections":[],"depth":2},{"title":"CLIPConfig","local":"transformers.CLIPConfig","sections":[],"depth":2},{"title":"CLIPTextConfig","local":"transformers.CLIPTextConfig","sections":[],"depth":2},{"title":"CLIPVisionConfig","local":"transformers.CLIPVisionConfig","sections":[],"depth":2},{"title":"CLIPTokenizer","local":"transformers.CLIPTokenizer","sections":[],"depth":2},{"title":"CLIPTokenizerFast","local":"transformers.CLIPTokenizerFast","sections":[],"depth":2},{"title":"CLIPImageProcessor","local":"transformers.CLIPImageProcessor","sections":[],"depth":2},{"title":"CLIPFeatureExtractor","local":"transformers.CLIPFeatureExtractor","sections":[],"depth":2},{"title":"CLIPProcessor","local":"transformers.CLIPProcessor","sections":[],"depth":2},{"title":"CLIPModel","local":"transformers.CLIPModel","sections":[],"depth":2},{"title":"CLIPTextModel","local":"transformers.CLIPTextModel","sections":[],"depth":2},{"title":"CLIPTextModelWithProjection","local":"transformers.CLIPTextModelWithProjection","sections":[],"depth":2},{"title":"CLIPVisionModelWithProjection","local":"transformers.CLIPVisionModelWithProjection","sections":[],"depth":2},{"title":"CLIPVisionModel","local":"transformers.CLIPVisionModel","sections":[],"depth":2},{"title":"CLIPForImageClassification","local":"transformers.CLIPForImageClassification","sections":[],"depth":2},{"title":"TFCLIPModel","local":"transformers.TFCLIPModel","sections":[],"depth":2},{"title":"TFCLIPTextModel","local":"transformers.TFCLIPTextModel","sections":[],"depth":2},{"title":"TFCLIPVisionModel","local":"transformers.TFCLIPVisionModel","sections":[],"depth":2},{"title":"FlaxCLIPModel","local":"transformers.FlaxCLIPModel","sections":[],"depth":2},{"title":"FlaxCLIPTextModel","local":"transformers.FlaxCLIPTextModel","sections":[],"depth":2},{"title":"FlaxCLIPTextModelWithProjection","local":"transformers.FlaxCLIPTextModelWithProjection","sections":[],"depth":2},{"title":"FlaxCLIPVisionModel","local":"transformers.FlaxCLIPVisionModel","sections":[],"depth":2}],"depth":1}';function nr(C){return ea(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class mr extends ta{constructor(e){super(),na(this,e,nr,er,Ks,{})}}export{mr as component};
