import{S as fi,i as hi,s as ui,e as a,k as h,w as v,t as l,M as gi,c as s,d as o,m as u,a as r,x as y,h as i,b as p,G as e,g as _,y as C,q as I,o as w,B as T,v as _i,L as Ke}from"../../chunks/vendor-hf-doc-builder.js";import{T as cn}from"../../chunks/Tip-hf-doc-builder.js";import{D as x}from"../../chunks/Docstring-hf-doc-builder.js";import{C as he}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as F}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as Oe}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";function bi(P){let d,M,g,m,b;return m=new he({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEFsdENMSVBDb25maWclMkMlMjBBbHRDTElQTW9kZWwlMEElMEElMjMlMjBJbml0aWFsaXppbmclMjBhJTIwQWx0Q0xJUENvbmZpZyUyMHdpdGglMjBCQUFJJTJGQWx0Q0xJUCUyMHN0eWxlJTIwY29uZmlndXJhdGlvbiUwQWNvbmZpZ3VyYXRpb24lMjAlM0QlMjBBbHRDTElQQ29uZmlnKCklMEElMEElMjMlMjBJbml0aWFsaXppbmclMjBhJTIwQWx0Q0xJUE1vZGVsJTIwKHdpdGglMjByYW5kb20lMjB3ZWlnaHRzKSUyMGZyb20lMjB0aGUlMjBCQUFJJTJGQWx0Q0xJUCUyMHN0eWxlJTIwY29uZmlndXJhdGlvbiUwQW1vZGVsJTIwJTNEJTIwQWx0Q0xJUE1vZGVsKGNvbmZpZ3VyYXRpb24pJTBBJTBBJTIzJTIwQWNjZXNzaW5nJTIwdGhlJTIwbW9kZWwlMjBjb25maWd1cmF0aW9uJTBBY29uZmlndXJhdGlvbiUyMCUzRCUyMG1vZGVsLmNvbmZpZyUwQSUwQSUyMyUyMFdlJTIwY2FuJTIwYWxzbyUyMGluaXRpYWxpemUlMjBhJTIwQWx0Q0xJUENvbmZpZyUyMGZyb20lMjBhJTIwQWx0Q0xJUFRleHRDb25maWclMjBhbmQlMjBhJTIwQWx0Q0xJUFZpc2lvbkNvbmZpZyUwQSUwQSUyMyUyMEluaXRpYWxpemluZyUyMGElMjBBbHRDTElQVGV4dCUyMGFuZCUyMEFsdENMSVBWaXNpb24lMjBjb25maWd1cmF0aW9uJTBBY29uZmlnX3RleHQlMjAlM0QlMjBBbHRDTElQVGV4dENvbmZpZygpJTBBY29uZmlnX3Zpc2lvbiUyMCUzRCUyMEFsdENMSVBWaXNpb25Db25maWcoKSUwQSUwQWNvbmZpZyUyMCUzRCUyMEFsdENMSVBDb25maWcuZnJvbV90ZXh0X3Zpc2lvbl9jb25maWdzKGNvbmZpZ190ZXh0JTJDJTIwY29uZmlnX3Zpc2lvbik=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AltCLIPConfig, AltCLIPModel

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a AltCLIPConfig with BAAI/AltCLIP style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = AltCLIPConfig()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a AltCLIPModel (with random weights) from the BAAI/AltCLIP style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = AltCLIPModel(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 AltCLIPConfig from a AltCLIPTextConfig and a AltCLIPVisionConfig</span>

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a AltCLIPText and AltCLIPVision configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>config_text = AltCLIPTextConfig()
<span class="hljs-meta">&gt;&gt;&gt; </span>config_vision = AltCLIPVisionConfig()

<span class="hljs-meta">&gt;&gt;&gt; </span>config = AltCLIPConfig.from_text_vision_configs(config_text, config_vision)`}}),{c(){d=a("p"),M=l("Example:"),g=h(),v(m.$$.fragment)},l(n){d=s(n,"P",{});var c=r(d);M=i(c,"Example:"),c.forEach(o),g=u(n),y(m.$$.fragment,n)},m(n,c){_(n,d,c),e(d,M),_(n,g,c),C(m,n,c),b=!0},p:Ke,i(n){b||(I(m.$$.fragment,n),b=!0)},o(n){w(m.$$.fragment,n),b=!1},d(n){n&&o(d),n&&o(g),T(m,n)}}}function Mi(P){let d,M,g,m,b;return m=new he({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEFsdENMSVBUZXh0TW9kZWwlMkMlMjBBbHRDTElQVGV4dENvbmZpZyUwQSUwQSUyMyUyMEluaXRpYWxpemluZyUyMGElMjBBbHRDTElQVGV4dENvbmZpZyUyMHdpdGglMjBCQUFJJTJGQWx0Q0xJUCUyMHN0eWxlJTIwY29uZmlndXJhdGlvbiUwQWNvbmZpZ3VyYXRpb24lMjAlM0QlMjBBbHRDTElQVGV4dENvbmZpZygpJTBBJTBBJTIzJTIwSW5pdGlhbGl6aW5nJTIwYSUyMEFsdENMSVBUZXh0TW9kZWwlMjAod2l0aCUyMHJhbmRvbSUyMHdlaWdodHMpJTIwZnJvbSUyMHRoZSUyMEJBQUklMkZBbHRDTElQJTIwc3R5bGUlMjBjb25maWd1cmF0aW9uJTBBbW9kZWwlMjAlM0QlMjBBbHRDTElQVGV4dE1vZGVsKGNvbmZpZ3VyYXRpb24pJTBBJTBBJTIzJTIwQWNjZXNzaW5nJTIwdGhlJTIwbW9kZWwlMjBjb25maWd1cmF0aW9uJTBBY29uZmlndXJhdGlvbiUyMCUzRCUyMG1vZGVsLmNvbmZpZw==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AltCLIPTextModel, AltCLIPTextConfig

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a AltCLIPTextConfig with BAAI/AltCLIP style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = AltCLIPTextConfig()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a AltCLIPTextModel (with random weights) from the BAAI/AltCLIP style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = AltCLIPTextModel(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`}}),{c(){d=a("p"),M=l("Examples:"),g=h(),v(m.$$.fragment)},l(n){d=s(n,"P",{});var c=r(d);M=i(c,"Examples:"),c.forEach(o),g=u(n),y(m.$$.fragment,n)},m(n,c){_(n,d,c),e(d,M),_(n,g,c),C(m,n,c),b=!0},p:Ke,i(n){b||(I(m.$$.fragment,n),b=!0)},o(n){w(m.$$.fragment,n),b=!1},d(n){n&&o(d),n&&o(g),T(m,n)}}}function vi(P){let d,M,g,m,b;return m=new he({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEFsdENMSVBWaXNpb25Db25maWclMkMlMjBBbHRDTElQVmlzaW9uTW9kZWwlMEElMEElMjMlMjBJbml0aWFsaXppbmclMjBhJTIwQWx0Q0xJUFZpc2lvbkNvbmZpZyUyMHdpdGglMjBCQUFJJTJGQWx0Q0xJUCUyMHN0eWxlJTIwY29uZmlndXJhdGlvbiUwQWNvbmZpZ3VyYXRpb24lMjAlM0QlMjBBbHRDTElQVmlzaW9uQ29uZmlnKCklMEElMEElMjMlMjBJbml0aWFsaXppbmclMjBhJTIwQWx0Q0xJUFZpc2lvbk1vZGVsJTIwKHdpdGglMjByYW5kb20lMjB3ZWlnaHRzKSUyMGZyb20lMjB0aGUlMjBCQUFJJTJGQWx0Q0xJUCUyMHN0eWxlJTIwY29uZmlndXJhdGlvbiUwQW1vZGVsJTIwJTNEJTIwQWx0Q0xJUFZpc2lvbk1vZGVsKGNvbmZpZ3VyYXRpb24pJTBBJTBBJTIzJTIwQWNjZXNzaW5nJTIwdGhlJTIwbW9kZWwlMjBjb25maWd1cmF0aW9uJTBBY29uZmlndXJhdGlvbiUyMCUzRCUyMG1vZGVsLmNvbmZpZw==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AltCLIPVisionConfig, AltCLIPVisionModel

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a AltCLIPVisionConfig with BAAI/AltCLIP style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = AltCLIPVisionConfig()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a AltCLIPVisionModel (with random weights) from the BAAI/AltCLIP style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = AltCLIPVisionModel(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`}}),{c(){d=a("p"),M=l("Example:"),g=h(),v(m.$$.fragment)},l(n){d=s(n,"P",{});var c=r(d);M=i(c,"Example:"),c.forEach(o),g=u(n),y(m.$$.fragment,n)},m(n,c){_(n,d,c),e(d,M),_(n,g,c),C(m,n,c),b=!0},p:Ke,i(n){b||(I(m.$$.fragment,n),b=!0)},o(n){w(m.$$.fragment,n),b=!1},d(n){n&&o(d),n&&o(g),T(m,n)}}}function yi(P){let d,M,g,m,b;return{c(){d=a("p"),M=l("Although the recipe for forward pass needs to be defined within this function, one should call the "),g=a("code"),m=l("Module"),b=l(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(n){d=s(n,"P",{});var c=r(d);M=i(c,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=s(c,"CODE",{});var A=r(g);m=i(A,"Module"),A.forEach(o),b=i(c,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),c.forEach(o)},m(n,c){_(n,d,c),e(d,M),e(d,g),e(g,m),e(d,b)},d(n){n&&o(d)}}}function Ci(P){let d,M,g,m,b;return m=new he({props:{code:"ZnJvbSUyMFBJTCUyMGltcG9ydCUyMEltYWdlJTBBaW1wb3J0JTIwcmVxdWVzdHMlMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b1Byb2Nlc3NvciUyQyUyMEFsdENMSVBNb2RlbCUwQSUwQW1vZGVsJTIwJTNEJTIwQWx0Q0xJUE1vZGVsLmZyb21fcHJldHJhaW5lZCglMjJCQUFJJTJGQWx0Q0xJUCUyMiklMEFwcm9jZXNzb3IlMjAlM0QlMjBBdXRvUHJvY2Vzc29yLmZyb21fcHJldHJhaW5lZCglMjJCQUFJJTJGQWx0Q0xJUCUyMiklMEF1cmwlMjAlM0QlMjAlMjJodHRwJTNBJTJGJTJGaW1hZ2VzLmNvY29kYXRhc2V0Lm9yZyUyRnZhbDIwMTclMkYwMDAwMDAwMzk3NjkuanBnJTIyJTBBaW1hZ2UlMjAlM0QlMjBJbWFnZS5vcGVuKHJlcXVlc3RzLmdldCh1cmwlMkMlMjBzdHJlYW0lM0RUcnVlKS5yYXcpJTBBaW5wdXRzJTIwJTNEJTIwcHJvY2Vzc29yKCUwQSUyMCUyMCUyMCUyMHRleHQlM0QlNUIlMjJhJTIwcGhvdG8lMjBvZiUyMGElMjBjYXQlMjIlMkMlMjAlMjJhJTIwcGhvdG8lMjBvZiUyMGElMjBkb2clMjIlNUQlMkMlMjBpbWFnZXMlM0RpbWFnZSUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIlMkMlMjBwYWRkaW5nJTNEVHJ1ZSUwQSklMEFvdXRwdXRzJTIwJTNEJTIwbW9kZWwoKippbnB1dHMpJTBBbG9naXRzX3Blcl9pbWFnZSUyMCUzRCUyMG91dHB1dHMubG9naXRzX3Blcl9pbWFnZSUyMCUyMCUyMyUyMHRoaXMlMjBpcyUyMHRoZSUyMGltYWdlLXRleHQlMjBzaW1pbGFyaXR5JTIwc2NvcmUlMEFwcm9icyUyMCUzRCUyMGxvZ2l0c19wZXJfaW1hZ2Uuc29mdG1heChkaW0lM0QxKSUyMCUyMCUyMyUyMHdlJTIwY2FuJTIwdGFrZSUyMHRoZSUyMHNvZnRtYXglMjB0byUyMGdldCUyMHRoZSUyMGxhYmVsJTIwcHJvYmFiaWxpdGllcw==",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, AltCLIPModel

<span class="hljs-meta">&gt;&gt;&gt; </span>model = AltCLIPModel.from_pretrained(<span class="hljs-string">&quot;BAAI/AltCLIP&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>processor = AutoProcessor.from_pretrained(<span class="hljs-string">&quot;BAAI/AltCLIP&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>`}}),{c(){d=a("p"),M=l("Examples:"),g=h(),v(m.$$.fragment)},l(n){d=s(n,"P",{});var c=r(d);M=i(c,"Examples:"),c.forEach(o),g=u(n),y(m.$$.fragment,n)},m(n,c){_(n,d,c),e(d,M),_(n,g,c),C(m,n,c),b=!0},p:Ke,i(n){b||(I(m.$$.fragment,n),b=!0)},o(n){w(m.$$.fragment,n),b=!1},d(n){n&&o(d),n&&o(g),T(m,n)}}}function Ii(P){let d,M,g,m,b;return{c(){d=a("p"),M=l("Although the recipe for forward pass needs to be defined within this function, one should call the "),g=a("code"),m=l("Module"),b=l(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(n){d=s(n,"P",{});var c=r(d);M=i(c,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=s(c,"CODE",{});var A=r(g);m=i(A,"Module"),A.forEach(o),b=i(c,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),c.forEach(o)},m(n,c){_(n,d,c),e(d,M),e(d,g),e(g,m),e(d,b)},d(n){n&&o(d)}}}function wi(P){let d,M,g,m,b;return m=new he({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Qcm9jZXNzb3IlMkMlMjBBbHRDTElQTW9kZWwlMEElMEFtb2RlbCUyMCUzRCUyMEFsdENMSVBNb2RlbC5mcm9tX3ByZXRyYWluZWQoJTIyQkFBSSUyRkFsdENMSVAlMjIpJTBBcHJvY2Vzc29yJTIwJTNEJTIwQXV0b1Byb2Nlc3Nvci5mcm9tX3ByZXRyYWluZWQoJTIyQkFBSSUyRkFsdENMSVAlMjIpJTBBaW5wdXRzJTIwJTNEJTIwcHJvY2Vzc29yKHRleHQlM0QlNUIlMjJhJTIwcGhvdG8lMjBvZiUyMGElMjBjYXQlMjIlMkMlMjAlMjJhJTIwcGhvdG8lMjBvZiUyMGElMjBkb2clMjIlNUQlMkMlMjBwYWRkaW5nJTNEVHJ1ZSUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpJTBBdGV4dF9mZWF0dXJlcyUyMCUzRCUyMG1vZGVsLmdldF90ZXh0X2ZlYXR1cmVzKCoqaW5wdXRzKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoProcessor, AltCLIPModel

<span class="hljs-meta">&gt;&gt;&gt; </span>model = AltCLIPModel.from_pretrained(<span class="hljs-string">&quot;BAAI/AltCLIP&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>processor = AutoProcessor.from_pretrained(<span class="hljs-string">&quot;BAAI/AltCLIP&quot;</span>)
<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>], 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)`}}),{c(){d=a("p"),M=l("Examples:"),g=h(),v(m.$$.fragment)},l(n){d=s(n,"P",{});var c=r(d);M=i(c,"Examples:"),c.forEach(o),g=u(n),y(m.$$.fragment,n)},m(n,c){_(n,d,c),e(d,M),_(n,g,c),C(m,n,c),b=!0},p:Ke,i(n){b||(I(m.$$.fragment,n),b=!0)},o(n){w(m.$$.fragment,n),b=!1},d(n){n&&o(d),n&&o(g),T(m,n)}}}function Ti(P){let d,M,g,m,b;return{c(){d=a("p"),M=l("Although the recipe for forward pass needs to be defined within this function, one should call the "),g=a("code"),m=l("Module"),b=l(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(n){d=s(n,"P",{});var c=r(d);M=i(c,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=s(c,"CODE",{});var A=r(g);m=i(A,"Module"),A.forEach(o),b=i(c,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),c.forEach(o)},m(n,c){_(n,d,c),e(d,M),e(d,g),e(g,m),e(d,b)},d(n){n&&o(d)}}}function Pi(P){let d,M,g,m,b;return m=new he({props:{code:"ZnJvbSUyMFBJTCUyMGltcG9ydCUyMEltYWdlJTBBaW1wb3J0JTIwcmVxdWVzdHMlMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b1Byb2Nlc3NvciUyQyUyMEFsdENMSVBNb2RlbCUwQSUwQW1vZGVsJTIwJTNEJTIwQWx0Q0xJUE1vZGVsLmZyb21fcHJldHJhaW5lZCglMjJCQUFJJTJGQWx0Q0xJUCUyMiklMEFwcm9jZXNzb3IlMjAlM0QlMjBBdXRvUHJvY2Vzc29yLmZyb21fcHJldHJhaW5lZCglMjJCQUFJJTJGQWx0Q0xJUCUyMiklMEF1cmwlMjAlM0QlMjAlMjJodHRwJTNBJTJGJTJGaW1hZ2VzLmNvY29kYXRhc2V0Lm9yZyUyRnZhbDIwMTclMkYwMDAwMDAwMzk3NjkuanBnJTIyJTBBaW1hZ2UlMjAlM0QlMjBJbWFnZS5vcGVuKHJlcXVlc3RzLmdldCh1cmwlMkMlMjBzdHJlYW0lM0RUcnVlKS5yYXcpJTBBaW5wdXRzJTIwJTNEJTIwcHJvY2Vzc29yKGltYWdlcyUzRGltYWdlJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMiklMEFpbWFnZV9mZWF0dXJlcyUyMCUzRCUyMG1vZGVsLmdldF9pbWFnZV9mZWF0dXJlcygqKmlucHV0cyk=",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, AltCLIPModel

<span class="hljs-meta">&gt;&gt;&gt; </span>model = AltCLIPModel.from_pretrained(<span class="hljs-string">&quot;BAAI/AltCLIP&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>processor = AutoProcessor.from_pretrained(<span class="hljs-string">&quot;BAAI/AltCLIP&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)`}}),{c(){d=a("p"),M=l("Examples:"),g=h(),v(m.$$.fragment)},l(n){d=s(n,"P",{});var c=r(d);M=i(c,"Examples:"),c.forEach(o),g=u(n),y(m.$$.fragment,n)},m(n,c){_(n,d,c),e(d,M),_(n,g,c),C(m,n,c),b=!0},p:Ke,i(n){b||(I(m.$$.fragment,n),b=!0)},o(n){w(m.$$.fragment,n),b=!1},d(n){n&&o(d),n&&o(g),T(m,n)}}}function Ai(P){let d,M,g,m,b;return{c(){d=a("p"),M=l("Although the recipe for forward pass needs to be defined within this function, one should call the "),g=a("code"),m=l("Module"),b=l(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(n){d=s(n,"P",{});var c=r(d);M=i(c,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=s(c,"CODE",{});var A=r(g);m=i(A,"Module"),A.forEach(o),b=i(c,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),c.forEach(o)},m(n,c){_(n,d,c),e(d,M),e(d,g),e(g,m),e(d,b)},d(n){n&&o(d)}}}function $i(P){let d,M,g,m,b;return m=new he({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Qcm9jZXNzb3IlMkMlMjBBbHRDTElQVGV4dE1vZGVsJTBBJTBBbW9kZWwlMjAlM0QlMjBBbHRDTElQVGV4dE1vZGVsLmZyb21fcHJldHJhaW5lZCglMjJCQUFJJTJGQWx0Q0xJUCUyMiklMEFwcm9jZXNzb3IlMjAlM0QlMjBBdXRvUHJvY2Vzc29yLmZyb21fcHJldHJhaW5lZCglMjJCQUFJJTJGQWx0Q0xJUCUyMiklMEElMEF0ZXh0cyUyMCUzRCUyMCU1QiUyMml0J3MlMjBhJTIwY2F0JTIyJTJDJTIwJTIyaXQncyUyMGElMjBkb2clMjIlNUQlMEElMEFpbnB1dHMlMjAlM0QlMjBwcm9jZXNzb3IodGV4dCUzRHRleHRzJTJDJTIwcGFkZGluZyUzRFRydWUlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKSUwQSUwQW91dHB1dHMlMjAlM0QlMjBtb2RlbCgqKmlucHV0cyklMEFsYXN0X2hpZGRlbl9zdGF0ZSUyMCUzRCUyMG91dHB1dHMubGFzdF9oaWRkZW5fc3RhdGUlMEFwb29sZWRfb3V0cHV0JTIwJTNEJTIwb3V0cHV0cy5wb29sZXJfb3V0cHV0JTIwJTIwJTIzJTIwcG9vbGVkJTIwQ0xTJTIwc3RhdGVz",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoProcessor, AltCLIPTextModel

<span class="hljs-meta">&gt;&gt;&gt; </span>model = AltCLIPTextModel.from_pretrained(<span class="hljs-string">&quot;BAAI/AltCLIP&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>processor = AutoProcessor.from_pretrained(<span class="hljs-string">&quot;BAAI/AltCLIP&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>texts = [<span class="hljs-string">&quot;it&#x27;s a cat&quot;</span>, <span class="hljs-string">&quot;it&#x27;s a dog&quot;</span>]

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = processor(text=texts, 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 CLS states</span>`}}),{c(){d=a("p"),M=l("Examples:"),g=h(),v(m.$$.fragment)},l(n){d=s(n,"P",{});var c=r(d);M=i(c,"Examples:"),c.forEach(o),g=u(n),y(m.$$.fragment,n)},m(n,c){_(n,d,c),e(d,M),_(n,g,c),C(m,n,c),b=!0},p:Ke,i(n){b||(I(m.$$.fragment,n),b=!0)},o(n){w(m.$$.fragment,n),b=!1},d(n){n&&o(d),n&&o(g),T(m,n)}}}function Li(P){let d,M,g,m,b;return{c(){d=a("p"),M=l("Although the recipe for forward pass needs to be defined within this function, one should call the "),g=a("code"),m=l("Module"),b=l(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(n){d=s(n,"P",{});var c=r(d);M=i(c,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=s(c,"CODE",{});var A=r(g);m=i(A,"Module"),A.forEach(o),b=i(c,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),c.forEach(o)},m(n,c){_(n,d,c),e(d,M),e(d,g),e(g,m),e(d,b)},d(n){n&&o(d)}}}function Ji(P){let d,M,g,m,b;return m=new he({props:{code:"ZnJvbSUyMFBJTCUyMGltcG9ydCUyMEltYWdlJTBBaW1wb3J0JTIwcmVxdWVzdHMlMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b1Byb2Nlc3NvciUyQyUyMEFsdENMSVBWaXNpb25Nb2RlbCUwQSUwQW1vZGVsJTIwJTNEJTIwQWx0Q0xJUFZpc2lvbk1vZGVsLmZyb21fcHJldHJhaW5lZCglMjJCQUFJJTJGQWx0Q0xJUCUyMiklMEFwcm9jZXNzb3IlMjAlM0QlMjBBdXRvUHJvY2Vzc29yLmZyb21fcHJldHJhaW5lZCglMjJCQUFJJTJGQWx0Q0xJUCUyMiklMEElMEF1cmwlMjAlM0QlMjAlMjJodHRwJTNBJTJGJTJGaW1hZ2VzLmNvY29kYXRhc2V0Lm9yZyUyRnZhbDIwMTclMkYwMDAwMDAwMzk3NjkuanBnJTIyJTBBaW1hZ2UlMjAlM0QlMjBJbWFnZS5vcGVuKHJlcXVlc3RzLmdldCh1cmwlMkMlMjBzdHJlYW0lM0RUcnVlKS5yYXcpJTBBJTBBaW5wdXRzJTIwJTNEJTIwcHJvY2Vzc29yKGltYWdlcyUzRGltYWdlJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMiklMEElMEFvdXRwdXRzJTIwJTNEJTIwbW9kZWwoKippbnB1dHMpJTBBbGFzdF9oaWRkZW5fc3RhdGUlMjAlM0QlMjBvdXRwdXRzLmxhc3RfaGlkZGVuX3N0YXRlJTBBcG9vbGVkX291dHB1dCUyMCUzRCUyMG91dHB1dHMucG9vbGVyX291dHB1dCUyMCUyMCUyMyUyMHBvb2xlZCUyMENMUyUyMHN0YXRlcw==",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, AltCLIPVisionModel

<span class="hljs-meta">&gt;&gt;&gt; </span>model = AltCLIPVisionModel.from_pretrained(<span class="hljs-string">&quot;BAAI/AltCLIP&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>processor = AutoProcessor.from_pretrained(<span class="hljs-string">&quot;BAAI/AltCLIP&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>`}}),{c(){d=a("p"),M=l("Examples:"),g=h(),v(m.$$.fragment)},l(n){d=s(n,"P",{});var c=r(d);M=i(c,"Examples:"),c.forEach(o),g=u(n),y(m.$$.fragment,n)},m(n,c){_(n,d,c),e(d,M),_(n,g,c),C(m,n,c),b=!0},p:Ke,i(n){b||(I(m.$$.fragment,n),b=!0)},o(n){w(m.$$.fragment,n),b=!1},d(n){n&&o(d),n&&o(g),T(m,n)}}}function xi(P){let d,M,g,m,b,n,c,A,aa,pn,H,ue,Po,et,sa,Ao,ra,mn,ge,la,tt,ia,da,fn,Bt,ca,hn,zt,$o,pa,un,X,_e,Lo,ot,ma,Jo,fa,gn,Wt,ha,_n,Zt,ua,bn,be,ga,Vt,_a,ba,Mn,$,Ma,Nt,va,ya,Qt,Ca,Ia,Gt,wa,Ta,Rt,Pa,Aa,Ft,$a,La,vn,nt,yn,Ht,Ja,Cn,Me,xa,xo,ja,ka,In,ve,Ea,at,Ua,Ba,wn,q,ye,jo,st,za,ko,Wa,Tn,L,rt,Za,S,Va,Xt,Na,Qa,lt,Ga,Ra,Fa,D,Ha,qt,Xa,qa,St,Sa,Da,Ya,Ce,Oa,Ie,it,Ka,dt,es,Dt,ts,os,Pn,Y,we,Eo,ct,ns,Uo,as,An,k,pt,ss,O,rs,Yt,ls,is,mt,ds,cs,ps,K,ms,Ot,fs,hs,Kt,us,gs,_s,Te,$n,ee,Pe,Bo,ft,bs,zo,Ms,Ln,E,ht,vs,te,ys,eo,Cs,Is,ut,ws,Ts,Ps,oe,As,to,$s,Ls,oo,Js,xs,js,Ae,Jn,ne,$e,Wo,gt,ks,Zo,Es,xn,J,_t,Us,Vo,Bs,zs,j,no,Ws,Zs,ao,Vs,Ns,so,Qs,Gs,No,Rs,Fs,ro,Hs,Xs,qs,Le,bt,Ss,Mt,Ds,lo,Ys,Os,Ks,Je,vt,er,yt,tr,io,or,nr,jn,ae,xe,Qo,Ct,ar,Go,sr,kn,U,It,rr,B,wt,lr,se,ir,co,dr,cr,Ro,pr,mr,fr,je,hr,ke,ur,z,Tt,gr,re,_r,po,br,Mr,Fo,vr,yr,Cr,Ee,Ir,Ue,wr,W,Pt,Tr,le,Pr,mo,Ar,$r,Ho,Lr,Jr,xr,Be,jr,ze,En,ie,We,Xo,At,kr,qo,Er,Un,de,$t,Ur,Z,Lt,Br,ce,zr,fo,Wr,Zr,So,Vr,Nr,Qr,Ze,Gr,Ve,Bn,pe,Ne,Do,Jt,Rr,Yo,Fr,zn,me,xt,Hr,V,jt,Xr,fe,qr,ho,Sr,Dr,Oo,Yr,Or,Kr,Qe,el,Ge,Wn;return n=new F({}),et=new F({}),ot=new F({}),nt=new he({props:{code:"ZnJvbSUyMFBJTCUyMGltcG9ydCUyMEltYWdlJTBBaW1wb3J0JTIwcmVxdWVzdHMlMEElMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQWx0Q0xJUE1vZGVsJTJDJTIwQWx0Q0xJUFByb2Nlc3NvciUwQSUwQW1vZGVsJTIwJTNEJTIwQWx0Q0xJUE1vZGVsLmZyb21fcHJldHJhaW5lZCglMjJCQUFJJTJGQWx0Q0xJUCUyMiklMEFwcm9jZXNzb3IlMjAlM0QlMjBBbHRDTElQUHJvY2Vzc29yLmZyb21fcHJldHJhaW5lZCglMjJCQUFJJTJGQWx0Q0xJUCUyMiklMEElMEF1cmwlMjAlM0QlMjAlMjJodHRwJTNBJTJGJTJGaW1hZ2VzLmNvY29kYXRhc2V0Lm9yZyUyRnZhbDIwMTclMkYwMDAwMDAwMzk3NjkuanBnJTIyJTBBaW1hZ2UlMjAlM0QlMjBJbWFnZS5vcGVuKHJlcXVlc3RzLmdldCh1cmwlMkMlMjBzdHJlYW0lM0RUcnVlKS5yYXcpJTBBJTBBaW5wdXRzJTIwJTNEJTIwcHJvY2Vzc29yKHRleHQlM0QlNUIlMjJhJTIwcGhvdG8lMjBvZiUyMGElMjBjYXQlMjIlMkMlMjAlMjJhJTIwcGhvdG8lMjBvZiUyMGElMjBkb2clMjIlNUQlMkMlMjBpbWFnZXMlM0RpbWFnZSUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIlMkMlMjBwYWRkaW5nJTNEVHJ1ZSklMEElMEFvdXRwdXRzJTIwJTNEJTIwbW9kZWwoKippbnB1dHMpJTBBbG9naXRzX3Blcl9pbWFnZSUyMCUzRCUyMG91dHB1dHMubG9naXRzX3Blcl9pbWFnZSUyMCUyMCUyMyUyMHRoaXMlMjBpcyUyMHRoZSUyMGltYWdlLXRleHQlMjBzaW1pbGFyaXR5JTIwc2NvcmUlMEFwcm9icyUyMCUzRCUyMGxvZ2l0c19wZXJfaW1hZ2Uuc29mdG1heChkaW0lM0QxKSUyMCUyMCUyMyUyMHdlJTIwY2FuJTIwdGFrZSUyMHRoZSUyMHNvZnRtYXglMjB0byUyMGdldCUyMHRoZSUyMGxhYmVsJTIwcHJvYmFiaWxpdGllcw==",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> AltCLIPModel, AltCLIPProcessor

<span class="hljs-meta">&gt;&gt;&gt; </span>model = AltCLIPModel.from_pretrained(<span class="hljs-string">&quot;BAAI/AltCLIP&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>processor = AltCLIPProcessor.from_pretrained(<span class="hljs-string">&quot;BAAI/AltCLIP&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>`}}),st=new F({}),rt=new x({props:{name:"class transformers.AltCLIPConfig",anchor:"transformers.AltCLIPConfig",parameters:[{name:"text_config",val:" = None"},{name:"vision_config",val:" = None"},{name:"projection_dim",val:" = 768"},{name:"logit_scale_init_value",val:" = 2.6592"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.AltCLIPConfig.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/altclip#transformers.AltCLIPTextConfig">AltCLIPTextConfig</a>.`,name:"text_config"},{anchor:"transformers.AltCLIPConfig.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/altclip#transformers.AltCLIPVisionConfig">AltCLIPVisionConfig</a>.`,name:"vision_config"},{anchor:"transformers.AltCLIPConfig.projection_dim",description:`<strong>projection_dim</strong> (<code>int</code>, <em>optional</em>, defaults to 512) &#x2014;
Dimentionality of text and vision projection layers.`,name:"projection_dim"},{anchor:"transformers.AltCLIPConfig.logit_scale_init_value",description:`<strong>logit_scale_init_value</strong> (<code>float</code>, <em>optional</em>, defaults to 2.6592) &#x2014;
The inital value of the <em>logit_scale</em> paramter. Default is used as per the original CLIP implementation.`,name:"logit_scale_init_value"},{anchor:"transformers.AltCLIPConfig.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/altclip/configuration_altclip.py#L247"}}),Ce=new Oe({props:{anchor:"transformers.AltCLIPConfig.example",$$slots:{default:[bi]},$$scope:{ctx:P}}}),it=new x({props:{name:"from_text_vision_configs",anchor:"transformers.AltCLIPConfig.from_text_vision_configs",parameters:[{name:"text_config",val:": AltCLIPTextConfig"},{name:"vision_config",val:": AltCLIPVisionConfig"},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/altclip/configuration_altclip.py#L382",returnDescription:`
<p>An instance of a configuration object</p>
`,returnType:`
<p><a
  href="/docs/transformers/main/en/model_doc/altclip#transformers.AltCLIPConfig"
>AltCLIPConfig</a></p>
`}}),ct=new F({}),pt=new x({props:{name:"class transformers.AltCLIPTextConfig",anchor:"transformers.AltCLIPTextConfig",parameters:[{name:"vocab_size",val:" = 250002"},{name:"hidden_size",val:" = 1024"},{name:"num_hidden_layers",val:" = 24"},{name:"num_attention_heads",val:" = 16"},{name:"intermediate_size",val:" = 4096"},{name:"hidden_act",val:" = 'gelu'"},{name:"hidden_dropout_prob",val:" = 0.1"},{name:"attention_probs_dropout_prob",val:" = 0.1"},{name:"max_position_embeddings",val:" = 514"},{name:"type_vocab_size",val:" = 1"},{name:"initializer_range",val:" = 0.02"},{name:"initializer_factor",val:" = 0.02"},{name:"layer_norm_eps",val:" = 1e-05"},{name:"pad_token_id",val:" = 1"},{name:"bos_token_id",val:" = 0"},{name:"eos_token_id",val:" = 2"},{name:"position_embedding_type",val:" = 'absolute'"},{name:"use_cache",val:" = True"},{name:"project_dim",val:" = 768"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.AltCLIPTextConfig.vocab_size",description:`<strong>vocab_size</strong> (<code>int</code>, <em>optional</em>, defaults to 250002) &#x2014;
Vocabulary size of the AltCLIP 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/altclip#transformers.AltCLIPTextModel">AltCLIPTextModel</a>.`,name:"vocab_size"},{anchor:"transformers.AltCLIPTextConfig.hidden_size",description:`<strong>hidden_size</strong> (<code>int</code>, <em>optional</em>, defaults to 1024) &#x2014;
Dimensionality of the encoder layers and the pooler layer.`,name:"hidden_size"},{anchor:"transformers.AltCLIPTextConfig.num_hidden_layers",description:`<strong>num_hidden_layers</strong> (<code>int</code>, <em>optional</em>, defaults to 24) &#x2014;
Number of hidden layers in the Transformer encoder.`,name:"num_hidden_layers"},{anchor:"transformers.AltCLIPTextConfig.num_attention_heads",description:`<strong>num_attention_heads</strong> (<code>int</code>, <em>optional</em>, defaults to 16) &#x2014;
Number of attention heads for each attention layer in the Transformer encoder.`,name:"num_attention_heads"},{anchor:"transformers.AltCLIPTextConfig.intermediate_size",description:`<strong>intermediate_size</strong> (<code>int</code>, <em>optional</em>, defaults to 4096) &#x2014;
Dimensionality of the &#x201C;intermediate&#x201D; (often named feed-forward) layer in the Transformer encoder.`,name:"intermediate_size"},{anchor:"transformers.AltCLIPTextConfig.hidden_act",description:`<strong>hidden_act</strong> (<code>str</code> or <code>Callable</code>, <em>optional</em>, defaults to <code>&quot;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;silu&quot;</code> and <code>&quot;gelu_new&quot;</code> are supported.`,name:"hidden_act"},{anchor:"transformers.AltCLIPTextConfig.hidden_dropout_prob",description:`<strong>hidden_dropout_prob</strong> (<code>float</code>, <em>optional</em>, defaults to 0.1) &#x2014;
The dropout probability for all fully connected layers in the embeddings, encoder, and pooler.`,name:"hidden_dropout_prob"},{anchor:"transformers.AltCLIPTextConfig.attention_probs_dropout_prob",description:`<strong>attention_probs_dropout_prob</strong> (<code>float</code>, <em>optional</em>, defaults to 0.1) &#x2014;
The dropout ratio for the attention probabilities.`,name:"attention_probs_dropout_prob"},{anchor:"transformers.AltCLIPTextConfig.max_position_embeddings",description:`<strong>max_position_embeddings</strong> (<code>int</code>, <em>optional</em>, defaults to 514) &#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.AltCLIPTextConfig.type_vocab_size",description:`<strong>type_vocab_size</strong> (<code>int</code>, <em>optional</em>, defaults to 2) &#x2014;
The vocabulary size of the <code>token_type_ids</code> passed when calling <a href="/docs/transformers/main/en/model_doc/altclip#transformers.AltCLIPTextModel">AltCLIPTextModel</a>`,name:"type_vocab_size"},{anchor:"transformers.AltCLIPTextConfig.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.AltCLIPTextConfig.layer_norm_eps",description:`<strong>layer_norm_eps</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-5) &#x2014;
The epsilon used by the layer normalization layers.`,name:"layer_norm_eps"},{anchor:"transformers.AltCLIPTextConfig.position_embedding_type",description:`<strong>position_embedding_type</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;absolute&quot;</code>) &#x2014;
Type of position embedding. Choose one of <code>&quot;absolute&quot;</code>, <code>&quot;relative_key&quot;</code>, <code>&quot;relative_key_query&quot;</code>. For
positional embeddings use <code>&quot;absolute&quot;</code>. For more information on <code>&quot;relative_key&quot;</code>, please refer to
<a href="https://arxiv.org/abs/1803.02155" rel="nofollow">Self-Attention with Relative Position Representations (Shaw et al.)</a>.
For more information on <code>&quot;relative_key_query&quot;</code>, please refer to <em>Method 4</em> in <a href="https://arxiv.org/abs/2009.13658" rel="nofollow">Improve Transformer Models
with Better Relative Position Embeddings (Huang et al.)</a>.`,name:"position_embedding_type"},{anchor:"transformers.AltCLIPTextConfig.use_cache",description:`<strong>use_cache</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not the model should return the last key/values attentions (not used by all models). Only
relevant if <code>config.is_decoder=True</code>.`,name:"use_cache"},{anchor:"transformers.AltCLIPTextConfig.project_dim",description:`<strong>project_dim</strong> (<code>int</code>, <em>optional</em>, defaults to 768) &#x2014;
The dimentions of the teacher model before the mapping layer.`,name:"project_dim"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/altclip/configuration_altclip.py#L31"}}),Te=new Oe({props:{anchor:"transformers.AltCLIPTextConfig.example",$$slots:{default:[Mi]},$$scope:{ctx:P}}}),ft=new F({}),ht=new x({props:{name:"class transformers.AltCLIPVisionConfig",anchor:"transformers.AltCLIPVisionConfig",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.AltCLIPVisionConfig.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.AltCLIPVisionConfig.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.AltCLIPVisionConfig.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.AltCLIPVisionConfig.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.AltCLIPVisionConfig.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.AltCLIPVisionConfig.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.AltCLIPVisionConfig.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.AltCLIPVisionConfig.layer_norm_eps",description:`<strong>layer_norm_eps</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-5) &#x2014;
The epsilon used by the layer normalization layers.`,name:"layer_norm_eps"},{anchor:"transformers.AltCLIPVisionConfig.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.AltCLIPVisionConfig.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.AltCLIPVisionConfig.initializer_factor",description:`<strong>initializer_factor</strong> (\`float&#x201C;, <em>optional</em>, defaults to 1) &#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/altclip/configuration_altclip.py#L141"}}),Ae=new Oe({props:{anchor:"transformers.AltCLIPVisionConfig.example",$$slots:{default:[vi]},$$scope:{ctx:P}}}),gt=new F({}),_t=new x({props:{name:"class transformers.AltCLIPProcessor",anchor:"transformers.AltCLIPProcessor",parameters:[{name:"image_processor",val:" = None"},{name:"tokenizer",val:" = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.AltCLIPProcessor.image_processor",description:`<strong>image_processor</strong> (<a href="/docs/transformers/main/en/model_doc/clip#transformers.CLIPImageProcessor">CLIPImageProcessor</a>) &#x2014;
The image processor is a required input.`,name:"image_processor"},{anchor:"transformers.AltCLIPProcessor.tokenizer",description:`<strong>tokenizer</strong> (<a href="/docs/transformers/main/en/model_doc/xlm-roberta#transformers.XLMRobertaTokenizerFast">XLMRobertaTokenizerFast</a>) &#x2014;
The tokenizer is a required input.`,name:"tokenizer"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/altclip/processing_altclip.py#L24"}}),bt=new x({props:{name:"batch_decode",anchor:"transformers.AltCLIPProcessor.batch_decode",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/altclip/processing_altclip.py#L113"}}),vt=new x({props:{name:"decode",anchor:"transformers.AltCLIPProcessor.decode",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/altclip/processing_altclip.py#L120"}}),Ct=new F({}),It=new x({props:{name:"class transformers.AltCLIPModel",anchor:"transformers.AltCLIPModel",parameters:[{name:"config",val:": AltCLIPConfig"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/altclip/modeling_altclip.py#L1481"}}),wt=new x({props:{name:"forward",anchor:"transformers.AltCLIPModel.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"pixel_values",val:": typing.Optional[torch.FloatTensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"position_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"token_type_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"return_loss",val:": typing.Optional[bool] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.AltCLIPModel.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.AltCLIPModel.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.AltCLIPModel.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.AltCLIPModel.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/donut#transformers.DonutFeatureExtractor.__call__">CLIPImageProcessor.<strong>call</strong>()</a> for details.`,name:"pixel_values"},{anchor:"transformers.AltCLIPModel.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.AltCLIPModel.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.AltCLIPModel.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.AltCLIPModel.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/altclip/modeling_altclip.py#L1608",returnDescription:`
<p>A <code>transformers.models.altclip.modeling_altclip.AltCLIPOutput</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.altclip.configuration_altclip.AltCLIPConfig'&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>) \u2014 Contrastive loss for image-text similarity.</li>
<li><strong>logits_per_image:(<code>torch.FloatTensor</code></strong> of shape <code>(image_batch_size, text_batch_size)</code>) \u2014 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>torch.FloatTensor</code></strong> of shape <code>(text_batch_size, image_batch_size)</code>) \u2014 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>torch.FloatTensor</code></strong> of shape <code>(batch_size, output_dim</code>) \u2014 The text embeddings obtained by applying the projection layer to the pooled output of <a
  href="/docs/transformers/main/en/model_doc/altclip#transformers.AltCLIPTextModel"
>AltCLIPTextModel</a>.</li>
<li><strong>image_embeds(<code>torch.FloatTensor</code></strong> of shape <code>(batch_size, output_dim</code>) \u2014 The image embeddings obtained by applying the projection layer to the pooled output of
<a
  href="/docs/transformers/main/en/model_doc/altclip#transformers.AltCLIPVisionModel"
>AltCLIPVisionModel</a>.</li>
<li><strong>text_model_output(<code>BaseModelOutputWithPooling</code>):</strong>
The output of the <a
  href="/docs/transformers/main/en/model_doc/altclip#transformers.AltCLIPTextModel"
>AltCLIPTextModel</a>.</li>
<li><strong>vision_model_output(<code>BaseModelOutputWithPooling</code>):</strong>
The output of the <a
  href="/docs/transformers/main/en/model_doc/altclip#transformers.AltCLIPVisionModel"
>AltCLIPVisionModel</a>.</li>
</ul>
`,returnType:`
<p><code>transformers.models.altclip.modeling_altclip.AltCLIPOutput</code> or <code>tuple(torch.FloatTensor)</code></p>
`}}),je=new cn({props:{$$slots:{default:[yi]},$$scope:{ctx:P}}}),ke=new Oe({props:{anchor:"transformers.AltCLIPModel.forward.example",$$slots:{default:[Ci]},$$scope:{ctx:P}}}),Tt=new x({props:{name:"get_text_features",anchor:"transformers.AltCLIPModel.get_text_features",parameters:[{name:"input_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"position_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"token_type_ids",val:" = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.AltCLIPModel.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.AltCLIPModel.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.AltCLIPModel.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.AltCLIPModel.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.AltCLIPModel.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.AltCLIPModel.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/altclip/modeling_altclip.py#L1515",returnDescription:`
<p>The text embeddings obtained by
applying the projection layer to the pooled output of <a
  href="/docs/transformers/main/en/model_doc/altclip#transformers.AltCLIPTextModel"
>AltCLIPTextModel</a>.</p>
`,returnType:`
<p>text_features (<code>torch.FloatTensor</code> of shape <code>(batch_size, output_dim</code>)</p>
`}}),Ee=new cn({props:{$$slots:{default:[Ii]},$$scope:{ctx:P}}}),Ue=new Oe({props:{anchor:"transformers.AltCLIPModel.get_text_features.example",$$slots:{default:[wi]},$$scope:{ctx:P}}}),Pt=new x({props:{name:"get_image_features",anchor:"transformers.AltCLIPModel.get_image_features",parameters:[{name:"pixel_values",val:": typing.Optional[torch.FloatTensor] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.AltCLIPModel.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/donut#transformers.DonutFeatureExtractor.__call__">CLIPImageProcessor.<strong>call</strong>()</a> for details.`,name:"pixel_values"},{anchor:"transformers.AltCLIPModel.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.AltCLIPModel.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.AltCLIPModel.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/altclip/modeling_altclip.py#L1562",returnDescription:`
<p>The image embeddings obtained by
applying the projection layer to the pooled output of <a
  href="/docs/transformers/main/en/model_doc/altclip#transformers.AltCLIPVisionModel"
>AltCLIPVisionModel</a>.</p>
`,returnType:`
<p>image_features (<code>torch.FloatTensor</code> of shape <code>(batch_size, output_dim</code>)</p>
`}}),Be=new cn({props:{$$slots:{default:[Ti]},$$scope:{ctx:P}}}),ze=new Oe({props:{anchor:"transformers.AltCLIPModel.get_image_features.example",$$slots:{default:[Pi]},$$scope:{ctx:P}}}),At=new F({}),$t=new x({props:{name:"class transformers.AltCLIPTextModel",anchor:"transformers.AltCLIPTextModel",parameters:[{name:"config",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/altclip/modeling_altclip.py#L1389"}}),Lt=new x({props:{name:"forward",anchor:"transformers.AltCLIPTextModel.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"token_type_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"position_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"head_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.Tensor] = None"},{name:"encoder_hidden_states",val:": typing.Optional[torch.Tensor] = None"},{name:"encoder_attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.AltCLIPTextModel.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.AltCLIPTextModel.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.AltCLIPTextModel.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.AltCLIPTextModel.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.AltCLIPTextModel.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.AltCLIPTextModel.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/altclip/modeling_altclip.py#L1408",returnDescription:`
<p>A <code>transformers.modeling_outputs.BaseModelOutputWithPoolingAndProjection</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.altclip.configuration_altclip.AltCLIPTextConfig'&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>) \u2014 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>) \u2014 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>) \u2014 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>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
<li>
<p><strong>projection_state</strong> (<code>tuple(torch.FloatTensor)</code>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> of shape <code>(batch_size,config.project_dim)</code>.</p>
<p>Text embeddings before the projection layer, used to mimic the last hidden state of the teacher encoder.</p>
</li>
</ul>
`,returnType:`
<p><code>transformers.modeling_outputs.BaseModelOutputWithPoolingAndProjection</code> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Ze=new cn({props:{$$slots:{default:[Ai]},$$scope:{ctx:P}}}),Ve=new Oe({props:{anchor:"transformers.AltCLIPTextModel.forward.example",$$slots:{default:[$i]},$$scope:{ctx:P}}}),Jt=new F({}),xt=new x({props:{name:"class transformers.AltCLIPVisionModel",anchor:"transformers.AltCLIPVisionModel",parameters:[{name:"config",val:": AltCLIPVisionConfig"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/altclip/modeling_altclip.py#L1158"}}),jt=new x({props:{name:"forward",anchor:"transformers.AltCLIPVisionModel.forward",parameters:[{name:"pixel_values",val:": typing.Optional[torch.FloatTensor] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.AltCLIPVisionModel.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/donut#transformers.DonutFeatureExtractor.__call__">CLIPImageProcessor.<strong>call</strong>()</a> for details.`,name:"pixel_values"},{anchor:"transformers.AltCLIPVisionModel.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.AltCLIPVisionModel.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.AltCLIPVisionModel.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/altclip/modeling_altclip.py#L1171",returnDescription:`
<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.altclip.configuration_altclip.AltCLIPVisionConfig'&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>) \u2014 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>) \u2014 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>) \u2014 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>) \u2014 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:`
<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>
`}}),Qe=new cn({props:{$$slots:{default:[Li]},$$scope:{ctx:P}}}),Ge=new Oe({props:{anchor:"transformers.AltCLIPVisionModel.forward.example",$$slots:{default:[Ji]},$$scope:{ctx:P}}}),{c(){d=a("meta"),M=h(),g=a("h1"),m=a("a"),b=a("span"),v(n.$$.fragment),c=h(),A=a("span"),aa=l("AltCLIP"),pn=h(),H=a("h2"),ue=a("a"),Po=a("span"),v(et.$$.fragment),sa=h(),Ao=a("span"),ra=l("Overview"),mn=h(),ge=a("p"),la=l("The AltCLIP model was proposed in "),tt=a("a"),ia=l("AltCLIP: Altering the Language Encoder in CLIP for Extended Language Capabilities"),da=l(` by Zhongzhi Chen, Guang Liu, Bo-Wen Zhang, Fulong Ye, Qinghong Yang, Ledell Wu. AltCLIP
(Altering the Language Encoder in CLIP) is a neural network trained on a variety of image-text and text-text pairs. By switching CLIP\u2019s
text encoder with a pretrained multilingual text encoder XLM-R, we could obtain very close performances with CLIP on almost all tasks, and extended original CLIP\u2019s capabilities such as multilingual understanding.`),fn=h(),Bt=a("p"),ca=l("The abstract from the paper is the following:"),hn=h(),zt=a("p"),$o=a("em"),pa=l(`In this work, we present a conceptually simple and effective method to train a strong bilingual multimodal representation model.
Starting from the pretrained multimodal representation model CLIP released by OpenAI, we switched its text encoder with a pretrained
multilingual text encoder XLM-R, and aligned both languages and image representations by a two-stage training schema consisting of
teacher learning and contrastive learning. We validate our method through evaluations of a wide range of tasks. We set new state-of-the-art
performances on a bunch of tasks including ImageNet-CN, Flicker30k- CN, and COCO-CN. Further, we obtain very close performances with
CLIP on almost all tasks, suggesting that one can simply alter the text encoder in CLIP for extended capabilities such as multilingual understanding.`),un=h(),X=a("h2"),_e=a("a"),Lo=a("span"),v(ot.$$.fragment),ma=h(),Jo=a("span"),fa=l("Usage"),gn=h(),Wt=a("p"),ha=l(`The usage of AltCLIP is very similar to the CLIP. the difference between CLIP is the text encoder. Note that we use bidirectional attention instead of casual attention
and we take the [CLS] token in XLM-R to represent text embedding.`),_n=h(),Zt=a("p"),ua=l(`AltCLIP is a multi-modal vision and language model. It can be used for image-text similarity and for zero-shot image
classification. AltCLIP uses a ViT like transformer to get visual features and a bidirectional 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.`),bn=h(),be=a("p"),ga=l(`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 `),Vt=a("a"),_a=l("CLIPImageProcessor"),ba=l(" can be used to resize (or rescale) and normalize images for the model."),Mn=h(),$=a("p"),Ma=l("The "),Nt=a("a"),va=l("AltCLIPProcessor"),ya=l(" wraps a "),Qt=a("a"),Ca=l("CLIPImageProcessor"),Ia=l(" and a "),Gt=a("a"),wa=l("XLMRobertaTokenizer"),Ta=l(` 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
`),Rt=a("a"),Pa=l("AltCLIPProcessor"),Aa=l(" and "),Ft=a("a"),$a=l("AltCLIPModel"),La=l("."),vn=h(),v(nt.$$.fragment),yn=h(),Ht=a("p"),Ja=l("Tips:"),Cn=h(),Me=a("p"),xa=l("This model is build on "),xo=a("code"),ja=l("CLIPModel"),ka=l(", so use it like a original CLIP."),In=h(),ve=a("p"),Ea=l("This model was contributed by "),at=a("a"),Ua=l("jongjyh"),Ba=l("."),wn=h(),q=a("h2"),ye=a("a"),jo=a("span"),v(st.$$.fragment),za=h(),ko=a("span"),Wa=l("AltCLIPConfig"),Tn=h(),L=a("div"),v(rt.$$.fragment),Za=h(),S=a("p"),Va=l("This is the configuration class to store the configuration of a "),Xt=a("a"),Na=l("AltCLIPModel"),Qa=l(`. It is used to instantiate an
AltCLIP model according to the specified arguments, defining the model architecture. Instantiating a configuration
with the defaults will yield a similar configuration to that of the AltCLIP
`),lt=a("a"),Ga=l("BAAI/AltCLIP"),Ra=l(" architecture."),Fa=h(),D=a("p"),Ha=l("Configuration objects inherit from "),qt=a("a"),Xa=l("PretrainedConfig"),qa=l(` and can be used to control the model outputs. Read the
documentation from `),St=a("a"),Sa=l("PretrainedConfig"),Da=l(" for more information."),Ya=h(),v(Ce.$$.fragment),Oa=h(),Ie=a("div"),v(it.$$.fragment),Ka=h(),dt=a("p"),es=l("Instantiate a "),Dt=a("a"),ts=l("AltCLIPConfig"),os=l(` (or a derived class) from altclip text model configuration and altclip vision
model configuration.`),Pn=h(),Y=a("h2"),we=a("a"),Eo=a("span"),v(ct.$$.fragment),ns=h(),Uo=a("span"),as=l("AltCLIPTextConfig"),An=h(),k=a("div"),v(pt.$$.fragment),ss=h(),O=a("p"),rs=l("This is the configuration class to store the configuration of a "),Yt=a("a"),ls=l("AltCLIPTextModel"),is=l(`. It is used to instantiate a
AltCLIP text model according to the specified arguments, defining the model architecture. Instantiating a
configuration with the defaults will yield a similar configuration to that of the AltCLIP
`),mt=a("a"),ds=l("BAAI/AltCLIP"),cs=l(" architecture."),ps=h(),K=a("p"),ms=l("Configuration objects inherit from "),Ot=a("a"),fs=l("PretrainedConfig"),hs=l(` and can be used to control the model outputs. Read the
documentation from `),Kt=a("a"),us=l("PretrainedConfig"),gs=l(" for more information."),_s=h(),v(Te.$$.fragment),$n=h(),ee=a("h2"),Pe=a("a"),Bo=a("span"),v(ft.$$.fragment),bs=h(),zo=a("span"),Ms=l("AltCLIPVisionConfig"),Ln=h(),E=a("div"),v(ht.$$.fragment),vs=h(),te=a("p"),ys=l("This is the configuration class to store the configuration of a "),eo=a("a"),Cs=l("AltCLIPModel"),Is=l(`. It is used to instantiate an
AltCLIP model according to the specified arguments, defining the model architecture. Instantiating a configuration
with the defaults will yield a similar configuration to that of the AltCLIP
`),ut=a("a"),ws=l("BAAI/AltCLIP"),Ts=l(" architecture."),Ps=h(),oe=a("p"),As=l("Configuration objects inherit from "),to=a("a"),$s=l("PretrainedConfig"),Ls=l(` and can be used to control the model outputs. Read the
documentation from `),oo=a("a"),Js=l("PretrainedConfig"),xs=l(" for more information."),js=h(),v(Ae.$$.fragment),Jn=h(),ne=a("h2"),$e=a("a"),Wo=a("span"),v(gt.$$.fragment),ks=h(),Zo=a("span"),Es=l("AltCLIPProcessor"),xn=h(),J=a("div"),v(_t.$$.fragment),Us=h(),Vo=a("p"),Bs=l(`Constructs a AltCLIP processor which wraps a CLIP image processor and a XLM-Roberta tokenizer into a single
processor.`),zs=h(),j=a("p"),no=a("a"),Ws=l("AltCLIPProcessor"),Zs=l(" offers all the functionalities of "),ao=a("a"),Vs=l("CLIPImageProcessor"),Ns=l(" and "),so=a("a"),Qs=l("XLMRobertaTokenizerFast"),Gs=l(`. See
the `),No=a("code"),Rs=l("__call__()"),Fs=l(" and "),ro=a("a"),Hs=l("decode()"),Xs=l(" for more information."),qs=h(),Le=a("div"),v(bt.$$.fragment),Ss=h(),Mt=a("p"),Ds=l("This method forwards all its arguments to XLMRobertaTokenizerFast\u2019s "),lo=a("a"),Ys=l("batch_decode()"),Os=l(`.
Please refer to the docstring of this method for more information.`),Ks=h(),Je=a("div"),v(vt.$$.fragment),er=h(),yt=a("p"),tr=l("This method forwards all its arguments to XLMRobertaTokenizerFast\u2019s "),io=a("a"),or=l("decode()"),nr=l(`. Please
refer to the docstring of this method for more information.`),jn=h(),ae=a("h2"),xe=a("a"),Qo=a("span"),v(Ct.$$.fragment),ar=h(),Go=a("span"),sr=l("AltCLIPModel"),kn=h(),U=a("div"),v(It.$$.fragment),rr=h(),B=a("div"),v(wt.$$.fragment),lr=h(),se=a("p"),ir=l("The "),co=a("a"),dr=l("AltCLIPModel"),cr=l(" forward method, overrides the "),Ro=a("code"),pr=l("__call__"),mr=l(" special method."),fr=h(),v(je.$$.fragment),hr=h(),v(ke.$$.fragment),ur=h(),z=a("div"),v(Tt.$$.fragment),gr=h(),re=a("p"),_r=l("The "),po=a("a"),br=l("AltCLIPModel"),Mr=l(" forward method, overrides the "),Fo=a("code"),vr=l("__call__"),yr=l(" special method."),Cr=h(),v(Ee.$$.fragment),Ir=h(),v(Ue.$$.fragment),wr=h(),W=a("div"),v(Pt.$$.fragment),Tr=h(),le=a("p"),Pr=l("The "),mo=a("a"),Ar=l("AltCLIPModel"),$r=l(" forward method, overrides the "),Ho=a("code"),Lr=l("__call__"),Jr=l(" special method."),xr=h(),v(Be.$$.fragment),jr=h(),v(ze.$$.fragment),En=h(),ie=a("h2"),We=a("a"),Xo=a("span"),v(At.$$.fragment),kr=h(),qo=a("span"),Er=l("AltCLIPTextModel"),Un=h(),de=a("div"),v($t.$$.fragment),Ur=h(),Z=a("div"),v(Lt.$$.fragment),Br=h(),ce=a("p"),zr=l("The "),fo=a("a"),Wr=l("AltCLIPTextModel"),Zr=l(" forward method, overrides the "),So=a("code"),Vr=l("__call__"),Nr=l(" special method."),Qr=h(),v(Ze.$$.fragment),Gr=h(),v(Ve.$$.fragment),Bn=h(),pe=a("h2"),Ne=a("a"),Do=a("span"),v(Jt.$$.fragment),Rr=h(),Yo=a("span"),Fr=l("AltCLIPVisionModel"),zn=h(),me=a("div"),v(xt.$$.fragment),Hr=h(),V=a("div"),v(jt.$$.fragment),Xr=h(),fe=a("p"),qr=l("The "),ho=a("a"),Sr=l("AltCLIPVisionModel"),Dr=l(" forward method, overrides the "),Oo=a("code"),Yr=l("__call__"),Or=l(" special method."),Kr=h(),v(Qe.$$.fragment),el=h(),v(Ge.$$.fragment),this.h()},l(t){const f=gi('[data-svelte="svelte-1phssyn"]',document.head);d=s(f,"META",{name:!0,content:!0}),f.forEach(o),M=u(t),g=s(t,"H1",{class:!0});var kt=r(g);m=s(kt,"A",{id:!0,class:!0,href:!0});var Ko=r(m);b=s(Ko,"SPAN",{});var en=r(b);y(n.$$.fragment,en),en.forEach(o),Ko.forEach(o),c=u(kt),A=s(kt,"SPAN",{});var tn=r(A);aa=i(tn,"AltCLIP"),tn.forEach(o),kt.forEach(o),pn=u(t),H=s(t,"H2",{class:!0});var Et=r(H);ue=s(Et,"A",{id:!0,class:!0,href:!0});var on=r(ue);Po=s(on,"SPAN",{});var nn=r(Po);y(et.$$.fragment,nn),nn.forEach(o),on.forEach(o),sa=u(Et),Ao=s(Et,"SPAN",{});var an=r(Ao);ra=i(an,"Overview"),an.forEach(o),Et.forEach(o),mn=u(t),ge=s(t,"P",{});var Ut=r(ge);la=i(Ut,"The AltCLIP model was proposed in "),tt=s(Ut,"A",{href:!0,rel:!0});var sn=r(tt);ia=i(sn,"AltCLIP: Altering the Language Encoder in CLIP for Extended Language Capabilities"),sn.forEach(o),da=i(Ut,` by Zhongzhi Chen, Guang Liu, Bo-Wen Zhang, Fulong Ye, Qinghong Yang, Ledell Wu. AltCLIP
(Altering the Language Encoder in CLIP) is a neural network trained on a variety of image-text and text-text pairs. By switching CLIP\u2019s
text encoder with a pretrained multilingual text encoder XLM-R, we could obtain very close performances with CLIP on almost all tasks, and extended original CLIP\u2019s capabilities such as multilingual understanding.`),Ut.forEach(o),fn=u(t),Bt=s(t,"P",{});var rn=r(Bt);ca=i(rn,"The abstract from the paper is the following:"),rn.forEach(o),hn=u(t),zt=s(t,"P",{});var ln=r(zt);$o=s(ln,"EM",{});var dn=r($o);pa=i(dn,`In this work, we present a conceptually simple and effective method to train a strong bilingual multimodal representation model.
Starting from the pretrained multimodal representation model CLIP released by OpenAI, we switched its text encoder with a pretrained
multilingual text encoder XLM-R, and aligned both languages and image representations by a two-stage training schema consisting of
teacher learning and contrastive learning. We validate our method through evaluations of a wide range of tasks. We set new state-of-the-art
performances on a bunch of tasks including ImageNet-CN, Flicker30k- CN, and COCO-CN. Further, we obtain very close performances with
CLIP on almost all tasks, suggesting that one can simply alter the text encoder in CLIP for extended capabilities such as multilingual understanding.`),dn.forEach(o),ln.forEach(o),un=u(t),X=s(t,"H2",{class:!0});var Zn=r(X);_e=s(Zn,"A",{id:!0,class:!0,href:!0});var tl=r(_e);Lo=s(tl,"SPAN",{});var ol=r(Lo);y(ot.$$.fragment,ol),ol.forEach(o),tl.forEach(o),ma=u(Zn),Jo=s(Zn,"SPAN",{});var nl=r(Jo);fa=i(nl,"Usage"),nl.forEach(o),Zn.forEach(o),gn=u(t),Wt=s(t,"P",{});var al=r(Wt);ha=i(al,`The usage of AltCLIP is very similar to the CLIP. the difference between CLIP is the text encoder. Note that we use bidirectional attention instead of casual attention
and we take the [CLS] token in XLM-R to represent text embedding.`),al.forEach(o),_n=u(t),Zt=s(t,"P",{});var sl=r(Zt);ua=i(sl,`AltCLIP is a multi-modal vision and language model. It can be used for image-text similarity and for zero-shot image
classification. AltCLIP uses a ViT like transformer to get visual features and a bidirectional 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.`),sl.forEach(o),bn=u(t),be=s(t,"P",{});var Vn=r(be);ga=i(Vn,`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 `),Vt=s(Vn,"A",{href:!0});var rl=r(Vt);_a=i(rl,"CLIPImageProcessor"),rl.forEach(o),ba=i(Vn," can be used to resize (or rescale) and normalize images for the model."),Vn.forEach(o),Mn=u(t),$=s(t,"P",{});var N=r($);Ma=i(N,"The "),Nt=s(N,"A",{href:!0});var ll=r(Nt);va=i(ll,"AltCLIPProcessor"),ll.forEach(o),ya=i(N," wraps a "),Qt=s(N,"A",{href:!0});var il=r(Qt);Ca=i(il,"CLIPImageProcessor"),il.forEach(o),Ia=i(N," and a "),Gt=s(N,"A",{href:!0});var dl=r(Gt);wa=i(dl,"XLMRobertaTokenizer"),dl.forEach(o),Ta=i(N,` 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
`),Rt=s(N,"A",{href:!0});var cl=r(Rt);Pa=i(cl,"AltCLIPProcessor"),cl.forEach(o),Aa=i(N," and "),Ft=s(N,"A",{href:!0});var pl=r(Ft);$a=i(pl,"AltCLIPModel"),pl.forEach(o),La=i(N,"."),N.forEach(o),vn=u(t),y(nt.$$.fragment,t),yn=u(t),Ht=s(t,"P",{});var ml=r(Ht);Ja=i(ml,"Tips:"),ml.forEach(o),Cn=u(t),Me=s(t,"P",{});var Nn=r(Me);xa=i(Nn,"This model is build on "),xo=s(Nn,"CODE",{});var fl=r(xo);ja=i(fl,"CLIPModel"),fl.forEach(o),ka=i(Nn,", so use it like a original CLIP."),Nn.forEach(o),In=u(t),ve=s(t,"P",{});var Qn=r(ve);Ea=i(Qn,"This model was contributed by "),at=s(Qn,"A",{href:!0,rel:!0});var hl=r(at);Ua=i(hl,"jongjyh"),hl.forEach(o),Ba=i(Qn,"."),Qn.forEach(o),wn=u(t),q=s(t,"H2",{class:!0});var Gn=r(q);ye=s(Gn,"A",{id:!0,class:!0,href:!0});var ul=r(ye);jo=s(ul,"SPAN",{});var gl=r(jo);y(st.$$.fragment,gl),gl.forEach(o),ul.forEach(o),za=u(Gn),ko=s(Gn,"SPAN",{});var _l=r(ko);Wa=i(_l,"AltCLIPConfig"),_l.forEach(o),Gn.forEach(o),Tn=u(t),L=s(t,"DIV",{class:!0});var G=r(L);y(rt.$$.fragment,G),Za=u(G),S=s(G,"P",{});var uo=r(S);Va=i(uo,"This is the configuration class to store the configuration of a "),Xt=s(uo,"A",{href:!0});var bl=r(Xt);Na=i(bl,"AltCLIPModel"),bl.forEach(o),Qa=i(uo,`. It is used to instantiate an
AltCLIP model according to the specified arguments, defining the model architecture. Instantiating a configuration
with the defaults will yield a similar configuration to that of the AltCLIP
`),lt=s(uo,"A",{href:!0,rel:!0});var Ml=r(lt);Ga=i(Ml,"BAAI/AltCLIP"),Ml.forEach(o),Ra=i(uo," architecture."),uo.forEach(o),Fa=u(G),D=s(G,"P",{});var go=r(D);Ha=i(go,"Configuration objects inherit from "),qt=s(go,"A",{href:!0});var vl=r(qt);Xa=i(vl,"PretrainedConfig"),vl.forEach(o),qa=i(go,` and can be used to control the model outputs. Read the
documentation from `),St=s(go,"A",{href:!0});var yl=r(St);Sa=i(yl,"PretrainedConfig"),yl.forEach(o),Da=i(go," for more information."),go.forEach(o),Ya=u(G),y(Ce.$$.fragment,G),Oa=u(G),Ie=s(G,"DIV",{class:!0});var Rn=r(Ie);y(it.$$.fragment,Rn),Ka=u(Rn),dt=s(Rn,"P",{});var Fn=r(dt);es=i(Fn,"Instantiate a "),Dt=s(Fn,"A",{href:!0});var Cl=r(Dt);ts=i(Cl,"AltCLIPConfig"),Cl.forEach(o),os=i(Fn,` (or a derived class) from altclip text model configuration and altclip vision
model configuration.`),Fn.forEach(o),Rn.forEach(o),G.forEach(o),Pn=u(t),Y=s(t,"H2",{class:!0});var Hn=r(Y);we=s(Hn,"A",{id:!0,class:!0,href:!0});var Il=r(we);Eo=s(Il,"SPAN",{});var wl=r(Eo);y(ct.$$.fragment,wl),wl.forEach(o),Il.forEach(o),ns=u(Hn),Uo=s(Hn,"SPAN",{});var Tl=r(Uo);as=i(Tl,"AltCLIPTextConfig"),Tl.forEach(o),Hn.forEach(o),An=u(t),k=s(t,"DIV",{class:!0});var Re=r(k);y(pt.$$.fragment,Re),ss=u(Re),O=s(Re,"P",{});var _o=r(O);rs=i(_o,"This is the configuration class to store the configuration of a "),Yt=s(_o,"A",{href:!0});var Pl=r(Yt);ls=i(Pl,"AltCLIPTextModel"),Pl.forEach(o),is=i(_o,`. It is used to instantiate a
AltCLIP text model according to the specified arguments, defining the model architecture. Instantiating a
configuration with the defaults will yield a similar configuration to that of the AltCLIP
`),mt=s(_o,"A",{href:!0,rel:!0});var Al=r(mt);ds=i(Al,"BAAI/AltCLIP"),Al.forEach(o),cs=i(_o," architecture."),_o.forEach(o),ps=u(Re),K=s(Re,"P",{});var bo=r(K);ms=i(bo,"Configuration objects inherit from "),Ot=s(bo,"A",{href:!0});var $l=r(Ot);fs=i($l,"PretrainedConfig"),$l.forEach(o),hs=i(bo,` and can be used to control the model outputs. Read the
documentation from `),Kt=s(bo,"A",{href:!0});var Ll=r(Kt);us=i(Ll,"PretrainedConfig"),Ll.forEach(o),gs=i(bo," for more information."),bo.forEach(o),_s=u(Re),y(Te.$$.fragment,Re),Re.forEach(o),$n=u(t),ee=s(t,"H2",{class:!0});var Xn=r(ee);Pe=s(Xn,"A",{id:!0,class:!0,href:!0});var Jl=r(Pe);Bo=s(Jl,"SPAN",{});var xl=r(Bo);y(ft.$$.fragment,xl),xl.forEach(o),Jl.forEach(o),bs=u(Xn),zo=s(Xn,"SPAN",{});var jl=r(zo);Ms=i(jl,"AltCLIPVisionConfig"),jl.forEach(o),Xn.forEach(o),Ln=u(t),E=s(t,"DIV",{class:!0});var Fe=r(E);y(ht.$$.fragment,Fe),vs=u(Fe),te=s(Fe,"P",{});var Mo=r(te);ys=i(Mo,"This is the configuration class to store the configuration of a "),eo=s(Mo,"A",{href:!0});var kl=r(eo);Cs=i(kl,"AltCLIPModel"),kl.forEach(o),Is=i(Mo,`. It is used to instantiate an
AltCLIP model according to the specified arguments, defining the model architecture. Instantiating a configuration
with the defaults will yield a similar configuration to that of the AltCLIP
`),ut=s(Mo,"A",{href:!0,rel:!0});var El=r(ut);ws=i(El,"BAAI/AltCLIP"),El.forEach(o),Ts=i(Mo," architecture."),Mo.forEach(o),Ps=u(Fe),oe=s(Fe,"P",{});var vo=r(oe);As=i(vo,"Configuration objects inherit from "),to=s(vo,"A",{href:!0});var Ul=r(to);$s=i(Ul,"PretrainedConfig"),Ul.forEach(o),Ls=i(vo,` and can be used to control the model outputs. Read the
documentation from `),oo=s(vo,"A",{href:!0});var Bl=r(oo);Js=i(Bl,"PretrainedConfig"),Bl.forEach(o),xs=i(vo," for more information."),vo.forEach(o),js=u(Fe),y(Ae.$$.fragment,Fe),Fe.forEach(o),Jn=u(t),ne=s(t,"H2",{class:!0});var qn=r(ne);$e=s(qn,"A",{id:!0,class:!0,href:!0});var zl=r($e);Wo=s(zl,"SPAN",{});var Wl=r(Wo);y(gt.$$.fragment,Wl),Wl.forEach(o),zl.forEach(o),ks=u(qn),Zo=s(qn,"SPAN",{});var Zl=r(Zo);Es=i(Zl,"AltCLIPProcessor"),Zl.forEach(o),qn.forEach(o),xn=u(t),J=s(t,"DIV",{class:!0});var R=r(J);y(_t.$$.fragment,R),Us=u(R),Vo=s(R,"P",{});var Vl=r(Vo);Bs=i(Vl,`Constructs a AltCLIP processor which wraps a CLIP image processor and a XLM-Roberta tokenizer into a single
processor.`),Vl.forEach(o),zs=u(R),j=s(R,"P",{});var Q=r(j);no=s(Q,"A",{href:!0});var Nl=r(no);Ws=i(Nl,"AltCLIPProcessor"),Nl.forEach(o),Zs=i(Q," offers all the functionalities of "),ao=s(Q,"A",{href:!0});var Ql=r(ao);Vs=i(Ql,"CLIPImageProcessor"),Ql.forEach(o),Ns=i(Q," and "),so=s(Q,"A",{href:!0});var Gl=r(so);Qs=i(Gl,"XLMRobertaTokenizerFast"),Gl.forEach(o),Gs=i(Q,`. See
the `),No=s(Q,"CODE",{});var Rl=r(No);Rs=i(Rl,"__call__()"),Rl.forEach(o),Fs=i(Q," and "),ro=s(Q,"A",{href:!0});var Fl=r(ro);Hs=i(Fl,"decode()"),Fl.forEach(o),Xs=i(Q," for more information."),Q.forEach(o),qs=u(R),Le=s(R,"DIV",{class:!0});var Sn=r(Le);y(bt.$$.fragment,Sn),Ss=u(Sn),Mt=s(Sn,"P",{});var Dn=r(Mt);Ds=i(Dn,"This method forwards all its arguments to XLMRobertaTokenizerFast\u2019s "),lo=s(Dn,"A",{href:!0});var Hl=r(lo);Ys=i(Hl,"batch_decode()"),Hl.forEach(o),Os=i(Dn,`.
Please refer to the docstring of this method for more information.`),Dn.forEach(o),Sn.forEach(o),Ks=u(R),Je=s(R,"DIV",{class:!0});var Yn=r(Je);y(vt.$$.fragment,Yn),er=u(Yn),yt=s(Yn,"P",{});var On=r(yt);tr=i(On,"This method forwards all its arguments to XLMRobertaTokenizerFast\u2019s "),io=s(On,"A",{href:!0});var Xl=r(io);or=i(Xl,"decode()"),Xl.forEach(o),nr=i(On,`. Please
refer to the docstring of this method for more information.`),On.forEach(o),Yn.forEach(o),R.forEach(o),jn=u(t),ae=s(t,"H2",{class:!0});var Kn=r(ae);xe=s(Kn,"A",{id:!0,class:!0,href:!0});var ql=r(xe);Qo=s(ql,"SPAN",{});var Sl=r(Qo);y(Ct.$$.fragment,Sl),Sl.forEach(o),ql.forEach(o),ar=u(Kn),Go=s(Kn,"SPAN",{});var Dl=r(Go);sr=i(Dl,"AltCLIPModel"),Dl.forEach(o),Kn.forEach(o),kn=u(t),U=s(t,"DIV",{class:!0});var He=r(U);y(It.$$.fragment,He),rr=u(He),B=s(He,"DIV",{class:!0});var Xe=r(B);y(wt.$$.fragment,Xe),lr=u(Xe),se=s(Xe,"P",{});var yo=r(se);ir=i(yo,"The "),co=s(yo,"A",{href:!0});var Yl=r(co);dr=i(Yl,"AltCLIPModel"),Yl.forEach(o),cr=i(yo," forward method, overrides the "),Ro=s(yo,"CODE",{});var Ol=r(Ro);pr=i(Ol,"__call__"),Ol.forEach(o),mr=i(yo," special method."),yo.forEach(o),fr=u(Xe),y(je.$$.fragment,Xe),hr=u(Xe),y(ke.$$.fragment,Xe),Xe.forEach(o),ur=u(He),z=s(He,"DIV",{class:!0});var qe=r(z);y(Tt.$$.fragment,qe),gr=u(qe),re=s(qe,"P",{});var Co=r(re);_r=i(Co,"The "),po=s(Co,"A",{href:!0});var Kl=r(po);br=i(Kl,"AltCLIPModel"),Kl.forEach(o),Mr=i(Co," forward method, overrides the "),Fo=s(Co,"CODE",{});var ei=r(Fo);vr=i(ei,"__call__"),ei.forEach(o),yr=i(Co," special method."),Co.forEach(o),Cr=u(qe),y(Ee.$$.fragment,qe),Ir=u(qe),y(Ue.$$.fragment,qe),qe.forEach(o),wr=u(He),W=s(He,"DIV",{class:!0});var Se=r(W);y(Pt.$$.fragment,Se),Tr=u(Se),le=s(Se,"P",{});var Io=r(le);Pr=i(Io,"The "),mo=s(Io,"A",{href:!0});var ti=r(mo);Ar=i(ti,"AltCLIPModel"),ti.forEach(o),$r=i(Io," forward method, overrides the "),Ho=s(Io,"CODE",{});var oi=r(Ho);Lr=i(oi,"__call__"),oi.forEach(o),Jr=i(Io," special method."),Io.forEach(o),xr=u(Se),y(Be.$$.fragment,Se),jr=u(Se),y(ze.$$.fragment,Se),Se.forEach(o),He.forEach(o),En=u(t),ie=s(t,"H2",{class:!0});var ea=r(ie);We=s(ea,"A",{id:!0,class:!0,href:!0});var ni=r(We);Xo=s(ni,"SPAN",{});var ai=r(Xo);y(At.$$.fragment,ai),ai.forEach(o),ni.forEach(o),kr=u(ea),qo=s(ea,"SPAN",{});var si=r(qo);Er=i(si,"AltCLIPTextModel"),si.forEach(o),ea.forEach(o),Un=u(t),de=s(t,"DIV",{class:!0});var ta=r(de);y($t.$$.fragment,ta),Ur=u(ta),Z=s(ta,"DIV",{class:!0});var De=r(Z);y(Lt.$$.fragment,De),Br=u(De),ce=s(De,"P",{});var wo=r(ce);zr=i(wo,"The "),fo=s(wo,"A",{href:!0});var ri=r(fo);Wr=i(ri,"AltCLIPTextModel"),ri.forEach(o),Zr=i(wo," forward method, overrides the "),So=s(wo,"CODE",{});var li=r(So);Vr=i(li,"__call__"),li.forEach(o),Nr=i(wo," special method."),wo.forEach(o),Qr=u(De),y(Ze.$$.fragment,De),Gr=u(De),y(Ve.$$.fragment,De),De.forEach(o),ta.forEach(o),Bn=u(t),pe=s(t,"H2",{class:!0});var oa=r(pe);Ne=s(oa,"A",{id:!0,class:!0,href:!0});var ii=r(Ne);Do=s(ii,"SPAN",{});var di=r(Do);y(Jt.$$.fragment,di),di.forEach(o),ii.forEach(o),Rr=u(oa),Yo=s(oa,"SPAN",{});var ci=r(Yo);Fr=i(ci,"AltCLIPVisionModel"),ci.forEach(o),oa.forEach(o),zn=u(t),me=s(t,"DIV",{class:!0});var na=r(me);y(xt.$$.fragment,na),Hr=u(na),V=s(na,"DIV",{class:!0});var Ye=r(V);y(jt.$$.fragment,Ye),Xr=u(Ye),fe=s(Ye,"P",{});var To=r(fe);qr=i(To,"The "),ho=s(To,"A",{href:!0});var pi=r(ho);Sr=i(pi,"AltCLIPVisionModel"),pi.forEach(o),Dr=i(To," forward method, overrides the "),Oo=s(To,"CODE",{});var mi=r(Oo);Yr=i(mi,"__call__"),mi.forEach(o),Or=i(To," special method."),To.forEach(o),Kr=u(Ye),y(Qe.$$.fragment,Ye),el=u(Ye),y(Ge.$$.fragment,Ye),Ye.forEach(o),na.forEach(o),this.h()},h(){p(d,"name","hf:doc:metadata"),p(d,"content",JSON.stringify(ji)),p(m,"id","altclip"),p(m,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),p(m,"href","#altclip"),p(g,"class","relative group"),p(ue,"id","overview"),p(ue,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),p(ue,"href","#overview"),p(H,"class","relative group"),p(tt,"href","https://arxiv.org/abs/2211.06679v2"),p(tt,"rel","nofollow"),p(_e,"id","usage"),p(_e,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),p(_e,"href","#usage"),p(X,"class","relative group"),p(Vt,"href","/docs/transformers/main/en/model_doc/clip#transformers.CLIPImageProcessor"),p(Nt,"href","/docs/transformers/main/en/model_doc/altclip#transformers.AltCLIPProcessor"),p(Qt,"href","/docs/transformers/main/en/model_doc/clip#transformers.CLIPImageProcessor"),p(Gt,"href","/docs/transformers/main/en/model_doc/xlm-roberta#transformers.XLMRobertaTokenizer"),p(Rt,"href","/docs/transformers/main/en/model_doc/altclip#transformers.AltCLIPProcessor"),p(Ft,"href","/docs/transformers/main/en/model_doc/altclip#transformers.AltCLIPModel"),p(at,"href","https://huggingface.co/jongjyh"),p(at,"rel","nofollow"),p(ye,"id","transformers.AltCLIPConfig"),p(ye,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),p(ye,"href","#transformers.AltCLIPConfig"),p(q,"class","relative group"),p(Xt,"href","/docs/transformers/main/en/model_doc/altclip#transformers.AltCLIPModel"),p(lt,"href","https://huggingface.co/BAAI/AltCLIP"),p(lt,"rel","nofollow"),p(qt,"href","/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig"),p(St,"href","/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig"),p(Dt,"href","/docs/transformers/main/en/model_doc/altclip#transformers.AltCLIPConfig"),p(Ie,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(L,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(we,"id","transformers.AltCLIPTextConfig"),p(we,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),p(we,"href","#transformers.AltCLIPTextConfig"),p(Y,"class","relative group"),p(Yt,"href","/docs/transformers/main/en/model_doc/altclip#transformers.AltCLIPTextModel"),p(mt,"href","https://huggingface.co/BAAI/AltCLIP"),p(mt,"rel","nofollow"),p(Ot,"href","/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig"),p(Kt,"href","/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig"),p(k,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(Pe,"id","transformers.AltCLIPVisionConfig"),p(Pe,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),p(Pe,"href","#transformers.AltCLIPVisionConfig"),p(ee,"class","relative group"),p(eo,"href","/docs/transformers/main/en/model_doc/altclip#transformers.AltCLIPModel"),p(ut,"href","https://huggingface.co/BAAI/AltCLIP"),p(ut,"rel","nofollow"),p(to,"href","/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig"),p(oo,"href","/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig"),p(E,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p($e,"id","transformers.AltCLIPProcessor"),p($e,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),p($e,"href","#transformers.AltCLIPProcessor"),p(ne,"class","relative group"),p(no,"href","/docs/transformers/main/en/model_doc/altclip#transformers.AltCLIPProcessor"),p(ao,"href","/docs/transformers/main/en/model_doc/clip#transformers.CLIPImageProcessor"),p(so,"href","/docs/transformers/main/en/model_doc/xlm-roberta#transformers.XLMRobertaTokenizerFast"),p(ro,"href","/docs/transformers/main/en/model_doc/altclip#transformers.AltCLIPProcessor.decode"),p(lo,"href","/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.batch_decode"),p(Le,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(io,"href","/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.decode"),p(Je,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(J,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(xe,"id","transformers.AltCLIPModel"),p(xe,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),p(xe,"href","#transformers.AltCLIPModel"),p(ae,"class","relative group"),p(co,"href","/docs/transformers/main/en/model_doc/altclip#transformers.AltCLIPModel"),p(B,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(po,"href","/docs/transformers/main/en/model_doc/altclip#transformers.AltCLIPModel"),p(z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(mo,"href","/docs/transformers/main/en/model_doc/altclip#transformers.AltCLIPModel"),p(W,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(U,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(We,"id","transformers.AltCLIPTextModel"),p(We,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),p(We,"href","#transformers.AltCLIPTextModel"),p(ie,"class","relative group"),p(fo,"href","/docs/transformers/main/en/model_doc/altclip#transformers.AltCLIPTextModel"),p(Z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(de,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(Ne,"id","transformers.AltCLIPVisionModel"),p(Ne,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),p(Ne,"href","#transformers.AltCLIPVisionModel"),p(pe,"class","relative group"),p(ho,"href","/docs/transformers/main/en/model_doc/altclip#transformers.AltCLIPVisionModel"),p(V,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(me,"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,f){e(document.head,d),_(t,M,f),_(t,g,f),e(g,m),e(m,b),C(n,b,null),e(g,c),e(g,A),e(A,aa),_(t,pn,f),_(t,H,f),e(H,ue),e(ue,Po),C(et,Po,null),e(H,sa),e(H,Ao),e(Ao,ra),_(t,mn,f),_(t,ge,f),e(ge,la),e(ge,tt),e(tt,ia),e(ge,da),_(t,fn,f),_(t,Bt,f),e(Bt,ca),_(t,hn,f),_(t,zt,f),e(zt,$o),e($o,pa),_(t,un,f),_(t,X,f),e(X,_e),e(_e,Lo),C(ot,Lo,null),e(X,ma),e(X,Jo),e(Jo,fa),_(t,gn,f),_(t,Wt,f),e(Wt,ha),_(t,_n,f),_(t,Zt,f),e(Zt,ua),_(t,bn,f),_(t,be,f),e(be,ga),e(be,Vt),e(Vt,_a),e(be,ba),_(t,Mn,f),_(t,$,f),e($,Ma),e($,Nt),e(Nt,va),e($,ya),e($,Qt),e(Qt,Ca),e($,Ia),e($,Gt),e(Gt,wa),e($,Ta),e($,Rt),e(Rt,Pa),e($,Aa),e($,Ft),e(Ft,$a),e($,La),_(t,vn,f),C(nt,t,f),_(t,yn,f),_(t,Ht,f),e(Ht,Ja),_(t,Cn,f),_(t,Me,f),e(Me,xa),e(Me,xo),e(xo,ja),e(Me,ka),_(t,In,f),_(t,ve,f),e(ve,Ea),e(ve,at),e(at,Ua),e(ve,Ba),_(t,wn,f),_(t,q,f),e(q,ye),e(ye,jo),C(st,jo,null),e(q,za),e(q,ko),e(ko,Wa),_(t,Tn,f),_(t,L,f),C(rt,L,null),e(L,Za),e(L,S),e(S,Va),e(S,Xt),e(Xt,Na),e(S,Qa),e(S,lt),e(lt,Ga),e(S,Ra),e(L,Fa),e(L,D),e(D,Ha),e(D,qt),e(qt,Xa),e(D,qa),e(D,St),e(St,Sa),e(D,Da),e(L,Ya),C(Ce,L,null),e(L,Oa),e(L,Ie),C(it,Ie,null),e(Ie,Ka),e(Ie,dt),e(dt,es),e(dt,Dt),e(Dt,ts),e(dt,os),_(t,Pn,f),_(t,Y,f),e(Y,we),e(we,Eo),C(ct,Eo,null),e(Y,ns),e(Y,Uo),e(Uo,as),_(t,An,f),_(t,k,f),C(pt,k,null),e(k,ss),e(k,O),e(O,rs),e(O,Yt),e(Yt,ls),e(O,is),e(O,mt),e(mt,ds),e(O,cs),e(k,ps),e(k,K),e(K,ms),e(K,Ot),e(Ot,fs),e(K,hs),e(K,Kt),e(Kt,us),e(K,gs),e(k,_s),C(Te,k,null),_(t,$n,f),_(t,ee,f),e(ee,Pe),e(Pe,Bo),C(ft,Bo,null),e(ee,bs),e(ee,zo),e(zo,Ms),_(t,Ln,f),_(t,E,f),C(ht,E,null),e(E,vs),e(E,te),e(te,ys),e(te,eo),e(eo,Cs),e(te,Is),e(te,ut),e(ut,ws),e(te,Ts),e(E,Ps),e(E,oe),e(oe,As),e(oe,to),e(to,$s),e(oe,Ls),e(oe,oo),e(oo,Js),e(oe,xs),e(E,js),C(Ae,E,null),_(t,Jn,f),_(t,ne,f),e(ne,$e),e($e,Wo),C(gt,Wo,null),e(ne,ks),e(ne,Zo),e(Zo,Es),_(t,xn,f),_(t,J,f),C(_t,J,null),e(J,Us),e(J,Vo),e(Vo,Bs),e(J,zs),e(J,j),e(j,no),e(no,Ws),e(j,Zs),e(j,ao),e(ao,Vs),e(j,Ns),e(j,so),e(so,Qs),e(j,Gs),e(j,No),e(No,Rs),e(j,Fs),e(j,ro),e(ro,Hs),e(j,Xs),e(J,qs),e(J,Le),C(bt,Le,null),e(Le,Ss),e(Le,Mt),e(Mt,Ds),e(Mt,lo),e(lo,Ys),e(Mt,Os),e(J,Ks),e(J,Je),C(vt,Je,null),e(Je,er),e(Je,yt),e(yt,tr),e(yt,io),e(io,or),e(yt,nr),_(t,jn,f),_(t,ae,f),e(ae,xe),e(xe,Qo),C(Ct,Qo,null),e(ae,ar),e(ae,Go),e(Go,sr),_(t,kn,f),_(t,U,f),C(It,U,null),e(U,rr),e(U,B),C(wt,B,null),e(B,lr),e(B,se),e(se,ir),e(se,co),e(co,dr),e(se,cr),e(se,Ro),e(Ro,pr),e(se,mr),e(B,fr),C(je,B,null),e(B,hr),C(ke,B,null),e(U,ur),e(U,z),C(Tt,z,null),e(z,gr),e(z,re),e(re,_r),e(re,po),e(po,br),e(re,Mr),e(re,Fo),e(Fo,vr),e(re,yr),e(z,Cr),C(Ee,z,null),e(z,Ir),C(Ue,z,null),e(U,wr),e(U,W),C(Pt,W,null),e(W,Tr),e(W,le),e(le,Pr),e(le,mo),e(mo,Ar),e(le,$r),e(le,Ho),e(Ho,Lr),e(le,Jr),e(W,xr),C(Be,W,null),e(W,jr),C(ze,W,null),_(t,En,f),_(t,ie,f),e(ie,We),e(We,Xo),C(At,Xo,null),e(ie,kr),e(ie,qo),e(qo,Er),_(t,Un,f),_(t,de,f),C($t,de,null),e(de,Ur),e(de,Z),C(Lt,Z,null),e(Z,Br),e(Z,ce),e(ce,zr),e(ce,fo),e(fo,Wr),e(ce,Zr),e(ce,So),e(So,Vr),e(ce,Nr),e(Z,Qr),C(Ze,Z,null),e(Z,Gr),C(Ve,Z,null),_(t,Bn,f),_(t,pe,f),e(pe,Ne),e(Ne,Do),C(Jt,Do,null),e(pe,Rr),e(pe,Yo),e(Yo,Fr),_(t,zn,f),_(t,me,f),C(xt,me,null),e(me,Hr),e(me,V),C(jt,V,null),e(V,Xr),e(V,fe),e(fe,qr),e(fe,ho),e(ho,Sr),e(fe,Dr),e(fe,Oo),e(Oo,Yr),e(fe,Or),e(V,Kr),C(Qe,V,null),e(V,el),C(Ge,V,null),Wn=!0},p(t,[f]){const kt={};f&2&&(kt.$$scope={dirty:f,ctx:t}),Ce.$set(kt);const Ko={};f&2&&(Ko.$$scope={dirty:f,ctx:t}),Te.$set(Ko);const en={};f&2&&(en.$$scope={dirty:f,ctx:t}),Ae.$set(en);const tn={};f&2&&(tn.$$scope={dirty:f,ctx:t}),je.$set(tn);const Et={};f&2&&(Et.$$scope={dirty:f,ctx:t}),ke.$set(Et);const on={};f&2&&(on.$$scope={dirty:f,ctx:t}),Ee.$set(on);const nn={};f&2&&(nn.$$scope={dirty:f,ctx:t}),Ue.$set(nn);const an={};f&2&&(an.$$scope={dirty:f,ctx:t}),Be.$set(an);const Ut={};f&2&&(Ut.$$scope={dirty:f,ctx:t}),ze.$set(Ut);const sn={};f&2&&(sn.$$scope={dirty:f,ctx:t}),Ze.$set(sn);const rn={};f&2&&(rn.$$scope={dirty:f,ctx:t}),Ve.$set(rn);const ln={};f&2&&(ln.$$scope={dirty:f,ctx:t}),Qe.$set(ln);const dn={};f&2&&(dn.$$scope={dirty:f,ctx:t}),Ge.$set(dn)},i(t){Wn||(I(n.$$.fragment,t),I(et.$$.fragment,t),I(ot.$$.fragment,t),I(nt.$$.fragment,t),I(st.$$.fragment,t),I(rt.$$.fragment,t),I(Ce.$$.fragment,t),I(it.$$.fragment,t),I(ct.$$.fragment,t),I(pt.$$.fragment,t),I(Te.$$.fragment,t),I(ft.$$.fragment,t),I(ht.$$.fragment,t),I(Ae.$$.fragment,t),I(gt.$$.fragment,t),I(_t.$$.fragment,t),I(bt.$$.fragment,t),I(vt.$$.fragment,t),I(Ct.$$.fragment,t),I(It.$$.fragment,t),I(wt.$$.fragment,t),I(je.$$.fragment,t),I(ke.$$.fragment,t),I(Tt.$$.fragment,t),I(Ee.$$.fragment,t),I(Ue.$$.fragment,t),I(Pt.$$.fragment,t),I(Be.$$.fragment,t),I(ze.$$.fragment,t),I(At.$$.fragment,t),I($t.$$.fragment,t),I(Lt.$$.fragment,t),I(Ze.$$.fragment,t),I(Ve.$$.fragment,t),I(Jt.$$.fragment,t),I(xt.$$.fragment,t),I(jt.$$.fragment,t),I(Qe.$$.fragment,t),I(Ge.$$.fragment,t),Wn=!0)},o(t){w(n.$$.fragment,t),w(et.$$.fragment,t),w(ot.$$.fragment,t),w(nt.$$.fragment,t),w(st.$$.fragment,t),w(rt.$$.fragment,t),w(Ce.$$.fragment,t),w(it.$$.fragment,t),w(ct.$$.fragment,t),w(pt.$$.fragment,t),w(Te.$$.fragment,t),w(ft.$$.fragment,t),w(ht.$$.fragment,t),w(Ae.$$.fragment,t),w(gt.$$.fragment,t),w(_t.$$.fragment,t),w(bt.$$.fragment,t),w(vt.$$.fragment,t),w(Ct.$$.fragment,t),w(It.$$.fragment,t),w(wt.$$.fragment,t),w(je.$$.fragment,t),w(ke.$$.fragment,t),w(Tt.$$.fragment,t),w(Ee.$$.fragment,t),w(Ue.$$.fragment,t),w(Pt.$$.fragment,t),w(Be.$$.fragment,t),w(ze.$$.fragment,t),w(At.$$.fragment,t),w($t.$$.fragment,t),w(Lt.$$.fragment,t),w(Ze.$$.fragment,t),w(Ve.$$.fragment,t),w(Jt.$$.fragment,t),w(xt.$$.fragment,t),w(jt.$$.fragment,t),w(Qe.$$.fragment,t),w(Ge.$$.fragment,t),Wn=!1},d(t){o(d),t&&o(M),t&&o(g),T(n),t&&o(pn),t&&o(H),T(et),t&&o(mn),t&&o(ge),t&&o(fn),t&&o(Bt),t&&o(hn),t&&o(zt),t&&o(un),t&&o(X),T(ot),t&&o(gn),t&&o(Wt),t&&o(_n),t&&o(Zt),t&&o(bn),t&&o(be),t&&o(Mn),t&&o($),t&&o(vn),T(nt,t),t&&o(yn),t&&o(Ht),t&&o(Cn),t&&o(Me),t&&o(In),t&&o(ve),t&&o(wn),t&&o(q),T(st),t&&o(Tn),t&&o(L),T(rt),T(Ce),T(it),t&&o(Pn),t&&o(Y),T(ct),t&&o(An),t&&o(k),T(pt),T(Te),t&&o($n),t&&o(ee),T(ft),t&&o(Ln),t&&o(E),T(ht),T(Ae),t&&o(Jn),t&&o(ne),T(gt),t&&o(xn),t&&o(J),T(_t),T(bt),T(vt),t&&o(jn),t&&o(ae),T(Ct),t&&o(kn),t&&o(U),T(It),T(wt),T(je),T(ke),T(Tt),T(Ee),T(Ue),T(Pt),T(Be),T(ze),t&&o(En),t&&o(ie),T(At),t&&o(Un),t&&o(de),T($t),T(Lt),T(Ze),T(Ve),t&&o(Bn),t&&o(pe),T(Jt),t&&o(zn),t&&o(me),T(xt),T(jt),T(Qe),T(Ge)}}}const ji={local:"altclip",sections:[{local:"overview",title:"Overview"},{local:"usage",title:"Usage"},{local:"transformers.AltCLIPConfig",title:"AltCLIPConfig"},{local:"transformers.AltCLIPTextConfig",title:"AltCLIPTextConfig"},{local:"transformers.AltCLIPVisionConfig",title:"AltCLIPVisionConfig"},{local:"transformers.AltCLIPProcessor",title:"AltCLIPProcessor"},{local:"transformers.AltCLIPModel",title:"AltCLIPModel"},{local:"transformers.AltCLIPTextModel",title:"AltCLIPTextModel"},{local:"transformers.AltCLIPVisionModel",title:"AltCLIPVisionModel"}],title:"AltCLIP"};function ki(P){return _i(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Vi extends fi{constructor(d){super();hi(this,d,ki,xi,ui,{})}}export{Vi as default,ji as metadata};
