import{S as fi,i as hi,s as ui,e as s,k as h,w as M,t as l,M as gi,c as a,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 vi(P){let d,b,g,m,v;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=s("p"),b=l("Example:"),g=h(),M(m.$$.fragment)},l(n){d=a(n,"P",{});var c=r(d);b=i(c,"Example:"),c.forEach(o),g=u(n),y(m.$$.fragment,n)},m(n,c){_(n,d,c),e(d,b),_(n,g,c),C(m,n,c),v=!0},p:Ke,i(n){v||(I(m.$$.fragment,n),v=!0)},o(n){w(m.$$.fragment,n),v=!1},d(n){n&&o(d),n&&o(g),T(m,n)}}}function bi(P){let d,b,g,m,v;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=s("p"),b=l("Examples:"),g=h(),M(m.$$.fragment)},l(n){d=a(n,"P",{});var c=r(d);b=i(c,"Examples:"),c.forEach(o),g=u(n),y(m.$$.fragment,n)},m(n,c){_(n,d,c),e(d,b),_(n,g,c),C(m,n,c),v=!0},p:Ke,i(n){v||(I(m.$$.fragment,n),v=!0)},o(n){w(m.$$.fragment,n),v=!1},d(n){n&&o(d),n&&o(g),T(m,n)}}}function Mi(P){let d,b,g,m,v;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=s("p"),b=l("Example:"),g=h(),M(m.$$.fragment)},l(n){d=a(n,"P",{});var c=r(d);b=i(c,"Example:"),c.forEach(o),g=u(n),y(m.$$.fragment,n)},m(n,c){_(n,d,c),e(d,b),_(n,g,c),C(m,n,c),v=!0},p:Ke,i(n){v||(I(m.$$.fragment,n),v=!0)},o(n){w(m.$$.fragment,n),v=!1},d(n){n&&o(d),n&&o(g),T(m,n)}}}function yi(P){let d,b,g,m,v;return{c(){d=s("p"),b=l("Although the recipe for forward pass needs to be defined within this function, one should call the "),g=s("code"),m=l("Module"),v=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=a(n,"P",{});var c=r(d);b=i(c,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=a(c,"CODE",{});var A=r(g);m=i(A,"Module"),A.forEach(o),v=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,b),e(d,g),e(g,m),e(d,v)},d(n){n&&o(d)}}}function Ci(P){let d,b,g,m,v;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=s("p"),b=l("Examples:"),g=h(),M(m.$$.fragment)},l(n){d=a(n,"P",{});var c=r(d);b=i(c,"Examples:"),c.forEach(o),g=u(n),y(m.$$.fragment,n)},m(n,c){_(n,d,c),e(d,b),_(n,g,c),C(m,n,c),v=!0},p:Ke,i(n){v||(I(m.$$.fragment,n),v=!0)},o(n){w(m.$$.fragment,n),v=!1},d(n){n&&o(d),n&&o(g),T(m,n)}}}function Ii(P){let d,b,g,m,v;return{c(){d=s("p"),b=l("Although the recipe for forward pass needs to be defined within this function, one should call the "),g=s("code"),m=l("Module"),v=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=a(n,"P",{});var c=r(d);b=i(c,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=a(c,"CODE",{});var A=r(g);m=i(A,"Module"),A.forEach(o),v=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,b),e(d,g),e(g,m),e(d,v)},d(n){n&&o(d)}}}function wi(P){let d,b,g,m,v;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=s("p"),b=l("Examples:"),g=h(),M(m.$$.fragment)},l(n){d=a(n,"P",{});var c=r(d);b=i(c,"Examples:"),c.forEach(o),g=u(n),y(m.$$.fragment,n)},m(n,c){_(n,d,c),e(d,b),_(n,g,c),C(m,n,c),v=!0},p:Ke,i(n){v||(I(m.$$.fragment,n),v=!0)},o(n){w(m.$$.fragment,n),v=!1},d(n){n&&o(d),n&&o(g),T(m,n)}}}function Ti(P){let d,b,g,m,v;return{c(){d=s("p"),b=l("Although the recipe for forward pass needs to be defined within this function, one should call the "),g=s("code"),m=l("Module"),v=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=a(n,"P",{});var c=r(d);b=i(c,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=a(c,"CODE",{});var A=r(g);m=i(A,"Module"),A.forEach(o),v=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,b),e(d,g),e(g,m),e(d,v)},d(n){n&&o(d)}}}function Pi(P){let d,b,g,m,v;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=s("p"),b=l("Examples:"),g=h(),M(m.$$.fragment)},l(n){d=a(n,"P",{});var c=r(d);b=i(c,"Examples:"),c.forEach(o),g=u(n),y(m.$$.fragment,n)},m(n,c){_(n,d,c),e(d,b),_(n,g,c),C(m,n,c),v=!0},p:Ke,i(n){v||(I(m.$$.fragment,n),v=!0)},o(n){w(m.$$.fragment,n),v=!1},d(n){n&&o(d),n&&o(g),T(m,n)}}}function Ai(P){let d,b,g,m,v;return{c(){d=s("p"),b=l("Although the recipe for forward pass needs to be defined within this function, one should call the "),g=s("code"),m=l("Module"),v=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=a(n,"P",{});var c=r(d);b=i(c,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=a(c,"CODE",{});var A=r(g);m=i(A,"Module"),A.forEach(o),v=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,b),e(d,g),e(g,m),e(d,v)},d(n){n&&o(d)}}}function $i(P){let d,b,g,m,v;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=s("p"),b=l("Examples:"),g=h(),M(m.$$.fragment)},l(n){d=a(n,"P",{});var c=r(d);b=i(c,"Examples:"),c.forEach(o),g=u(n),y(m.$$.fragment,n)},m(n,c){_(n,d,c),e(d,b),_(n,g,c),C(m,n,c),v=!0},p:Ke,i(n){v||(I(m.$$.fragment,n),v=!0)},o(n){w(m.$$.fragment,n),v=!1},d(n){n&&o(d),n&&o(g),T(m,n)}}}function Li(P){let d,b,g,m,v;return{c(){d=s("p"),b=l("Although the recipe for forward pass needs to be defined within this function, one should call the "),g=s("code"),m=l("Module"),v=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=a(n,"P",{});var c=r(d);b=i(c,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=a(c,"CODE",{});var A=r(g);m=i(A,"Module"),A.forEach(o),v=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,b),e(d,g),e(g,m),e(d,v)},d(n){n&&o(d)}}}function Ji(P){let d,b,g,m,v;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=s("p"),b=l("Examples:"),g=h(),M(m.$$.fragment)},l(n){d=a(n,"P",{});var c=r(d);b=i(c,"Examples:"),c.forEach(o),g=u(n),y(m.$$.fragment,n)},m(n,c){_(n,d,c),e(d,b),_(n,g,c),C(m,n,c),v=!0},p:Ke,i(n){v||(I(m.$$.fragment,n),v=!0)},o(n){w(m.$$.fragment,n),v=!1},d(n){n&&o(d),n&&o(g),T(m,n)}}}function xi(P){let d,b,g,m,v,n,c,A,ss,pn,H,ue,Po,et,as,Ao,rs,mn,ge,ls,tt,is,ds,fn,Bt,cs,hn,zt,$o,ps,un,X,_e,Lo,ot,ms,Jo,fs,gn,Wt,hs,_n,Zt,us,vn,ve,gs,Vt,_s,vs,bn,$,bs,Nt,Ms,ys,Qt,Cs,Is,Gt,ws,Ts,Rt,Ps,As,Ft,$s,Ls,Mn,nt,yn,Ht,Js,Cn,be,xs,xo,js,ks,In,Me,Es,st,Us,Bs,wn,q,ye,jo,at,zs,ko,Ws,Tn,L,rt,Zs,S,Vs,Xt,Ns,Qs,lt,Gs,Rs,Fs,D,Hs,qt,Xs,qs,St,Ss,Ds,Ys,Ce,Os,Ie,it,Ks,dt,ea,Dt,ta,oa,Pn,Y,we,Eo,ct,na,Uo,sa,An,k,pt,aa,O,ra,Yt,la,ia,mt,da,ca,pa,K,ma,Ot,fa,ha,Kt,ua,ga,_a,Te,$n,ee,Pe,Bo,ft,va,zo,ba,Ln,E,ht,Ma,te,ya,eo,Ca,Ia,ut,wa,Ta,Pa,oe,Aa,to,$a,La,oo,Ja,xa,ja,Ae,Jn,ne,$e,Wo,gt,ka,Zo,Ea,xn,J,_t,Ua,Vo,Ba,za,j,no,Wa,Za,so,Va,Na,ao,Qa,Ga,No,Ra,Fa,ro,Ha,Xa,qa,Le,vt,Sa,bt,Da,lo,Ya,Oa,Ka,Je,Mt,er,yt,tr,io,or,nr,jn,se,xe,Qo,Ct,sr,Go,ar,kn,U,It,rr,B,wt,lr,ae,ir,co,dr,cr,Ro,pr,mr,fr,je,hr,ke,ur,z,Tt,gr,re,_r,po,vr,br,Fo,Mr,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>`}}),at=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/v4.33.0/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/v4.33.0/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/v4.33.0/src/transformers/models/altclip/configuration_altclip.py#L247"}}),Ce=new Oe({props:{anchor:"transformers.AltCLIPConfig.example",$$slots:{default:[vi]},$$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/v4.33.0/src/transformers/models/altclip/configuration_altclip.py#L382",returnDescription:`
<p>An instance of a configuration object</p>
`,returnType:`
<p><a
  href="/docs/transformers/v4.33.0/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/v4.33.0/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/v4.33.0/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/v4.33.0/src/transformers/models/altclip/configuration_altclip.py#L31"}}),Te=new Oe({props:{anchor:"transformers.AltCLIPTextConfig.example",$$slots:{default:[bi]},$$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/v4.33.0/src/transformers/models/altclip/configuration_altclip.py#L141"}}),Ae=new Oe({props:{anchor:"transformers.AltCLIPVisionConfig.example",$$slots:{default:[Mi]},$$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/v4.33.0/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/v4.33.0/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/v4.33.0/src/transformers/models/altclip/processing_altclip.py#L24"}}),vt=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/v4.33.0/src/transformers/models/altclip/processing_altclip.py#L113"}}),Mt=new x({props:{name:"decode",anchor:"transformers.AltCLIPProcessor.decode",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.33.0/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/v4.33.0/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/v4.33.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.33.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.33.0/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/v4.33.0/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <a href="/docs/transformers/v4.33.0/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/v4.33.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/v4.33.0/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/v4.33.0/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/v4.33.0/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/v4.33.0/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/v4.33.0/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/v4.33.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.33.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.33.0/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/v4.33.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/v4.33.0/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/v4.33.0/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/v4.33.0/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <a href="/docs/transformers/v4.33.0/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/v4.33.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/v4.33.0/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/v4.33.0/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/v4.33.0/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/v4.33.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.33.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.33.0/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/v4.33.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/v4.33.0/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/v4.33.0/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/v4.33.0/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <a href="/docs/transformers/v4.33.0/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/v4.33.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/v4.33.0/src/transformers/models/altclip/modeling_altclip.py#L1171",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.33.0/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/v4.33.0/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=s("meta"),b=h(),g=s("h1"),m=s("a"),v=s("span"),M(n.$$.fragment),c=h(),A=s("span"),ss=l("AltCLIP"),pn=h(),H=s("h2"),ue=s("a"),Po=s("span"),M(et.$$.fragment),as=h(),Ao=s("span"),rs=l("Overview"),mn=h(),ge=s("p"),ls=l("The AltCLIP model was proposed in "),tt=s("a"),is=l("AltCLIP: Altering the Language Encoder in CLIP for Extended Language Capabilities"),ds=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=s("p"),cs=l("The abstract from the paper is the following:"),hn=h(),zt=s("p"),$o=s("em"),ps=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=s("h2"),_e=s("a"),Lo=s("span"),M(ot.$$.fragment),ms=h(),Jo=s("span"),fs=l("Usage"),gn=h(),Wt=s("p"),hs=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=s("p"),us=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.`),vn=h(),ve=s("p"),gs=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=s("a"),_s=l("CLIPImageProcessor"),vs=l(" can be used to resize (or rescale) and normalize images for the model."),bn=h(),$=s("p"),bs=l("The "),Nt=s("a"),Ms=l("AltCLIPProcessor"),ys=l(" wraps a "),Qt=s("a"),Cs=l("CLIPImageProcessor"),Is=l(" and a "),Gt=s("a"),ws=l("XLMRobertaTokenizer"),Ts=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=s("a"),Ps=l("AltCLIPProcessor"),As=l(" and "),Ft=s("a"),$s=l("AltCLIPModel"),Ls=l("."),Mn=h(),M(nt.$$.fragment),yn=h(),Ht=s("p"),Js=l("Tips:"),Cn=h(),be=s("p"),xs=l("This model is build on "),xo=s("code"),js=l("CLIPModel"),ks=l(", so use it like a original CLIP."),In=h(),Me=s("p"),Es=l("This model was contributed by "),st=s("a"),Us=l("jongjyh"),Bs=l("."),wn=h(),q=s("h2"),ye=s("a"),jo=s("span"),M(at.$$.fragment),zs=h(),ko=s("span"),Ws=l("AltCLIPConfig"),Tn=h(),L=s("div"),M(rt.$$.fragment),Zs=h(),S=s("p"),Vs=l("This is the configuration class to store the configuration of a "),Xt=s("a"),Ns=l("AltCLIPModel"),Qs=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=s("a"),Gs=l("BAAI/AltCLIP"),Rs=l(" architecture."),Fs=h(),D=s("p"),Hs=l("Configuration objects inherit from "),qt=s("a"),Xs=l("PretrainedConfig"),qs=l(` and can be used to control the model outputs. Read the
documentation from `),St=s("a"),Ss=l("PretrainedConfig"),Ds=l(" for more information."),Ys=h(),M(Ce.$$.fragment),Os=h(),Ie=s("div"),M(it.$$.fragment),Ks=h(),dt=s("p"),ea=l("Instantiate a "),Dt=s("a"),ta=l("AltCLIPConfig"),oa=l(` (or a derived class) from altclip text model configuration and altclip vision
model configuration.`),Pn=h(),Y=s("h2"),we=s("a"),Eo=s("span"),M(ct.$$.fragment),na=h(),Uo=s("span"),sa=l("AltCLIPTextConfig"),An=h(),k=s("div"),M(pt.$$.fragment),aa=h(),O=s("p"),ra=l("This is the configuration class to store the configuration of a "),Yt=s("a"),la=l("AltCLIPTextModel"),ia=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=s("a"),da=l("BAAI/AltCLIP"),ca=l(" architecture."),pa=h(),K=s("p"),ma=l("Configuration objects inherit from "),Ot=s("a"),fa=l("PretrainedConfig"),ha=l(` and can be used to control the model outputs. Read the
documentation from `),Kt=s("a"),ua=l("PretrainedConfig"),ga=l(" for more information."),_a=h(),M(Te.$$.fragment),$n=h(),ee=s("h2"),Pe=s("a"),Bo=s("span"),M(ft.$$.fragment),va=h(),zo=s("span"),ba=l("AltCLIPVisionConfig"),Ln=h(),E=s("div"),M(ht.$$.fragment),Ma=h(),te=s("p"),ya=l("This is the configuration class to store the configuration of a "),eo=s("a"),Ca=l("AltCLIPModel"),Ia=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=s("a"),wa=l("BAAI/AltCLIP"),Ta=l(" architecture."),Pa=h(),oe=s("p"),Aa=l("Configuration objects inherit from "),to=s("a"),$a=l("PretrainedConfig"),La=l(` and can be used to control the model outputs. Read the
documentation from `),oo=s("a"),Ja=l("PretrainedConfig"),xa=l(" for more information."),ja=h(),M(Ae.$$.fragment),Jn=h(),ne=s("h2"),$e=s("a"),Wo=s("span"),M(gt.$$.fragment),ka=h(),Zo=s("span"),Ea=l("AltCLIPProcessor"),xn=h(),J=s("div"),M(_t.$$.fragment),Ua=h(),Vo=s("p"),Ba=l(`Constructs a AltCLIP processor which wraps a CLIP image processor and a XLM-Roberta tokenizer into a single
processor.`),za=h(),j=s("p"),no=s("a"),Wa=l("AltCLIPProcessor"),Za=l(" offers all the functionalities of "),so=s("a"),Va=l("CLIPImageProcessor"),Na=l(" and "),ao=s("a"),Qa=l("XLMRobertaTokenizerFast"),Ga=l(`. See
the `),No=s("code"),Ra=l("__call__()"),Fa=l(" and "),ro=s("a"),Ha=l("decode()"),Xa=l(" for more information."),qa=h(),Le=s("div"),M(vt.$$.fragment),Sa=h(),bt=s("p"),Da=l("This method forwards all its arguments to XLMRobertaTokenizerFast\u2019s "),lo=s("a"),Ya=l("batch_decode()"),Oa=l(`.
Please refer to the docstring of this method for more information.`),Ka=h(),Je=s("div"),M(Mt.$$.fragment),er=h(),yt=s("p"),tr=l("This method forwards all its arguments to XLMRobertaTokenizerFast\u2019s "),io=s("a"),or=l("decode()"),nr=l(`. Please
refer to the docstring of this method for more information.`),jn=h(),se=s("h2"),xe=s("a"),Qo=s("span"),M(Ct.$$.fragment),sr=h(),Go=s("span"),ar=l("AltCLIPModel"),kn=h(),U=s("div"),M(It.$$.fragment),rr=h(),B=s("div"),M(wt.$$.fragment),lr=h(),ae=s("p"),ir=l("The "),co=s("a"),dr=l("AltCLIPModel"),cr=l(" forward method, overrides the "),Ro=s("code"),pr=l("__call__"),mr=l(" special method."),fr=h(),M(je.$$.fragment),hr=h(),M(ke.$$.fragment),ur=h(),z=s("div"),M(Tt.$$.fragment),gr=h(),re=s("p"),_r=l("The "),po=s("a"),vr=l("AltCLIPModel"),br=l(" forward method, overrides the "),Fo=s("code"),Mr=l("__call__"),yr=l(" special method."),Cr=h(),M(Ee.$$.fragment),Ir=h(),M(Ue.$$.fragment),wr=h(),W=s("div"),M(Pt.$$.fragment),Tr=h(),le=s("p"),Pr=l("The "),mo=s("a"),Ar=l("AltCLIPModel"),$r=l(" forward method, overrides the "),Ho=s("code"),Lr=l("__call__"),Jr=l(" special method."),xr=h(),M(Be.$$.fragment),jr=h(),M(ze.$$.fragment),En=h(),ie=s("h2"),We=s("a"),Xo=s("span"),M(At.$$.fragment),kr=h(),qo=s("span"),Er=l("AltCLIPTextModel"),Un=h(),de=s("div"),M($t.$$.fragment),Ur=h(),Z=s("div"),M(Lt.$$.fragment),Br=h(),ce=s("p"),zr=l("The "),fo=s("a"),Wr=l("AltCLIPTextModel"),Zr=l(" forward method, overrides the "),So=s("code"),Vr=l("__call__"),Nr=l(" special method."),Qr=h(),M(Ze.$$.fragment),Gr=h(),M(Ve.$$.fragment),Bn=h(),pe=s("h2"),Ne=s("a"),Do=s("span"),M(Jt.$$.fragment),Rr=h(),Yo=s("span"),Fr=l("AltCLIPVisionModel"),zn=h(),me=s("div"),M(xt.$$.fragment),Hr=h(),V=s("div"),M(jt.$$.fragment),Xr=h(),fe=s("p"),qr=l("The "),ho=s("a"),Sr=l("AltCLIPVisionModel"),Dr=l(" forward method, overrides the "),Oo=s("code"),Yr=l("__call__"),Or=l(" special method."),Kr=h(),M(Qe.$$.fragment),el=h(),M(Ge.$$.fragment),this.h()},l(t){const f=gi('[data-svelte="svelte-1phssyn"]',document.head);d=a(f,"META",{name:!0,content:!0}),f.forEach(o),b=u(t),g=a(t,"H1",{class:!0});var kt=r(g);m=a(kt,"A",{id:!0,class:!0,href:!0});var Ko=r(m);v=a(Ko,"SPAN",{});var en=r(v);y(n.$$.fragment,en),en.forEach(o),Ko.forEach(o),c=u(kt),A=a(kt,"SPAN",{});var tn=r(A);ss=i(tn,"AltCLIP"),tn.forEach(o),kt.forEach(o),pn=u(t),H=a(t,"H2",{class:!0});var Et=r(H);ue=a(Et,"A",{id:!0,class:!0,href:!0});var on=r(ue);Po=a(on,"SPAN",{});var nn=r(Po);y(et.$$.fragment,nn),nn.forEach(o),on.forEach(o),as=u(Et),Ao=a(Et,"SPAN",{});var sn=r(Ao);rs=i(sn,"Overview"),sn.forEach(o),Et.forEach(o),mn=u(t),ge=a(t,"P",{});var Ut=r(ge);ls=i(Ut,"The AltCLIP model was proposed in "),tt=a(Ut,"A",{href:!0,rel:!0});var an=r(tt);is=i(an,"AltCLIP: Altering the Language Encoder in CLIP for Extended Language Capabilities"),an.forEach(o),ds=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=a(t,"P",{});var rn=r(Bt);cs=i(rn,"The abstract from the paper is the following:"),rn.forEach(o),hn=u(t),zt=a(t,"P",{});var ln=r(zt);$o=a(ln,"EM",{});var dn=r($o);ps=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=a(t,"H2",{class:!0});var Zn=r(X);_e=a(Zn,"A",{id:!0,class:!0,href:!0});var tl=r(_e);Lo=a(tl,"SPAN",{});var ol=r(Lo);y(ot.$$.fragment,ol),ol.forEach(o),tl.forEach(o),ms=u(Zn),Jo=a(Zn,"SPAN",{});var nl=r(Jo);fs=i(nl,"Usage"),nl.forEach(o),Zn.forEach(o),gn=u(t),Wt=a(t,"P",{});var sl=r(Wt);hs=i(sl,`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.`),sl.forEach(o),_n=u(t),Zt=a(t,"P",{});var al=r(Zt);us=i(al,`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.`),al.forEach(o),vn=u(t),ve=a(t,"P",{});var Vn=r(ve);gs=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=a(Vn,"A",{href:!0});var rl=r(Vt);_s=i(rl,"CLIPImageProcessor"),rl.forEach(o),vs=i(Vn," can be used to resize (or rescale) and normalize images for the model."),Vn.forEach(o),bn=u(t),$=a(t,"P",{});var N=r($);bs=i(N,"The "),Nt=a(N,"A",{href:!0});var ll=r(Nt);Ms=i(ll,"AltCLIPProcessor"),ll.forEach(o),ys=i(N," wraps a "),Qt=a(N,"A",{href:!0});var il=r(Qt);Cs=i(il,"CLIPImageProcessor"),il.forEach(o),Is=i(N," and a "),Gt=a(N,"A",{href:!0});var dl=r(Gt);ws=i(dl,"XLMRobertaTokenizer"),dl.forEach(o),Ts=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=a(N,"A",{href:!0});var cl=r(Rt);Ps=i(cl,"AltCLIPProcessor"),cl.forEach(o),As=i(N," and "),Ft=a(N,"A",{href:!0});var pl=r(Ft);$s=i(pl,"AltCLIPModel"),pl.forEach(o),Ls=i(N,"."),N.forEach(o),Mn=u(t),y(nt.$$.fragment,t),yn=u(t),Ht=a(t,"P",{});var ml=r(Ht);Js=i(ml,"Tips:"),ml.forEach(o),Cn=u(t),be=a(t,"P",{});var Nn=r(be);xs=i(Nn,"This model is build on "),xo=a(Nn,"CODE",{});var fl=r(xo);js=i(fl,"CLIPModel"),fl.forEach(o),ks=i(Nn,", so use it like a original CLIP."),Nn.forEach(o),In=u(t),Me=a(t,"P",{});var Qn=r(Me);Es=i(Qn,"This model was contributed by "),st=a(Qn,"A",{href:!0,rel:!0});var hl=r(st);Us=i(hl,"jongjyh"),hl.forEach(o),Bs=i(Qn,"."),Qn.forEach(o),wn=u(t),q=a(t,"H2",{class:!0});var Gn=r(q);ye=a(Gn,"A",{id:!0,class:!0,href:!0});var ul=r(ye);jo=a(ul,"SPAN",{});var gl=r(jo);y(at.$$.fragment,gl),gl.forEach(o),ul.forEach(o),zs=u(Gn),ko=a(Gn,"SPAN",{});var _l=r(ko);Ws=i(_l,"AltCLIPConfig"),_l.forEach(o),Gn.forEach(o),Tn=u(t),L=a(t,"DIV",{class:!0});var G=r(L);y(rt.$$.fragment,G),Zs=u(G),S=a(G,"P",{});var uo=r(S);Vs=i(uo,"This is the configuration class to store the configuration of a "),Xt=a(uo,"A",{href:!0});var vl=r(Xt);Ns=i(vl,"AltCLIPModel"),vl.forEach(o),Qs=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=a(uo,"A",{href:!0,rel:!0});var bl=r(lt);Gs=i(bl,"BAAI/AltCLIP"),bl.forEach(o),Rs=i(uo," architecture."),uo.forEach(o),Fs=u(G),D=a(G,"P",{});var go=r(D);Hs=i(go,"Configuration objects inherit from "),qt=a(go,"A",{href:!0});var Ml=r(qt);Xs=i(Ml,"PretrainedConfig"),Ml.forEach(o),qs=i(go,` and can be used to control the model outputs. Read the
documentation from `),St=a(go,"A",{href:!0});var yl=r(St);Ss=i(yl,"PretrainedConfig"),yl.forEach(o),Ds=i(go," for more information."),go.forEach(o),Ys=u(G),y(Ce.$$.fragment,G),Os=u(G),Ie=a(G,"DIV",{class:!0});var Rn=r(Ie);y(it.$$.fragment,Rn),Ks=u(Rn),dt=a(Rn,"P",{});var Fn=r(dt);ea=i(Fn,"Instantiate a "),Dt=a(Fn,"A",{href:!0});var Cl=r(Dt);ta=i(Cl,"AltCLIPConfig"),Cl.forEach(o),oa=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=a(t,"H2",{class:!0});var Hn=r(Y);we=a(Hn,"A",{id:!0,class:!0,href:!0});var Il=r(we);Eo=a(Il,"SPAN",{});var wl=r(Eo);y(ct.$$.fragment,wl),wl.forEach(o),Il.forEach(o),na=u(Hn),Uo=a(Hn,"SPAN",{});var Tl=r(Uo);sa=i(Tl,"AltCLIPTextConfig"),Tl.forEach(o),Hn.forEach(o),An=u(t),k=a(t,"DIV",{class:!0});var Re=r(k);y(pt.$$.fragment,Re),aa=u(Re),O=a(Re,"P",{});var _o=r(O);ra=i(_o,"This is the configuration class to store the configuration of a "),Yt=a(_o,"A",{href:!0});var Pl=r(Yt);la=i(Pl,"AltCLIPTextModel"),Pl.forEach(o),ia=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=a(_o,"A",{href:!0,rel:!0});var Al=r(mt);da=i(Al,"BAAI/AltCLIP"),Al.forEach(o),ca=i(_o," architecture."),_o.forEach(o),pa=u(Re),K=a(Re,"P",{});var vo=r(K);ma=i(vo,"Configuration objects inherit from "),Ot=a(vo,"A",{href:!0});var $l=r(Ot);fa=i($l,"PretrainedConfig"),$l.forEach(o),ha=i(vo,` and can be used to control the model outputs. Read the
documentation from `),Kt=a(vo,"A",{href:!0});var Ll=r(Kt);ua=i(Ll,"PretrainedConfig"),Ll.forEach(o),ga=i(vo," for more information."),vo.forEach(o),_a=u(Re),y(Te.$$.fragment,Re),Re.forEach(o),$n=u(t),ee=a(t,"H2",{class:!0});var Xn=r(ee);Pe=a(Xn,"A",{id:!0,class:!0,href:!0});var Jl=r(Pe);Bo=a(Jl,"SPAN",{});var xl=r(Bo);y(ft.$$.fragment,xl),xl.forEach(o),Jl.forEach(o),va=u(Xn),zo=a(Xn,"SPAN",{});var jl=r(zo);ba=i(jl,"AltCLIPVisionConfig"),jl.forEach(o),Xn.forEach(o),Ln=u(t),E=a(t,"DIV",{class:!0});var Fe=r(E);y(ht.$$.fragment,Fe),Ma=u(Fe),te=a(Fe,"P",{});var bo=r(te);ya=i(bo,"This is the configuration class to store the configuration of a "),eo=a(bo,"A",{href:!0});var kl=r(eo);Ca=i(kl,"AltCLIPModel"),kl.forEach(o),Ia=i(bo,`. 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(bo,"A",{href:!0,rel:!0});var El=r(ut);wa=i(El,"BAAI/AltCLIP"),El.forEach(o),Ta=i(bo," architecture."),bo.forEach(o),Pa=u(Fe),oe=a(Fe,"P",{});var Mo=r(oe);Aa=i(Mo,"Configuration objects inherit from "),to=a(Mo,"A",{href:!0});var Ul=r(to);$a=i(Ul,"PretrainedConfig"),Ul.forEach(o),La=i(Mo,` and can be used to control the model outputs. Read the
documentation from `),oo=a(Mo,"A",{href:!0});var Bl=r(oo);Ja=i(Bl,"PretrainedConfig"),Bl.forEach(o),xa=i(Mo," for more information."),Mo.forEach(o),ja=u(Fe),y(Ae.$$.fragment,Fe),Fe.forEach(o),Jn=u(t),ne=a(t,"H2",{class:!0});var qn=r(ne);$e=a(qn,"A",{id:!0,class:!0,href:!0});var zl=r($e);Wo=a(zl,"SPAN",{});var Wl=r(Wo);y(gt.$$.fragment,Wl),Wl.forEach(o),zl.forEach(o),ka=u(qn),Zo=a(qn,"SPAN",{});var Zl=r(Zo);Ea=i(Zl,"AltCLIPProcessor"),Zl.forEach(o),qn.forEach(o),xn=u(t),J=a(t,"DIV",{class:!0});var R=r(J);y(_t.$$.fragment,R),Ua=u(R),Vo=a(R,"P",{});var Vl=r(Vo);Ba=i(Vl,`Constructs a AltCLIP processor which wraps a CLIP image processor and a XLM-Roberta tokenizer into a single
processor.`),Vl.forEach(o),za=u(R),j=a(R,"P",{});var Q=r(j);no=a(Q,"A",{href:!0});var Nl=r(no);Wa=i(Nl,"AltCLIPProcessor"),Nl.forEach(o),Za=i(Q," offers all the functionalities of "),so=a(Q,"A",{href:!0});var Ql=r(so);Va=i(Ql,"CLIPImageProcessor"),Ql.forEach(o),Na=i(Q," and "),ao=a(Q,"A",{href:!0});var Gl=r(ao);Qa=i(Gl,"XLMRobertaTokenizerFast"),Gl.forEach(o),Ga=i(Q,`. See
the `),No=a(Q,"CODE",{});var Rl=r(No);Ra=i(Rl,"__call__()"),Rl.forEach(o),Fa=i(Q," and "),ro=a(Q,"A",{href:!0});var Fl=r(ro);Ha=i(Fl,"decode()"),Fl.forEach(o),Xa=i(Q," for more information."),Q.forEach(o),qa=u(R),Le=a(R,"DIV",{class:!0});var Sn=r(Le);y(vt.$$.fragment,Sn),Sa=u(Sn),bt=a(Sn,"P",{});var Dn=r(bt);Da=i(Dn,"This method forwards all its arguments to XLMRobertaTokenizerFast\u2019s "),lo=a(Dn,"A",{href:!0});var Hl=r(lo);Ya=i(Hl,"batch_decode()"),Hl.forEach(o),Oa=i(Dn,`.
Please refer to the docstring of this method for more information.`),Dn.forEach(o),Sn.forEach(o),Ka=u(R),Je=a(R,"DIV",{class:!0});var Yn=r(Je);y(Mt.$$.fragment,Yn),er=u(Yn),yt=a(Yn,"P",{});var On=r(yt);tr=i(On,"This method forwards all its arguments to XLMRobertaTokenizerFast\u2019s "),io=a(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),se=a(t,"H2",{class:!0});var Kn=r(se);xe=a(Kn,"A",{id:!0,class:!0,href:!0});var ql=r(xe);Qo=a(ql,"SPAN",{});var Sl=r(Qo);y(Ct.$$.fragment,Sl),Sl.forEach(o),ql.forEach(o),sr=u(Kn),Go=a(Kn,"SPAN",{});var Dl=r(Go);ar=i(Dl,"AltCLIPModel"),Dl.forEach(o),Kn.forEach(o),kn=u(t),U=a(t,"DIV",{class:!0});var He=r(U);y(It.$$.fragment,He),rr=u(He),B=a(He,"DIV",{class:!0});var Xe=r(B);y(wt.$$.fragment,Xe),lr=u(Xe),ae=a(Xe,"P",{});var yo=r(ae);ir=i(yo,"The "),co=a(yo,"A",{href:!0});var Yl=r(co);dr=i(Yl,"AltCLIPModel"),Yl.forEach(o),cr=i(yo," forward method, overrides the "),Ro=a(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=a(He,"DIV",{class:!0});var qe=r(z);y(Tt.$$.fragment,qe),gr=u(qe),re=a(qe,"P",{});var Co=r(re);_r=i(Co,"The "),po=a(Co,"A",{href:!0});var Kl=r(po);vr=i(Kl,"AltCLIPModel"),Kl.forEach(o),br=i(Co," forward method, overrides the "),Fo=a(Co,"CODE",{});var ei=r(Fo);Mr=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=a(He,"DIV",{class:!0});var Se=r(W);y(Pt.$$.fragment,Se),Tr=u(Se),le=a(Se,"P",{});var Io=r(le);Pr=i(Io,"The "),mo=a(Io,"A",{href:!0});var ti=r(mo);Ar=i(ti,"AltCLIPModel"),ti.forEach(o),$r=i(Io," forward method, overrides the "),Ho=a(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=a(t,"H2",{class:!0});var es=r(ie);We=a(es,"A",{id:!0,class:!0,href:!0});var ni=r(We);Xo=a(ni,"SPAN",{});var si=r(Xo);y(At.$$.fragment,si),si.forEach(o),ni.forEach(o),kr=u(es),qo=a(es,"SPAN",{});var ai=r(qo);Er=i(ai,"AltCLIPTextModel"),ai.forEach(o),es.forEach(o),Un=u(t),de=a(t,"DIV",{class:!0});var ts=r(de);y($t.$$.fragment,ts),Ur=u(ts),Z=a(ts,"DIV",{class:!0});var De=r(Z);y(Lt.$$.fragment,De),Br=u(De),ce=a(De,"P",{});var wo=r(ce);zr=i(wo,"The "),fo=a(wo,"A",{href:!0});var ri=r(fo);Wr=i(ri,"AltCLIPTextModel"),ri.forEach(o),Zr=i(wo," forward method, overrides the "),So=a(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),ts.forEach(o),Bn=u(t),pe=a(t,"H2",{class:!0});var os=r(pe);Ne=a(os,"A",{id:!0,class:!0,href:!0});var ii=r(Ne);Do=a(ii,"SPAN",{});var di=r(Do);y(Jt.$$.fragment,di),di.forEach(o),ii.forEach(o),Rr=u(os),Yo=a(os,"SPAN",{});var ci=r(Yo);Fr=i(ci,"AltCLIPVisionModel"),ci.forEach(o),os.forEach(o),zn=u(t),me=a(t,"DIV",{class:!0});var ns=r(me);y(xt.$$.fragment,ns),Hr=u(ns),V=a(ns,"DIV",{class:!0});var Ye=r(V);y(jt.$$.fragment,Ye),Xr=u(Ye),fe=a(Ye,"P",{});var To=r(fe);qr=i(To,"The "),ho=a(To,"A",{href:!0});var pi=r(ho);Sr=i(pi,"AltCLIPVisionModel"),pi.forEach(o),Dr=i(To," forward method, overrides the "),Oo=a(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),ns.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/v4.33.0/en/model_doc/clip#transformers.CLIPImageProcessor"),p(Nt,"href","/docs/transformers/v4.33.0/en/model_doc/altclip#transformers.AltCLIPProcessor"),p(Qt,"href","/docs/transformers/v4.33.0/en/model_doc/clip#transformers.CLIPImageProcessor"),p(Gt,"href","/docs/transformers/v4.33.0/en/model_doc/xlm-roberta#transformers.XLMRobertaTokenizer"),p(Rt,"href","/docs/transformers/v4.33.0/en/model_doc/altclip#transformers.AltCLIPProcessor"),p(Ft,"href","/docs/transformers/v4.33.0/en/model_doc/altclip#transformers.AltCLIPModel"),p(st,"href","https://huggingface.co/jongjyh"),p(st,"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/v4.33.0/en/model_doc/altclip#transformers.AltCLIPModel"),p(lt,"href","https://huggingface.co/BAAI/AltCLIP"),p(lt,"rel","nofollow"),p(qt,"href","/docs/transformers/v4.33.0/en/main_classes/configuration#transformers.PretrainedConfig"),p(St,"href","/docs/transformers/v4.33.0/en/main_classes/configuration#transformers.PretrainedConfig"),p(Dt,"href","/docs/transformers/v4.33.0/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/v4.33.0/en/model_doc/altclip#transformers.AltCLIPTextModel"),p(mt,"href","https://huggingface.co/BAAI/AltCLIP"),p(mt,"rel","nofollow"),p(Ot,"href","/docs/transformers/v4.33.0/en/main_classes/configuration#transformers.PretrainedConfig"),p(Kt,"href","/docs/transformers/v4.33.0/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/v4.33.0/en/model_doc/altclip#transformers.AltCLIPModel"),p(ut,"href","https://huggingface.co/BAAI/AltCLIP"),p(ut,"rel","nofollow"),p(to,"href","/docs/transformers/v4.33.0/en/main_classes/configuration#transformers.PretrainedConfig"),p(oo,"href","/docs/transformers/v4.33.0/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/v4.33.0/en/model_doc/altclip#transformers.AltCLIPProcessor"),p(so,"href","/docs/transformers/v4.33.0/en/model_doc/clip#transformers.CLIPImageProcessor"),p(ao,"href","/docs/transformers/v4.33.0/en/model_doc/xlm-roberta#transformers.XLMRobertaTokenizerFast"),p(ro,"href","/docs/transformers/v4.33.0/en/model_doc/altclip#transformers.AltCLIPProcessor.decode"),p(lo,"href","/docs/transformers/v4.33.0/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/v4.33.0/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(se,"class","relative group"),p(co,"href","/docs/transformers/v4.33.0/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/v4.33.0/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/v4.33.0/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/v4.33.0/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/v4.33.0/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,b,f),_(t,g,f),e(g,m),e(m,v),C(n,v,null),e(g,c),e(g,A),e(A,ss),_(t,pn,f),_(t,H,f),e(H,ue),e(ue,Po),C(et,Po,null),e(H,as),e(H,Ao),e(Ao,rs),_(t,mn,f),_(t,ge,f),e(ge,ls),e(ge,tt),e(tt,is),e(ge,ds),_(t,fn,f),_(t,Bt,f),e(Bt,cs),_(t,hn,f),_(t,zt,f),e(zt,$o),e($o,ps),_(t,un,f),_(t,X,f),e(X,_e),e(_e,Lo),C(ot,Lo,null),e(X,ms),e(X,Jo),e(Jo,fs),_(t,gn,f),_(t,Wt,f),e(Wt,hs),_(t,_n,f),_(t,Zt,f),e(Zt,us),_(t,vn,f),_(t,ve,f),e(ve,gs),e(ve,Vt),e(Vt,_s),e(ve,vs),_(t,bn,f),_(t,$,f),e($,bs),e($,Nt),e(Nt,Ms),e($,ys),e($,Qt),e(Qt,Cs),e($,Is),e($,Gt),e(Gt,ws),e($,Ts),e($,Rt),e(Rt,Ps),e($,As),e($,Ft),e(Ft,$s),e($,Ls),_(t,Mn,f),C(nt,t,f),_(t,yn,f),_(t,Ht,f),e(Ht,Js),_(t,Cn,f),_(t,be,f),e(be,xs),e(be,xo),e(xo,js),e(be,ks),_(t,In,f),_(t,Me,f),e(Me,Es),e(Me,st),e(st,Us),e(Me,Bs),_(t,wn,f),_(t,q,f),e(q,ye),e(ye,jo),C(at,jo,null),e(q,zs),e(q,ko),e(ko,Ws),_(t,Tn,f),_(t,L,f),C(rt,L,null),e(L,Zs),e(L,S),e(S,Vs),e(S,Xt),e(Xt,Ns),e(S,Qs),e(S,lt),e(lt,Gs),e(S,Rs),e(L,Fs),e(L,D),e(D,Hs),e(D,qt),e(qt,Xs),e(D,qs),e(D,St),e(St,Ss),e(D,Ds),e(L,Ys),C(Ce,L,null),e(L,Os),e(L,Ie),C(it,Ie,null),e(Ie,Ks),e(Ie,dt),e(dt,ea),e(dt,Dt),e(Dt,ta),e(dt,oa),_(t,Pn,f),_(t,Y,f),e(Y,we),e(we,Eo),C(ct,Eo,null),e(Y,na),e(Y,Uo),e(Uo,sa),_(t,An,f),_(t,k,f),C(pt,k,null),e(k,aa),e(k,O),e(O,ra),e(O,Yt),e(Yt,la),e(O,ia),e(O,mt),e(mt,da),e(O,ca),e(k,pa),e(k,K),e(K,ma),e(K,Ot),e(Ot,fa),e(K,ha),e(K,Kt),e(Kt,ua),e(K,ga),e(k,_a),C(Te,k,null),_(t,$n,f),_(t,ee,f),e(ee,Pe),e(Pe,Bo),C(ft,Bo,null),e(ee,va),e(ee,zo),e(zo,ba),_(t,Ln,f),_(t,E,f),C(ht,E,null),e(E,Ma),e(E,te),e(te,ya),e(te,eo),e(eo,Ca),e(te,Ia),e(te,ut),e(ut,wa),e(te,Ta),e(E,Pa),e(E,oe),e(oe,Aa),e(oe,to),e(to,$a),e(oe,La),e(oe,oo),e(oo,Ja),e(oe,xa),e(E,ja),C(Ae,E,null),_(t,Jn,f),_(t,ne,f),e(ne,$e),e($e,Wo),C(gt,Wo,null),e(ne,ka),e(ne,Zo),e(Zo,Ea),_(t,xn,f),_(t,J,f),C(_t,J,null),e(J,Ua),e(J,Vo),e(Vo,Ba),e(J,za),e(J,j),e(j,no),e(no,Wa),e(j,Za),e(j,so),e(so,Va),e(j,Na),e(j,ao),e(ao,Qa),e(j,Ga),e(j,No),e(No,Ra),e(j,Fa),e(j,ro),e(ro,Ha),e(j,Xa),e(J,qa),e(J,Le),C(vt,Le,null),e(Le,Sa),e(Le,bt),e(bt,Da),e(bt,lo),e(lo,Ya),e(bt,Oa),e(J,Ka),e(J,Je),C(Mt,Je,null),e(Je,er),e(Je,yt),e(yt,tr),e(yt,io),e(io,or),e(yt,nr),_(t,jn,f),_(t,se,f),e(se,xe),e(xe,Qo),C(Ct,Qo,null),e(se,sr),e(se,Go),e(Go,ar),_(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,ae),e(ae,ir),e(ae,co),e(co,dr),e(ae,cr),e(ae,Ro),e(Ro,pr),e(ae,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,vr),e(re,br),e(re,Fo),e(Fo,Mr),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 sn={};f&2&&(sn.$$scope={dirty:f,ctx:t}),Be.$set(sn);const Ut={};f&2&&(Ut.$$scope={dirty:f,ctx:t}),ze.$set(Ut);const an={};f&2&&(an.$$scope={dirty:f,ctx:t}),Ze.$set(an);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(at.$$.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(vt.$$.fragment,t),I(Mt.$$.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(at.$$.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(vt.$$.fragment,t),w(Mt.$$.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(b),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(vn),t&&o(ve),t&&o(bn),t&&o($),t&&o(Mn),T(nt,t),t&&o(yn),t&&o(Ht),t&&o(Cn),t&&o(be),t&&o(In),t&&o(Me),t&&o(wn),t&&o(q),T(at),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(vt),T(Mt),t&&o(jn),t&&o(se),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};
