import{S as qc,i as Oc,s as Yc,e as n,k as h,w as b,t as i,M as Hc,c as s,d as o,m as p,a,x as y,h as l,b as c,G as e,g as _,y as M,q as T,o as I,B as w,v as Dc,L as rt}from"../../chunks/vendor-hf-doc-builder.js";import{T as Gn}from"../../chunks/Tip-hf-doc-builder.js";import{D as $}from"../../chunks/Docstring-hf-doc-builder.js";import{C as ye}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as F}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as at}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";function Kc(P){let d,v,u,f,C;return f=new ye({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMENoaW5lc2VDTElQQ29uZmlnJTJDJTIwQ2hpbmVzZUNMSVBNb2RlbCUwQSUwQSUyMyUyMEluaXRpYWxpemluZyUyMGElMjBDaGluZXNlQ0xJUENvbmZpZyUyMHdpdGglMjBPRkEtU3lzJTJGY2hpbmVzZS1jbGlwLXZpdC1iYXNlLXBhdGNoMTYlMjBzdHlsZSUyMGNvbmZpZ3VyYXRpb24lMEFjb25maWd1cmF0aW9uJTIwJTNEJTIwQ2hpbmVzZUNMSVBDb25maWcoKSUwQSUwQSUyMyUyMEluaXRpYWxpemluZyUyMGElMjBDaGluZXNlQ0xJUE1vZGVsJTIwKHdpdGglMjByYW5kb20lMjB3ZWlnaHRzKSUyMGZyb20lMjB0aGUlMjBPRkEtU3lzJTJGY2hpbmVzZS1jbGlwLXZpdC1iYXNlLXBhdGNoMTYlMjBzdHlsZSUyMGNvbmZpZ3VyYXRpb24lMEFtb2RlbCUyMCUzRCUyMENoaW5lc2VDTElQTW9kZWwoY29uZmlndXJhdGlvbiklMEElMEElMjMlMjBBY2Nlc3NpbmclMjB0aGUlMjBtb2RlbCUyMGNvbmZpZ3VyYXRpb24lMEFjb25maWd1cmF0aW9uJTIwJTNEJTIwbW9kZWwuY29uZmlnJTBBJTBBJTIzJTIwV2UlMjBjYW4lMjBhbHNvJTIwaW5pdGlhbGl6ZSUyMGElMjBDaGluZXNlQ0xJUENvbmZpZyUyMGZyb20lMjBhJTIwQ2hpbmVzZUNMSVBUZXh0Q29uZmlnJTIwYW5kJTIwYSUyMENoaW5lc2VDTElQVmlzaW9uQ29uZmlnJTBBJTBBJTIzJTIwSW5pdGlhbGl6aW5nJTIwYSUyMENoaW5lc2VDTElQVGV4dENvbmZpZyUyMGFuZCUyMENoaW5lc2VDTElQVmlzaW9uQ29uZmlnJTIwY29uZmlndXJhdGlvbiUwQWNvbmZpZ190ZXh0JTIwJTNEJTIwQ2hpbmVzZUNMSVBUZXh0Q29uZmlnKCklMEFjb25maWdfdmlzaW9uJTIwJTNEJTIwQ2hpbmVzZUNMSVBWaXNpb25Db25maWcoKSUwQSUwQWNvbmZpZyUyMCUzRCUyMENoaW5lc2VDTElQQ29uZmlnLmZyb21fdGV4dF92aXNpb25fY29uZmlncyhjb25maWdfdGV4dCUyQyUyMGNvbmZpZ192aXNpb24p",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> ChineseCLIPConfig, ChineseCLIPModel

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a ChineseCLIPConfig with OFA-Sys/chinese-clip-vit-base-patch16 style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = ChineseCLIPConfig()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a ChineseCLIPModel (with random weights) from the OFA-Sys/chinese-clip-vit-base-patch16 style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = ChineseCLIPModel(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 ChineseCLIPConfig from a ChineseCLIPTextConfig and a ChineseCLIPVisionConfig</span>

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a ChineseCLIPTextConfig and ChineseCLIPVisionConfig configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>config_text = ChineseCLIPTextConfig()
<span class="hljs-meta">&gt;&gt;&gt; </span>config_vision = ChineseCLIPVisionConfig()

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

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a ChineseCLIPTextConfig with OFA-Sys/chinese-clip-vit-base-patch16 style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = ChineseCLIPTextConfig()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a ChineseCLIPTextModel (with random weights) from the OFA-Sys/chinese-clip-vit-base-patch16 style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = ChineseCLIPTextModel(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=n("p"),v=i("Example:"),u=h(),b(f.$$.fragment)},l(r){d=s(r,"P",{});var m=a(d);v=l(m,"Example:"),m.forEach(o),u=p(r),y(f.$$.fragment,r)},m(r,m){_(r,d,m),e(d,v),_(r,u,m),M(f,r,m),C=!0},p:rt,i(r){C||(T(f.$$.fragment,r),C=!0)},o(r){I(f.$$.fragment,r),C=!1},d(r){r&&o(d),r&&o(u),w(f,r)}}}function td(P){let d,v,u,f,C;return f=new ye({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMENoaW5lc2VDTElQVmlzaW9uQ29uZmlnJTJDJTIwQ2hpbmVzZUNMSVBWaXNpb25Nb2RlbCUwQSUwQSUyMyUyMEluaXRpYWxpemluZyUyMGElMjBDaGluZXNlQ0xJUFZpc2lvbkNvbmZpZyUyMHdpdGglMjBPRkEtU3lzJTJGY2hpbmVzZS1jbGlwLXZpdC1iYXNlLXBhdGNoMTYlMjBzdHlsZSUyMGNvbmZpZ3VyYXRpb24lMEFjb25maWd1cmF0aW9uJTIwJTNEJTIwQ2hpbmVzZUNMSVBWaXNpb25Db25maWcoKSUwQSUwQSUyMyUyMEluaXRpYWxpemluZyUyMGElMjBDaGluZXNlQ0xJUFZpc2lvbk1vZGVsJTIwKHdpdGglMjByYW5kb20lMjB3ZWlnaHRzKSUyMGZyb20lMjB0aGUlMjBPRkEtU3lzJTJGY2hpbmVzZS1jbGlwLXZpdC1iYXNlLXBhdGNoMTYlMjBzdHlsZSUyMGNvbmZpZ3VyYXRpb24lMEFtb2RlbCUyMCUzRCUyMENoaW5lc2VDTElQVmlzaW9uTW9kZWwoY29uZmlndXJhdGlvbiklMEElMEElMjMlMjBBY2Nlc3NpbmclMjB0aGUlMjBtb2RlbCUyMGNvbmZpZ3VyYXRpb24lMEFjb25maWd1cmF0aW9uJTIwJTNEJTIwbW9kZWwuY29uZmln",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> ChineseCLIPVisionConfig, ChineseCLIPVisionModel

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a ChineseCLIPVisionConfig with OFA-Sys/chinese-clip-vit-base-patch16 style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = ChineseCLIPVisionConfig()

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

<span class="hljs-meta">&gt;&gt;&gt; </span>model = ChineseCLIPModel.from_pretrained(<span class="hljs-string">&quot;OFA-Sys/chinese-clip-vit-base-patch16&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>processor = AutoProcessor.from_pretrained(<span class="hljs-string">&quot;OFA-Sys/chinese-clip-vit-base-patch16&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>url = <span class="hljs-string">&quot;https://clip-cn-beijing.oss-cn-beijing.aliyuncs.com/pokemon.jpeg&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;\u6770\u5C3C\u9F9F&quot;</span>, <span class="hljs-string">&quot;\u5999\u86D9\u79CD\u5B50&quot;</span>, <span class="hljs-string">&quot;\u5C0F\u706B\u9F99&quot;</span>, <span class="hljs-string">&quot;\u76AE\u5361\u4E18&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>`}}),{c(){d=n("p"),v=i("Examples:"),u=h(),b(f.$$.fragment)},l(r){d=s(r,"P",{});var m=a(d);v=l(m,"Examples:"),m.forEach(o),u=p(r),y(f.$$.fragment,r)},m(r,m){_(r,d,m),e(d,v),_(r,u,m),M(f,r,m),C=!0},p:rt,i(r){C||(T(f.$$.fragment,r),C=!0)},o(r){I(f.$$.fragment,r),C=!1},d(r){r&&o(d),r&&o(u),w(f,r)}}}function sd(P){let d,v,u,f,C;return{c(){d=n("p"),v=i("Although the recipe for forward pass needs to be defined within this function, one should call the "),u=n("code"),f=i("Module"),C=i(`
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(r){d=s(r,"P",{});var m=a(d);v=l(m,"Although the recipe for forward pass needs to be defined within this function, one should call the "),u=s(m,"CODE",{});var L=a(u);f=l(L,"Module"),L.forEach(o),C=l(m,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),m.forEach(o)},m(r,m){_(r,d,m),e(d,v),e(d,u),e(u,f),e(d,C)},d(r){r&&o(d)}}}function ad(P){let d,v,u,f,C;return f=new ye({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBDaGluZXNlQ0xJUE1vZGVsJTBBJTBBbW9kZWwlMjAlM0QlMjBDaGluZXNlQ0xJUE1vZGVsLmZyb21fcHJldHJhaW5lZCglMjJPRkEtU3lzJTJGY2hpbmVzZS1jbGlwLXZpdC1iYXNlLXBhdGNoMTYlMjIpJTBBdG9rZW5pemVyJTIwJTNEJTIwQXV0b1Rva2VuaXplci5mcm9tX3ByZXRyYWluZWQoJTIyT0ZBLVN5cyUyRmNoaW5lc2UtY2xpcC12aXQtYmFzZS1wYXRjaDE2JTIyKSUwQSUwQWlucHV0cyUyMCUzRCUyMHRva2VuaXplciglNUIlMjIlRTYlOUQlQjAlRTUlQjAlQkMlRTklQkUlOUYlMjIlMkMlMjAlMjIlRTUlQTYlOTklRTglOUIlOTklRTclQTclOEQlRTUlQUQlOTAlMjIlMkMlMjAlMjIlRTUlQjAlOEYlRTclODElQUIlRTklQkUlOTklMjIlMkMlMjAlMjIlRTclOUElQUUlRTUlOEQlQTElRTQlQjglOTglMjIlNUQlMkMlMjBwYWRkaW5nJTNEVHJ1ZSUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpJTBBdGV4dF9mZWF0dXJlcyUyMCUzRCUyMG1vZGVsLmdldF90ZXh0X2ZlYXR1cmVzKCoqaW5wdXRzKSUwQXRleHRfZmVhdHVyZXMlMjAlM0QlMjB0ZXh0X2ZlYXR1cmVzJTIwJTJGJTIwdGV4dF9mZWF0dXJlcy5ub3JtKHAlM0QyJTJDJTIwZGltJTNELTElMkMlMjBrZWVwZGltJTNEVHJ1ZSk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, ChineseCLIPModel

<span class="hljs-meta">&gt;&gt;&gt; </span>model = ChineseCLIPModel.from_pretrained(<span class="hljs-string">&quot;OFA-Sys/chinese-clip-vit-base-patch16&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;OFA-Sys/chinese-clip-vit-base-patch16&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer([<span class="hljs-string">&quot;\u6770\u5C3C\u9F9F&quot;</span>, <span class="hljs-string">&quot;\u5999\u86D9\u79CD\u5B50&quot;</span>, <span class="hljs-string">&quot;\u5C0F\u706B\u9F99&quot;</span>, <span class="hljs-string">&quot;\u76AE\u5361\u4E18&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)
<span class="hljs-meta">&gt;&gt;&gt; </span>text_features = text_features / text_features.norm(p=<span class="hljs-number">2</span>, dim=-<span class="hljs-number">1</span>, keepdim=<span class="hljs-literal">True</span>)`}}),{c(){d=n("p"),v=i("Examples:"),u=h(),b(f.$$.fragment)},l(r){d=s(r,"P",{});var m=a(d);v=l(m,"Examples:"),m.forEach(o),u=p(r),y(f.$$.fragment,r)},m(r,m){_(r,d,m),e(d,v),_(r,u,m),M(f,r,m),C=!0},p:rt,i(r){C||(T(f.$$.fragment,r),C=!0)},o(r){I(f.$$.fragment,r),C=!1},d(r){r&&o(d),r&&o(u),w(f,r)}}}function rd(P){let d,v,u,f,C;return{c(){d=n("p"),v=i("Although the recipe for forward pass needs to be defined within this function, one should call the "),u=n("code"),f=i("Module"),C=i(`
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(r){d=s(r,"P",{});var m=a(d);v=l(m,"Although the recipe for forward pass needs to be defined within this function, one should call the "),u=s(m,"CODE",{});var L=a(u);f=l(L,"Module"),L.forEach(o),C=l(m,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),m.forEach(o)},m(r,m){_(r,d,m),e(d,v),e(d,u),e(u,f),e(d,C)},d(r){r&&o(d)}}}function id(P){let d,v,u,f,C;return f=new ye({props:{code:"ZnJvbSUyMFBJTCUyMGltcG9ydCUyMEltYWdlJTBBaW1wb3J0JTIwcmVxdWVzdHMlMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b1Byb2Nlc3NvciUyQyUyMENoaW5lc2VDTElQTW9kZWwlMEElMEFtb2RlbCUyMCUzRCUyMENoaW5lc2VDTElQTW9kZWwuZnJvbV9wcmV0cmFpbmVkKCUyMk9GQS1TeXMlMkZjaGluZXNlLWNsaXAtdml0LWJhc2UtcGF0Y2gxNiUyMiklMEFwcm9jZXNzb3IlMjAlM0QlMjBBdXRvUHJvY2Vzc29yLmZyb21fcHJldHJhaW5lZCglMjJPRkEtU3lzJTJGY2hpbmVzZS1jbGlwLXZpdC1iYXNlLXBhdGNoMTYlMjIpJTBBJTBBdXJsJTIwJTNEJTIwJTIyaHR0cHMlM0ElMkYlMkZjbGlwLWNuLWJlaWppbmcub3NzLWNuLWJlaWppbmcuYWxpeXVuY3MuY29tJTJGcG9rZW1vbi5qcGVnJTIyJTBBaW1hZ2UlMjAlM0QlMjBJbWFnZS5vcGVuKHJlcXVlc3RzLmdldCh1cmwlMkMlMjBzdHJlYW0lM0RUcnVlKS5yYXcpJTBBJTBBaW5wdXRzJTIwJTNEJTIwcHJvY2Vzc29yKGltYWdlcyUzRGltYWdlJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMiklMEElMEFpbWFnZV9mZWF0dXJlcyUyMCUzRCUyMG1vZGVsLmdldF9pbWFnZV9mZWF0dXJlcygqKmlucHV0cyklMEFpbWFnZV9mZWF0dXJlcyUyMCUzRCUyMGltYWdlX2ZlYXR1cmVzJTIwJTJGJTIwaW1hZ2VfZmVhdHVyZXMubm9ybShwJTNEMiUyQyUyMGRpbSUzRC0xJTJDJTIwa2VlcGRpbSUzRFRydWUp",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, ChineseCLIPModel

<span class="hljs-meta">&gt;&gt;&gt; </span>model = ChineseCLIPModel.from_pretrained(<span class="hljs-string">&quot;OFA-Sys/chinese-clip-vit-base-patch16&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>processor = AutoProcessor.from_pretrained(<span class="hljs-string">&quot;OFA-Sys/chinese-clip-vit-base-patch16&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>url = <span class="hljs-string">&quot;https://clip-cn-beijing.oss-cn-beijing.aliyuncs.com/pokemon.jpeg&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)
<span class="hljs-meta">&gt;&gt;&gt; </span>image_features = image_features / image_features.norm(p=<span class="hljs-number">2</span>, dim=-<span class="hljs-number">1</span>, keepdim=<span class="hljs-literal">True</span>)`}}),{c(){d=n("p"),v=i("Examples:"),u=h(),b(f.$$.fragment)},l(r){d=s(r,"P",{});var m=a(d);v=l(m,"Examples:"),m.forEach(o),u=p(r),y(f.$$.fragment,r)},m(r,m){_(r,d,m),e(d,v),_(r,u,m),M(f,r,m),C=!0},p:rt,i(r){C||(T(f.$$.fragment,r),C=!0)},o(r){I(f.$$.fragment,r),C=!1},d(r){r&&o(d),r&&o(u),w(f,r)}}}function ld(P){let d,v,u,f,C;return{c(){d=n("p"),v=i("Although the recipe for forward pass needs to be defined within this function, one should call the "),u=n("code"),f=i("Module"),C=i(`
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(r){d=s(r,"P",{});var m=a(d);v=l(m,"Although the recipe for forward pass needs to be defined within this function, one should call the "),u=s(m,"CODE",{});var L=a(u);f=l(L,"Module"),L.forEach(o),C=l(m,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),m.forEach(o)},m(r,m){_(r,d,m),e(d,v),e(d,u),e(u,f),e(d,C)},d(r){r&&o(d)}}}function cd(P){let d,v,u,f,C;return f=new ye({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBDaGluZXNlQ0xJUFRleHRNb2RlbCUwQWltcG9ydCUyMHRvcmNoJTBBJTBBdG9rZW5pemVyJTIwJTNEJTIwQXV0b1Rva2VuaXplci5mcm9tX3ByZXRyYWluZWQoJTIyT0ZBLVN5cyUyRmNoaW5lc2UtY2xpcC12aXQtYmFzZS1wYXRjaDE2JTIyKSUwQW1vZGVsJTIwJTNEJTIwQ2hpbmVzZUNMSVBUZXh0TW9kZWwuZnJvbV9wcmV0cmFpbmVkKCUyMk9GQS1TeXMlMkZjaGluZXNlLWNsaXAtdml0LWJhc2UtcGF0Y2gxNiUyMiklMEElMEFpbnB1dHMlMjAlM0QlMjB0b2tlbml6ZXIoJTIySGVsbG8lMkMlMjBteSUyMGRvZyUyMGlzJTIwY3V0ZSUyMiUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpJTBBb3V0cHV0cyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzKSUwQSUwQWxhc3RfaGlkZGVuX3N0YXRlcyUyMCUzRCUyMG91dHB1dHMubGFzdF9oaWRkZW5fc3RhdGU=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, ChineseCLIPTextModel
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;OFA-Sys/chinese-clip-vit-base-patch16&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = ChineseCLIPTextModel.from_pretrained(<span class="hljs-string">&quot;OFA-Sys/chinese-clip-vit-base-patch16&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(<span class="hljs-string">&quot;Hello, my dog is cute&quot;</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_states = outputs.last_hidden_state`}}),{c(){d=n("p"),v=i("Example:"),u=h(),b(f.$$.fragment)},l(r){d=s(r,"P",{});var m=a(d);v=l(m,"Example:"),m.forEach(o),u=p(r),y(f.$$.fragment,r)},m(r,m){_(r,d,m),e(d,v),_(r,u,m),M(f,r,m),C=!0},p:rt,i(r){C||(T(f.$$.fragment,r),C=!0)},o(r){I(f.$$.fragment,r),C=!1},d(r){r&&o(d),r&&o(u),w(f,r)}}}function dd(P){let d,v,u,f,C;return{c(){d=n("p"),v=i("Although the recipe for forward pass needs to be defined within this function, one should call the "),u=n("code"),f=i("Module"),C=i(`
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(r){d=s(r,"P",{});var m=a(d);v=l(m,"Although the recipe for forward pass needs to be defined within this function, one should call the "),u=s(m,"CODE",{});var L=a(u);f=l(L,"Module"),L.forEach(o),C=l(m,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),m.forEach(o)},m(r,m){_(r,d,m),e(d,v),e(d,u),e(u,f),e(d,C)},d(r){r&&o(d)}}}function hd(P){let d,v,u,f,C;return f=new ye({props:{code:"ZnJvbSUyMFBJTCUyMGltcG9ydCUyMEltYWdlJTBBaW1wb3J0JTIwcmVxdWVzdHMlMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQ0xJUFByb2Nlc3NvciUyQyUyMENoaW5lc2VDTElQVmlzaW9uTW9kZWwlMEElMEFtb2RlbCUyMCUzRCUyMENoaW5lc2VDTElQVmlzaW9uTW9kZWwuZnJvbV9wcmV0cmFpbmVkKCUyMk9GQS1TeXMlMkZjaGluZXNlLWNsaXAtdml0LWJhc2UtcGF0Y2gxNiUyMiklMEFwcm9jZXNzb3IlMjAlM0QlMjBDTElQUHJvY2Vzc29yLmZyb21fcHJldHJhaW5lZCglMjJPRkEtU3lzJTJGY2hpbmVzZS1jbGlwLXZpdC1iYXNlLXBhdGNoMTYlMjIpJTBBJTBBdXJsJTIwJTNEJTIwJTIyaHR0cHMlM0ElMkYlMkZjbGlwLWNuLWJlaWppbmcub3NzLWNuLWJlaWppbmcuYWxpeXVuY3MuY29tJTJGcG9rZW1vbi5qcGVnJTIyJTBBaW1hZ2UlMjAlM0QlMjBJbWFnZS5vcGVuKHJlcXVlc3RzLmdldCh1cmwlMkMlMjBzdHJlYW0lM0RUcnVlKS5yYXcpJTBBJTBBaW5wdXRzJTIwJTNEJTIwcHJvY2Vzc29yKGltYWdlcyUzRGltYWdlJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMiklMEElMEFvdXRwdXRzJTIwJTNEJTIwbW9kZWwoKippbnB1dHMpJTBBbGFzdF9oaWRkZW5fc3RhdGUlMjAlM0QlMjBvdXRwdXRzLmxhc3RfaGlkZGVuX3N0YXRlJTBBcG9vbGVkX291dHB1dCUyMCUzRCUyMG91dHB1dHMucG9vbGVyX291dHB1dCUyMCUyMCUyMyUyMHBvb2xlZCUyMENMUyUyMHN0YXRlcw==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> PIL <span class="hljs-keyword">import</span> Image
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> requests
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> CLIPProcessor, ChineseCLIPVisionModel

<span class="hljs-meta">&gt;&gt;&gt; </span>model = ChineseCLIPVisionModel.from_pretrained(<span class="hljs-string">&quot;OFA-Sys/chinese-clip-vit-base-patch16&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>processor = CLIPProcessor.from_pretrained(<span class="hljs-string">&quot;OFA-Sys/chinese-clip-vit-base-patch16&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>url = <span class="hljs-string">&quot;https://clip-cn-beijing.oss-cn-beijing.aliyuncs.com/pokemon.jpeg&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=n("p"),v=i("Examples:"),u=h(),b(f.$$.fragment)},l(r){d=s(r,"P",{});var m=a(d);v=l(m,"Examples:"),m.forEach(o),u=p(r),y(f.$$.fragment,r)},m(r,m){_(r,d,m),e(d,v),_(r,u,m),M(f,r,m),C=!0},p:rt,i(r){C||(T(f.$$.fragment,r),C=!0)},o(r){I(f.$$.fragment,r),C=!1},d(r){r&&o(d),r&&o(u),w(f,r)}}}function pd(P){let d,v,u,f,C,r,m,L,Fs,Xn,ee,Me,Xo,it,Gs,Qo,Xs,Qn,q,Qs,lt,qs,Os,ct,Ys,Hs,qn,io,Ds,On,lo,qo,Ks,Yn,te,Te,Oo,dt,ea,Yo,ta,Hn,co,oa,Dn,ht,Kn,ho,na,es,N,Ho,pt,sa,aa,Do,mt,ra,ia,Ko,ft,la,ca,en,gt,da,ts,Ie,ha,ut,pa,ma,os,oe,we,tn,_t,fa,on,ga,ns,k,Ct,ua,O,po,_a,Ca,mo,va,ba,vt,ya,Ma,Ta,ne,Ia,fo,wa,Pa,go,La,$a,ja,Pe,ka,Le,bt,Ea,se,Ja,uo,xa,za,_o,Ua,Za,ss,ae,$e,nn,yt,Wa,sn,Na,as,Z,Mt,Va,Tt,Ba,Co,Ra,Aa,Sa,re,Fa,vo,Ga,Xa,bo,Qa,qa,Oa,je,rs,ie,ke,an,It,Ya,rn,Ha,is,W,wt,Da,Pt,Ka,yo,er,tr,or,le,nr,Mo,sr,ar,To,rr,ir,lr,Ee,ls,ce,Je,ln,Lt,cr,cn,dr,cs,G,$t,hr,dn,pr,mr,xe,jt,fr,hn,gr,ds,de,ze,pn,kt,ur,mn,_r,hs,Et,Jt,ps,he,Ue,fn,xt,Cr,gn,vr,ms,E,zt,br,un,yr,Mr,z,Io,Tr,Ir,wo,wr,Pr,Po,Lr,$r,_n,jr,kr,Lo,Er,Jr,xr,Ze,Ut,zr,Zt,Ur,$o,Zr,Wr,Nr,We,Wt,Vr,Nt,Br,jo,Rr,Ar,fs,pe,Ne,Cn,Vt,Sr,vn,Fr,gs,J,Bt,Gr,Rt,Xr,At,Qr,qr,Or,V,St,Yr,me,Hr,ko,Dr,Kr,bn,ei,ti,oi,Ve,ni,Be,si,B,Ft,ai,fe,ri,Eo,ii,li,yn,ci,di,hi,Re,pi,Ae,mi,R,Gt,fi,ge,gi,Jo,ui,_i,Mn,Ci,vi,bi,Se,yi,Fe,us,ue,Ge,Tn,Xt,Mi,In,Ti,_s,x,Qt,Ii,qt,wi,Ot,Pi,Li,$i,Yt,ji,Ht,ki,Ei,Ji,j,xi,wn,zi,Ui,Pn,Zi,Wi,Ln,Ni,Vi,$n,Bi,Ri,jn,Ai,Si,kn,Fi,Gi,Xi,A,Dt,Qi,_e,qi,xo,Oi,Yi,En,Hi,Di,Ki,Xe,el,Qe,Cs,Ce,qe,Jn,Kt,tl,xn,ol,vs,X,eo,nl,to,sl,oo,al,rl,il,S,no,ll,ve,cl,zo,dl,hl,zn,pl,ml,fl,Oe,gl,Ye,bs;return r=new F({}),it=new F({}),dt=new F({}),ht=new ye({props:{code:"ZnJvbSUyMFBJTCUyMGltcG9ydCUyMEltYWdlJTBBaW1wb3J0JTIwcmVxdWVzdHMlMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQ2hpbmVzZUNMSVBQcm9jZXNzb3IlMkMlMjBDaGluZXNlQ0xJUE1vZGVsJTBBJTBBbW9kZWwlMjAlM0QlMjBDaGluZXNlQ0xJUE1vZGVsLmZyb21fcHJldHJhaW5lZCglMjJPRkEtU3lzJTJGY2hpbmVzZS1jbGlwLXZpdC1iYXNlLXBhdGNoMTYlMjIpJTBBcHJvY2Vzc29yJTIwJTNEJTIwQ2hpbmVzZUNMSVBQcm9jZXNzb3IuZnJvbV9wcmV0cmFpbmVkKCUyMk9GQS1TeXMlMkZjaGluZXNlLWNsaXAtdml0LWJhc2UtcGF0Y2gxNiUyMiklMEElMEF1cmwlMjAlM0QlMjAlMjJodHRwcyUzQSUyRiUyRmNsaXAtY24tYmVpamluZy5vc3MtY24tYmVpamluZy5hbGl5dW5jcy5jb20lMkZwb2tlbW9uLmpwZWclMjIlMEFpbWFnZSUyMCUzRCUyMEltYWdlLm9wZW4ocmVxdWVzdHMuZ2V0KHVybCUyQyUyMHN0cmVhbSUzRFRydWUpLnJhdyklMEElMjMlMjBTcXVpcnRsZSUyQyUyMEJ1bGJhc2F1ciUyQyUyMENoYXJtYW5kZXIlMkMlMjBQaWthY2h1JTIwaW4lMjBFbmdsaXNoJTBBdGV4dHMlMjAlM0QlMjAlNUIlMjIlRTYlOUQlQjAlRTUlQjAlQkMlRTklQkUlOUYlMjIlMkMlMjAlMjIlRTUlQTYlOTklRTglOUIlOTklRTclQTclOEQlRTUlQUQlOTAlMjIlMkMlMjAlMjIlRTUlQjAlOEYlRTclODElQUIlRTklQkUlOTklMjIlMkMlMjAlMjIlRTclOUElQUUlRTUlOEQlQTElRTQlQjglOTglMjIlNUQlMEElMEElMjMlMjBjb21wdXRlJTIwaW1hZ2UlMjBmZWF0dXJlJTBBaW5wdXRzJTIwJTNEJTIwcHJvY2Vzc29yKGltYWdlcyUzRGltYWdlJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMiklMEFpbWFnZV9mZWF0dXJlcyUyMCUzRCUyMG1vZGVsLmdldF9pbWFnZV9mZWF0dXJlcygqKmlucHV0cyklMEFpbWFnZV9mZWF0dXJlcyUyMCUzRCUyMGltYWdlX2ZlYXR1cmVzJTIwJTJGJTIwaW1hZ2VfZmVhdHVyZXMubm9ybShwJTNEMiUyQyUyMGRpbSUzRC0xJTJDJTIwa2VlcGRpbSUzRFRydWUpJTIwJTIwJTIzJTIwbm9ybWFsaXplJTBBJTBBJTIzJTIwY29tcHV0ZSUyMHRleHQlMjBmZWF0dXJlcyUwQWlucHV0cyUyMCUzRCUyMHByb2Nlc3Nvcih0ZXh0JTNEdGV4dHMlMkMlMjBwYWRkaW5nJTNEVHJ1ZSUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpJTBBdGV4dF9mZWF0dXJlcyUyMCUzRCUyMG1vZGVsLmdldF90ZXh0X2ZlYXR1cmVzKCoqaW5wdXRzKSUwQXRleHRfZmVhdHVyZXMlMjAlM0QlMjB0ZXh0X2ZlYXR1cmVzJTIwJTJGJTIwdGV4dF9mZWF0dXJlcy5ub3JtKHAlM0QyJTJDJTIwZGltJTNELTElMkMlMjBrZWVwZGltJTNEVHJ1ZSklMjAlMjAlMjMlMjBub3JtYWxpemUlMEElMEElMjMlMjBjb21wdXRlJTIwaW1hZ2UtdGV4dCUyMHNpbWlsYXJpdHklMjBzY29yZXMlMEFpbnB1dHMlMjAlM0QlMjBwcm9jZXNzb3IodGV4dCUzRHRleHRzJTJDJTIwaW1hZ2VzJTNEaW1hZ2UlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyJTJDJTIwcGFkZGluZyUzRFRydWUpJTBBb3V0cHV0cyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzKSUwQWxvZ2l0c19wZXJfaW1hZ2UlMjAlM0QlMjBvdXRwdXRzLmxvZ2l0c19wZXJfaW1hZ2UlMjAlMjAlMjMlMjB0aGlzJTIwaXMlMjB0aGUlMjBpbWFnZS10ZXh0JTIwc2ltaWxhcml0eSUyMHNjb3JlJTBBcHJvYnMlMjAlM0QlMjBsb2dpdHNfcGVyX2ltYWdlLnNvZnRtYXgoZGltJTNEMSklMjAlMjAlMjMlMjBwcm9icyUzQSUyMCU1QiU1QjEuMjY4NmUtMDMlMkMlMjA1LjQ0OTllLTAyJTJDJTIwNi43OTY4ZS0wNCUyQyUyMDkuNDM1NWUtMDElNUQlNUQ=",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> ChineseCLIPProcessor, ChineseCLIPModel

<span class="hljs-meta">&gt;&gt;&gt; </span>model = ChineseCLIPModel.from_pretrained(<span class="hljs-string">&quot;OFA-Sys/chinese-clip-vit-base-patch16&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>processor = ChineseCLIPProcessor.from_pretrained(<span class="hljs-string">&quot;OFA-Sys/chinese-clip-vit-base-patch16&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>url = <span class="hljs-string">&quot;https://clip-cn-beijing.oss-cn-beijing.aliyuncs.com/pokemon.jpeg&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><span class="hljs-comment"># Squirtle, Bulbasaur, Charmander, Pikachu in English</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>texts = [<span class="hljs-string">&quot;\u6770\u5C3C\u9F9F&quot;</span>, <span class="hljs-string">&quot;\u5999\u86D9\u79CD\u5B50&quot;</span>, <span class="hljs-string">&quot;\u5C0F\u706B\u9F99&quot;</span>, <span class="hljs-string">&quot;\u76AE\u5361\u4E18&quot;</span>]

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># compute image feature</span>
<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)
<span class="hljs-meta">&gt;&gt;&gt; </span>image_features = image_features / image_features.norm(p=<span class="hljs-number">2</span>, dim=-<span class="hljs-number">1</span>, keepdim=<span class="hljs-literal">True</span>)  <span class="hljs-comment"># normalize</span>

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># compute text features</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>text_features = model.get_text_features(**inputs)
<span class="hljs-meta">&gt;&gt;&gt; </span>text_features = text_features / text_features.norm(p=<span class="hljs-number">2</span>, dim=-<span class="hljs-number">1</span>, keepdim=<span class="hljs-literal">True</span>)  <span class="hljs-comment"># normalize</span>

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># compute image-text similarity scores</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = processor(text=texts, 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"># probs: [[1.2686e-03, 5.4499e-02, 6.7968e-04, 9.4355e-01]]</span>`}}),_t=new F({}),Ct=new $({props:{name:"class transformers.ChineseCLIPConfig",anchor:"transformers.ChineseCLIPConfig",parameters:[{name:"text_config",val:" = None"},{name:"vision_config",val:" = None"},{name:"projection_dim",val:" = 512"},{name:"logit_scale_init_value",val:" = 2.6592"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.ChineseCLIPConfig.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.31.0/en/model_doc/chinese_clip#transformers.ChineseCLIPTextConfig">ChineseCLIPTextConfig</a>.`,name:"text_config"},{anchor:"transformers.ChineseCLIPConfig.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.31.0/en/model_doc/chinese_clip#transformers.ChineseCLIPVisionConfig">ChineseCLIPVisionConfig</a>.`,name:"vision_config"},{anchor:"transformers.ChineseCLIPConfig.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.ChineseCLIPConfig.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 ChineseCLIP
implementation.`,name:"logit_scale_init_value"},{anchor:"transformers.ChineseCLIPConfig.kwargs",description:`<strong>kwargs</strong> (<em>optional</em>) &#x2014;
Dictionary of keyword arguments.`,name:"kwargs"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/chinese_clip/configuration_chinese_clip.py#L269"}}),Pe=new at({props:{anchor:"transformers.ChineseCLIPConfig.example",$$slots:{default:[Kc]},$$scope:{ctx:P}}}),bt=new $({props:{name:"from_text_vision_configs",anchor:"transformers.ChineseCLIPConfig.from_text_vision_configs",parameters:[{name:"text_config",val:": ChineseCLIPTextConfig"},{name:"vision_config",val:": ChineseCLIPVisionConfig"},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/chinese_clip/configuration_chinese_clip.py#L408"}}),yt=new F({}),Mt=new $({props:{name:"class transformers.ChineseCLIPTextConfig",anchor:"transformers.ChineseCLIPTextConfig",parameters:[{name:"vocab_size",val:" = 30522"},{name:"hidden_size",val:" = 768"},{name:"num_hidden_layers",val:" = 12"},{name:"num_attention_heads",val:" = 12"},{name:"intermediate_size",val:" = 3072"},{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:" = 512"},{name:"type_vocab_size",val:" = 2"},{name:"initializer_range",val:" = 0.02"},{name:"initializer_factor",val:" = 1.0"},{name:"layer_norm_eps",val:" = 1e-12"},{name:"pad_token_id",val:" = 0"},{name:"position_embedding_type",val:" = 'absolute'"},{name:"use_cache",val:" = True"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.ChineseCLIPTextConfig.vocab_size",description:`<strong>vocab_size</strong> (<code>int</code>, <em>optional</em>, defaults to 30522) &#x2014;
Vocabulary size of the CHINESE_CLIP 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.31.0/en/model_doc/chinese_clip#transformers.ChineseCLIPModel">ChineseCLIPModel</a>.`,name:"vocab_size"},{anchor:"transformers.ChineseCLIPTextConfig.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.ChineseCLIPTextConfig.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.ChineseCLIPTextConfig.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.ChineseCLIPTextConfig.intermediate_size",description:`<strong>intermediate_size</strong> (<code>int</code>, <em>optional</em>, defaults to 3072) &#x2014;
Dimensionality of the &#x201C;intermediate&#x201D; (often named feed-forward) layer in the Transformer encoder.`,name:"intermediate_size"},{anchor:"transformers.ChineseCLIPTextConfig.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.ChineseCLIPTextConfig.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.ChineseCLIPTextConfig.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.ChineseCLIPTextConfig.max_position_embeddings",description:`<strong>max_position_embeddings</strong> (<code>int</code>, <em>optional</em>, defaults to 512) &#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.ChineseCLIPTextConfig.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.31.0/en/model_doc/chinese_clip#transformers.ChineseCLIPModel">ChineseCLIPModel</a>.`,name:"type_vocab_size"},{anchor:"transformers.ChineseCLIPTextConfig.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.ChineseCLIPTextConfig.layer_norm_eps",description:`<strong>layer_norm_eps</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-12) &#x2014;
The epsilon used by the layer normalization layers.`,name:"layer_norm_eps"},{anchor:"transformers.ChineseCLIPTextConfig.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.ChineseCLIPTextConfig.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"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/chinese_clip/configuration_chinese_clip.py#L41"}}),je=new at({props:{anchor:"transformers.ChineseCLIPTextConfig.example",$$slots:{default:[ed]},$$scope:{ctx:P}}}),It=new F({}),wt=new $({props:{name:"class transformers.ChineseCLIPVisionConfig",anchor:"transformers.ChineseCLIPVisionConfig",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.ChineseCLIPVisionConfig.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.ChineseCLIPVisionConfig.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.ChineseCLIPVisionConfig.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.ChineseCLIPVisionConfig.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.ChineseCLIPVisionConfig.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.ChineseCLIPVisionConfig.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.ChineseCLIPVisionConfig.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.ChineseCLIPVisionConfig.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.ChineseCLIPVisionConfig.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.ChineseCLIPVisionConfig.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.ChineseCLIPVisionConfig.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.31.0/src/transformers/models/chinese_clip/configuration_chinese_clip.py#L164"}}),Ee=new at({props:{anchor:"transformers.ChineseCLIPVisionConfig.example",$$slots:{default:[td]},$$scope:{ctx:P}}}),Lt=new F({}),$t=new $({props:{name:"class transformers.ChineseCLIPImageProcessor",anchor:"transformers.ChineseCLIPImageProcessor",parameters:[{name:"do_resize",val:": bool = True"},{name:"size",val:": typing.Dict[str, int] = None"},{name:"resample",val:": Resampling = <Resampling.BICUBIC: 3>"},{name:"do_center_crop",val:": bool = True"},{name:"crop_size",val:": typing.Dict[str, int] = None"},{name:"do_rescale",val:": bool = True"},{name:"rescale_factor",val:": typing.Union[int, float] = 0.00392156862745098"},{name:"do_normalize",val:": bool = True"},{name:"image_mean",val:": typing.Union[float, typing.List[float], NoneType] = None"},{name:"image_std",val:": typing.Union[float, typing.List[float], NoneType] = None"},{name:"do_convert_rgb",val:": bool = True"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.ChineseCLIPImageProcessor.do_resize",description:`<strong>do_resize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to resize the image&#x2019;s (height, width) dimensions to the specified <code>size</code>. Can be overridden by
<code>do_resize</code> in the <code>preprocess</code> method.`,name:"do_resize"},{anchor:"transformers.ChineseCLIPImageProcessor.size",description:`<strong>size</strong> (<code>Dict[str, int]</code> <em>optional</em>, defaults to <code>{&quot;shortest_edge&quot; -- 224}</code>):
Size of the image after resizing. The shortest edge of the image is resized to size[&#x201C;shortest_edge&#x201D;], with
the longest edge resized to keep the input aspect ratio. Can be overridden by <code>size</code> in the <code>preprocess</code>
method.`,name:"size"},{anchor:"transformers.ChineseCLIPImageProcessor.resample",description:`<strong>resample</strong> (<code>PILImageResampling</code>, <em>optional</em>, defaults to <code>PILImageResampling.BICUBIC</code>) &#x2014;
Resampling filter to use if resizing the image. Can be overridden by <code>resample</code> in the <code>preprocess</code> method.`,name:"resample"},{anchor:"transformers.ChineseCLIPImageProcessor.do_center_crop",description:`<strong>do_center_crop</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to center crop the image to the specified <code>crop_size</code>. Can be overridden by <code>do_center_crop</code> in the
<code>preprocess</code> method.`,name:"do_center_crop"},{anchor:"transformers.ChineseCLIPImageProcessor.crop_size",description:`<strong>crop_size</strong> (<code>Dict[str, int]</code> <em>optional</em>, defaults to 224) &#x2014;
Size of the output image after applying <code>center_crop</code>. Can be overridden by <code>crop_size</code> in the <code>preprocess</code>
method.`,name:"crop_size"},{anchor:"transformers.ChineseCLIPImageProcessor.do_rescale",description:`<strong>do_rescale</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to rescale the image by the specified scale <code>rescale_factor</code>. Can be overridden by <code>do_rescale</code> in
the <code>preprocess</code> method.`,name:"do_rescale"},{anchor:"transformers.ChineseCLIPImageProcessor.rescale_factor",description:`<strong>rescale_factor</strong> (<code>int</code> or <code>float</code>, <em>optional</em>, defaults to <code>1/255</code>) &#x2014;
Scale factor to use if rescaling the image. Can be overridden by <code>rescale_factor</code> in the <code>preprocess</code>
method.
do_normalize &#x2014;
Whether to normalize the image. Can be overridden by <code>do_normalize</code> in the <code>preprocess</code> method.`,name:"rescale_factor"},{anchor:"transformers.ChineseCLIPImageProcessor.image_mean",description:`<strong>image_mean</strong> (<code>float</code> or <code>List[float]</code>, <em>optional</em>, defaults to <code>IMAGENET_STANDARD_MEAN</code>) &#x2014;
Mean to use if normalizing the image. This is a float or list of floats the length of the number of
channels in the image. Can be overridden by the <code>image_mean</code> parameter in the <code>preprocess</code> method.`,name:"image_mean"},{anchor:"transformers.ChineseCLIPImageProcessor.image_std",description:`<strong>image_std</strong> (<code>float</code> or <code>List[float]</code>, <em>optional</em>, defaults to <code>IMAGENET_STANDARD_STD</code>) &#x2014;
Image standard deviation.`,name:"image_std"},{anchor:"transformers.ChineseCLIPImageProcessor.do_convert_rgb",description:`<strong>do_convert_rgb</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Standard deviation to use if normalizing the image. This is a float or list of floats the length of the
number of channels in the image. Can be overridden by the <code>image_std</code> parameter in the <code>preprocess</code> method.`,name:"do_convert_rgb"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/chinese_clip/image_processing_chinese_clip.py#L51"}}),jt=new $({props:{name:"preprocess",anchor:"transformers.ChineseCLIPImageProcessor.preprocess",parameters:[{name:"images",val:": typing.Union[ForwardRef('PIL.Image.Image'), numpy.ndarray, ForwardRef('torch.Tensor'), typing.List[ForwardRef('PIL.Image.Image')], typing.List[numpy.ndarray], typing.List[ForwardRef('torch.Tensor')]]"},{name:"do_resize",val:": bool = None"},{name:"size",val:": typing.Dict[str, int] = None"},{name:"resample",val:": Resampling = None"},{name:"do_center_crop",val:": bool = None"},{name:"crop_size",val:": int = None"},{name:"do_rescale",val:": bool = None"},{name:"rescale_factor",val:": float = None"},{name:"do_normalize",val:": bool = None"},{name:"image_mean",val:": typing.Union[float, typing.List[float], NoneType] = None"},{name:"image_std",val:": typing.Union[float, typing.List[float], NoneType] = None"},{name:"do_convert_rgb",val:": bool = None"},{name:"return_tensors",val:": typing.Union[str, transformers.utils.generic.TensorType, NoneType] = None"},{name:"data_format",val:": typing.Optional[transformers.image_utils.ChannelDimension] = <ChannelDimension.FIRST: 'channels_first'>"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.ChineseCLIPImageProcessor.preprocess.images",description:`<strong>images</strong> (<code>ImageInput</code>) &#x2014;
Image to preprocess.`,name:"images"},{anchor:"transformers.ChineseCLIPImageProcessor.preprocess.do_resize",description:`<strong>do_resize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>self.do_resize</code>) &#x2014;
Whether to resize the image.`,name:"do_resize"},{anchor:"transformers.ChineseCLIPImageProcessor.preprocess.size",description:`<strong>size</strong> (<code>Dict[str, int]</code>, <em>optional</em>, defaults to <code>self.size</code>) &#x2014;
Size of the image after resizing. Shortest edge of the image is resized to size[&#x201C;shortest_edge&#x201D;], with
the longest edge resized to keep the input aspect ratio.`,name:"size"},{anchor:"transformers.ChineseCLIPImageProcessor.preprocess.resample",description:`<strong>resample</strong> (<code>int</code>, <em>optional</em>, defaults to <code>self.resample</code>) &#x2014;
Resampling filter to use if resizing the image. This can be one of the enum <code>PILImageResampling</code>. Only
has an effect if <code>do_resize</code> is set to <code>True</code>.`,name:"resample"},{anchor:"transformers.ChineseCLIPImageProcessor.preprocess.do_center_crop",description:`<strong>do_center_crop</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>self.do_center_crop</code>) &#x2014;
Whether to center crop the image.`,name:"do_center_crop"},{anchor:"transformers.ChineseCLIPImageProcessor.preprocess.crop_size",description:`<strong>crop_size</strong> (<code>Dict[str, int]</code>, <em>optional</em>, defaults to <code>self.crop_size</code>) &#x2014;
Size of the center crop. Only has an effect if <code>do_center_crop</code> is set to <code>True</code>.`,name:"crop_size"},{anchor:"transformers.ChineseCLIPImageProcessor.preprocess.do_rescale",description:`<strong>do_rescale</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>self.do_rescale</code>) &#x2014;
Whether to rescale the image.`,name:"do_rescale"},{anchor:"transformers.ChineseCLIPImageProcessor.preprocess.rescale_factor",description:`<strong>rescale_factor</strong> (<code>float</code>, <em>optional</em>, defaults to <code>self.rescale_factor</code>) &#x2014;
Rescale factor to rescale the image by if <code>do_rescale</code> is set to <code>True</code>.`,name:"rescale_factor"},{anchor:"transformers.ChineseCLIPImageProcessor.preprocess.do_normalize",description:`<strong>do_normalize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>self.do_normalize</code>) &#x2014;
Whether to normalize the image.`,name:"do_normalize"},{anchor:"transformers.ChineseCLIPImageProcessor.preprocess.image_mean",description:`<strong>image_mean</strong> (<code>float</code> or <code>List[float]</code>, <em>optional</em>, defaults to <code>self.image_mean</code>) &#x2014;
Image mean to use for normalization. Only has an effect if <code>do_normalize</code> is set to <code>True</code>.`,name:"image_mean"},{anchor:"transformers.ChineseCLIPImageProcessor.preprocess.image_std",description:`<strong>image_std</strong> (<code>float</code> or <code>List[float]</code>, <em>optional</em>, defaults to <code>self.image_std</code>) &#x2014;
Image standard deviation to use for normalization. Only has an effect if <code>do_normalize</code> is set to
<code>True</code>.`,name:"image_std"},{anchor:"transformers.ChineseCLIPImageProcessor.preprocess.do_convert_rgb",description:`<strong>do_convert_rgb</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>self.do_convert_rgb</code>) &#x2014;
Whether to convert the image to RGB.`,name:"do_convert_rgb"},{anchor:"transformers.ChineseCLIPImageProcessor.preprocess.return_tensors",description:`<strong>return_tensors</strong> (<code>str</code> or <code>TensorType</code>, <em>optional</em>) &#x2014;
The type of tensors to return. Can be one of:<ul>
<li>Unset: Return a list of <code>np.ndarray</code>.</li>
<li><code>TensorType.TENSORFLOW</code> or <code>&apos;tf&apos;</code>: Return a batch of type <code>tf.Tensor</code>.</li>
<li><code>TensorType.PYTORCH</code> or <code>&apos;pt&apos;</code>: Return a batch of type <code>torch.Tensor</code>.</li>
<li><code>TensorType.NUMPY</code> or <code>&apos;np&apos;</code>: Return a batch of type <code>np.ndarray</code>.</li>
<li><code>TensorType.JAX</code> or <code>&apos;jax&apos;</code>: Return a batch of type <code>jax.numpy.ndarray</code>.</li>
</ul>`,name:"return_tensors"},{anchor:"transformers.ChineseCLIPImageProcessor.preprocess.data_format",description:`<strong>data_format</strong> (<code>ChannelDimension</code> or <code>str</code>, <em>optional</em>, defaults to <code>ChannelDimension.FIRST</code>) &#x2014;
The channel dimension format for the output image. Can be one of:<ul>
<li><code>ChannelDimension.FIRST</code>: image in (num_channels, height, width) format.</li>
<li><code>ChannelDimension.LAST</code>: image in (height, width, num_channels) format.</li>
<li>Unset: defaults to the channel dimension format of the input image.</li>
</ul>`,name:"data_format"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/chinese_clip/image_processing_chinese_clip.py#L217"}}),kt=new F({}),Jt=new $({props:{name:"class transformers.ChineseCLIPFeatureExtractor",anchor:"transformers.ChineseCLIPFeatureExtractor",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/chinese_clip/feature_extraction_chinese_clip.py#L26"}}),xt=new F({}),zt=new $({props:{name:"class transformers.ChineseCLIPProcessor",anchor:"transformers.ChineseCLIPProcessor",parameters:[{name:"image_processor",val:" = None"},{name:"tokenizer",val:" = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.ChineseCLIPProcessor.image_processor",description:`<strong>image_processor</strong> (<a href="/docs/transformers/v4.31.0/en/model_doc/chinese_clip#transformers.ChineseCLIPImageProcessor">ChineseCLIPImageProcessor</a>) &#x2014;
The image processor is a required input.`,name:"image_processor"},{anchor:"transformers.ChineseCLIPProcessor.tokenizer",description:`<strong>tokenizer</strong> (<a href="/docs/transformers/v4.31.0/en/model_doc/bert#transformers.BertTokenizerFast">BertTokenizerFast</a>) &#x2014;
The tokenizer is a required input.`,name:"tokenizer"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/chinese_clip/processing_chinese_clip.py#L25"}}),Ut=new $({props:{name:"batch_decode",anchor:"transformers.ChineseCLIPProcessor.batch_decode",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/chinese_clip/processing_chinese_clip.py#L115"}}),Wt=new $({props:{name:"decode",anchor:"transformers.ChineseCLIPProcessor.decode",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/chinese_clip/processing_chinese_clip.py#L122"}}),Vt=new F({}),Bt=new $({props:{name:"class transformers.ChineseCLIPModel",anchor:"transformers.ChineseCLIPModel",parameters:[{name:"config",val:": ChineseCLIPConfig"}],parametersDescription:[{anchor:"transformers.ChineseCLIPModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.31.0/en/model_doc/chinese_clip#transformers.ChineseCLIPConfig">ChineseCLIPConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/v4.31.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/chinese_clip/modeling_chinese_clip.py#L1349"}}),St=new $({props:{name:"forward",anchor:"transformers.ChineseCLIPModel.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:"token_type_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"position_ids",val:": typing.Optional[torch.LongTensor] = 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.ChineseCLIPModel.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.31.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.31.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.31.0/en/model_doc/wav2vec2#transformers.Wav2Vec2CTCTokenizer.__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.ChineseCLIPModel.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.ChineseCLIPModel.forward.token_type_ids",description:`<strong>token_type_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>:</p>
<ul>
<li>0 corresponds to a <em>sentence A</em> token,</li>
<li>1 corresponds to a <em>sentence B</em> token.</li>
</ul>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a>`,name:"token_type_ids"},{anchor:"transformers.ChineseCLIPModel.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.ChineseCLIPModel.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.31.0/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <a href="/docs/transformers/v4.31.0/en/model_doc/perceiver#transformers.PerceiverFeatureExtractor.__call__">ChineseCLIPImageProcessor.<strong>call</strong>()</a> for details.`,name:"pixel_values"},{anchor:"transformers.ChineseCLIPModel.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.ChineseCLIPModel.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.ChineseCLIPModel.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.ChineseCLIPModel.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.31.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.31.0/src/transformers/models/chinese_clip/modeling_chinese_clip.py#L1484",returnDescription:`
<p>A <code>transformers.models.chinese_clip.modeling_chinese_clip.ChineseCLIPOutput</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.chinese_clip.configuration_chinese_clip.ChineseCLIPConfig'&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.31.0/en/model_doc/chinese_clip#transformers.ChineseCLIPTextModel"
>ChineseCLIPTextModel</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.31.0/en/model_doc/chinese_clip#transformers.ChineseCLIPVisionModel"
>ChineseCLIPVisionModel</a>.</li>
<li><strong>text_model_output(<code>BaseModelOutputWithPoolingAndCrossAttentions</code>):</strong>
The output of the <a
  href="/docs/transformers/v4.31.0/en/model_doc/chinese_clip#transformers.ChineseCLIPTextModel"
>ChineseCLIPTextModel</a>.</li>
<li><strong>vision_model_output(<code>BaseModelOutputWithPoolingAndCrossAttentions</code>):</strong>
The output of the <a
  href="/docs/transformers/v4.31.0/en/model_doc/chinese_clip#transformers.ChineseCLIPVisionModel"
>ChineseCLIPVisionModel</a>.</li>
</ul>
`,returnType:`
<p><code>transformers.models.chinese_clip.modeling_chinese_clip.ChineseCLIPOutput</code> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Ve=new Gn({props:{$$slots:{default:[od]},$$scope:{ctx:P}}}),Be=new at({props:{anchor:"transformers.ChineseCLIPModel.forward.example",$$slots:{default:[nd]},$$scope:{ctx:P}}}),Ft=new $({props:{name:"get_text_features",anchor:"transformers.ChineseCLIPModel.get_text_features",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:"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.ChineseCLIPModel.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.</p>
<p>Indices can be obtained using <a href="/docs/transformers/v4.31.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.31.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.31.0/en/model_doc/wav2vec2#transformers.Wav2Vec2CTCTokenizer.__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.ChineseCLIPModel.get_text_features.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.FloatTensor</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.ChineseCLIPModel.get_text_features.token_type_ids",description:`<strong>token_type_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>:</p>
<ul>
<li>0 corresponds to a <em>sentence A</em> token,</li>
<li>1 corresponds to a <em>sentence B</em> token.</li>
</ul>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a>`,name:"token_type_ids"},{anchor:"transformers.ChineseCLIPModel.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.ChineseCLIPModel.get_text_features.head_mask",description:`<strong>head_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.ChineseCLIPModel.get_text_features.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.ChineseCLIPModel.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.ChineseCLIPModel.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.ChineseCLIPModel.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.31.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.31.0/src/transformers/models/chinese_clip/modeling_chinese_clip.py#L1384",returnDescription:`
<p>The text embeddings obtained by
applying the projection layer to the final [CLS] hidden state of Text-Transformer.</p>
`,returnType:`
<p>text_features (<code>torch.FloatTensor</code> of shape <code>(batch_size, output_dim</code>)</p>
`}}),Re=new Gn({props:{$$slots:{default:[sd]},$$scope:{ctx:P}}}),Ae=new at({props:{anchor:"transformers.ChineseCLIPModel.get_text_features.example",$$slots:{default:[ad]},$$scope:{ctx:P}}}),Gt=new $({props:{name:"get_image_features",anchor:"transformers.ChineseCLIPModel.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.ChineseCLIPModel.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.31.0/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <a href="/docs/transformers/v4.31.0/en/model_doc/perceiver#transformers.PerceiverFeatureExtractor.__call__">ChineseCLIPImageProcessor.<strong>call</strong>()</a> for details.`,name:"pixel_values"},{anchor:"transformers.ChineseCLIPModel.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.ChineseCLIPModel.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.ChineseCLIPModel.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.31.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.31.0/src/transformers/models/chinese_clip/modeling_chinese_clip.py#L1434",returnDescription:`
<p>The image embeddings obtained by
applying the projection layer to the final [CLS] hidden state of Vision-Transformer.</p>
`,returnType:`
<p>image_features (<code>torch.FloatTensor</code> of shape <code>(batch_size, output_dim</code>)</p>
`}}),Se=new Gn({props:{$$slots:{default:[rd]},$$scope:{ctx:P}}}),Fe=new at({props:{anchor:"transformers.ChineseCLIPModel.get_image_features.example",$$slots:{default:[id]},$$scope:{ctx:P}}}),Xt=new F({}),Qt=new $({props:{name:"class transformers.ChineseCLIPTextModel",anchor:"transformers.ChineseCLIPTextModel",parameters:[{name:"config",val:""},{name:"add_pooling_layer",val:" = True"}],parametersDescription:[{anchor:"transformers.ChineseCLIPTextModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.31.0/en/model_doc/chinese_clip#transformers.ChineseCLIPConfig">ChineseCLIPConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/v4.31.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/chinese_clip/modeling_chinese_clip.py#L1113"}}),Dt=new $({props:{name:"forward",anchor:"transformers.ChineseCLIPTextModel.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:"past_key_values",val:": typing.Optional[typing.List[torch.FloatTensor]] = None"},{name:"use_cache",val:": typing.Optional[bool] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.ChineseCLIPTextModel.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.31.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.31.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.31.0/en/model_doc/wav2vec2#transformers.Wav2Vec2CTCTokenizer.__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.ChineseCLIPTextModel.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.ChineseCLIPTextModel.forward.token_type_ids",description:`<strong>token_type_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>:</p>
<ul>
<li>0 corresponds to a <em>sentence A</em> token,</li>
<li>1 corresponds to a <em>sentence B</em> token.</li>
</ul>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a>`,name:"token_type_ids"},{anchor:"transformers.ChineseCLIPTextModel.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.ChineseCLIPTextModel.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.31.0/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <a href="/docs/transformers/v4.31.0/en/model_doc/perceiver#transformers.PerceiverFeatureExtractor.__call__">ChineseCLIPImageProcessor.<strong>call</strong>()</a> for details.`,name:"pixel_values"},{anchor:"transformers.ChineseCLIPTextModel.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.ChineseCLIPTextModel.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.ChineseCLIPTextModel.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.ChineseCLIPTextModel.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.31.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.ChineseCLIPTextModel.forward.encoder_hidden_states",description:`<strong>encoder_hidden_states</strong>  (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Sequence of hidden-states at the output of the last layer of the encoder. Used in the cross-attention if
the model is configured as a decoder.`,name:"encoder_hidden_states"},{anchor:"transformers.ChineseCLIPTextModel.forward.encoder_attention_mask",description:`<strong>encoder_attention_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on the padding token indices of the encoder input. This mask is used in
the cross-attention if the model is configured as a decoder. 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>`,name:"encoder_attention_mask"},{anchor:"transformers.ChineseCLIPTextModel.forward.past_key_values",description:`<strong>past_key_values</strong> (<code>tuple(tuple(torch.FloatTensor))</code> of length <code>config.n_layers</code> with each tuple having 4 tensors of shape <code>(batch_size, num_heads, sequence_length - 1, embed_size_per_head)</code>) &#x2014;
Contains precomputed key and value hidden states of the attention blocks. Can be used to speed up decoding.</p>
<p>If <code>past_key_values</code> are used, the user can optionally input only the last <code>decoder_input_ids</code> (those that
don&#x2019;t have their past key value states given to this model) of shape <code>(batch_size, 1)</code> instead of all
<code>decoder_input_ids</code> of shape <code>(batch_size, sequence_length)</code>.`,name:"past_key_values"},{anchor:"transformers.ChineseCLIPTextModel.forward.use_cache",description:`<strong>use_cache</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
If set to <code>True</code>, <code>past_key_values</code> key value states are returned and can be used to speed up decoding (see
<code>past_key_values</code>).`,name:"use_cache"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/chinese_clip/modeling_chinese_clip.py#L1154",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.31.0/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPoolingAndCrossAttentions"
>transformers.modeling_outputs.BaseModelOutputWithPoolingAndCrossAttentions</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/v4.31.0/en/model_doc/chinese_clip#transformers.ChineseCLIPConfig"
>ChineseCLIPConfig</a>) 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>cross_attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> and <code>config.add_cross_attention=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 of the decoder\u2019s cross-attention layer, after the attention softmax, used to compute the
weighted average in the cross-attention heads.</p>
</li>
<li>
<p><strong>past_key_values</strong> (<code>tuple(tuple(torch.FloatTensor))</code>, <em>optional</em>, returned when <code>use_cache=True</code> is passed or when <code>config.use_cache=True</code>) \u2014 Tuple of <code>tuple(torch.FloatTensor)</code> of length <code>config.n_layers</code>, with each tuple having 2 tensors of shape
<code>(batch_size, num_heads, sequence_length, embed_size_per_head)</code>) and optionally if
<code>config.is_encoder_decoder=True</code> 2 additional tensors of shape <code>(batch_size, num_heads, encoder_sequence_length, embed_size_per_head)</code>.</p>
<p>Contains pre-computed hidden-states (key and values in the self-attention blocks and optionally if
<code>config.is_encoder_decoder=True</code> in the cross-attention blocks) that can be used (see <code>past_key_values</code>
input) to speed up sequential decoding.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.31.0/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPoolingAndCrossAttentions"
>transformers.modeling_outputs.BaseModelOutputWithPoolingAndCrossAttentions</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Xe=new Gn({props:{$$slots:{default:[ld]},$$scope:{ctx:P}}}),Qe=new at({props:{anchor:"transformers.ChineseCLIPTextModel.forward.example",$$slots:{default:[cd]},$$scope:{ctx:P}}}),Kt=new F({}),eo=new $({props:{name:"class transformers.ChineseCLIPVisionModel",anchor:"transformers.ChineseCLIPVisionModel",parameters:[{name:"config",val:": ChineseCLIPVisionConfig"}],parametersDescription:[{anchor:"transformers.ChineseCLIPVisionModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.31.0/en/model_doc/chinese_clip#transformers.ChineseCLIPConfig">ChineseCLIPConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/v4.31.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/chinese_clip/modeling_chinese_clip.py#L1294"}}),no=new $({props:{name:"forward",anchor:"transformers.ChineseCLIPVisionModel.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.ChineseCLIPVisionModel.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.31.0/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <a href="/docs/transformers/v4.31.0/en/model_doc/perceiver#transformers.PerceiverFeatureExtractor.__call__">ChineseCLIPImageProcessor.<strong>call</strong>()</a> for details.`,name:"pixel_values"},{anchor:"transformers.ChineseCLIPVisionModel.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.ChineseCLIPVisionModel.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.ChineseCLIPVisionModel.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.31.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.31.0/src/transformers/models/chinese_clip/modeling_chinese_clip.py#L1307",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.31.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.chinese_clip.configuration_chinese_clip.ChineseCLIPVisionConfig'&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.31.0/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPooling"
>transformers.modeling_outputs.BaseModelOutputWithPooling</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Oe=new Gn({props:{$$slots:{default:[dd]},$$scope:{ctx:P}}}),Ye=new at({props:{anchor:"transformers.ChineseCLIPVisionModel.forward.example",$$slots:{default:[hd]},$$scope:{ctx:P}}}),{c(){d=n("meta"),v=h(),u=n("h1"),f=n("a"),C=n("span"),b(r.$$.fragment),m=h(),L=n("span"),Fs=i("Chinese-CLIP"),Xn=h(),ee=n("h2"),Me=n("a"),Xo=n("span"),b(it.$$.fragment),Gs=h(),Qo=n("span"),Xs=i("Overview"),Qn=h(),q=n("p"),Qs=i("The Chinese-CLIP model was proposed in "),lt=n("a"),qs=i("Chinese CLIP: Contrastive Vision-Language Pretraining in Chinese"),Os=i(` by An Yang, Junshu Pan, Junyang Lin, Rui Men, Yichang Zhang, Jingren Zhou, Chang Zhou.
Chinese-CLIP is an implementation of CLIP (Radford et al., 2021) on a large-scale dataset of Chinese image-text pairs. It is capable of performing cross-modal retrieval and also playing as a vision backbone for vision tasks like zero-shot image classification, open-domain object detection, etc. The original Chinese-CLIP code is released `),ct=n("a"),Ys=i("at this link"),Hs=i("."),qn=h(),io=n("p"),Ds=i("The abstract from the paper is the following:"),On=h(),lo=n("p"),qo=n("em"),Ks=i("The tremendous success of CLIP (Radford et al., 2021) has promoted the research and application of contrastive learning for vision-language pretraining. In this work, we construct a large-scale dataset of image-text pairs in Chinese, where most data are retrieved from publicly available datasets, and we pretrain Chinese CLIP models on the new dataset. We develop 5 Chinese CLIP models of multiple sizes, spanning from 77 to 958 million parameters. Furthermore, we propose a two-stage pretraining method, where the model is first trained with the image encoder frozen and then trained with all parameters being optimized, to achieve enhanced model performance. Our comprehensive experiments demonstrate that Chinese CLIP can achieve the state-of-the-art performance on MUGE, Flickr30K-CN, and COCO-CN in the setups of zero-shot learning and finetuning, and it is able to achieve competitive performance in zero-shot image classification based on the evaluation on the ELEVATER benchmark (Li et al., 2022). Our codes, pretrained models, and demos have been released."),Yn=h(),te=n("h2"),Te=n("a"),Oo=n("span"),b(dt.$$.fragment),ea=h(),Yo=n("span"),ta=i("Usage"),Hn=h(),co=n("p"),oa=i("The code snippet below shows how to compute image & text features and similarities:"),Dn=h(),b(ht.$$.fragment),Kn=h(),ho=n("p"),na=i("Currently, we release the following scales of pretrained Chinese-CLIP models at HF Model Hub:"),es=h(),N=n("ul"),Ho=n("li"),pt=n("a"),sa=i("OFA-Sys/chinese-clip-vit-base-patch16"),aa=h(),Do=n("li"),mt=n("a"),ra=i("OFA-Sys/chinese-clip-vit-large-patch14"),ia=h(),Ko=n("li"),ft=n("a"),la=i("OFA-Sys/chinese-clip-vit-large-patch14-336px"),ca=h(),en=n("li"),gt=n("a"),da=i("OFA-Sys/chinese-clip-vit-huge-patch14"),ts=h(),Ie=n("p"),ha=i("The Chinese-CLIP model was contributed by "),ut=n("a"),pa=i("OFA-Sys"),ma=i("."),os=h(),oe=n("h2"),we=n("a"),tn=n("span"),b(_t.$$.fragment),fa=h(),on=n("span"),ga=i("ChineseCLIPConfig"),ns=h(),k=n("div"),b(Ct.$$.fragment),ua=h(),O=n("p"),po=n("a"),_a=i("ChineseCLIPConfig"),Ca=i(" is the configuration class to store the configuration of a "),mo=n("a"),va=i("ChineseCLIPModel"),ba=i(`. It is used
to instantiate Chinese-CLIP model according to the specified arguments, defining the text model and vision model
configs. Instantiating a configuration with the defaults will yield a similar configuration to that of the
Chinese-CLIP `),vt=n("a"),ya=i("OFA-Sys/chinese-clip-vit-base-patch16"),Ma=i(`
architecture.`),Ta=h(),ne=n("p"),Ia=i("Configuration objects inherit from "),fo=n("a"),wa=i("PretrainedConfig"),Pa=i(` and can be used to control the model outputs. Read the
documentation from `),go=n("a"),La=i("PretrainedConfig"),$a=i(" for more information."),ja=h(),b(Pe.$$.fragment),ka=h(),Le=n("div"),b(bt.$$.fragment),Ea=h(),se=n("p"),Ja=i("Instantiate a "),uo=n("a"),xa=i("ChineseCLIPConfig"),za=i(` (or a derived class) from Chinese-CLIP text model configuration and
Chinese-CLIP vision model configuration. Returns:
`),_o=n("a"),Ua=i("ChineseCLIPConfig"),Za=i(": An instance of a configuration object"),ss=h(),ae=n("h2"),$e=n("a"),nn=n("span"),b(yt.$$.fragment),Wa=h(),sn=n("span"),Na=i("ChineseCLIPTextConfig"),as=h(),Z=n("div"),b(Mt.$$.fragment),Va=h(),Tt=n("p"),Ba=i("This is the configuration class to store the configuration of a "),Co=n("a"),Ra=i("ChineseCLIPModel"),Aa=i(`. It is used to instantiate a
Chinese CLIP 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 Chinese CLIP
[OFA-Sys/chinese-clip-vit-base-patch16](https:
//huggingface.co/OFA-Sys/chinese-clip-vit-base-patch16) architecture.`),Sa=h(),re=n("p"),Fa=i("Configuration objects inherit from "),vo=n("a"),Ga=i("PretrainedConfig"),Xa=i(` and can be used to control the model outputs. Read the
documentation from `),bo=n("a"),Qa=i("PretrainedConfig"),qa=i(" for more information."),Oa=h(),b(je.$$.fragment),rs=h(),ie=n("h2"),ke=n("a"),an=n("span"),b(It.$$.fragment),Ya=h(),rn=n("span"),Ha=i("ChineseCLIPVisionConfig"),is=h(),W=n("div"),b(wt.$$.fragment),Da=h(),Pt=n("p"),Ka=i("This is the configuration class to store the configuration of a "),yo=n("a"),er=i("ChineseCLIPModel"),tr=i(`. It is used to instantiate an
ChineseCLIP 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 ChineseCLIP
[OFA-Sys/chinese-clip-vit-base-patch16](https:
//huggingface.co/OFA-Sys/chinese-clip-vit-base-patch16) architecture.`),or=h(),le=n("p"),nr=i("Configuration objects inherit from "),Mo=n("a"),sr=i("PretrainedConfig"),ar=i(` and can be used to control the model outputs. Read the
documentation from `),To=n("a"),rr=i("PretrainedConfig"),ir=i(" for more information."),lr=h(),b(Ee.$$.fragment),ls=h(),ce=n("h2"),Je=n("a"),ln=n("span"),b(Lt.$$.fragment),cr=h(),cn=n("span"),dr=i("ChineseCLIPImageProcessor"),cs=h(),G=n("div"),b($t.$$.fragment),hr=h(),dn=n("p"),pr=i("Constructs a Chinese-CLIP image processor."),mr=h(),xe=n("div"),b(jt.$$.fragment),fr=h(),hn=n("p"),gr=i("Preprocess an image or batch of images."),ds=h(),de=n("h2"),ze=n("a"),pn=n("span"),b(kt.$$.fragment),ur=h(),mn=n("span"),_r=i("ChineseCLIPFeatureExtractor"),hs=h(),Et=n("div"),b(Jt.$$.fragment),ps=h(),he=n("h2"),Ue=n("a"),fn=n("span"),b(xt.$$.fragment),Cr=h(),gn=n("span"),vr=i("ChineseCLIPProcessor"),ms=h(),E=n("div"),b(zt.$$.fragment),br=h(),un=n("p"),yr=i(`Constructs a Chinese-CLIP processor which wraps a Chinese-CLIP image processor and a Chinese-CLIP tokenizer into a
single processor.`),Mr=h(),z=n("p"),Io=n("a"),Tr=i("ChineseCLIPProcessor"),Ir=i(" offers all the functionalities of "),wo=n("a"),wr=i("ChineseCLIPImageProcessor"),Pr=i(" and "),Po=n("a"),Lr=i("BertTokenizerFast"),$r=i(`.
See the `),_n=n("code"),jr=i("__call__()"),kr=i(" and "),Lo=n("a"),Er=i("decode()"),Jr=i(" for more information."),xr=h(),Ze=n("div"),b(Ut.$$.fragment),zr=h(),Zt=n("p"),Ur=i("This method forwards all its arguments to BertTokenizerFast\u2019s "),$o=n("a"),Zr=i("batch_decode()"),Wr=i(`. Please
refer to the docstring of this method for more information.`),Nr=h(),We=n("div"),b(Wt.$$.fragment),Vr=h(),Nt=n("p"),Br=i("This method forwards all its arguments to BertTokenizerFast\u2019s "),jo=n("a"),Rr=i("decode()"),Ar=i(`. Please refer to
the docstring of this method for more information.`),fs=h(),pe=n("h2"),Ne=n("a"),Cn=n("span"),b(Vt.$$.fragment),Sr=h(),vn=n("span"),Fr=i("ChineseCLIPModel"),gs=h(),J=n("div"),b(Bt.$$.fragment),Gr=h(),Rt=n("p"),Xr=i("This model is a PyTorch "),At=n("a"),Qr=i("torch.nn.Module"),qr=i(` subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Or=h(),V=n("div"),b(St.$$.fragment),Yr=h(),me=n("p"),Hr=i("The "),ko=n("a"),Dr=i("ChineseCLIPModel"),Kr=i(" forward method, overrides the "),bn=n("code"),ei=i("__call__"),ti=i(" special method."),oi=h(),b(Ve.$$.fragment),ni=h(),b(Be.$$.fragment),si=h(),B=n("div"),b(Ft.$$.fragment),ai=h(),fe=n("p"),ri=i("The "),Eo=n("a"),ii=i("ChineseCLIPModel"),li=i(" forward method, overrides the "),yn=n("code"),ci=i("__call__"),di=i(" special method."),hi=h(),b(Re.$$.fragment),pi=h(),b(Ae.$$.fragment),mi=h(),R=n("div"),b(Gt.$$.fragment),fi=h(),ge=n("p"),gi=i("The "),Jo=n("a"),ui=i("ChineseCLIPModel"),_i=i(" forward method, overrides the "),Mn=n("code"),Ci=i("__call__"),vi=i(" special method."),bi=h(),b(Se.$$.fragment),yi=h(),b(Fe.$$.fragment),us=h(),ue=n("h2"),Ge=n("a"),Tn=n("span"),b(Xt.$$.fragment),Mi=h(),In=n("span"),Ti=i("ChineseCLIPTextModel"),_s=h(),x=n("div"),b(Qt.$$.fragment),Ii=h(),qt=n("p"),wi=i(`The text model from CHINESE_CLIP without any head or projection on top.
This model is a PyTorch `),Ot=n("a"),Pi=i("torch.nn.Module"),Li=i(` subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),$i=h(),Yt=n("p"),ji=i(`The model can behave as an encoder (with only self-attention) as well as a decoder, in which case a layer of
cross-attention is added between the self-attention layers, following the architecture described in `),Ht=n("a"),ki=i(`Attention is
all you need`),Ei=i(` by Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit,
Llion Jones, Aidan N. Gomez, Lukasz Kaiser and Illia Polosukhin.`),Ji=h(),j=n("p"),xi=i("To behave as an decoder the model needs to be initialized with the "),wn=n("code"),zi=i("is_decoder"),Ui=i(` argument of the configuration set
to `),Pn=n("code"),Zi=i("True"),Wi=i(". To be used in a Seq2Seq model, the model needs to initialized with both "),Ln=n("code"),Ni=i("is_decoder"),Vi=i(` argument and
`),$n=n("code"),Bi=i("add_cross_attention"),Ri=i(" set to "),jn=n("code"),Ai=i("True"),Si=i("; an "),kn=n("code"),Fi=i("encoder_hidden_states"),Gi=i(" is then expected as an input to the forward pass."),Xi=h(),A=n("div"),b(Dt.$$.fragment),Qi=h(),_e=n("p"),qi=i("The "),xo=n("a"),Oi=i("ChineseCLIPTextModel"),Yi=i(" forward method, overrides the "),En=n("code"),Hi=i("__call__"),Di=i(" special method."),Ki=h(),b(Xe.$$.fragment),el=h(),b(Qe.$$.fragment),Cs=h(),Ce=n("h2"),qe=n("a"),Jn=n("span"),b(Kt.$$.fragment),tl=h(),xn=n("span"),ol=i("ChineseCLIPVisionModel"),vs=h(),X=n("div"),b(eo.$$.fragment),nl=h(),to=n("p"),sl=i(`The vision model from CHINESE_CLIP without any head or projection on top.
This model is a PyTorch `),oo=n("a"),al=i("torch.nn.Module"),rl=i(` subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),il=h(),S=n("div"),b(no.$$.fragment),ll=h(),ve=n("p"),cl=i("The "),zo=n("a"),dl=i("ChineseCLIPVisionModel"),hl=i(" forward method, overrides the "),zn=n("code"),pl=i("__call__"),ml=i(" special method."),fl=h(),b(Oe.$$.fragment),gl=h(),b(Ye.$$.fragment),this.h()},l(t){const g=Hc('[data-svelte="svelte-1phssyn"]',document.head);d=s(g,"META",{name:!0,content:!0}),g.forEach(o),v=p(t),u=s(t,"H1",{class:!0});var so=a(u);f=s(so,"A",{id:!0,class:!0,href:!0});var Un=a(f);C=s(Un,"SPAN",{});var Zn=a(C);y(r.$$.fragment,Zn),Zn.forEach(o),Un.forEach(o),m=p(so),L=s(so,"SPAN",{});var Wn=a(L);Fs=l(Wn,"Chinese-CLIP"),Wn.forEach(o),so.forEach(o),Xn=p(t),ee=s(t,"H2",{class:!0});var ao=a(ee);Me=s(ao,"A",{id:!0,class:!0,href:!0});var Nn=a(Me);Xo=s(Nn,"SPAN",{});var Vn=a(Xo);y(it.$$.fragment,Vn),Vn.forEach(o),Nn.forEach(o),Gs=p(ao),Qo=s(ao,"SPAN",{});var Bn=a(Qo);Xs=l(Bn,"Overview"),Bn.forEach(o),ao.forEach(o),Qn=p(t),q=s(t,"P",{});var be=a(q);Qs=l(be,"The Chinese-CLIP model was proposed in "),lt=s(be,"A",{href:!0,rel:!0});var Rn=a(lt);qs=l(Rn,"Chinese CLIP: Contrastive Vision-Language Pretraining in Chinese"),Rn.forEach(o),Os=l(be,` by An Yang, Junshu Pan, Junyang Lin, Rui Men, Yichang Zhang, Jingren Zhou, Chang Zhou.
Chinese-CLIP is an implementation of CLIP (Radford et al., 2021) on a large-scale dataset of Chinese image-text pairs. It is capable of performing cross-modal retrieval and also playing as a vision backbone for vision tasks like zero-shot image classification, open-domain object detection, etc. The original Chinese-CLIP code is released `),ct=s(be,"A",{href:!0,rel:!0});var An=a(ct);Ys=l(An,"at this link"),An.forEach(o),Hs=l(be,"."),be.forEach(o),qn=p(t),io=s(t,"P",{});var Sn=a(io);Ds=l(Sn,"The abstract from the paper is the following:"),Sn.forEach(o),On=p(t),lo=s(t,"P",{});var Fn=a(lo);qo=s(Fn,"EM",{});var ul=a(qo);Ks=l(ul,"The tremendous success of CLIP (Radford et al., 2021) has promoted the research and application of contrastive learning for vision-language pretraining. In this work, we construct a large-scale dataset of image-text pairs in Chinese, where most data are retrieved from publicly available datasets, and we pretrain Chinese CLIP models on the new dataset. We develop 5 Chinese CLIP models of multiple sizes, spanning from 77 to 958 million parameters. Furthermore, we propose a two-stage pretraining method, where the model is first trained with the image encoder frozen and then trained with all parameters being optimized, to achieve enhanced model performance. Our comprehensive experiments demonstrate that Chinese CLIP can achieve the state-of-the-art performance on MUGE, Flickr30K-CN, and COCO-CN in the setups of zero-shot learning and finetuning, and it is able to achieve competitive performance in zero-shot image classification based on the evaluation on the ELEVATER benchmark (Li et al., 2022). Our codes, pretrained models, and demos have been released."),ul.forEach(o),Fn.forEach(o),Yn=p(t),te=s(t,"H2",{class:!0});var ys=a(te);Te=s(ys,"A",{id:!0,class:!0,href:!0});var _l=a(Te);Oo=s(_l,"SPAN",{});var Cl=a(Oo);y(dt.$$.fragment,Cl),Cl.forEach(o),_l.forEach(o),ea=p(ys),Yo=s(ys,"SPAN",{});var vl=a(Yo);ta=l(vl,"Usage"),vl.forEach(o),ys.forEach(o),Hn=p(t),co=s(t,"P",{});var bl=a(co);oa=l(bl,"The code snippet below shows how to compute image & text features and similarities:"),bl.forEach(o),Dn=p(t),y(ht.$$.fragment,t),Kn=p(t),ho=s(t,"P",{});var yl=a(ho);na=l(yl,"Currently, we release the following scales of pretrained Chinese-CLIP models at HF Model Hub:"),yl.forEach(o),es=p(t),N=s(t,"UL",{});var He=a(N);Ho=s(He,"LI",{});var Ml=a(Ho);pt=s(Ml,"A",{href:!0,rel:!0});var Tl=a(pt);sa=l(Tl,"OFA-Sys/chinese-clip-vit-base-patch16"),Tl.forEach(o),Ml.forEach(o),aa=p(He),Do=s(He,"LI",{});var Il=a(Do);mt=s(Il,"A",{href:!0,rel:!0});var wl=a(mt);ra=l(wl,"OFA-Sys/chinese-clip-vit-large-patch14"),wl.forEach(o),Il.forEach(o),ia=p(He),Ko=s(He,"LI",{});var Pl=a(Ko);ft=s(Pl,"A",{href:!0,rel:!0});var Ll=a(ft);la=l(Ll,"OFA-Sys/chinese-clip-vit-large-patch14-336px"),Ll.forEach(o),Pl.forEach(o),ca=p(He),en=s(He,"LI",{});var $l=a(en);gt=s($l,"A",{href:!0,rel:!0});var jl=a(gt);da=l(jl,"OFA-Sys/chinese-clip-vit-huge-patch14"),jl.forEach(o),$l.forEach(o),He.forEach(o),ts=p(t),Ie=s(t,"P",{});var Ms=a(Ie);ha=l(Ms,"The Chinese-CLIP model was contributed by "),ut=s(Ms,"A",{href:!0,rel:!0});var kl=a(ut);pa=l(kl,"OFA-Sys"),kl.forEach(o),ma=l(Ms,"."),Ms.forEach(o),os=p(t),oe=s(t,"H2",{class:!0});var Ts=a(oe);we=s(Ts,"A",{id:!0,class:!0,href:!0});var El=a(we);tn=s(El,"SPAN",{});var Jl=a(tn);y(_t.$$.fragment,Jl),Jl.forEach(o),El.forEach(o),fa=p(Ts),on=s(Ts,"SPAN",{});var xl=a(on);ga=l(xl,"ChineseCLIPConfig"),xl.forEach(o),Ts.forEach(o),ns=p(t),k=s(t,"DIV",{class:!0});var Y=a(k);y(Ct.$$.fragment,Y),ua=p(Y),O=s(Y,"P",{});var ro=a(O);po=s(ro,"A",{href:!0});var zl=a(po);_a=l(zl,"ChineseCLIPConfig"),zl.forEach(o),Ca=l(ro," is the configuration class to store the configuration of a "),mo=s(ro,"A",{href:!0});var Ul=a(mo);va=l(Ul,"ChineseCLIPModel"),Ul.forEach(o),ba=l(ro,`. It is used
to instantiate Chinese-CLIP model according to the specified arguments, defining the text model and vision model
configs. Instantiating a configuration with the defaults will yield a similar configuration to that of the
Chinese-CLIP `),vt=s(ro,"A",{href:!0,rel:!0});var Zl=a(vt);ya=l(Zl,"OFA-Sys/chinese-clip-vit-base-patch16"),Zl.forEach(o),Ma=l(ro,`
architecture.`),ro.forEach(o),Ta=p(Y),ne=s(Y,"P",{});var Uo=a(ne);Ia=l(Uo,"Configuration objects inherit from "),fo=s(Uo,"A",{href:!0});var Wl=a(fo);wa=l(Wl,"PretrainedConfig"),Wl.forEach(o),Pa=l(Uo,` and can be used to control the model outputs. Read the
documentation from `),go=s(Uo,"A",{href:!0});var Nl=a(go);La=l(Nl,"PretrainedConfig"),Nl.forEach(o),$a=l(Uo," for more information."),Uo.forEach(o),ja=p(Y),y(Pe.$$.fragment,Y),ka=p(Y),Le=s(Y,"DIV",{class:!0});var Is=a(Le);y(bt.$$.fragment,Is),Ea=p(Is),se=s(Is,"P",{});var Zo=a(se);Ja=l(Zo,"Instantiate a "),uo=s(Zo,"A",{href:!0});var Vl=a(uo);xa=l(Vl,"ChineseCLIPConfig"),Vl.forEach(o),za=l(Zo,` (or a derived class) from Chinese-CLIP text model configuration and
Chinese-CLIP vision model configuration. Returns:
`),_o=s(Zo,"A",{href:!0});var Bl=a(_o);Ua=l(Bl,"ChineseCLIPConfig"),Bl.forEach(o),Za=l(Zo,": An instance of a configuration object"),Zo.forEach(o),Is.forEach(o),Y.forEach(o),ss=p(t),ae=s(t,"H2",{class:!0});var ws=a(ae);$e=s(ws,"A",{id:!0,class:!0,href:!0});var Rl=a($e);nn=s(Rl,"SPAN",{});var Al=a(nn);y(yt.$$.fragment,Al),Al.forEach(o),Rl.forEach(o),Wa=p(ws),sn=s(ws,"SPAN",{});var Sl=a(sn);Na=l(Sl,"ChineseCLIPTextConfig"),Sl.forEach(o),ws.forEach(o),as=p(t),Z=s(t,"DIV",{class:!0});var De=a(Z);y(Mt.$$.fragment,De),Va=p(De),Tt=s(De,"P",{});var Ps=a(Tt);Ba=l(Ps,"This is the configuration class to store the configuration of a "),Co=s(Ps,"A",{href:!0});var Fl=a(Co);Ra=l(Fl,"ChineseCLIPModel"),Fl.forEach(o),Aa=l(Ps,`. It is used to instantiate a
Chinese CLIP 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 Chinese CLIP
[OFA-Sys/chinese-clip-vit-base-patch16](https:
//huggingface.co/OFA-Sys/chinese-clip-vit-base-patch16) architecture.`),Ps.forEach(o),Sa=p(De),re=s(De,"P",{});var Wo=a(re);Fa=l(Wo,"Configuration objects inherit from "),vo=s(Wo,"A",{href:!0});var Gl=a(vo);Ga=l(Gl,"PretrainedConfig"),Gl.forEach(o),Xa=l(Wo,` and can be used to control the model outputs. Read the
documentation from `),bo=s(Wo,"A",{href:!0});var Xl=a(bo);Qa=l(Xl,"PretrainedConfig"),Xl.forEach(o),qa=l(Wo," for more information."),Wo.forEach(o),Oa=p(De),y(je.$$.fragment,De),De.forEach(o),rs=p(t),ie=s(t,"H2",{class:!0});var Ls=a(ie);ke=s(Ls,"A",{id:!0,class:!0,href:!0});var Ql=a(ke);an=s(Ql,"SPAN",{});var ql=a(an);y(It.$$.fragment,ql),ql.forEach(o),Ql.forEach(o),Ya=p(Ls),rn=s(Ls,"SPAN",{});var Ol=a(rn);Ha=l(Ol,"ChineseCLIPVisionConfig"),Ol.forEach(o),Ls.forEach(o),is=p(t),W=s(t,"DIV",{class:!0});var Ke=a(W);y(wt.$$.fragment,Ke),Da=p(Ke),Pt=s(Ke,"P",{});var $s=a(Pt);Ka=l($s,"This is the configuration class to store the configuration of a "),yo=s($s,"A",{href:!0});var Yl=a(yo);er=l(Yl,"ChineseCLIPModel"),Yl.forEach(o),tr=l($s,`. It is used to instantiate an
ChineseCLIP 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 ChineseCLIP
[OFA-Sys/chinese-clip-vit-base-patch16](https:
//huggingface.co/OFA-Sys/chinese-clip-vit-base-patch16) architecture.`),$s.forEach(o),or=p(Ke),le=s(Ke,"P",{});var No=a(le);nr=l(No,"Configuration objects inherit from "),Mo=s(No,"A",{href:!0});var Hl=a(Mo);sr=l(Hl,"PretrainedConfig"),Hl.forEach(o),ar=l(No,` and can be used to control the model outputs. Read the
documentation from `),To=s(No,"A",{href:!0});var Dl=a(To);rr=l(Dl,"PretrainedConfig"),Dl.forEach(o),ir=l(No," for more information."),No.forEach(o),lr=p(Ke),y(Ee.$$.fragment,Ke),Ke.forEach(o),ls=p(t),ce=s(t,"H2",{class:!0});var js=a(ce);Je=s(js,"A",{id:!0,class:!0,href:!0});var Kl=a(Je);ln=s(Kl,"SPAN",{});var ec=a(ln);y(Lt.$$.fragment,ec),ec.forEach(o),Kl.forEach(o),cr=p(js),cn=s(js,"SPAN",{});var tc=a(cn);dr=l(tc,"ChineseCLIPImageProcessor"),tc.forEach(o),js.forEach(o),cs=p(t),G=s(t,"DIV",{class:!0});var Vo=a(G);y($t.$$.fragment,Vo),hr=p(Vo),dn=s(Vo,"P",{});var oc=a(dn);pr=l(oc,"Constructs a Chinese-CLIP image processor."),oc.forEach(o),mr=p(Vo),xe=s(Vo,"DIV",{class:!0});var ks=a(xe);y(jt.$$.fragment,ks),fr=p(ks),hn=s(ks,"P",{});var nc=a(hn);gr=l(nc,"Preprocess an image or batch of images."),nc.forEach(o),ks.forEach(o),Vo.forEach(o),ds=p(t),de=s(t,"H2",{class:!0});var Es=a(de);ze=s(Es,"A",{id:!0,class:!0,href:!0});var sc=a(ze);pn=s(sc,"SPAN",{});var ac=a(pn);y(kt.$$.fragment,ac),ac.forEach(o),sc.forEach(o),ur=p(Es),mn=s(Es,"SPAN",{});var rc=a(mn);_r=l(rc,"ChineseCLIPFeatureExtractor"),rc.forEach(o),Es.forEach(o),hs=p(t),Et=s(t,"DIV",{class:!0});var ic=a(Et);y(Jt.$$.fragment,ic),ic.forEach(o),ps=p(t),he=s(t,"H2",{class:!0});var Js=a(he);Ue=s(Js,"A",{id:!0,class:!0,href:!0});var lc=a(Ue);fn=s(lc,"SPAN",{});var cc=a(fn);y(xt.$$.fragment,cc),cc.forEach(o),lc.forEach(o),Cr=p(Js),gn=s(Js,"SPAN",{});var dc=a(gn);vr=l(dc,"ChineseCLIPProcessor"),dc.forEach(o),Js.forEach(o),ms=p(t),E=s(t,"DIV",{class:!0});var H=a(E);y(zt.$$.fragment,H),br=p(H),un=s(H,"P",{});var hc=a(un);yr=l(hc,`Constructs a Chinese-CLIP processor which wraps a Chinese-CLIP image processor and a Chinese-CLIP tokenizer into a
single processor.`),hc.forEach(o),Mr=p(H),z=s(H,"P",{});var Q=a(z);Io=s(Q,"A",{href:!0});var pc=a(Io);Tr=l(pc,"ChineseCLIPProcessor"),pc.forEach(o),Ir=l(Q," offers all the functionalities of "),wo=s(Q,"A",{href:!0});var mc=a(wo);wr=l(mc,"ChineseCLIPImageProcessor"),mc.forEach(o),Pr=l(Q," and "),Po=s(Q,"A",{href:!0});var fc=a(Po);Lr=l(fc,"BertTokenizerFast"),fc.forEach(o),$r=l(Q,`.
See the `),_n=s(Q,"CODE",{});var gc=a(_n);jr=l(gc,"__call__()"),gc.forEach(o),kr=l(Q," and "),Lo=s(Q,"A",{href:!0});var uc=a(Lo);Er=l(uc,"decode()"),uc.forEach(o),Jr=l(Q," for more information."),Q.forEach(o),xr=p(H),Ze=s(H,"DIV",{class:!0});var xs=a(Ze);y(Ut.$$.fragment,xs),zr=p(xs),Zt=s(xs,"P",{});var zs=a(Zt);Ur=l(zs,"This method forwards all its arguments to BertTokenizerFast\u2019s "),$o=s(zs,"A",{href:!0});var _c=a($o);Zr=l(_c,"batch_decode()"),_c.forEach(o),Wr=l(zs,`. Please
refer to the docstring of this method for more information.`),zs.forEach(o),xs.forEach(o),Nr=p(H),We=s(H,"DIV",{class:!0});var Us=a(We);y(Wt.$$.fragment,Us),Vr=p(Us),Nt=s(Us,"P",{});var Zs=a(Nt);Br=l(Zs,"This method forwards all its arguments to BertTokenizerFast\u2019s "),jo=s(Zs,"A",{href:!0});var Cc=a(jo);Rr=l(Cc,"decode()"),Cc.forEach(o),Ar=l(Zs,`. Please refer to
the docstring of this method for more information.`),Zs.forEach(o),Us.forEach(o),H.forEach(o),fs=p(t),pe=s(t,"H2",{class:!0});var Ws=a(pe);Ne=s(Ws,"A",{id:!0,class:!0,href:!0});var vc=a(Ne);Cn=s(vc,"SPAN",{});var bc=a(Cn);y(Vt.$$.fragment,bc),bc.forEach(o),vc.forEach(o),Sr=p(Ws),vn=s(Ws,"SPAN",{});var yc=a(vn);Fr=l(yc,"ChineseCLIPModel"),yc.forEach(o),Ws.forEach(o),gs=p(t),J=s(t,"DIV",{class:!0});var D=a(J);y(Bt.$$.fragment,D),Gr=p(D),Rt=s(D,"P",{});var Ns=a(Rt);Xr=l(Ns,"This model is a PyTorch "),At=s(Ns,"A",{href:!0,rel:!0});var Mc=a(At);Qr=l(Mc,"torch.nn.Module"),Mc.forEach(o),qr=l(Ns,` subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Ns.forEach(o),Or=p(D),V=s(D,"DIV",{class:!0});var et=a(V);y(St.$$.fragment,et),Yr=p(et),me=s(et,"P",{});var Bo=a(me);Hr=l(Bo,"The "),ko=s(Bo,"A",{href:!0});var Tc=a(ko);Dr=l(Tc,"ChineseCLIPModel"),Tc.forEach(o),Kr=l(Bo," forward method, overrides the "),bn=s(Bo,"CODE",{});var Ic=a(bn);ei=l(Ic,"__call__"),Ic.forEach(o),ti=l(Bo," special method."),Bo.forEach(o),oi=p(et),y(Ve.$$.fragment,et),ni=p(et),y(Be.$$.fragment,et),et.forEach(o),si=p(D),B=s(D,"DIV",{class:!0});var tt=a(B);y(Ft.$$.fragment,tt),ai=p(tt),fe=s(tt,"P",{});var Ro=a(fe);ri=l(Ro,"The "),Eo=s(Ro,"A",{href:!0});var wc=a(Eo);ii=l(wc,"ChineseCLIPModel"),wc.forEach(o),li=l(Ro," forward method, overrides the "),yn=s(Ro,"CODE",{});var Pc=a(yn);ci=l(Pc,"__call__"),Pc.forEach(o),di=l(Ro," special method."),Ro.forEach(o),hi=p(tt),y(Re.$$.fragment,tt),pi=p(tt),y(Ae.$$.fragment,tt),tt.forEach(o),mi=p(D),R=s(D,"DIV",{class:!0});var ot=a(R);y(Gt.$$.fragment,ot),fi=p(ot),ge=s(ot,"P",{});var Ao=a(ge);gi=l(Ao,"The "),Jo=s(Ao,"A",{href:!0});var Lc=a(Jo);ui=l(Lc,"ChineseCLIPModel"),Lc.forEach(o),_i=l(Ao," forward method, overrides the "),Mn=s(Ao,"CODE",{});var $c=a(Mn);Ci=l($c,"__call__"),$c.forEach(o),vi=l(Ao," special method."),Ao.forEach(o),bi=p(ot),y(Se.$$.fragment,ot),yi=p(ot),y(Fe.$$.fragment,ot),ot.forEach(o),D.forEach(o),us=p(t),ue=s(t,"H2",{class:!0});var Vs=a(ue);Ge=s(Vs,"A",{id:!0,class:!0,href:!0});var jc=a(Ge);Tn=s(jc,"SPAN",{});var kc=a(Tn);y(Xt.$$.fragment,kc),kc.forEach(o),jc.forEach(o),Mi=p(Vs),In=s(Vs,"SPAN",{});var Ec=a(In);Ti=l(Ec,"ChineseCLIPTextModel"),Ec.forEach(o),Vs.forEach(o),_s=p(t),x=s(t,"DIV",{class:!0});var K=a(x);y(Qt.$$.fragment,K),Ii=p(K),qt=s(K,"P",{});var Bs=a(qt);wi=l(Bs,`The text model from CHINESE_CLIP without any head or projection on top.
This model is a PyTorch `),Ot=s(Bs,"A",{href:!0,rel:!0});var Jc=a(Ot);Pi=l(Jc,"torch.nn.Module"),Jc.forEach(o),Li=l(Bs,` subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Bs.forEach(o),$i=p(K),Yt=s(K,"P",{});var Rs=a(Yt);ji=l(Rs,`The model can behave as an encoder (with only self-attention) as well as a decoder, in which case a layer of
cross-attention is added between the self-attention layers, following the architecture described in `),Ht=s(Rs,"A",{href:!0,rel:!0});var xc=a(Ht);ki=l(xc,`Attention is
all you need`),xc.forEach(o),Ei=l(Rs,` by Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit,
Llion Jones, Aidan N. Gomez, Lukasz Kaiser and Illia Polosukhin.`),Rs.forEach(o),Ji=p(K),j=s(K,"P",{});var U=a(j);xi=l(U,"To behave as an decoder the model needs to be initialized with the "),wn=s(U,"CODE",{});var zc=a(wn);zi=l(zc,"is_decoder"),zc.forEach(o),Ui=l(U,` argument of the configuration set
to `),Pn=s(U,"CODE",{});var Uc=a(Pn);Zi=l(Uc,"True"),Uc.forEach(o),Wi=l(U,". To be used in a Seq2Seq model, the model needs to initialized with both "),Ln=s(U,"CODE",{});var Zc=a(Ln);Ni=l(Zc,"is_decoder"),Zc.forEach(o),Vi=l(U,` argument and
`),$n=s(U,"CODE",{});var Wc=a($n);Bi=l(Wc,"add_cross_attention"),Wc.forEach(o),Ri=l(U," set to "),jn=s(U,"CODE",{});var Nc=a(jn);Ai=l(Nc,"True"),Nc.forEach(o),Si=l(U,"; an "),kn=s(U,"CODE",{});var Vc=a(kn);Fi=l(Vc,"encoder_hidden_states"),Vc.forEach(o),Gi=l(U," is then expected as an input to the forward pass."),U.forEach(o),Xi=p(K),A=s(K,"DIV",{class:!0});var nt=a(A);y(Dt.$$.fragment,nt),Qi=p(nt),_e=s(nt,"P",{});var So=a(_e);qi=l(So,"The "),xo=s(So,"A",{href:!0});var Bc=a(xo);Oi=l(Bc,"ChineseCLIPTextModel"),Bc.forEach(o),Yi=l(So," forward method, overrides the "),En=s(So,"CODE",{});var Rc=a(En);Hi=l(Rc,"__call__"),Rc.forEach(o),Di=l(So," special method."),So.forEach(o),Ki=p(nt),y(Xe.$$.fragment,nt),el=p(nt),y(Qe.$$.fragment,nt),nt.forEach(o),K.forEach(o),Cs=p(t),Ce=s(t,"H2",{class:!0});var As=a(Ce);qe=s(As,"A",{id:!0,class:!0,href:!0});var Ac=a(qe);Jn=s(Ac,"SPAN",{});var Sc=a(Jn);y(Kt.$$.fragment,Sc),Sc.forEach(o),Ac.forEach(o),tl=p(As),xn=s(As,"SPAN",{});var Fc=a(xn);ol=l(Fc,"ChineseCLIPVisionModel"),Fc.forEach(o),As.forEach(o),vs=p(t),X=s(t,"DIV",{class:!0});var Fo=a(X);y(eo.$$.fragment,Fo),nl=p(Fo),to=s(Fo,"P",{});var Ss=a(to);sl=l(Ss,`The vision model from CHINESE_CLIP without any head or projection on top.
This model is a PyTorch `),oo=s(Ss,"A",{href:!0,rel:!0});var Gc=a(oo);al=l(Gc,"torch.nn.Module"),Gc.forEach(o),rl=l(Ss,` subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Ss.forEach(o),il=p(Fo),S=s(Fo,"DIV",{class:!0});var st=a(S);y(no.$$.fragment,st),ll=p(st),ve=s(st,"P",{});var Go=a(ve);cl=l(Go,"The "),zo=s(Go,"A",{href:!0});var Xc=a(zo);dl=l(Xc,"ChineseCLIPVisionModel"),Xc.forEach(o),hl=l(Go," forward method, overrides the "),zn=s(Go,"CODE",{});var Qc=a(zn);pl=l(Qc,"__call__"),Qc.forEach(o),ml=l(Go," special method."),Go.forEach(o),fl=p(st),y(Oe.$$.fragment,st),gl=p(st),y(Ye.$$.fragment,st),st.forEach(o),Fo.forEach(o),this.h()},h(){c(d,"name","hf:doc:metadata"),c(d,"content",JSON.stringify(md)),c(f,"id","chineseclip"),c(f,"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"),c(f,"href","#chineseclip"),c(u,"class","relative group"),c(Me,"id","overview"),c(Me,"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"),c(Me,"href","#overview"),c(ee,"class","relative group"),c(lt,"href","https://arxiv.org/abs/2211.01335"),c(lt,"rel","nofollow"),c(ct,"href","https://github.com/OFA-Sys/Chinese-CLIP"),c(ct,"rel","nofollow"),c(Te,"id","usage"),c(Te,"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"),c(Te,"href","#usage"),c(te,"class","relative group"),c(pt,"href","https://huggingface.co/OFA-Sys/chinese-clip-vit-base-patch16"),c(pt,"rel","nofollow"),c(mt,"href","https://huggingface.co/OFA-Sys/chinese-clip-vit-large-patch14"),c(mt,"rel","nofollow"),c(ft,"href","https://huggingface.co/OFA-Sys/chinese-clip-vit-large-patch14-336px"),c(ft,"rel","nofollow"),c(gt,"href","https://huggingface.co/OFA-Sys/chinese-clip-vit-huge-patch14"),c(gt,"rel","nofollow"),c(ut,"href","https://huggingface.co/OFA-Sys"),c(ut,"rel","nofollow"),c(we,"id","transformers.ChineseCLIPConfig"),c(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"),c(we,"href","#transformers.ChineseCLIPConfig"),c(oe,"class","relative group"),c(po,"href","/docs/transformers/v4.31.0/en/model_doc/chinese_clip#transformers.ChineseCLIPConfig"),c(mo,"href","/docs/transformers/v4.31.0/en/model_doc/chinese_clip#transformers.ChineseCLIPModel"),c(vt,"href","https://huggingface.co/OFA-Sys/chinese-clip-vit-base-patch16"),c(vt,"rel","nofollow"),c(fo,"href","/docs/transformers/v4.31.0/en/main_classes/configuration#transformers.PretrainedConfig"),c(go,"href","/docs/transformers/v4.31.0/en/main_classes/configuration#transformers.PretrainedConfig"),c(uo,"href","/docs/transformers/v4.31.0/en/model_doc/chinese_clip#transformers.ChineseCLIPConfig"),c(_o,"href","/docs/transformers/v4.31.0/en/model_doc/chinese_clip#transformers.ChineseCLIPConfig"),c(Le,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(k,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c($e,"id","transformers.ChineseCLIPTextConfig"),c($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"),c($e,"href","#transformers.ChineseCLIPTextConfig"),c(ae,"class","relative group"),c(Co,"href","/docs/transformers/v4.31.0/en/model_doc/chinese_clip#transformers.ChineseCLIPModel"),c(vo,"href","/docs/transformers/v4.31.0/en/main_classes/configuration#transformers.PretrainedConfig"),c(bo,"href","/docs/transformers/v4.31.0/en/main_classes/configuration#transformers.PretrainedConfig"),c(Z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(ke,"id","transformers.ChineseCLIPVisionConfig"),c(ke,"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"),c(ke,"href","#transformers.ChineseCLIPVisionConfig"),c(ie,"class","relative group"),c(yo,"href","/docs/transformers/v4.31.0/en/model_doc/chinese_clip#transformers.ChineseCLIPModel"),c(Mo,"href","/docs/transformers/v4.31.0/en/main_classes/configuration#transformers.PretrainedConfig"),c(To,"href","/docs/transformers/v4.31.0/en/main_classes/configuration#transformers.PretrainedConfig"),c(W,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(Je,"id","transformers.ChineseCLIPImageProcessor"),c(Je,"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"),c(Je,"href","#transformers.ChineseCLIPImageProcessor"),c(ce,"class","relative group"),c(xe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(G,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(ze,"id","transformers.ChineseCLIPFeatureExtractor"),c(ze,"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"),c(ze,"href","#transformers.ChineseCLIPFeatureExtractor"),c(de,"class","relative group"),c(Et,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(Ue,"id","transformers.ChineseCLIPProcessor"),c(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"),c(Ue,"href","#transformers.ChineseCLIPProcessor"),c(he,"class","relative group"),c(Io,"href","/docs/transformers/v4.31.0/en/model_doc/chinese_clip#transformers.ChineseCLIPProcessor"),c(wo,"href","/docs/transformers/v4.31.0/en/model_doc/chinese_clip#transformers.ChineseCLIPImageProcessor"),c(Po,"href","/docs/transformers/v4.31.0/en/model_doc/bert#transformers.BertTokenizerFast"),c(Lo,"href","/docs/transformers/v4.31.0/en/model_doc/chinese_clip#transformers.ChineseCLIPProcessor.decode"),c($o,"href","/docs/transformers/v4.31.0/en/model_doc/speecht5#transformers.SpeechT5Tokenizer.batch_decode"),c(Ze,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(jo,"href","/docs/transformers/v4.31.0/en/model_doc/speecht5#transformers.SpeechT5Tokenizer.decode"),c(We,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(E,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(Ne,"id","transformers.ChineseCLIPModel"),c(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"),c(Ne,"href","#transformers.ChineseCLIPModel"),c(pe,"class","relative group"),c(At,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),c(At,"rel","nofollow"),c(ko,"href","/docs/transformers/v4.31.0/en/model_doc/chinese_clip#transformers.ChineseCLIPModel"),c(V,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(Eo,"href","/docs/transformers/v4.31.0/en/model_doc/chinese_clip#transformers.ChineseCLIPModel"),c(B,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(Jo,"href","/docs/transformers/v4.31.0/en/model_doc/chinese_clip#transformers.ChineseCLIPModel"),c(R,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(J,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(Ge,"id","transformers.ChineseCLIPTextModel"),c(Ge,"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"),c(Ge,"href","#transformers.ChineseCLIPTextModel"),c(ue,"class","relative group"),c(Ot,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),c(Ot,"rel","nofollow"),c(Ht,"href","https://arxiv.org/abs/1706.03762"),c(Ht,"rel","nofollow"),c(xo,"href","/docs/transformers/v4.31.0/en/model_doc/chinese_clip#transformers.ChineseCLIPTextModel"),c(A,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(x,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(qe,"id","transformers.ChineseCLIPVisionModel"),c(qe,"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"),c(qe,"href","#transformers.ChineseCLIPVisionModel"),c(Ce,"class","relative group"),c(oo,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),c(oo,"rel","nofollow"),c(zo,"href","/docs/transformers/v4.31.0/en/model_doc/chinese_clip#transformers.ChineseCLIPVisionModel"),c(S,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(X,"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,g){e(document.head,d),_(t,v,g),_(t,u,g),e(u,f),e(f,C),M(r,C,null),e(u,m),e(u,L),e(L,Fs),_(t,Xn,g),_(t,ee,g),e(ee,Me),e(Me,Xo),M(it,Xo,null),e(ee,Gs),e(ee,Qo),e(Qo,Xs),_(t,Qn,g),_(t,q,g),e(q,Qs),e(q,lt),e(lt,qs),e(q,Os),e(q,ct),e(ct,Ys),e(q,Hs),_(t,qn,g),_(t,io,g),e(io,Ds),_(t,On,g),_(t,lo,g),e(lo,qo),e(qo,Ks),_(t,Yn,g),_(t,te,g),e(te,Te),e(Te,Oo),M(dt,Oo,null),e(te,ea),e(te,Yo),e(Yo,ta),_(t,Hn,g),_(t,co,g),e(co,oa),_(t,Dn,g),M(ht,t,g),_(t,Kn,g),_(t,ho,g),e(ho,na),_(t,es,g),_(t,N,g),e(N,Ho),e(Ho,pt),e(pt,sa),e(N,aa),e(N,Do),e(Do,mt),e(mt,ra),e(N,ia),e(N,Ko),e(Ko,ft),e(ft,la),e(N,ca),e(N,en),e(en,gt),e(gt,da),_(t,ts,g),_(t,Ie,g),e(Ie,ha),e(Ie,ut),e(ut,pa),e(Ie,ma),_(t,os,g),_(t,oe,g),e(oe,we),e(we,tn),M(_t,tn,null),e(oe,fa),e(oe,on),e(on,ga),_(t,ns,g),_(t,k,g),M(Ct,k,null),e(k,ua),e(k,O),e(O,po),e(po,_a),e(O,Ca),e(O,mo),e(mo,va),e(O,ba),e(O,vt),e(vt,ya),e(O,Ma),e(k,Ta),e(k,ne),e(ne,Ia),e(ne,fo),e(fo,wa),e(ne,Pa),e(ne,go),e(go,La),e(ne,$a),e(k,ja),M(Pe,k,null),e(k,ka),e(k,Le),M(bt,Le,null),e(Le,Ea),e(Le,se),e(se,Ja),e(se,uo),e(uo,xa),e(se,za),e(se,_o),e(_o,Ua),e(se,Za),_(t,ss,g),_(t,ae,g),e(ae,$e),e($e,nn),M(yt,nn,null),e(ae,Wa),e(ae,sn),e(sn,Na),_(t,as,g),_(t,Z,g),M(Mt,Z,null),e(Z,Va),e(Z,Tt),e(Tt,Ba),e(Tt,Co),e(Co,Ra),e(Tt,Aa),e(Z,Sa),e(Z,re),e(re,Fa),e(re,vo),e(vo,Ga),e(re,Xa),e(re,bo),e(bo,Qa),e(re,qa),e(Z,Oa),M(je,Z,null),_(t,rs,g),_(t,ie,g),e(ie,ke),e(ke,an),M(It,an,null),e(ie,Ya),e(ie,rn),e(rn,Ha),_(t,is,g),_(t,W,g),M(wt,W,null),e(W,Da),e(W,Pt),e(Pt,Ka),e(Pt,yo),e(yo,er),e(Pt,tr),e(W,or),e(W,le),e(le,nr),e(le,Mo),e(Mo,sr),e(le,ar),e(le,To),e(To,rr),e(le,ir),e(W,lr),M(Ee,W,null),_(t,ls,g),_(t,ce,g),e(ce,Je),e(Je,ln),M(Lt,ln,null),e(ce,cr),e(ce,cn),e(cn,dr),_(t,cs,g),_(t,G,g),M($t,G,null),e(G,hr),e(G,dn),e(dn,pr),e(G,mr),e(G,xe),M(jt,xe,null),e(xe,fr),e(xe,hn),e(hn,gr),_(t,ds,g),_(t,de,g),e(de,ze),e(ze,pn),M(kt,pn,null),e(de,ur),e(de,mn),e(mn,_r),_(t,hs,g),_(t,Et,g),M(Jt,Et,null),_(t,ps,g),_(t,he,g),e(he,Ue),e(Ue,fn),M(xt,fn,null),e(he,Cr),e(he,gn),e(gn,vr),_(t,ms,g),_(t,E,g),M(zt,E,null),e(E,br),e(E,un),e(un,yr),e(E,Mr),e(E,z),e(z,Io),e(Io,Tr),e(z,Ir),e(z,wo),e(wo,wr),e(z,Pr),e(z,Po),e(Po,Lr),e(z,$r),e(z,_n),e(_n,jr),e(z,kr),e(z,Lo),e(Lo,Er),e(z,Jr),e(E,xr),e(E,Ze),M(Ut,Ze,null),e(Ze,zr),e(Ze,Zt),e(Zt,Ur),e(Zt,$o),e($o,Zr),e(Zt,Wr),e(E,Nr),e(E,We),M(Wt,We,null),e(We,Vr),e(We,Nt),e(Nt,Br),e(Nt,jo),e(jo,Rr),e(Nt,Ar),_(t,fs,g),_(t,pe,g),e(pe,Ne),e(Ne,Cn),M(Vt,Cn,null),e(pe,Sr),e(pe,vn),e(vn,Fr),_(t,gs,g),_(t,J,g),M(Bt,J,null),e(J,Gr),e(J,Rt),e(Rt,Xr),e(Rt,At),e(At,Qr),e(Rt,qr),e(J,Or),e(J,V),M(St,V,null),e(V,Yr),e(V,me),e(me,Hr),e(me,ko),e(ko,Dr),e(me,Kr),e(me,bn),e(bn,ei),e(me,ti),e(V,oi),M(Ve,V,null),e(V,ni),M(Be,V,null),e(J,si),e(J,B),M(Ft,B,null),e(B,ai),e(B,fe),e(fe,ri),e(fe,Eo),e(Eo,ii),e(fe,li),e(fe,yn),e(yn,ci),e(fe,di),e(B,hi),M(Re,B,null),e(B,pi),M(Ae,B,null),e(J,mi),e(J,R),M(Gt,R,null),e(R,fi),e(R,ge),e(ge,gi),e(ge,Jo),e(Jo,ui),e(ge,_i),e(ge,Mn),e(Mn,Ci),e(ge,vi),e(R,bi),M(Se,R,null),e(R,yi),M(Fe,R,null),_(t,us,g),_(t,ue,g),e(ue,Ge),e(Ge,Tn),M(Xt,Tn,null),e(ue,Mi),e(ue,In),e(In,Ti),_(t,_s,g),_(t,x,g),M(Qt,x,null),e(x,Ii),e(x,qt),e(qt,wi),e(qt,Ot),e(Ot,Pi),e(qt,Li),e(x,$i),e(x,Yt),e(Yt,ji),e(Yt,Ht),e(Ht,ki),e(Yt,Ei),e(x,Ji),e(x,j),e(j,xi),e(j,wn),e(wn,zi),e(j,Ui),e(j,Pn),e(Pn,Zi),e(j,Wi),e(j,Ln),e(Ln,Ni),e(j,Vi),e(j,$n),e($n,Bi),e(j,Ri),e(j,jn),e(jn,Ai),e(j,Si),e(j,kn),e(kn,Fi),e(j,Gi),e(x,Xi),e(x,A),M(Dt,A,null),e(A,Qi),e(A,_e),e(_e,qi),e(_e,xo),e(xo,Oi),e(_e,Yi),e(_e,En),e(En,Hi),e(_e,Di),e(A,Ki),M(Xe,A,null),e(A,el),M(Qe,A,null),_(t,Cs,g),_(t,Ce,g),e(Ce,qe),e(qe,Jn),M(Kt,Jn,null),e(Ce,tl),e(Ce,xn),e(xn,ol),_(t,vs,g),_(t,X,g),M(eo,X,null),e(X,nl),e(X,to),e(to,sl),e(to,oo),e(oo,al),e(to,rl),e(X,il),e(X,S),M(no,S,null),e(S,ll),e(S,ve),e(ve,cl),e(ve,zo),e(zo,dl),e(ve,hl),e(ve,zn),e(zn,pl),e(ve,ml),e(S,fl),M(Oe,S,null),e(S,gl),M(Ye,S,null),bs=!0},p(t,[g]){const so={};g&2&&(so.$$scope={dirty:g,ctx:t}),Pe.$set(so);const Un={};g&2&&(Un.$$scope={dirty:g,ctx:t}),je.$set(Un);const Zn={};g&2&&(Zn.$$scope={dirty:g,ctx:t}),Ee.$set(Zn);const Wn={};g&2&&(Wn.$$scope={dirty:g,ctx:t}),Ve.$set(Wn);const ao={};g&2&&(ao.$$scope={dirty:g,ctx:t}),Be.$set(ao);const Nn={};g&2&&(Nn.$$scope={dirty:g,ctx:t}),Re.$set(Nn);const Vn={};g&2&&(Vn.$$scope={dirty:g,ctx:t}),Ae.$set(Vn);const Bn={};g&2&&(Bn.$$scope={dirty:g,ctx:t}),Se.$set(Bn);const be={};g&2&&(be.$$scope={dirty:g,ctx:t}),Fe.$set(be);const Rn={};g&2&&(Rn.$$scope={dirty:g,ctx:t}),Xe.$set(Rn);const An={};g&2&&(An.$$scope={dirty:g,ctx:t}),Qe.$set(An);const Sn={};g&2&&(Sn.$$scope={dirty:g,ctx:t}),Oe.$set(Sn);const Fn={};g&2&&(Fn.$$scope={dirty:g,ctx:t}),Ye.$set(Fn)},i(t){bs||(T(r.$$.fragment,t),T(it.$$.fragment,t),T(dt.$$.fragment,t),T(ht.$$.fragment,t),T(_t.$$.fragment,t),T(Ct.$$.fragment,t),T(Pe.$$.fragment,t),T(bt.$$.fragment,t),T(yt.$$.fragment,t),T(Mt.$$.fragment,t),T(je.$$.fragment,t),T(It.$$.fragment,t),T(wt.$$.fragment,t),T(Ee.$$.fragment,t),T(Lt.$$.fragment,t),T($t.$$.fragment,t),T(jt.$$.fragment,t),T(kt.$$.fragment,t),T(Jt.$$.fragment,t),T(xt.$$.fragment,t),T(zt.$$.fragment,t),T(Ut.$$.fragment,t),T(Wt.$$.fragment,t),T(Vt.$$.fragment,t),T(Bt.$$.fragment,t),T(St.$$.fragment,t),T(Ve.$$.fragment,t),T(Be.$$.fragment,t),T(Ft.$$.fragment,t),T(Re.$$.fragment,t),T(Ae.$$.fragment,t),T(Gt.$$.fragment,t),T(Se.$$.fragment,t),T(Fe.$$.fragment,t),T(Xt.$$.fragment,t),T(Qt.$$.fragment,t),T(Dt.$$.fragment,t),T(Xe.$$.fragment,t),T(Qe.$$.fragment,t),T(Kt.$$.fragment,t),T(eo.$$.fragment,t),T(no.$$.fragment,t),T(Oe.$$.fragment,t),T(Ye.$$.fragment,t),bs=!0)},o(t){I(r.$$.fragment,t),I(it.$$.fragment,t),I(dt.$$.fragment,t),I(ht.$$.fragment,t),I(_t.$$.fragment,t),I(Ct.$$.fragment,t),I(Pe.$$.fragment,t),I(bt.$$.fragment,t),I(yt.$$.fragment,t),I(Mt.$$.fragment,t),I(je.$$.fragment,t),I(It.$$.fragment,t),I(wt.$$.fragment,t),I(Ee.$$.fragment,t),I(Lt.$$.fragment,t),I($t.$$.fragment,t),I(jt.$$.fragment,t),I(kt.$$.fragment,t),I(Jt.$$.fragment,t),I(xt.$$.fragment,t),I(zt.$$.fragment,t),I(Ut.$$.fragment,t),I(Wt.$$.fragment,t),I(Vt.$$.fragment,t),I(Bt.$$.fragment,t),I(St.$$.fragment,t),I(Ve.$$.fragment,t),I(Be.$$.fragment,t),I(Ft.$$.fragment,t),I(Re.$$.fragment,t),I(Ae.$$.fragment,t),I(Gt.$$.fragment,t),I(Se.$$.fragment,t),I(Fe.$$.fragment,t),I(Xt.$$.fragment,t),I(Qt.$$.fragment,t),I(Dt.$$.fragment,t),I(Xe.$$.fragment,t),I(Qe.$$.fragment,t),I(Kt.$$.fragment,t),I(eo.$$.fragment,t),I(no.$$.fragment,t),I(Oe.$$.fragment,t),I(Ye.$$.fragment,t),bs=!1},d(t){o(d),t&&o(v),t&&o(u),w(r),t&&o(Xn),t&&o(ee),w(it),t&&o(Qn),t&&o(q),t&&o(qn),t&&o(io),t&&o(On),t&&o(lo),t&&o(Yn),t&&o(te),w(dt),t&&o(Hn),t&&o(co),t&&o(Dn),w(ht,t),t&&o(Kn),t&&o(ho),t&&o(es),t&&o(N),t&&o(ts),t&&o(Ie),t&&o(os),t&&o(oe),w(_t),t&&o(ns),t&&o(k),w(Ct),w(Pe),w(bt),t&&o(ss),t&&o(ae),w(yt),t&&o(as),t&&o(Z),w(Mt),w(je),t&&o(rs),t&&o(ie),w(It),t&&o(is),t&&o(W),w(wt),w(Ee),t&&o(ls),t&&o(ce),w(Lt),t&&o(cs),t&&o(G),w($t),w(jt),t&&o(ds),t&&o(de),w(kt),t&&o(hs),t&&o(Et),w(Jt),t&&o(ps),t&&o(he),w(xt),t&&o(ms),t&&o(E),w(zt),w(Ut),w(Wt),t&&o(fs),t&&o(pe),w(Vt),t&&o(gs),t&&o(J),w(Bt),w(St),w(Ve),w(Be),w(Ft),w(Re),w(Ae),w(Gt),w(Se),w(Fe),t&&o(us),t&&o(ue),w(Xt),t&&o(_s),t&&o(x),w(Qt),w(Dt),w(Xe),w(Qe),t&&o(Cs),t&&o(Ce),w(Kt),t&&o(vs),t&&o(X),w(eo),w(no),w(Oe),w(Ye)}}}const md={local:"chineseclip",sections:[{local:"overview",title:"Overview"},{local:"usage",title:"Usage"},{local:"transformers.ChineseCLIPConfig",title:"ChineseCLIPConfig"},{local:"transformers.ChineseCLIPTextConfig",title:"ChineseCLIPTextConfig"},{local:"transformers.ChineseCLIPVisionConfig",title:"ChineseCLIPVisionConfig"},{local:"transformers.ChineseCLIPImageProcessor",title:"ChineseCLIPImageProcessor"},{local:"transformers.ChineseCLIPFeatureExtractor",title:"ChineseCLIPFeatureExtractor"},{local:"transformers.ChineseCLIPProcessor",title:"ChineseCLIPProcessor"},{local:"transformers.ChineseCLIPModel",title:"ChineseCLIPModel"},{local:"transformers.ChineseCLIPTextModel",title:"ChineseCLIPTextModel"},{local:"transformers.ChineseCLIPVisionModel",title:"ChineseCLIPVisionModel"}],title:"Chinese-CLIP"};function fd(P){return Dc(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class yd extends qc{constructor(d){super();Oc(this,d,fd,pd,Yc,{})}}export{yd as default,md as metadata};
