import{S as Gc,i as Yc,s as Zc,e as n,k as h,w as P,t as i,M as Kc,c as s,d as o,m as p,a as r,x as b,h as l,b as c,G as e,g as _,y as I,q as y,o as $,B as L,v as Xc,L as at}from"../../chunks/vendor-hf-doc-builder.js";import{T as Un}from"../../chunks/Tip-hf-doc-builder.js";import{D as x}from"../../chunks/Docstring-hf-doc-builder.js";import{C as be}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as B}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as rt}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";function Qc(w){let d,v,u,f,C;return f=new be({props:{code:`from transformers import ChineseCLIPConfig, ChineseCLIPModel

# Initializing a ChineseCLIPConfig with OFA-Sys/chinese-clip-vit-base-patch16 style configuration
configuration = ChineseCLIPConfig()

# Initializing a ChineseCLIPModel (with random weights) from the OFA-Sys/chinese-clip-vit-base-patch16 style configuration
model = ChineseCLIPModel(configuration)

# Accessing the model configuration
configuration = model.config

# We can also initialize a ChineseCLIPConfig from a ChineseCLIPTextConfig and a ChineseCLIPVisionConfig

# Initializing a ChineseCLIPTextConfig and ChineseCLIPVisionConfig configuration
config_text = ChineseCLIPTextConfig()
config_vision = ChineseCLIPVisionConfig()

config = ChineseCLIPConfig.from_text_vision_configs(config_text, config_vision)`,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(),P(f.$$.fragment)},l(a){d=s(a,"P",{});var m=r(d);v=l(m,"Example:"),m.forEach(o),u=p(a),b(f.$$.fragment,a)},m(a,m){_(a,d,m),e(d,v),_(a,u,m),I(f,a,m),C=!0},p:at,i(a){C||(y(f.$$.fragment,a),C=!0)},o(a){$(f.$$.fragment,a),C=!1},d(a){a&&o(d),a&&o(u),L(f,a)}}}function ed(w){let d,v,u,f,C;return f=new be({props:{code:`from transformers import ChineseCLIPTextConfig, ChineseCLIPTextModel

# Initializing a ChineseCLIPTextConfig with OFA-Sys/chinese-clip-vit-base-patch16 style configuration
configuration = ChineseCLIPTextConfig()

# Initializing a ChineseCLIPTextModel (with random weights) from the OFA-Sys/chinese-clip-vit-base-patch16 style configuration
model = ChineseCLIPTextModel(configuration)

# Accessing the model configuration
configuration = model.config`,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(),P(f.$$.fragment)},l(a){d=s(a,"P",{});var m=r(d);v=l(m,"Example:"),m.forEach(o),u=p(a),b(f.$$.fragment,a)},m(a,m){_(a,d,m),e(d,v),_(a,u,m),I(f,a,m),C=!0},p:at,i(a){C||(y(f.$$.fragment,a),C=!0)},o(a){$(f.$$.fragment,a),C=!1},d(a){a&&o(d),a&&o(u),L(f,a)}}}function td(w){let d,v,u,f,C;return f=new be({props:{code:`from transformers import ChineseCLIPVisionConfig, ChineseCLIPVisionModel

# Initializing a ChineseCLIPVisionConfig with OFA-Sys/chinese-clip-vit-base-patch16 style configuration
configuration = ChineseCLIPVisionConfig()

# Initializing a ChineseCLIPVisionModel (with random weights) from the OFA-Sys/chinese-clip-vit-base-patch16 style configuration
model = ChineseCLIPVisionModel(configuration)

# Accessing the model configuration
configuration = model.config`,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(),P(f.$$.fragment)},l(a){d=s(a,"P",{});var m=r(d);v=l(m,"Example:"),m.forEach(o),u=p(a),b(f.$$.fragment,a)},m(a,m){_(a,d,m),e(d,v),_(a,u,m),I(f,a,m),C=!0},p:at,i(a){C||(y(f.$$.fragment,a),C=!0)},o(a){$(f.$$.fragment,a),C=!1},d(a){a&&o(d),a&&o(u),L(f,a)}}}function od(w){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(a){d=s(a,"P",{});var m=r(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 T=r(u);f=l(T,"Module"),T.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(a,m){_(a,d,m),e(d,v),e(d,u),e(u,f),e(d,C)},d(a){a&&o(d)}}}function nd(w){let d,v,u,f,C;return f=new be({props:{code:`from PIL import Image
import requests
from transformers import AutoProcessor, ChineseCLIPModel

model = ChineseCLIPModel.from_pretrained("OFA-Sys/chinese-clip-vit-base-patch16")
processor = AutoProcessor.from_pretrained("OFA-Sys/chinese-clip-vit-base-patch16")

url = "https://clip-cn-beijing.oss-cn-beijing.aliyuncs.com/pokemon.jpeg"
image = Image.open(requests.get(url, stream=True).raw)

inputs = processor(text=["\u6770\u5C3C\u9F9F", "\u5999\u86D9\u79CD\u5B50", "\u5C0F\u706B\u9F99", "\u76AE\u5361\u4E18"], images=image, return_tensors="pt", padding=True)

outputs = model(**inputs)
logits_per_image = outputs.logits_per_image  # this is the image-text similarity score
probs = logits_per_image.softmax(dim=1)  # we can take the softmax to get the label probabilities`,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(),P(f.$$.fragment)},l(a){d=s(a,"P",{});var m=r(d);v=l(m,"Examples:"),m.forEach(o),u=p(a),b(f.$$.fragment,a)},m(a,m){_(a,d,m),e(d,v),_(a,u,m),I(f,a,m),C=!0},p:at,i(a){C||(y(f.$$.fragment,a),C=!0)},o(a){$(f.$$.fragment,a),C=!1},d(a){a&&o(d),a&&o(u),L(f,a)}}}function sd(w){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(a){d=s(a,"P",{});var m=r(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 T=r(u);f=l(T,"Module"),T.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(a,m){_(a,d,m),e(d,v),e(d,u),e(u,f),e(d,C)},d(a){a&&o(d)}}}function rd(w){let d,v,u,f,C;return f=new be({props:{code:`from transformers import AutoTokenizer, ChineseCLIPModel

model = ChineseCLIPModel.from_pretrained("OFA-Sys/chinese-clip-vit-base-patch16")
tokenizer = AutoTokenizer.from_pretrained("OFA-Sys/chinese-clip-vit-base-patch16")

inputs = tokenizer(["\u6770\u5C3C\u9F9F", "\u5999\u86D9\u79CD\u5B50", "\u5C0F\u706B\u9F99", "\u76AE\u5361\u4E18"], padding=True, return_tensors="pt")
text_features = model.get_text_features(**inputs)
text_features = text_features / text_features.norm(p=2, dim=-1, keepdim=True)`,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(),P(f.$$.fragment)},l(a){d=s(a,"P",{});var m=r(d);v=l(m,"Examples:"),m.forEach(o),u=p(a),b(f.$$.fragment,a)},m(a,m){_(a,d,m),e(d,v),_(a,u,m),I(f,a,m),C=!0},p:at,i(a){C||(y(f.$$.fragment,a),C=!0)},o(a){$(f.$$.fragment,a),C=!1},d(a){a&&o(d),a&&o(u),L(f,a)}}}function ad(w){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(a){d=s(a,"P",{});var m=r(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 T=r(u);f=l(T,"Module"),T.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(a,m){_(a,d,m),e(d,v),e(d,u),e(u,f),e(d,C)},d(a){a&&o(d)}}}function id(w){let d,v,u,f,C;return f=new be({props:{code:`from PIL import Image
import requests
from transformers import AutoProcessor, ChineseCLIPModel

model = ChineseCLIPModel.from_pretrained("OFA-Sys/chinese-clip-vit-base-patch16")
processor = AutoProcessor.from_pretrained("OFA-Sys/chinese-clip-vit-base-patch16")

url = "https://clip-cn-beijing.oss-cn-beijing.aliyuncs.com/pokemon.jpeg"
image = Image.open(requests.get(url, stream=True).raw)

inputs = processor(images=image, return_tensors="pt")

image_features = model.get_image_features(**inputs)
image_features = image_features / image_features.norm(p=2, dim=-1, keepdim=True)`,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(),P(f.$$.fragment)},l(a){d=s(a,"P",{});var m=r(d);v=l(m,"Examples:"),m.forEach(o),u=p(a),b(f.$$.fragment,a)},m(a,m){_(a,d,m),e(d,v),_(a,u,m),I(f,a,m),C=!0},p:at,i(a){C||(y(f.$$.fragment,a),C=!0)},o(a){$(f.$$.fragment,a),C=!1},d(a){a&&o(d),a&&o(u),L(f,a)}}}function ld(w){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(a){d=s(a,"P",{});var m=r(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 T=r(u);f=l(T,"Module"),T.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(a,m){_(a,d,m),e(d,v),e(d,u),e(u,f),e(d,C)},d(a){a&&o(d)}}}function cd(w){let d,v,u,f,C;return f=new be({props:{code:`from transformers import AutoTokenizer, ChineseCLIPTextModel
import torch

tokenizer = AutoTokenizer.from_pretrained("OFA-Sys/chinese-clip-vit-base-patch16")
model = ChineseCLIPTextModel.from_pretrained("OFA-Sys/chinese-clip-vit-base-patch16")

inputs = tokenizer("Hello, my dog is cute", return_tensors="pt")
outputs = model(**inputs)

last_hidden_states = outputs.last_hidden_state`,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(),P(f.$$.fragment)},l(a){d=s(a,"P",{});var m=r(d);v=l(m,"Example:"),m.forEach(o),u=p(a),b(f.$$.fragment,a)},m(a,m){_(a,d,m),e(d,v),_(a,u,m),I(f,a,m),C=!0},p:at,i(a){C||(y(f.$$.fragment,a),C=!0)},o(a){$(f.$$.fragment,a),C=!1},d(a){a&&o(d),a&&o(u),L(f,a)}}}function dd(w){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(a){d=s(a,"P",{});var m=r(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 T=r(u);f=l(T,"Module"),T.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(a,m){_(a,d,m),e(d,v),e(d,u),e(u,f),e(d,C)},d(a){a&&o(d)}}}function hd(w){let d,v,u,f,C;return f=new be({props:{code:`from PIL import Image
import requests
from transformers import CLIPProcessor, ChineseCLIPVisionModel

model = ChineseCLIPVisionModel.from_pretrained("OFA-Sys/chinese-clip-vit-base-patch16")
processor = CLIPProcessor.from_pretrained("OFA-Sys/chinese-clip-vit-base-patch16")

url = "https://clip-cn-beijing.oss-cn-beijing.aliyuncs.com/pokemon.jpeg"
image = Image.open(requests.get(url, stream=True).raw)

inputs = processor(images=image, return_tensors="pt")

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

model = ChineseCLIPModel.from_pretrained("OFA-Sys/chinese-clip-vit-base-patch16")
processor = ChineseCLIPProcessor.from_pretrained("OFA-Sys/chinese-clip-vit-base-patch16")

url = "https://clip-cn-beijing.oss-cn-beijing.aliyuncs.com/pokemon.jpeg"
image = Image.open(requests.get(url, stream=True).raw)
# Squirtle, Bulbasaur, Charmander, Pikachu in English
texts = ["\u6770\u5C3C\u9F9F", "\u5999\u86D9\u79CD\u5B50", "\u5C0F\u706B\u9F99", "\u76AE\u5361\u4E18"]

# compute image feature
inputs = processor(images=image, return_tensors="pt")
image_features = model.get_image_features(**inputs)
image_features = image_features / image_features.norm(p=2, dim=-1, keepdim=True)  # normalize

# compute text features
inputs = processor(text=texts, padding=True, return_tensors="pt")
text_features = model.get_text_features(**inputs)
text_features = text_features / text_features.norm(p=2, dim=-1, keepdim=True)  # normalize

# compute image-text similarity scores
inputs = processor(text=texts, images=image, return_tensors="pt", padding=True)
outputs = model(**inputs)
logits_per_image = outputs.logits_per_image  # this is the image-text similarity score
probs = logits_per_image.softmax(dim=1)  # probs: [[1.2686e-03, 5.4499e-02, 6.7968e-04, 9.4355e-01]]`,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 B({}),Ct=new x({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/main/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/main/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/main/src/transformers/models/chinese_clip/configuration_chinese_clip.py#L270"}}),we=new rt({props:{anchor:"transformers.ChineseCLIPConfig.example",$$slots:{default:[Qc]},$$scope:{ctx:w}}}),Pt=new x({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/main/src/transformers/models/chinese_clip/configuration_chinese_clip.py#L349"}}),bt=new B({}),It=new x({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/main/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/main/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/main/src/transformers/models/chinese_clip/configuration_chinese_clip.py#L41"}}),ke=new rt({props:{anchor:"transformers.ChineseCLIPTextConfig.example",$$slots:{default:[ed]},$$scope:{ctx:w}}}),$t=new B({}),Lt=new x({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:"dropout",val:" = 0.0"},{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. layer_norm_eps (<code>float</code>, <em>optional</em>,
defaults to 1e-5): The epsilon used by the layer normalization layers.`,name:"hidden_act"},{anchor:"transformers.ChineseCLIPVisionConfig.dropout",description:`<strong>dropout</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
The dropout probabilitiy for all fully connected layers in the embeddings, encoder, and pooler.`,name:"dropout"},{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/main/src/transformers/models/chinese_clip/configuration_chinese_clip.py#L163"}}),je=new rt({props:{anchor:"transformers.ChineseCLIPVisionConfig.example",$$slots:{default:[td]},$$scope:{ctx:w}}}),Tt=new B({}),xt=new x({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/main/src/transformers/models/chinese_clip/image_processing_chinese_clip.py#L52"}}),kt=new x({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[transformers.utils.generic.TensorType, str, 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/main/src/transformers/models/chinese_clip/image_processing_chinese_clip.py#L218"}}),zt=new B({}),Et=new x({props:{name:"class transformers.ChineseCLIPFeatureExtractor",anchor:"transformers.ChineseCLIPFeatureExtractor",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/chinese_clip/feature_extraction_chinese_clip.py#L26"}}),Mt=new B({}),At=new x({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/main/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/main/en/model_doc/bert#transformers.BertTokenizerFast">BertTokenizerFast</a>) &#x2014;
The tokenizer is a required input.`,name:"tokenizer"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/chinese_clip/processing_chinese_clip.py#L25"}}),qt=new x({props:{name:"batch_decode",anchor:"transformers.ChineseCLIPProcessor.batch_decode",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/chinese_clip/processing_chinese_clip.py#L114"}}),Ft=new x({props:{name:"decode",anchor:"transformers.ChineseCLIPProcessor.decode",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/chinese_clip/processing_chinese_clip.py#L121"}}),Nt=new B({}),Dt=new x({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/main/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/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/chinese_clip/modeling_chinese_clip.py#L1347"}}),Rt=new x({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/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.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/main/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <a href="/docs/transformers/main/en/model_doc/poolformer#transformers.PoolFormerFeatureExtractor.__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/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/chinese_clip/modeling_chinese_clip.py#L1482",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/main/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/main/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/main/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/main/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>
`}}),Ne=new Un({props:{$$slots:{default:[od]},$$scope:{ctx:w}}}),De=new rt({props:{anchor:"transformers.ChineseCLIPModel.forward.example",$$slots:{default:[nd]},$$scope:{ctx:w}}}),Bt=new x({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/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.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/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/chinese_clip/modeling_chinese_clip.py#L1382",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>
`}}),Ve=new Un({props:{$$slots:{default:[sd]},$$scope:{ctx:w}}}),We=new rt({props:{anchor:"transformers.ChineseCLIPModel.get_text_features.example",$$slots:{default:[rd]},$$scope:{ctx:w}}}),Ut=new x({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/main/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <a href="/docs/transformers/main/en/model_doc/poolformer#transformers.PoolFormerFeatureExtractor.__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/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/chinese_clip/modeling_chinese_clip.py#L1432",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>
`}}),Re=new Un({props:{$$slots:{default:[ad]},$$scope:{ctx:w}}}),Be=new rt({props:{anchor:"transformers.ChineseCLIPModel.get_image_features.example",$$slots:{default:[id]},$$scope:{ctx:w}}}),Ht=new B({}),Jt=new x({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/main/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/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/chinese_clip/modeling_chinese_clip.py#L1111"}}),Xt=new x({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/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.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/main/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <a href="/docs/transformers/main/en/model_doc/poolformer#transformers.PoolFormerFeatureExtractor.__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/main/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/main/src/transformers/models/chinese_clip/modeling_chinese_clip.py#L1152",returnDescription:`
<p>A <a
  href="/docs/transformers/main/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/main/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/main/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPoolingAndCrossAttentions"
>transformers.modeling_outputs.BaseModelOutputWithPoolingAndCrossAttentions</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),He=new Un({props:{$$slots:{default:[ld]},$$scope:{ctx:w}}}),Je=new rt({props:{anchor:"transformers.ChineseCLIPTextModel.forward.example",$$slots:{default:[cd]},$$scope:{ctx:w}}}),Qt=new B({}),eo=new x({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/main/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/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/chinese_clip/modeling_chinese_clip.py#L1292"}}),no=new x({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/main/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <a href="/docs/transformers/main/en/model_doc/poolformer#transformers.PoolFormerFeatureExtractor.__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/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/chinese_clip/modeling_chinese_clip.py#L1305",returnDescription:`
<p>A <a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPooling"
>transformers.modeling_outputs.BaseModelOutputWithPooling</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<code>&lt;class 'transformers.models.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/main/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPooling"
>transformers.modeling_outputs.BaseModelOutputWithPooling</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Ye=new Un({props:{$$slots:{default:[dd]},$$scope:{ctx:w}}}),Ze=new rt({props:{anchor:"transformers.ChineseCLIPVisionModel.forward.example",$$slots:{default:[hd]},$$scope:{ctx:w}}}),{c(){d=n("meta"),v=h(),u=n("h1"),f=n("a"),C=n("span"),P(a.$$.fragment),m=h(),T=n("span"),Bs=i("Chinese-CLIP"),Hn=h(),ee=n("h2"),Ie=n("a"),Ho=n("span"),P(it.$$.fragment),Us=h(),Jo=n("span"),Hs=i("Overview"),Jn=h(),G=n("p"),Js=i("The Chinese-CLIP model was proposed in "),lt=n("a"),Gs=i("Chinese CLIP: Contrastive Vision-Language Pretraining in Chinese"),Ys=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"),Zs=i("at this link"),Ks=i("."),Gn=h(),io=n("p"),Xs=i("The abstract from the paper is the following:"),Yn=h(),lo=n("p"),Go=n("em"),Qs=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."),Zn=h(),te=n("h2"),ye=n("a"),Yo=n("span"),P(dt.$$.fragment),er=h(),Zo=n("span"),tr=i("Usage"),Kn=h(),co=n("p"),or=i("The code snippet below shows how to compute image & text features and similarities:"),Xn=h(),P(ht.$$.fragment),Qn=h(),ho=n("p"),nr=i("Currently, we release the following scales of pretrained Chinese-CLIP models at HF Model Hub:"),es=h(),S=n("ul"),Ko=n("li"),pt=n("a"),sr=i("OFA-Sys/chinese-clip-vit-base-patch16"),rr=h(),Xo=n("li"),mt=n("a"),ar=i("OFA-Sys/chinese-clip-vit-large-patch14"),ir=h(),Qo=n("li"),ft=n("a"),lr=i("OFA-Sys/chinese-clip-vit-large-patch14-336px"),cr=h(),en=n("li"),gt=n("a"),dr=i("OFA-Sys/chinese-clip-vit-huge-patch14"),ts=h(),$e=n("p"),hr=i("The Chinese-CLIP model was contributed by "),ut=n("a"),pr=i("OFA-Sys"),mr=i("."),os=h(),oe=n("h2"),Le=n("a"),tn=n("span"),P(_t.$$.fragment),fr=h(),on=n("span"),gr=i("ChineseCLIPConfig"),ns=h(),z=n("div"),P(Ct.$$.fragment),ur=h(),Y=n("p"),po=n("a"),_r=i("ChineseCLIPConfig"),Cr=i(" is the configuration class to store the configuration of a "),mo=n("a"),vr=i("ChineseCLIPModel"),Pr=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"),br=i("OFA-Sys/chinese-clip-vit-base-patch16"),Ir=i(`
architecture.`),yr=h(),ne=n("p"),$r=i("Configuration objects inherit from "),fo=n("a"),Lr=i("PretrainedConfig"),wr=i(` and can be used to control the model outputs. Read the
documentation from `),go=n("a"),Tr=i("PretrainedConfig"),xr=i(" for more information."),kr=h(),P(we.$$.fragment),zr=h(),Te=n("div"),P(Pt.$$.fragment),jr=h(),se=n("p"),Er=i("Instantiate a "),uo=n("a"),Mr=i("ChineseCLIPConfig"),Ar=i(` (or a derived class) from Chinese-CLIP text model configuration and
Chinese-CLIP vision model configuration. Returns:
`),_o=n("a"),qr=i("ChineseCLIPConfig"),Or=i(": An instance of a configuration object"),ss=h(),re=n("h2"),xe=n("a"),nn=n("span"),P(bt.$$.fragment),Fr=h(),sn=n("span"),Sr=i("ChineseCLIPTextConfig"),rs=h(),O=n("div"),P(It.$$.fragment),Nr=h(),yt=n("p"),Dr=i("This is the configuration class to store the configuration of a "),Co=n("a"),Vr=i("ChineseCLIPModel"),Wr=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.`),Rr=h(),ae=n("p"),Br=i("Configuration objects inherit from "),vo=n("a"),Ur=i("PretrainedConfig"),Hr=i(` and can be used to control the model outputs. Read the
documentation from `),Po=n("a"),Jr=i("PretrainedConfig"),Gr=i(" for more information."),Yr=h(),P(ke.$$.fragment),as=h(),ie=n("h2"),ze=n("a"),rn=n("span"),P($t.$$.fragment),Zr=h(),an=n("span"),Kr=i("ChineseCLIPVisionConfig"),is=h(),F=n("div"),P(Lt.$$.fragment),Xr=h(),wt=n("p"),Qr=i("This is the configuration class to store the configuration of a "),bo=n("a"),ea=i("ChineseCLIPModel"),ta=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.`),oa=h(),le=n("p"),na=i("Configuration objects inherit from "),Io=n("a"),sa=i("PretrainedConfig"),ra=i(` and can be used to control the model outputs. Read the
documentation from `),yo=n("a"),aa=i("PretrainedConfig"),ia=i(" for more information."),la=h(),P(je.$$.fragment),ls=h(),ce=n("h2"),Ee=n("a"),ln=n("span"),P(Tt.$$.fragment),ca=h(),cn=n("span"),da=i("ChineseCLIPImageProcessor"),cs=h(),U=n("div"),P(xt.$$.fragment),ha=h(),dn=n("p"),pa=i("Constructs a Chinese-CLIP image processor."),ma=h(),Me=n("div"),P(kt.$$.fragment),fa=h(),hn=n("p"),ga=i("Preprocess an image or batch of images."),ds=h(),de=n("h2"),Ae=n("a"),pn=n("span"),P(zt.$$.fragment),ua=h(),mn=n("span"),_a=i("ChineseCLIPFeatureExtractor"),hs=h(),jt=n("div"),P(Et.$$.fragment),ps=h(),he=n("h2"),qe=n("a"),fn=n("span"),P(Mt.$$.fragment),Ca=h(),gn=n("span"),va=i("ChineseCLIPProcessor"),ms=h(),j=n("div"),P(At.$$.fragment),Pa=h(),un=n("p"),ba=i(`Constructs a Chinese-CLIP processor which wraps a Chinese-CLIP image processor and a Chinese-CLIP tokenizer into a
single processor.`),Ia=h(),A=n("p"),$o=n("a"),ya=i("ChineseCLIPProcessor"),$a=i(" offers all the functionalities of "),Lo=n("a"),La=i("ChineseCLIPImageProcessor"),wa=i(" and "),wo=n("a"),Ta=i("BertTokenizerFast"),xa=i(`.
See the `),_n=n("code"),ka=i("__call__()"),za=i(" and "),To=n("a"),ja=i("decode()"),Ea=i(" for more information."),Ma=h(),Oe=n("div"),P(qt.$$.fragment),Aa=h(),Ot=n("p"),qa=i("This method forwards all its arguments to BertTokenizerFast\u2019s "),xo=n("a"),Oa=i("batch_decode()"),Fa=i(`. Please
refer to the docstring of this method for more information.`),Sa=h(),Fe=n("div"),P(Ft.$$.fragment),Na=h(),St=n("p"),Da=i("This method forwards all its arguments to BertTokenizerFast\u2019s "),ko=n("a"),Va=i("decode()"),Wa=i(`. Please refer to
the docstring of this method for more information.`),fs=h(),pe=n("h2"),Se=n("a"),Cn=n("span"),P(Nt.$$.fragment),Ra=h(),vn=n("span"),Ba=i("ChineseCLIPModel"),gs=h(),E=n("div"),P(Dt.$$.fragment),Ua=h(),Vt=n("p"),Ha=i("This model is a PyTorch "),Wt=n("a"),Ja=i("torch.nn.Module"),Ga=i(` subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Ya=h(),N=n("div"),P(Rt.$$.fragment),Za=h(),me=n("p"),Ka=i("The "),zo=n("a"),Xa=i("ChineseCLIPModel"),Qa=i(" forward method, overrides the "),Pn=n("code"),ei=i("__call__"),ti=i(" special method."),oi=h(),P(Ne.$$.fragment),ni=h(),P(De.$$.fragment),si=h(),D=n("div"),P(Bt.$$.fragment),ri=h(),fe=n("p"),ai=i("The "),jo=n("a"),ii=i("ChineseCLIPModel"),li=i(" forward method, overrides the "),bn=n("code"),ci=i("__call__"),di=i(" special method."),hi=h(),P(Ve.$$.fragment),pi=h(),P(We.$$.fragment),mi=h(),V=n("div"),P(Ut.$$.fragment),fi=h(),ge=n("p"),gi=i("The "),Eo=n("a"),ui=i("ChineseCLIPModel"),_i=i(" forward method, overrides the "),In=n("code"),Ci=i("__call__"),vi=i(" special method."),Pi=h(),P(Re.$$.fragment),bi=h(),P(Be.$$.fragment),us=h(),ue=n("h2"),Ue=n("a"),yn=n("span"),P(Ht.$$.fragment),Ii=h(),$n=n("span"),yi=i("ChineseCLIPTextModel"),_s=h(),M=n("div"),P(Jt.$$.fragment),$i=h(),Gt=n("p"),Li=i(`The text model from CHINESE_CLIP without any head or projection on top.
This model is a PyTorch `),Yt=n("a"),wi=i("torch.nn.Module"),Ti=i(` subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),xi=h(),Zt=n("p"),ki=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 `),Kt=n("a"),zi=i(`Attention is
all you need`),ji=i(` by Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit,
Llion Jones, Aidan N. Gomez, Lukasz Kaiser and Illia Polosukhin.`),Ei=h(),k=n("p"),Mi=i("To behave as an decoder the model needs to be initialized with the "),Ln=n("code"),Ai=i("is_decoder"),qi=i(` argument of the configuration set
to `),wn=n("code"),Oi=i("True"),Fi=i(". To be used in a Seq2Seq model, the model needs to initialized with both "),Tn=n("code"),Si=i("is_decoder"),Ni=i(` argument and
`),xn=n("code"),Di=i("add_cross_attention"),Vi=i(" set to "),kn=n("code"),Wi=i("True"),Ri=i("; an "),zn=n("code"),Bi=i("encoder_hidden_states"),Ui=i(" is then expected as an input to the forward pass."),Hi=h(),W=n("div"),P(Xt.$$.fragment),Ji=h(),_e=n("p"),Gi=i("The "),Mo=n("a"),Yi=i("ChineseCLIPTextModel"),Zi=i(" forward method, overrides the "),jn=n("code"),Ki=i("__call__"),Xi=i(" special method."),Qi=h(),P(He.$$.fragment),el=h(),P(Je.$$.fragment),Cs=h(),Ce=n("h2"),Ge=n("a"),En=n("span"),P(Qt.$$.fragment),tl=h(),Mn=n("span"),ol=i("ChineseCLIPVisionModel"),vs=h(),H=n("div"),P(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"),rl=i("torch.nn.Module"),al=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(),R=n("div"),P(no.$$.fragment),ll=h(),ve=n("p"),cl=i("The "),Ao=n("a"),dl=i("ChineseCLIPVisionModel"),hl=i(" forward method, overrides the "),An=n("code"),pl=i("__call__"),ml=i(" special method."),fl=h(),P(Ye.$$.fragment),gl=h(),P(Ze.$$.fragment),this.h()},l(t){const g=Kc('[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=r(u);f=s(so,"A",{id:!0,class:!0,href:!0});var qn=r(f);C=s(qn,"SPAN",{});var On=r(C);b(a.$$.fragment,On),On.forEach(o),qn.forEach(o),m=p(so),T=s(so,"SPAN",{});var Fn=r(T);Bs=l(Fn,"Chinese-CLIP"),Fn.forEach(o),so.forEach(o),Hn=p(t),ee=s(t,"H2",{class:!0});var ro=r(ee);Ie=s(ro,"A",{id:!0,class:!0,href:!0});var Sn=r(Ie);Ho=s(Sn,"SPAN",{});var Nn=r(Ho);b(it.$$.fragment,Nn),Nn.forEach(o),Sn.forEach(o),Us=p(ro),Jo=s(ro,"SPAN",{});var Dn=r(Jo);Hs=l(Dn,"Overview"),Dn.forEach(o),ro.forEach(o),Jn=p(t),G=s(t,"P",{});var Pe=r(G);Js=l(Pe,"The Chinese-CLIP model was proposed in "),lt=s(Pe,"A",{href:!0,rel:!0});var Vn=r(lt);Gs=l(Vn,"Chinese CLIP: Contrastive Vision-Language Pretraining in Chinese"),Vn.forEach(o),Ys=l(Pe,` 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(Pe,"A",{href:!0,rel:!0});var Wn=r(ct);Zs=l(Wn,"at this link"),Wn.forEach(o),Ks=l(Pe,"."),Pe.forEach(o),Gn=p(t),io=s(t,"P",{});var Rn=r(io);Xs=l(Rn,"The abstract from the paper is the following:"),Rn.forEach(o),Yn=p(t),lo=s(t,"P",{});var Bn=r(lo);Go=s(Bn,"EM",{});var ul=r(Go);Qs=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),Bn.forEach(o),Zn=p(t),te=s(t,"H2",{class:!0});var bs=r(te);ye=s(bs,"A",{id:!0,class:!0,href:!0});var _l=r(ye);Yo=s(_l,"SPAN",{});var Cl=r(Yo);b(dt.$$.fragment,Cl),Cl.forEach(o),_l.forEach(o),er=p(bs),Zo=s(bs,"SPAN",{});var vl=r(Zo);tr=l(vl,"Usage"),vl.forEach(o),bs.forEach(o),Kn=p(t),co=s(t,"P",{});var Pl=r(co);or=l(Pl,"The code snippet below shows how to compute image & text features and similarities:"),Pl.forEach(o),Xn=p(t),b(ht.$$.fragment,t),Qn=p(t),ho=s(t,"P",{});var bl=r(ho);nr=l(bl,"Currently, we release the following scales of pretrained Chinese-CLIP models at HF Model Hub:"),bl.forEach(o),es=p(t),S=s(t,"UL",{});var Ke=r(S);Ko=s(Ke,"LI",{});var Il=r(Ko);pt=s(Il,"A",{href:!0,rel:!0});var yl=r(pt);sr=l(yl,"OFA-Sys/chinese-clip-vit-base-patch16"),yl.forEach(o),Il.forEach(o),rr=p(Ke),Xo=s(Ke,"LI",{});var $l=r(Xo);mt=s($l,"A",{href:!0,rel:!0});var Ll=r(mt);ar=l(Ll,"OFA-Sys/chinese-clip-vit-large-patch14"),Ll.forEach(o),$l.forEach(o),ir=p(Ke),Qo=s(Ke,"LI",{});var wl=r(Qo);ft=s(wl,"A",{href:!0,rel:!0});var Tl=r(ft);lr=l(Tl,"OFA-Sys/chinese-clip-vit-large-patch14-336px"),Tl.forEach(o),wl.forEach(o),cr=p(Ke),en=s(Ke,"LI",{});var xl=r(en);gt=s(xl,"A",{href:!0,rel:!0});var kl=r(gt);dr=l(kl,"OFA-Sys/chinese-clip-vit-huge-patch14"),kl.forEach(o),xl.forEach(o),Ke.forEach(o),ts=p(t),$e=s(t,"P",{});var Is=r($e);hr=l(Is,"The Chinese-CLIP model was contributed by "),ut=s(Is,"A",{href:!0,rel:!0});var zl=r(ut);pr=l(zl,"OFA-Sys"),zl.forEach(o),mr=l(Is,"."),Is.forEach(o),os=p(t),oe=s(t,"H2",{class:!0});var ys=r(oe);Le=s(ys,"A",{id:!0,class:!0,href:!0});var jl=r(Le);tn=s(jl,"SPAN",{});var El=r(tn);b(_t.$$.fragment,El),El.forEach(o),jl.forEach(o),fr=p(ys),on=s(ys,"SPAN",{});var Ml=r(on);gr=l(Ml,"ChineseCLIPConfig"),Ml.forEach(o),ys.forEach(o),ns=p(t),z=s(t,"DIV",{class:!0});var Z=r(z);b(Ct.$$.fragment,Z),ur=p(Z),Y=s(Z,"P",{});var ao=r(Y);po=s(ao,"A",{href:!0});var Al=r(po);_r=l(Al,"ChineseCLIPConfig"),Al.forEach(o),Cr=l(ao," is the configuration class to store the configuration of a "),mo=s(ao,"A",{href:!0});var ql=r(mo);vr=l(ql,"ChineseCLIPModel"),ql.forEach(o),Pr=l(ao,`. 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(ao,"A",{href:!0,rel:!0});var Ol=r(vt);br=l(Ol,"OFA-Sys/chinese-clip-vit-base-patch16"),Ol.forEach(o),Ir=l(ao,`
architecture.`),ao.forEach(o),yr=p(Z),ne=s(Z,"P",{});var qo=r(ne);$r=l(qo,"Configuration objects inherit from "),fo=s(qo,"A",{href:!0});var Fl=r(fo);Lr=l(Fl,"PretrainedConfig"),Fl.forEach(o),wr=l(qo,` and can be used to control the model outputs. Read the
documentation from `),go=s(qo,"A",{href:!0});var Sl=r(go);Tr=l(Sl,"PretrainedConfig"),Sl.forEach(o),xr=l(qo," for more information."),qo.forEach(o),kr=p(Z),b(we.$$.fragment,Z),zr=p(Z),Te=s(Z,"DIV",{class:!0});var $s=r(Te);b(Pt.$$.fragment,$s),jr=p($s),se=s($s,"P",{});var Oo=r(se);Er=l(Oo,"Instantiate a "),uo=s(Oo,"A",{href:!0});var Nl=r(uo);Mr=l(Nl,"ChineseCLIPConfig"),Nl.forEach(o),Ar=l(Oo,` (or a derived class) from Chinese-CLIP text model configuration and
Chinese-CLIP vision model configuration. Returns:
`),_o=s(Oo,"A",{href:!0});var Dl=r(_o);qr=l(Dl,"ChineseCLIPConfig"),Dl.forEach(o),Or=l(Oo,": An instance of a configuration object"),Oo.forEach(o),$s.forEach(o),Z.forEach(o),ss=p(t),re=s(t,"H2",{class:!0});var Ls=r(re);xe=s(Ls,"A",{id:!0,class:!0,href:!0});var Vl=r(xe);nn=s(Vl,"SPAN",{});var Wl=r(nn);b(bt.$$.fragment,Wl),Wl.forEach(o),Vl.forEach(o),Fr=p(Ls),sn=s(Ls,"SPAN",{});var Rl=r(sn);Sr=l(Rl,"ChineseCLIPTextConfig"),Rl.forEach(o),Ls.forEach(o),rs=p(t),O=s(t,"DIV",{class:!0});var Xe=r(O);b(It.$$.fragment,Xe),Nr=p(Xe),yt=s(Xe,"P",{});var ws=r(yt);Dr=l(ws,"This is the configuration class to store the configuration of a "),Co=s(ws,"A",{href:!0});var Bl=r(Co);Vr=l(Bl,"ChineseCLIPModel"),Bl.forEach(o),Wr=l(ws,`. 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.`),ws.forEach(o),Rr=p(Xe),ae=s(Xe,"P",{});var Fo=r(ae);Br=l(Fo,"Configuration objects inherit from "),vo=s(Fo,"A",{href:!0});var Ul=r(vo);Ur=l(Ul,"PretrainedConfig"),Ul.forEach(o),Hr=l(Fo,` and can be used to control the model outputs. Read the
documentation from `),Po=s(Fo,"A",{href:!0});var Hl=r(Po);Jr=l(Hl,"PretrainedConfig"),Hl.forEach(o),Gr=l(Fo," for more information."),Fo.forEach(o),Yr=p(Xe),b(ke.$$.fragment,Xe),Xe.forEach(o),as=p(t),ie=s(t,"H2",{class:!0});var Ts=r(ie);ze=s(Ts,"A",{id:!0,class:!0,href:!0});var Jl=r(ze);rn=s(Jl,"SPAN",{});var Gl=r(rn);b($t.$$.fragment,Gl),Gl.forEach(o),Jl.forEach(o),Zr=p(Ts),an=s(Ts,"SPAN",{});var Yl=r(an);Kr=l(Yl,"ChineseCLIPVisionConfig"),Yl.forEach(o),Ts.forEach(o),is=p(t),F=s(t,"DIV",{class:!0});var Qe=r(F);b(Lt.$$.fragment,Qe),Xr=p(Qe),wt=s(Qe,"P",{});var xs=r(wt);Qr=l(xs,"This is the configuration class to store the configuration of a "),bo=s(xs,"A",{href:!0});var Zl=r(bo);ea=l(Zl,"ChineseCLIPModel"),Zl.forEach(o),ta=l(xs,`. 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.`),xs.forEach(o),oa=p(Qe),le=s(Qe,"P",{});var So=r(le);na=l(So,"Configuration objects inherit from "),Io=s(So,"A",{href:!0});var Kl=r(Io);sa=l(Kl,"PretrainedConfig"),Kl.forEach(o),ra=l(So,` and can be used to control the model outputs. Read the
documentation from `),yo=s(So,"A",{href:!0});var Xl=r(yo);aa=l(Xl,"PretrainedConfig"),Xl.forEach(o),ia=l(So," for more information."),So.forEach(o),la=p(Qe),b(je.$$.fragment,Qe),Qe.forEach(o),ls=p(t),ce=s(t,"H2",{class:!0});var ks=r(ce);Ee=s(ks,"A",{id:!0,class:!0,href:!0});var Ql=r(Ee);ln=s(Ql,"SPAN",{});var ec=r(ln);b(Tt.$$.fragment,ec),ec.forEach(o),Ql.forEach(o),ca=p(ks),cn=s(ks,"SPAN",{});var tc=r(cn);da=l(tc,"ChineseCLIPImageProcessor"),tc.forEach(o),ks.forEach(o),cs=p(t),U=s(t,"DIV",{class:!0});var No=r(U);b(xt.$$.fragment,No),ha=p(No),dn=s(No,"P",{});var oc=r(dn);pa=l(oc,"Constructs a Chinese-CLIP image processor."),oc.forEach(o),ma=p(No),Me=s(No,"DIV",{class:!0});var zs=r(Me);b(kt.$$.fragment,zs),fa=p(zs),hn=s(zs,"P",{});var nc=r(hn);ga=l(nc,"Preprocess an image or batch of images."),nc.forEach(o),zs.forEach(o),No.forEach(o),ds=p(t),de=s(t,"H2",{class:!0});var js=r(de);Ae=s(js,"A",{id:!0,class:!0,href:!0});var sc=r(Ae);pn=s(sc,"SPAN",{});var rc=r(pn);b(zt.$$.fragment,rc),rc.forEach(o),sc.forEach(o),ua=p(js),mn=s(js,"SPAN",{});var ac=r(mn);_a=l(ac,"ChineseCLIPFeatureExtractor"),ac.forEach(o),js.forEach(o),hs=p(t),jt=s(t,"DIV",{class:!0});var ic=r(jt);b(Et.$$.fragment,ic),ic.forEach(o),ps=p(t),he=s(t,"H2",{class:!0});var Es=r(he);qe=s(Es,"A",{id:!0,class:!0,href:!0});var lc=r(qe);fn=s(lc,"SPAN",{});var cc=r(fn);b(Mt.$$.fragment,cc),cc.forEach(o),lc.forEach(o),Ca=p(Es),gn=s(Es,"SPAN",{});var dc=r(gn);va=l(dc,"ChineseCLIPProcessor"),dc.forEach(o),Es.forEach(o),ms=p(t),j=s(t,"DIV",{class:!0});var K=r(j);b(At.$$.fragment,K),Pa=p(K),un=s(K,"P",{});var hc=r(un);ba=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),Ia=p(K),A=s(K,"P",{});var J=r(A);$o=s(J,"A",{href:!0});var pc=r($o);ya=l(pc,"ChineseCLIPProcessor"),pc.forEach(o),$a=l(J," offers all the functionalities of "),Lo=s(J,"A",{href:!0});var mc=r(Lo);La=l(mc,"ChineseCLIPImageProcessor"),mc.forEach(o),wa=l(J," and "),wo=s(J,"A",{href:!0});var fc=r(wo);Ta=l(fc,"BertTokenizerFast"),fc.forEach(o),xa=l(J,`.
See the `),_n=s(J,"CODE",{});var gc=r(_n);ka=l(gc,"__call__()"),gc.forEach(o),za=l(J," and "),To=s(J,"A",{href:!0});var uc=r(To);ja=l(uc,"decode()"),uc.forEach(o),Ea=l(J," for more information."),J.forEach(o),Ma=p(K),Oe=s(K,"DIV",{class:!0});var Ms=r(Oe);b(qt.$$.fragment,Ms),Aa=p(Ms),Ot=s(Ms,"P",{});var As=r(Ot);qa=l(As,"This method forwards all its arguments to BertTokenizerFast\u2019s "),xo=s(As,"A",{href:!0});var _c=r(xo);Oa=l(_c,"batch_decode()"),_c.forEach(o),Fa=l(As,`. Please
refer to the docstring of this method for more information.`),As.forEach(o),Ms.forEach(o),Sa=p(K),Fe=s(K,"DIV",{class:!0});var qs=r(Fe);b(Ft.$$.fragment,qs),Na=p(qs),St=s(qs,"P",{});var Os=r(St);Da=l(Os,"This method forwards all its arguments to BertTokenizerFast\u2019s "),ko=s(Os,"A",{href:!0});var Cc=r(ko);Va=l(Cc,"decode()"),Cc.forEach(o),Wa=l(Os,`. Please refer to
the docstring of this method for more information.`),Os.forEach(o),qs.forEach(o),K.forEach(o),fs=p(t),pe=s(t,"H2",{class:!0});var Fs=r(pe);Se=s(Fs,"A",{id:!0,class:!0,href:!0});var vc=r(Se);Cn=s(vc,"SPAN",{});var Pc=r(Cn);b(Nt.$$.fragment,Pc),Pc.forEach(o),vc.forEach(o),Ra=p(Fs),vn=s(Fs,"SPAN",{});var bc=r(vn);Ba=l(bc,"ChineseCLIPModel"),bc.forEach(o),Fs.forEach(o),gs=p(t),E=s(t,"DIV",{class:!0});var X=r(E);b(Dt.$$.fragment,X),Ua=p(X),Vt=s(X,"P",{});var Ss=r(Vt);Ha=l(Ss,"This model is a PyTorch "),Wt=s(Ss,"A",{href:!0,rel:!0});var Ic=r(Wt);Ja=l(Ic,"torch.nn.Module"),Ic.forEach(o),Ga=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),Ya=p(X),N=s(X,"DIV",{class:!0});var et=r(N);b(Rt.$$.fragment,et),Za=p(et),me=s(et,"P",{});var Do=r(me);Ka=l(Do,"The "),zo=s(Do,"A",{href:!0});var yc=r(zo);Xa=l(yc,"ChineseCLIPModel"),yc.forEach(o),Qa=l(Do," forward method, overrides the "),Pn=s(Do,"CODE",{});var $c=r(Pn);ei=l($c,"__call__"),$c.forEach(o),ti=l(Do," special method."),Do.forEach(o),oi=p(et),b(Ne.$$.fragment,et),ni=p(et),b(De.$$.fragment,et),et.forEach(o),si=p(X),D=s(X,"DIV",{class:!0});var tt=r(D);b(Bt.$$.fragment,tt),ri=p(tt),fe=s(tt,"P",{});var Vo=r(fe);ai=l(Vo,"The "),jo=s(Vo,"A",{href:!0});var Lc=r(jo);ii=l(Lc,"ChineseCLIPModel"),Lc.forEach(o),li=l(Vo," forward method, overrides the "),bn=s(Vo,"CODE",{});var wc=r(bn);ci=l(wc,"__call__"),wc.forEach(o),di=l(Vo," special method."),Vo.forEach(o),hi=p(tt),b(Ve.$$.fragment,tt),pi=p(tt),b(We.$$.fragment,tt),tt.forEach(o),mi=p(X),V=s(X,"DIV",{class:!0});var ot=r(V);b(Ut.$$.fragment,ot),fi=p(ot),ge=s(ot,"P",{});var Wo=r(ge);gi=l(Wo,"The "),Eo=s(Wo,"A",{href:!0});var Tc=r(Eo);ui=l(Tc,"ChineseCLIPModel"),Tc.forEach(o),_i=l(Wo," forward method, overrides the "),In=s(Wo,"CODE",{});var xc=r(In);Ci=l(xc,"__call__"),xc.forEach(o),vi=l(Wo," special method."),Wo.forEach(o),Pi=p(ot),b(Re.$$.fragment,ot),bi=p(ot),b(Be.$$.fragment,ot),ot.forEach(o),X.forEach(o),us=p(t),ue=s(t,"H2",{class:!0});var Ns=r(ue);Ue=s(Ns,"A",{id:!0,class:!0,href:!0});var kc=r(Ue);yn=s(kc,"SPAN",{});var zc=r(yn);b(Ht.$$.fragment,zc),zc.forEach(o),kc.forEach(o),Ii=p(Ns),$n=s(Ns,"SPAN",{});var jc=r($n);yi=l(jc,"ChineseCLIPTextModel"),jc.forEach(o),Ns.forEach(o),_s=p(t),M=s(t,"DIV",{class:!0});var Q=r(M);b(Jt.$$.fragment,Q),$i=p(Q),Gt=s(Q,"P",{});var Ds=r(Gt);Li=l(Ds,`The text model from CHINESE_CLIP without any head or projection on top.
This model is a PyTorch `),Yt=s(Ds,"A",{href:!0,rel:!0});var Ec=r(Yt);wi=l(Ec,"torch.nn.Module"),Ec.forEach(o),Ti=l(Ds,` subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Ds.forEach(o),xi=p(Q),Zt=s(Q,"P",{});var Vs=r(Zt);ki=l(Vs,`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 `),Kt=s(Vs,"A",{href:!0,rel:!0});var Mc=r(Kt);zi=l(Mc,`Attention is
all you need`),Mc.forEach(o),ji=l(Vs,` by Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit,
Llion Jones, Aidan N. Gomez, Lukasz Kaiser and Illia Polosukhin.`),Vs.forEach(o),Ei=p(Q),k=s(Q,"P",{});var q=r(k);Mi=l(q,"To behave as an decoder the model needs to be initialized with the "),Ln=s(q,"CODE",{});var Ac=r(Ln);Ai=l(Ac,"is_decoder"),Ac.forEach(o),qi=l(q,` argument of the configuration set
to `),wn=s(q,"CODE",{});var qc=r(wn);Oi=l(qc,"True"),qc.forEach(o),Fi=l(q,". To be used in a Seq2Seq model, the model needs to initialized with both "),Tn=s(q,"CODE",{});var Oc=r(Tn);Si=l(Oc,"is_decoder"),Oc.forEach(o),Ni=l(q,` argument and
`),xn=s(q,"CODE",{});var Fc=r(xn);Di=l(Fc,"add_cross_attention"),Fc.forEach(o),Vi=l(q," set to "),kn=s(q,"CODE",{});var Sc=r(kn);Wi=l(Sc,"True"),Sc.forEach(o),Ri=l(q,"; an "),zn=s(q,"CODE",{});var Nc=r(zn);Bi=l(Nc,"encoder_hidden_states"),Nc.forEach(o),Ui=l(q," is then expected as an input to the forward pass."),q.forEach(o),Hi=p(Q),W=s(Q,"DIV",{class:!0});var nt=r(W);b(Xt.$$.fragment,nt),Ji=p(nt),_e=s(nt,"P",{});var Ro=r(_e);Gi=l(Ro,"The "),Mo=s(Ro,"A",{href:!0});var Dc=r(Mo);Yi=l(Dc,"ChineseCLIPTextModel"),Dc.forEach(o),Zi=l(Ro," forward method, overrides the "),jn=s(Ro,"CODE",{});var Vc=r(jn);Ki=l(Vc,"__call__"),Vc.forEach(o),Xi=l(Ro," special method."),Ro.forEach(o),Qi=p(nt),b(He.$$.fragment,nt),el=p(nt),b(Je.$$.fragment,nt),nt.forEach(o),Q.forEach(o),Cs=p(t),Ce=s(t,"H2",{class:!0});var Ws=r(Ce);Ge=s(Ws,"A",{id:!0,class:!0,href:!0});var Wc=r(Ge);En=s(Wc,"SPAN",{});var Rc=r(En);b(Qt.$$.fragment,Rc),Rc.forEach(o),Wc.forEach(o),tl=p(Ws),Mn=s(Ws,"SPAN",{});var Bc=r(Mn);ol=l(Bc,"ChineseCLIPVisionModel"),Bc.forEach(o),Ws.forEach(o),vs=p(t),H=s(t,"DIV",{class:!0});var Bo=r(H);b(eo.$$.fragment,Bo),nl=p(Bo),to=s(Bo,"P",{});var Rs=r(to);sl=l(Rs,`The vision model from CHINESE_CLIP without any head or projection on top.
This model is a PyTorch `),oo=s(Rs,"A",{href:!0,rel:!0});var Uc=r(oo);rl=l(Uc,"torch.nn.Module"),Uc.forEach(o),al=l(Rs,` subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Rs.forEach(o),il=p(Bo),R=s(Bo,"DIV",{class:!0});var st=r(R);b(no.$$.fragment,st),ll=p(st),ve=s(st,"P",{});var Uo=r(ve);cl=l(Uo,"The "),Ao=s(Uo,"A",{href:!0});var Hc=r(Ao);dl=l(Hc,"ChineseCLIPVisionModel"),Hc.forEach(o),hl=l(Uo," forward method, overrides the "),An=s(Uo,"CODE",{});var Jc=r(An);pl=l(Jc,"__call__"),Jc.forEach(o),ml=l(Uo," special method."),Uo.forEach(o),fl=p(st),b(Ye.$$.fragment,st),gl=p(st),b(Ze.$$.fragment,st),st.forEach(o),Bo.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(Ie,"id","overview"),c(Ie,"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(Ie,"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(ye,"id","usage"),c(ye,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(ye,"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(Le,"id","transformers.ChineseCLIPConfig"),c(Le,"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(Le,"href","#transformers.ChineseCLIPConfig"),c(oe,"class","relative group"),c(po,"href","/docs/transformers/main/en/model_doc/chinese_clip#transformers.ChineseCLIPConfig"),c(mo,"href","/docs/transformers/main/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/main/en/main_classes/configuration#transformers.PretrainedConfig"),c(go,"href","/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig"),c(uo,"href","/docs/transformers/main/en/model_doc/chinese_clip#transformers.ChineseCLIPConfig"),c(_o,"href","/docs/transformers/main/en/model_doc/chinese_clip#transformers.ChineseCLIPConfig"),c(Te,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(xe,"id","transformers.ChineseCLIPTextConfig"),c(xe,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(xe,"href","#transformers.ChineseCLIPTextConfig"),c(re,"class","relative group"),c(Co,"href","/docs/transformers/main/en/model_doc/chinese_clip#transformers.ChineseCLIPModel"),c(vo,"href","/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig"),c(Po,"href","/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig"),c(O,"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.ChineseCLIPVisionConfig"),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.ChineseCLIPVisionConfig"),c(ie,"class","relative group"),c(bo,"href","/docs/transformers/main/en/model_doc/chinese_clip#transformers.ChineseCLIPModel"),c(Io,"href","/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig"),c(yo,"href","/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig"),c(F,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(Ee,"id","transformers.ChineseCLIPImageProcessor"),c(Ee,"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(Ee,"href","#transformers.ChineseCLIPImageProcessor"),c(ce,"class","relative group"),c(Me,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(U,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(Ae,"id","transformers.ChineseCLIPFeatureExtractor"),c(Ae,"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(Ae,"href","#transformers.ChineseCLIPFeatureExtractor"),c(de,"class","relative group"),c(jt,"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.ChineseCLIPProcessor"),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.ChineseCLIPProcessor"),c(he,"class","relative group"),c($o,"href","/docs/transformers/main/en/model_doc/chinese_clip#transformers.ChineseCLIPProcessor"),c(Lo,"href","/docs/transformers/main/en/model_doc/chinese_clip#transformers.ChineseCLIPImageProcessor"),c(wo,"href","/docs/transformers/main/en/model_doc/bert#transformers.BertTokenizerFast"),c(To,"href","/docs/transformers/main/en/model_doc/chinese_clip#transformers.ChineseCLIPProcessor.decode"),c(xo,"href","/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.batch_decode"),c(Oe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(ko,"href","/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.decode"),c(Fe,"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(Se,"id","transformers.ChineseCLIPModel"),c(Se,"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(Se,"href","#transformers.ChineseCLIPModel"),c(pe,"class","relative group"),c(Wt,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),c(Wt,"rel","nofollow"),c(zo,"href","/docs/transformers/main/en/model_doc/chinese_clip#transformers.ChineseCLIPModel"),c(N,"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/main/en/model_doc/chinese_clip#transformers.ChineseCLIPModel"),c(D,"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/main/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(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(Ue,"id","transformers.ChineseCLIPTextModel"),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.ChineseCLIPTextModel"),c(ue,"class","relative group"),c(Yt,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),c(Yt,"rel","nofollow"),c(Kt,"href","https://arxiv.org/abs/1706.03762"),c(Kt,"rel","nofollow"),c(Mo,"href","/docs/transformers/main/en/model_doc/chinese_clip#transformers.ChineseCLIPTextModel"),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(M,"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.ChineseCLIPVisionModel"),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.ChineseCLIPVisionModel"),c(Ce,"class","relative group"),c(oo,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),c(oo,"rel","nofollow"),c(Ao,"href","/docs/transformers/main/en/model_doc/chinese_clip#transformers.ChineseCLIPVisionModel"),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(H,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(t,g){e(document.head,d),_(t,v,g),_(t,u,g),e(u,f),e(f,C),I(a,C,null),e(u,m),e(u,T),e(T,Bs),_(t,Hn,g),_(t,ee,g),e(ee,Ie),e(Ie,Ho),I(it,Ho,null),e(ee,Us),e(ee,Jo),e(Jo,Hs),_(t,Jn,g),_(t,G,g),e(G,Js),e(G,lt),e(lt,Gs),e(G,Ys),e(G,ct),e(ct,Zs),e(G,Ks),_(t,Gn,g),_(t,io,g),e(io,Xs),_(t,Yn,g),_(t,lo,g),e(lo,Go),e(Go,Qs),_(t,Zn,g),_(t,te,g),e(te,ye),e(ye,Yo),I(dt,Yo,null),e(te,er),e(te,Zo),e(Zo,tr),_(t,Kn,g),_(t,co,g),e(co,or),_(t,Xn,g),I(ht,t,g),_(t,Qn,g),_(t,ho,g),e(ho,nr),_(t,es,g),_(t,S,g),e(S,Ko),e(Ko,pt),e(pt,sr),e(S,rr),e(S,Xo),e(Xo,mt),e(mt,ar),e(S,ir),e(S,Qo),e(Qo,ft),e(ft,lr),e(S,cr),e(S,en),e(en,gt),e(gt,dr),_(t,ts,g),_(t,$e,g),e($e,hr),e($e,ut),e(ut,pr),e($e,mr),_(t,os,g),_(t,oe,g),e(oe,Le),e(Le,tn),I(_t,tn,null),e(oe,fr),e(oe,on),e(on,gr),_(t,ns,g),_(t,z,g),I(Ct,z,null),e(z,ur),e(z,Y),e(Y,po),e(po,_r),e(Y,Cr),e(Y,mo),e(mo,vr),e(Y,Pr),e(Y,vt),e(vt,br),e(Y,Ir),e(z,yr),e(z,ne),e(ne,$r),e(ne,fo),e(fo,Lr),e(ne,wr),e(ne,go),e(go,Tr),e(ne,xr),e(z,kr),I(we,z,null),e(z,zr),e(z,Te),I(Pt,Te,null),e(Te,jr),e(Te,se),e(se,Er),e(se,uo),e(uo,Mr),e(se,Ar),e(se,_o),e(_o,qr),e(se,Or),_(t,ss,g),_(t,re,g),e(re,xe),e(xe,nn),I(bt,nn,null),e(re,Fr),e(re,sn),e(sn,Sr),_(t,rs,g),_(t,O,g),I(It,O,null),e(O,Nr),e(O,yt),e(yt,Dr),e(yt,Co),e(Co,Vr),e(yt,Wr),e(O,Rr),e(O,ae),e(ae,Br),e(ae,vo),e(vo,Ur),e(ae,Hr),e(ae,Po),e(Po,Jr),e(ae,Gr),e(O,Yr),I(ke,O,null),_(t,as,g),_(t,ie,g),e(ie,ze),e(ze,rn),I($t,rn,null),e(ie,Zr),e(ie,an),e(an,Kr),_(t,is,g),_(t,F,g),I(Lt,F,null),e(F,Xr),e(F,wt),e(wt,Qr),e(wt,bo),e(bo,ea),e(wt,ta),e(F,oa),e(F,le),e(le,na),e(le,Io),e(Io,sa),e(le,ra),e(le,yo),e(yo,aa),e(le,ia),e(F,la),I(je,F,null),_(t,ls,g),_(t,ce,g),e(ce,Ee),e(Ee,ln),I(Tt,ln,null),e(ce,ca),e(ce,cn),e(cn,da),_(t,cs,g),_(t,U,g),I(xt,U,null),e(U,ha),e(U,dn),e(dn,pa),e(U,ma),e(U,Me),I(kt,Me,null),e(Me,fa),e(Me,hn),e(hn,ga),_(t,ds,g),_(t,de,g),e(de,Ae),e(Ae,pn),I(zt,pn,null),e(de,ua),e(de,mn),e(mn,_a),_(t,hs,g),_(t,jt,g),I(Et,jt,null),_(t,ps,g),_(t,he,g),e(he,qe),e(qe,fn),I(Mt,fn,null),e(he,Ca),e(he,gn),e(gn,va),_(t,ms,g),_(t,j,g),I(At,j,null),e(j,Pa),e(j,un),e(un,ba),e(j,Ia),e(j,A),e(A,$o),e($o,ya),e(A,$a),e(A,Lo),e(Lo,La),e(A,wa),e(A,wo),e(wo,Ta),e(A,xa),e(A,_n),e(_n,ka),e(A,za),e(A,To),e(To,ja),e(A,Ea),e(j,Ma),e(j,Oe),I(qt,Oe,null),e(Oe,Aa),e(Oe,Ot),e(Ot,qa),e(Ot,xo),e(xo,Oa),e(Ot,Fa),e(j,Sa),e(j,Fe),I(Ft,Fe,null),e(Fe,Na),e(Fe,St),e(St,Da),e(St,ko),e(ko,Va),e(St,Wa),_(t,fs,g),_(t,pe,g),e(pe,Se),e(Se,Cn),I(Nt,Cn,null),e(pe,Ra),e(pe,vn),e(vn,Ba),_(t,gs,g),_(t,E,g),I(Dt,E,null),e(E,Ua),e(E,Vt),e(Vt,Ha),e(Vt,Wt),e(Wt,Ja),e(Vt,Ga),e(E,Ya),e(E,N),I(Rt,N,null),e(N,Za),e(N,me),e(me,Ka),e(me,zo),e(zo,Xa),e(me,Qa),e(me,Pn),e(Pn,ei),e(me,ti),e(N,oi),I(Ne,N,null),e(N,ni),I(De,N,null),e(E,si),e(E,D),I(Bt,D,null),e(D,ri),e(D,fe),e(fe,ai),e(fe,jo),e(jo,ii),e(fe,li),e(fe,bn),e(bn,ci),e(fe,di),e(D,hi),I(Ve,D,null),e(D,pi),I(We,D,null),e(E,mi),e(E,V),I(Ut,V,null),e(V,fi),e(V,ge),e(ge,gi),e(ge,Eo),e(Eo,ui),e(ge,_i),e(ge,In),e(In,Ci),e(ge,vi),e(V,Pi),I(Re,V,null),e(V,bi),I(Be,V,null),_(t,us,g),_(t,ue,g),e(ue,Ue),e(Ue,yn),I(Ht,yn,null),e(ue,Ii),e(ue,$n),e($n,yi),_(t,_s,g),_(t,M,g),I(Jt,M,null),e(M,$i),e(M,Gt),e(Gt,Li),e(Gt,Yt),e(Yt,wi),e(Gt,Ti),e(M,xi),e(M,Zt),e(Zt,ki),e(Zt,Kt),e(Kt,zi),e(Zt,ji),e(M,Ei),e(M,k),e(k,Mi),e(k,Ln),e(Ln,Ai),e(k,qi),e(k,wn),e(wn,Oi),e(k,Fi),e(k,Tn),e(Tn,Si),e(k,Ni),e(k,xn),e(xn,Di),e(k,Vi),e(k,kn),e(kn,Wi),e(k,Ri),e(k,zn),e(zn,Bi),e(k,Ui),e(M,Hi),e(M,W),I(Xt,W,null),e(W,Ji),e(W,_e),e(_e,Gi),e(_e,Mo),e(Mo,Yi),e(_e,Zi),e(_e,jn),e(jn,Ki),e(_e,Xi),e(W,Qi),I(He,W,null),e(W,el),I(Je,W,null),_(t,Cs,g),_(t,Ce,g),e(Ce,Ge),e(Ge,En),I(Qt,En,null),e(Ce,tl),e(Ce,Mn),e(Mn,ol),_(t,vs,g),_(t,H,g),I(eo,H,null),e(H,nl),e(H,to),e(to,sl),e(to,oo),e(oo,rl),e(to,al),e(H,il),e(H,R),I(no,R,null),e(R,ll),e(R,ve),e(ve,cl),e(ve,Ao),e(Ao,dl),e(ve,hl),e(ve,An),e(An,pl),e(ve,ml),e(R,fl),I(Ye,R,null),e(R,gl),I(Ze,R,null),Ps=!0},p(t,[g]){const so={};g&2&&(so.$$scope={dirty:g,ctx:t}),we.$set(so);const qn={};g&2&&(qn.$$scope={dirty:g,ctx:t}),ke.$set(qn);const On={};g&2&&(On.$$scope={dirty:g,ctx:t}),je.$set(On);const Fn={};g&2&&(Fn.$$scope={dirty:g,ctx:t}),Ne.$set(Fn);const ro={};g&2&&(ro.$$scope={dirty:g,ctx:t}),De.$set(ro);const Sn={};g&2&&(Sn.$$scope={dirty:g,ctx:t}),Ve.$set(Sn);const Nn={};g&2&&(Nn.$$scope={dirty:g,ctx:t}),We.$set(Nn);const Dn={};g&2&&(Dn.$$scope={dirty:g,ctx:t}),Re.$set(Dn);const Pe={};g&2&&(Pe.$$scope={dirty:g,ctx:t}),Be.$set(Pe);const Vn={};g&2&&(Vn.$$scope={dirty:g,ctx:t}),He.$set(Vn);const Wn={};g&2&&(Wn.$$scope={dirty:g,ctx:t}),Je.$set(Wn);const Rn={};g&2&&(Rn.$$scope={dirty:g,ctx:t}),Ye.$set(Rn);const Bn={};g&2&&(Bn.$$scope={dirty:g,ctx:t}),Ze.$set(Bn)},i(t){Ps||(y(a.$$.fragment,t),y(it.$$.fragment,t),y(dt.$$.fragment,t),y(ht.$$.fragment,t),y(_t.$$.fragment,t),y(Ct.$$.fragment,t),y(we.$$.fragment,t),y(Pt.$$.fragment,t),y(bt.$$.fragment,t),y(It.$$.fragment,t),y(ke.$$.fragment,t),y($t.$$.fragment,t),y(Lt.$$.fragment,t),y(je.$$.fragment,t),y(Tt.$$.fragment,t),y(xt.$$.fragment,t),y(kt.$$.fragment,t),y(zt.$$.fragment,t),y(Et.$$.fragment,t),y(Mt.$$.fragment,t),y(At.$$.fragment,t),y(qt.$$.fragment,t),y(Ft.$$.fragment,t),y(Nt.$$.fragment,t),y(Dt.$$.fragment,t),y(Rt.$$.fragment,t),y(Ne.$$.fragment,t),y(De.$$.fragment,t),y(Bt.$$.fragment,t),y(Ve.$$.fragment,t),y(We.$$.fragment,t),y(Ut.$$.fragment,t),y(Re.$$.fragment,t),y(Be.$$.fragment,t),y(Ht.$$.fragment,t),y(Jt.$$.fragment,t),y(Xt.$$.fragment,t),y(He.$$.fragment,t),y(Je.$$.fragment,t),y(Qt.$$.fragment,t),y(eo.$$.fragment,t),y(no.$$.fragment,t),y(Ye.$$.fragment,t),y(Ze.$$.fragment,t),Ps=!0)},o(t){$(a.$$.fragment,t),$(it.$$.fragment,t),$(dt.$$.fragment,t),$(ht.$$.fragment,t),$(_t.$$.fragment,t),$(Ct.$$.fragment,t),$(we.$$.fragment,t),$(Pt.$$.fragment,t),$(bt.$$.fragment,t),$(It.$$.fragment,t),$(ke.$$.fragment,t),$($t.$$.fragment,t),$(Lt.$$.fragment,t),$(je.$$.fragment,t),$(Tt.$$.fragment,t),$(xt.$$.fragment,t),$(kt.$$.fragment,t),$(zt.$$.fragment,t),$(Et.$$.fragment,t),$(Mt.$$.fragment,t),$(At.$$.fragment,t),$(qt.$$.fragment,t),$(Ft.$$.fragment,t),$(Nt.$$.fragment,t),$(Dt.$$.fragment,t),$(Rt.$$.fragment,t),$(Ne.$$.fragment,t),$(De.$$.fragment,t),$(Bt.$$.fragment,t),$(Ve.$$.fragment,t),$(We.$$.fragment,t),$(Ut.$$.fragment,t),$(Re.$$.fragment,t),$(Be.$$.fragment,t),$(Ht.$$.fragment,t),$(Jt.$$.fragment,t),$(Xt.$$.fragment,t),$(He.$$.fragment,t),$(Je.$$.fragment,t),$(Qt.$$.fragment,t),$(eo.$$.fragment,t),$(no.$$.fragment,t),$(Ye.$$.fragment,t),$(Ze.$$.fragment,t),Ps=!1},d(t){o(d),t&&o(v),t&&o(u),L(a),t&&o(Hn),t&&o(ee),L(it),t&&o(Jn),t&&o(G),t&&o(Gn),t&&o(io),t&&o(Yn),t&&o(lo),t&&o(Zn),t&&o(te),L(dt),t&&o(Kn),t&&o(co),t&&o(Xn),L(ht,t),t&&o(Qn),t&&o(ho),t&&o(es),t&&o(S),t&&o(ts),t&&o($e),t&&o(os),t&&o(oe),L(_t),t&&o(ns),t&&o(z),L(Ct),L(we),L(Pt),t&&o(ss),t&&o(re),L(bt),t&&o(rs),t&&o(O),L(It),L(ke),t&&o(as),t&&o(ie),L($t),t&&o(is),t&&o(F),L(Lt),L(je),t&&o(ls),t&&o(ce),L(Tt),t&&o(cs),t&&o(U),L(xt),L(kt),t&&o(ds),t&&o(de),L(zt),t&&o(hs),t&&o(jt),L(Et),t&&o(ps),t&&o(he),L(Mt),t&&o(ms),t&&o(j),L(At),L(qt),L(Ft),t&&o(fs),t&&o(pe),L(Nt),t&&o(gs),t&&o(E),L(Dt),L(Rt),L(Ne),L(De),L(Bt),L(Ve),L(We),L(Ut),L(Re),L(Be),t&&o(us),t&&o(ue),L(Ht),t&&o(_s),t&&o(M),L(Jt),L(Xt),L(He),L(Je),t&&o(Cs),t&&o(Ce),L(Qt),t&&o(vs),t&&o(H),L(eo),L(no),L(Ye),L(Ze)}}}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(w){return Xc(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class bd extends Gc{constructor(d){super();Yc(this,d,fd,pd,Zc,{})}}export{bd as default,md as metadata};
