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,F,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,Sr,sn,Fr,rs,O,It,Nr,yt,Vr,Co,Dr,Wr,Rr,ae,Br,vo,Ur,Hr,Po,Jr,Gr,Yr,ke,as,ie,ze,rn,$t,Zr,an,Kr,is,S,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,Sa,Fa,Se,St,Na,Ft,Va,ko,Da,Wa,fs,pe,Fe,Cn,Nt,Ra,vn,Ba,gs,E,Vt,Ua,Dt,Ha,Wt,Ja,Ga,Ya,N,Rt,Za,me,Ka,zo,Xa,Qa,Pn,ei,ti,oi,Ne,ni,Ve,si,V,Bt,ri,fe,ai,jo,ii,li,bn,ci,di,hi,De,pi,We,mi,D,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,Si,Tn,Fi,Ni,xn,Vi,Di,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/v4.27.1/en/model_doc/chinese_clip#transformers.ChineseCLIPTextConfig">ChineseCLIPTextConfig</a>.`,name:"text_config"},{anchor:"transformers.ChineseCLIPConfig.vision_config",description:`<strong>vision_config</strong> (<code>dict</code>, <em>optional</em>) &#x2014;
Dictionary of configuration options used to initialize <a href="/docs/transformers/v4.27.1/en/model_doc/chinese_clip#transformers.ChineseCLIPVisionConfig">ChineseCLIPVisionConfig</a>.`,name:"vision_config"},{anchor:"transformers.ChineseCLIPConfig.projection_dim",description:`<strong>projection_dim</strong> (<code>int</code>, <em>optional</em>, defaults to 512) &#x2014;
Dimentionality of text and vision projection layers.`,name:"projection_dim"},{anchor:"transformers.ChineseCLIPConfig.logit_scale_init_value",description:`<strong>logit_scale_init_value</strong> (<code>float</code>, <em>optional</em>, defaults to 2.6592) &#x2014;
The inital value of the <em>logit_scale</em> paramter. Default is used as per the original ChineseCLIP
implementation.`,name:"logit_scale_init_value"},{anchor:"transformers.ChineseCLIPConfig.kwargs",description:`<strong>kwargs</strong> (<em>optional</em>) &#x2014;
Dictionary of keyword arguments.`,name:"kwargs"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/models/chinese_clip/configuration_chinese_clip.py#L265"}}),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/v4.27.1/src/transformers/models/chinese_clip/configuration_chinese_clip.py#L404"}}),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/v4.27.1/en/model_doc/chinese_clip#transformers.ChineseCLIPModel">ChineseCLIPModel</a>.`,name:"vocab_size"},{anchor:"transformers.ChineseCLIPTextConfig.hidden_size",description:`<strong>hidden_size</strong> (<code>int</code>, <em>optional</em>, defaults to 768) &#x2014;
Dimensionality of the encoder layers and the pooler layer.`,name:"hidden_size"},{anchor:"transformers.ChineseCLIPTextConfig.num_hidden_layers",description:`<strong>num_hidden_layers</strong> (<code>int</code>, <em>optional</em>, defaults to 12) &#x2014;
Number of hidden layers in the Transformer encoder.`,name:"num_hidden_layers"},{anchor:"transformers.ChineseCLIPTextConfig.num_attention_heads",description:`<strong>num_attention_heads</strong> (<code>int</code>, <em>optional</em>, defaults to 12) &#x2014;
Number of attention heads for each attention layer in the Transformer encoder.`,name:"num_attention_heads"},{anchor:"transformers.ChineseCLIPTextConfig.intermediate_size",description:`<strong>intermediate_size</strong> (<code>int</code>, <em>optional</em>, defaults to 3072) &#x2014;
Dimensionality of the &#x201C;intermediate&#x201D; (often named feed-forward) layer in the Transformer encoder.`,name:"intermediate_size"},{anchor:"transformers.ChineseCLIPTextConfig.hidden_act",description:`<strong>hidden_act</strong> (<code>str</code> or <code>Callable</code>, <em>optional</em>, defaults to <code>&quot;gelu&quot;</code>) &#x2014;
The non-linear activation function (function or string) in the encoder and pooler. If string, <code>&quot;gelu&quot;</code>,
<code>&quot;relu&quot;</code>, <code>&quot;silu&quot;</code> and <code>&quot;gelu_new&quot;</code> are supported.`,name:"hidden_act"},{anchor:"transformers.ChineseCLIPTextConfig.hidden_dropout_prob",description:`<strong>hidden_dropout_prob</strong> (<code>float</code>, <em>optional</em>, defaults to 0.1) &#x2014;
The dropout probability for all fully connected layers in the embeddings, encoder, and pooler.`,name:"hidden_dropout_prob"},{anchor:"transformers.ChineseCLIPTextConfig.attention_probs_dropout_prob",description:`<strong>attention_probs_dropout_prob</strong> (<code>float</code>, <em>optional</em>, defaults to 0.1) &#x2014;
The dropout ratio for the attention probabilities.`,name:"attention_probs_dropout_prob"},{anchor:"transformers.ChineseCLIPTextConfig.max_position_embeddings",description:`<strong>max_position_embeddings</strong> (<code>int</code>, <em>optional</em>, defaults to 512) &#x2014;
The maximum sequence length that this model might ever be used with. Typically set this to something large
just in case (e.g., 512 or 1024 or 2048).`,name:"max_position_embeddings"},{anchor:"transformers.ChineseCLIPTextConfig.type_vocab_size",description:`<strong>type_vocab_size</strong> (<code>int</code>, <em>optional</em>, defaults to 2) &#x2014;
The vocabulary size of the <code>token_type_ids</code> passed when calling <a href="/docs/transformers/v4.27.1/en/model_doc/chinese_clip#transformers.ChineseCLIPModel">ChineseCLIPModel</a>.`,name:"type_vocab_size"},{anchor:"transformers.ChineseCLIPTextConfig.initializer_range",description:`<strong>initializer_range</strong> (<code>float</code>, <em>optional</em>, defaults to 0.02) &#x2014;
The standard deviation of the truncated_normal_initializer for initializing all weight matrices.`,name:"initializer_range"},{anchor:"transformers.ChineseCLIPTextConfig.layer_norm_eps",description:`<strong>layer_norm_eps</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-12) &#x2014;
The epsilon used by the layer normalization layers.`,name:"layer_norm_eps"},{anchor:"transformers.ChineseCLIPTextConfig.position_embedding_type",description:`<strong>position_embedding_type</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;absolute&quot;</code>) &#x2014;
Type of position embedding. Choose one of <code>&quot;absolute&quot;</code>, <code>&quot;relative_key&quot;</code>, <code>&quot;relative_key_query&quot;</code>. For
positional embeddings use <code>&quot;absolute&quot;</code>. For more information on <code>&quot;relative_key&quot;</code>, please refer to
<a href="https://arxiv.org/abs/1803.02155" rel="nofollow">Self-Attention with Relative Position Representations (Shaw et al.)</a>.
For more information on <code>&quot;relative_key_query&quot;</code>, please refer to <em>Method 4</em> in <a href="https://arxiv.org/abs/2009.13658" rel="nofollow">Improve Transformer Models
with Better Relative Position Embeddings (Huang et al.)</a>.`,name:"position_embedding_type"},{anchor:"transformers.ChineseCLIPTextConfig.use_cache",description:`<strong>use_cache</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not the model should return the last key/values attentions (not used by all models). Only
relevant if <code>config.is_decoder=True</code>.`,name:"use_cache"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/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:"attention_dropout",val:" = 0.0"},{name:"initializer_range",val:" = 0.02"},{name:"initializer_factor",val:" = 1.0"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.ChineseCLIPVisionConfig.hidden_size",description:`<strong>hidden_size</strong> (<code>int</code>, <em>optional</em>, defaults to 768) &#x2014;
Dimensionality of the encoder layers and the pooler layer.`,name:"hidden_size"},{anchor:"transformers.ChineseCLIPVisionConfig.intermediate_size",description:`<strong>intermediate_size</strong> (<code>int</code>, <em>optional</em>, defaults to 3072) &#x2014;
Dimensionality of the &#x201C;intermediate&#x201D; (i.e., feed-forward) layer in the Transformer encoder.`,name:"intermediate_size"},{anchor:"transformers.ChineseCLIPVisionConfig.num_hidden_layers",description:`<strong>num_hidden_layers</strong> (<code>int</code>, <em>optional</em>, defaults to 12) &#x2014;
Number of hidden layers in the Transformer encoder.`,name:"num_hidden_layers"},{anchor:"transformers.ChineseCLIPVisionConfig.num_attention_heads",description:`<strong>num_attention_heads</strong> (<code>int</code>, <em>optional</em>, defaults to 12) &#x2014;
Number of attention heads for each attention layer in the Transformer encoder.`,name:"num_attention_heads"},{anchor:"transformers.ChineseCLIPVisionConfig.image_size",description:`<strong>image_size</strong> (<code>int</code>, <em>optional</em>, defaults to 224) &#x2014;
The size (resolution) of each image.`,name:"image_size"},{anchor:"transformers.ChineseCLIPVisionConfig.patch_size",description:`<strong>patch_size</strong> (<code>int</code>, <em>optional</em>, defaults to 32) &#x2014;
The size (resolution) of each patch.`,name:"patch_size"},{anchor:"transformers.ChineseCLIPVisionConfig.hidden_act",description:`<strong>hidden_act</strong> (<code>str</code> or <code>function</code>, <em>optional</em>, defaults to <code>&quot;quick_gelu&quot;</code>) &#x2014;
The non-linear activation function (function or string) in the encoder and pooler. If string, <code>&quot;gelu&quot;</code>,
<code>&quot;relu&quot;</code>, <code>&quot;selu&quot;</code> and <code>&quot;gelu_new&quot;</code> \`<code>&quot;quick_gelu&quot;</code> are supported.`,name:"hidden_act"},{anchor:"transformers.ChineseCLIPVisionConfig.layer_norm_eps",description:`<strong>layer_norm_eps</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-5) &#x2014;
The epsilon used by the layer normalization layers.`,name:"layer_norm_eps"},{anchor:"transformers.ChineseCLIPVisionConfig.attention_dropout",description:`<strong>attention_dropout</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
The dropout ratio for the attention probabilities.`,name:"attention_dropout"},{anchor:"transformers.ChineseCLIPVisionConfig.initializer_range",description:`<strong>initializer_range</strong> (<code>float</code>, <em>optional</em>, defaults to 0.02) &#x2014;
The standard deviation of the truncated_normal_initializer for initializing all weight matrices.`,name:"initializer_range"},{anchor:"transformers.ChineseCLIPVisionConfig.initializer_factor",description:`<strong>initializer_factor</strong> (\`float&#x201C;, <em>optional</em>, defaults to 1) &#x2014;
A factor for initializing all weight matrices (should be kept to 1, used internally for initialization
testing).`,name:"initializer_factor"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/models/chinese_clip/configuration_chinese_clip.py#L162"}}),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/v4.27.1/src/transformers/models/chinese_clip/image_processing_chinese_clip.py#L51"}}),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[str, transformers.utils.generic.TensorType, NoneType] = None"},{name:"data_format",val:": typing.Optional[transformers.image_utils.ChannelDimension] = <ChannelDimension.FIRST: 'channels_first'>"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.ChineseCLIPImageProcessor.preprocess.images",description:`<strong>images</strong> (<code>ImageInput</code>) &#x2014;
Image to preprocess.`,name:"images"},{anchor:"transformers.ChineseCLIPImageProcessor.preprocess.do_resize",description:`<strong>do_resize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>self.do_resize</code>) &#x2014;
Whether to resize the image.`,name:"do_resize"},{anchor:"transformers.ChineseCLIPImageProcessor.preprocess.size",description:`<strong>size</strong> (<code>Dict[str, int]</code>, <em>optional</em>, defaults to <code>self.size</code>) &#x2014;
Size of the image after resizing. Shortest edge of the image is resized to size[&#x201C;shortest_edge&#x201D;], with
the longest edge resized to keep the input aspect ratio.`,name:"size"},{anchor:"transformers.ChineseCLIPImageProcessor.preprocess.resample",description:`<strong>resample</strong> (<code>int</code>, <em>optional</em>, defaults to <code>self.resample</code>) &#x2014;
Resampling filter to use if resizing the image. This can be one of the enum <code>PILImageResampling</code>. Only
has an effect if <code>do_resize</code> is set to <code>True</code>.`,name:"resample"},{anchor:"transformers.ChineseCLIPImageProcessor.preprocess.do_center_crop",description:`<strong>do_center_crop</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>self.do_center_crop</code>) &#x2014;
Whether to center crop the image.`,name:"do_center_crop"},{anchor:"transformers.ChineseCLIPImageProcessor.preprocess.crop_size",description:`<strong>crop_size</strong> (<code>Dict[str, int]</code>, <em>optional</em>, defaults to <code>self.crop_size</code>) &#x2014;
Size of the center crop. Only has an effect if <code>do_center_crop</code> is set to <code>True</code>.`,name:"crop_size"},{anchor:"transformers.ChineseCLIPImageProcessor.preprocess.do_rescale",description:`<strong>do_rescale</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>self.do_rescale</code>) &#x2014;
Whether to rescale the image.`,name:"do_rescale"},{anchor:"transformers.ChineseCLIPImageProcessor.preprocess.rescale_factor",description:`<strong>rescale_factor</strong> (<code>float</code>, <em>optional</em>, defaults to <code>self.rescale_factor</code>) &#x2014;
Rescale factor to rescale the image by if <code>do_rescale</code> is set to <code>True</code>.`,name:"rescale_factor"},{anchor:"transformers.ChineseCLIPImageProcessor.preprocess.do_normalize",description:`<strong>do_normalize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>self.do_normalize</code>) &#x2014;
Whether to normalize the image.`,name:"do_normalize"},{anchor:"transformers.ChineseCLIPImageProcessor.preprocess.image_mean",description:`<strong>image_mean</strong> (<code>float</code> or <code>List[float]</code>, <em>optional</em>, defaults to <code>self.image_mean</code>) &#x2014;
Image mean to use for normalization. Only has an effect if <code>do_normalize</code> is set to <code>True</code>.`,name:"image_mean"},{anchor:"transformers.ChineseCLIPImageProcessor.preprocess.image_std",description:`<strong>image_std</strong> (<code>float</code> or <code>List[float]</code>, <em>optional</em>, defaults to <code>self.image_std</code>) &#x2014;
Image standard deviation to use for normalization. Only has an effect if <code>do_normalize</code> is set to
<code>True</code>.`,name:"image_std"},{anchor:"transformers.ChineseCLIPImageProcessor.preprocess.do_convert_rgb",description:`<strong>do_convert_rgb</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>self.do_convert_rgb</code>) &#x2014;
Whether to convert the image to RGB.`,name:"do_convert_rgb"},{anchor:"transformers.ChineseCLIPImageProcessor.preprocess.return_tensors",description:`<strong>return_tensors</strong> (<code>str</code> or <code>TensorType</code>, <em>optional</em>) &#x2014;
The type of tensors to return. Can be one of:<ul>
<li>Unset: Return a list of <code>np.ndarray</code>.</li>
<li><code>TensorType.TENSORFLOW</code> or <code>&apos;tf&apos;</code>: Return a batch of type <code>tf.Tensor</code>.</li>
<li><code>TensorType.PYTORCH</code> or <code>&apos;pt&apos;</code>: Return a batch of type <code>torch.Tensor</code>.</li>
<li><code>TensorType.NUMPY</code> or <code>&apos;np&apos;</code>: Return a batch of type <code>np.ndarray</code>.</li>
<li><code>TensorType.JAX</code> or <code>&apos;jax&apos;</code>: Return a batch of type <code>jax.numpy.ndarray</code>.</li>
</ul>`,name:"return_tensors"},{anchor:"transformers.ChineseCLIPImageProcessor.preprocess.data_format",description:`<strong>data_format</strong> (<code>ChannelDimension</code> or <code>str</code>, <em>optional</em>, defaults to <code>ChannelDimension.FIRST</code>) &#x2014;
The channel dimension format for the output image. Can be one of:<ul>
<li><code>ChannelDimension.FIRST</code>: image in (num_channels, height, width) format.</li>
<li><code>ChannelDimension.LAST</code>: image in (height, width, num_channels) format.</li>
<li>Unset: defaults to the channel dimension format of the input image.</li>
</ul>`,name:"data_format"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/models/chinese_clip/image_processing_chinese_clip.py#L217"}}),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/v4.27.1/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/v4.27.1/en/model_doc/chinese_clip#transformers.ChineseCLIPImageProcessor">ChineseCLIPImageProcessor</a>) &#x2014;
The image processor is a required input.`,name:"image_processor"},{anchor:"transformers.ChineseCLIPProcessor.tokenizer",description:`<strong>tokenizer</strong> (<a href="/docs/transformers/v4.27.1/en/model_doc/bert#transformers.BertTokenizerFast">BertTokenizerFast</a>) &#x2014;
The tokenizer is a required input.`,name:"tokenizer"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/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/v4.27.1/src/transformers/models/chinese_clip/processing_chinese_clip.py#L114"}}),St=new x({props:{name:"decode",anchor:"transformers.ChineseCLIPProcessor.decode",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/models/chinese_clip/processing_chinese_clip.py#L121"}}),Nt=new B({}),Vt=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/v4.27.1/en/model_doc/chinese_clip#transformers.ChineseCLIPConfig">ChineseCLIPConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/v4.27.1/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/models/chinese_clip/modeling_chinese_clip.py#L1348"}}),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/v4.27.1/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.27.1/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.27.1/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/v4.27.1/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <a href="/docs/transformers/v4.27.1/en/model_doc/videomae#transformers.VideoMAEFeatureExtractor.__call__">ChineseCLIPImageProcessor.<strong>call</strong>()</a> for details.`,name:"pixel_values"},{anchor:"transformers.ChineseCLIPModel.forward.return_loss",description:`<strong>return_loss</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the contrastive loss.`,name:"return_loss"},{anchor:"transformers.ChineseCLIPModel.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.ChineseCLIPModel.forward.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail.`,name:"output_hidden_states"},{anchor:"transformers.ChineseCLIPModel.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.27.1/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/models/chinese_clip/modeling_chinese_clip.py#L1483",returnDescription:`
<p>A <code>transformers.models.chinese_clip.modeling_chinese_clip.ChineseCLIPOutput</code> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<code>&lt;class 'transformers.models.chinese_clip.configuration_chinese_clip.ChineseCLIPConfig'&gt;</code>) and inputs.</p>
<ul>
<li><strong>loss</strong> (<code>torch.FloatTensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>return_loss</code> is <code>True</code>) \u2014 Contrastive loss for image-text similarity.</li>
<li><strong>logits_per_image:(<code>torch.FloatTensor</code></strong> of shape <code>(image_batch_size, text_batch_size)</code>) \u2014 The scaled dot product scores between <code>image_embeds</code> and <code>text_embeds</code>. This represents the image-text
similarity scores.</li>
<li><strong>logits_per_text:(<code>torch.FloatTensor</code></strong> of shape <code>(text_batch_size, image_batch_size)</code>) \u2014 The scaled dot product scores between <code>text_embeds</code> and <code>image_embeds</code>. This represents the text-image
similarity scores.</li>
<li><strong>text_embeds(<code>torch.FloatTensor</code></strong> of shape <code>(batch_size, output_dim</code>) \u2014 The text embeddings obtained by applying the projection layer to the pooled output of
<a
  href="/docs/transformers/v4.27.1/en/model_doc/chinese_clip#transformers.ChineseCLIPTextModel"
>ChineseCLIPTextModel</a>.</li>
<li><strong>image_embeds(<code>torch.FloatTensor</code></strong> of shape <code>(batch_size, output_dim</code>) \u2014 The image embeddings obtained by applying the projection layer to the pooled output of
<a
  href="/docs/transformers/v4.27.1/en/model_doc/chinese_clip#transformers.ChineseCLIPVisionModel"
>ChineseCLIPVisionModel</a>.</li>
<li><strong>text_model_output(<code>BaseModelOutputWithPoolingAndCrossAttentions</code>):</strong>
The output of the <a
  href="/docs/transformers/v4.27.1/en/model_doc/chinese_clip#transformers.ChineseCLIPTextModel"
>ChineseCLIPTextModel</a>.</li>
<li><strong>vision_model_output(<code>BaseModelOutputWithPoolingAndCrossAttentions</code>):</strong>
The output of the <a
  href="/docs/transformers/v4.27.1/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}}}),Ve=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/v4.27.1/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.27.1/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.27.1/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/v4.27.1/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/models/chinese_clip/modeling_chinese_clip.py#L1383",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>
`}}),De=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/v4.27.1/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <a href="/docs/transformers/v4.27.1/en/model_doc/videomae#transformers.VideoMAEFeatureExtractor.__call__">ChineseCLIPImageProcessor.<strong>call</strong>()</a> for details.`,name:"pixel_values"},{anchor:"transformers.ChineseCLIPModel.get_image_features.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.ChineseCLIPModel.get_image_features.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail.`,name:"output_hidden_states"},{anchor:"transformers.ChineseCLIPModel.get_image_features.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.27.1/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/models/chinese_clip/modeling_chinese_clip.py#L1433",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/v4.27.1/en/model_doc/chinese_clip#transformers.ChineseCLIPConfig">ChineseCLIPConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/v4.27.1/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/models/chinese_clip/modeling_chinese_clip.py#L1112"}}),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/v4.27.1/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.27.1/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.27.1/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/v4.27.1/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <a href="/docs/transformers/v4.27.1/en/model_doc/videomae#transformers.VideoMAEFeatureExtractor.__call__">ChineseCLIPImageProcessor.<strong>call</strong>()</a> for details.`,name:"pixel_values"},{anchor:"transformers.ChineseCLIPTextModel.forward.return_loss",description:`<strong>return_loss</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the contrastive loss.`,name:"return_loss"},{anchor:"transformers.ChineseCLIPTextModel.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.ChineseCLIPTextModel.forward.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail.`,name:"output_hidden_states"},{anchor:"transformers.ChineseCLIPTextModel.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.27.1/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.ChineseCLIPTextModel.forward.encoder_hidden_states",description:`<strong>encoder_hidden_states</strong>  (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Sequence of hidden-states at the output of the last layer of the encoder. Used in the cross-attention if
the model is configured as a decoder.`,name:"encoder_hidden_states"},{anchor:"transformers.ChineseCLIPTextModel.forward.encoder_attention_mask",description:`<strong>encoder_attention_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on the padding token indices of the encoder input. This mask is used in
the cross-attention if the model is configured as a decoder. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>`,name:"encoder_attention_mask"},{anchor:"transformers.ChineseCLIPTextModel.forward.past_key_values",description:`<strong>past_key_values</strong> (<code>tuple(tuple(torch.FloatTensor))</code> of length <code>config.n_layers</code> with each tuple having 4 tensors of shape <code>(batch_size, num_heads, sequence_length - 1, embed_size_per_head)</code>) &#x2014;
Contains precomputed key and value hidden states of the attention blocks. Can be used to speed up decoding.</p>
<p>If <code>past_key_values</code> are used, the user can optionally input only the last <code>decoder_input_ids</code> (those that
don&#x2019;t have their past key value states given to this model) of shape <code>(batch_size, 1)</code> instead of all
<code>decoder_input_ids</code> of shape <code>(batch_size, sequence_length)</code>.`,name:"past_key_values"},{anchor:"transformers.ChineseCLIPTextModel.forward.use_cache",description:`<strong>use_cache</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
If set to <code>True</code>, <code>past_key_values</code> key value states are returned and can be used to speed up decoding (see
<code>past_key_values</code>).`,name:"use_cache"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/models/chinese_clip/modeling_chinese_clip.py#L1153",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.27.1/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPoolingAndCrossAttentions"
>transformers.modeling_outputs.BaseModelOutputWithPoolingAndCrossAttentions</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/v4.27.1/en/model_doc/chinese_clip#transformers.ChineseCLIPConfig"
>ChineseCLIPConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>last_hidden_state</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>) \u2014 Sequence of hidden-states at the output of the last layer of the model.</p>
</li>
<li>
<p><strong>pooler_output</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, hidden_size)</code>) \u2014 Last layer hidden-state of the first token of the sequence (classification token) after further processing
through the layers used for the auxiliary pretraining task. E.g. for BERT-family of models, this returns
the classification token after processing through a linear layer and a tanh activation function. The linear
layer weights are trained from the next sentence prediction (classification) objective during pretraining.</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, +
one for the output of each layer) of shape <code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
<li>
<p><strong>cross_attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> and <code>config.add_cross_attention=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights of the decoder\u2019s cross-attention layer, after the attention softmax, used to compute the
weighted average in the cross-attention heads.</p>
</li>
<li>
<p><strong>past_key_values</strong> (<code>tuple(tuple(torch.FloatTensor))</code>, <em>optional</em>, returned when <code>use_cache=True</code> is passed or when <code>config.use_cache=True</code>) \u2014 Tuple of <code>tuple(torch.FloatTensor)</code> of length <code>config.n_layers</code>, with each tuple having 2 tensors of shape
<code>(batch_size, num_heads, sequence_length, embed_size_per_head)</code>) and optionally if
<code>config.is_encoder_decoder=True</code> 2 additional tensors of shape <code>(batch_size, num_heads, encoder_sequence_length, embed_size_per_head)</code>.</p>
<p>Contains pre-computed hidden-states (key and values in the self-attention blocks and optionally if
<code>config.is_encoder_decoder=True</code> in the cross-attention blocks) that can be used (see <code>past_key_values</code>
input) to speed up sequential decoding.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.27.1/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/v4.27.1/en/model_doc/chinese_clip#transformers.ChineseCLIPConfig">ChineseCLIPConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/v4.27.1/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/models/chinese_clip/modeling_chinese_clip.py#L1293"}}),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/v4.27.1/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <a href="/docs/transformers/v4.27.1/en/model_doc/videomae#transformers.VideoMAEFeatureExtractor.__call__">ChineseCLIPImageProcessor.<strong>call</strong>()</a> for details.`,name:"pixel_values"},{anchor:"transformers.ChineseCLIPVisionModel.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.ChineseCLIPVisionModel.forward.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail.`,name:"output_hidden_states"},{anchor:"transformers.ChineseCLIPVisionModel.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.27.1/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/models/chinese_clip/modeling_chinese_clip.py#L1306",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.27.1/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPooling"
>transformers.modeling_outputs.BaseModelOutputWithPooling</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<code>&lt;class 'transformers.models.chinese_clip.configuration_chinese_clip.ChineseCLIPVisionConfig'&gt;</code>) and inputs.</p>
<ul>
<li>
<p><strong>last_hidden_state</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>) \u2014 Sequence of hidden-states at the output of the last layer of the model.</p>
</li>
<li>
<p><strong>pooler_output</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, hidden_size)</code>) \u2014 Last layer hidden-state of the first token of the sequence (classification token) after further processing
through the layers used for the auxiliary pretraining task. E.g. for BERT-family of models, this returns
the classification token after processing through a linear layer and a tanh activation function. The linear
layer weights are trained from the next sentence prediction (classification) objective during pretraining.</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, +
one for the output of each layer) of shape <code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.27.1/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(),F=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),Sr=h(),sn=n("span"),Fr=i("ChineseCLIPTextConfig"),rs=h(),O=n("div"),P(It.$$.fragment),Nr=h(),yt=n("p"),Vr=i("This is the configuration class to store the configuration of a "),Co=n("a"),Dr=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(),S=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()"),Sa=i(`. Please
refer to the docstring of this method for more information.`),Fa=h(),Se=n("div"),P(St.$$.fragment),Na=h(),Ft=n("p"),Va=i("This method forwards all its arguments to BertTokenizerFast\u2019s "),ko=n("a"),Da=i("decode()"),Wa=i(`. Please refer to
the docstring of this method for more information.`),fs=h(),pe=n("h2"),Fe=n("a"),Cn=n("span"),P(Nt.$$.fragment),Ra=h(),vn=n("span"),Ba=i("ChineseCLIPModel"),gs=h(),E=n("div"),P(Vt.$$.fragment),Ua=h(),Dt=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(Ve.$$.fragment),si=h(),V=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(De.$$.fragment),pi=h(),P(We.$$.fragment),mi=h(),D=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"),Si=i(". To be used in a Seq2Seq model, the model needs to initialized with both "),Tn=n("code"),Fi=i("is_decoder"),Ni=i(` argument and
`),xn=n("code"),Vi=i("add_cross_attention"),Di=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 Sn=r(T);Bs=l(Sn,"Chinese-CLIP"),Sn.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 Fn=r(Ie);Ho=s(Fn,"SPAN",{});var Nn=r(Ho);b(it.$$.fragment,Nn),Nn.forEach(o),Fn.forEach(o),Us=p(ro),Jo=s(ro,"SPAN",{});var Vn=r(Jo);Hs=l(Vn,"Overview"),Vn.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 Dn=r(lt);Gs=l(Dn,"Chinese CLIP: Contrastive Vision-Language Pretraining in Chinese"),Dn.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),F=s(t,"UL",{});var Ke=r(F);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 Sl=r(fo);Lr=l(Sl,"PretrainedConfig"),Sl.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 Fl=r(go);Tr=l(Fl,"PretrainedConfig"),Fl.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 Vl=r(_o);qr=l(Vl,"ChineseCLIPConfig"),Vl.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 Dl=r(xe);nn=s(Dl,"SPAN",{});var Wl=r(nn);b(bt.$$.fragment,Wl),Wl.forEach(o),Dl.forEach(o),Sr=p(Ls),sn=s(Ls,"SPAN",{});var Rl=r(sn);Fr=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);Vr=l(ws,"This is the configuration class to store the configuration of a "),Co=s(ws,"A",{href:!0});var Bl=r(Co);Dr=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 So=r(ae);Br=l(So,"Configuration objects inherit from "),vo=s(So,"A",{href:!0});var Ul=r(vo);Ur=l(Ul,"PretrainedConfig"),Ul.forEach(o),Hr=l(So,` and can be used to control the model outputs. Read the
documentation from `),Po=s(So,"A",{href:!0});var Hl=r(Po);Jr=l(Hl,"PretrainedConfig"),Hl.forEach(o),Gr=l(So," for more information."),So.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),S=s(t,"DIV",{class:!0});var Qe=r(S);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 Fo=r(le);na=l(Fo,"Configuration objects inherit from "),Io=s(Fo,"A",{href:!0});var Kl=r(Io);sa=l(Kl,"PretrainedConfig"),Kl.forEach(o),ra=l(Fo,` and can be used to control the model outputs. Read the
documentation from `),yo=s(Fo,"A",{href:!0});var Xl=r(yo);aa=l(Xl,"PretrainedConfig"),Xl.forEach(o),ia=l(Fo," for more information."),Fo.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),Sa=l(As,`. Please
refer to the docstring of this method for more information.`),As.forEach(o),Ms.forEach(o),Fa=p(K),Se=s(K,"DIV",{class:!0});var qs=r(Se);b(St.$$.fragment,qs),Na=p(qs),Ft=s(qs,"P",{});var Os=r(Ft);Va=l(Os,"This method forwards all its arguments to BertTokenizerFast\u2019s "),ko=s(Os,"A",{href:!0});var Cc=r(ko);Da=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 Ss=r(pe);Fe=s(Ss,"A",{id:!0,class:!0,href:!0});var vc=r(Fe);Cn=s(vc,"SPAN",{});var Pc=r(Cn);b(Nt.$$.fragment,Pc),Pc.forEach(o),vc.forEach(o),Ra=p(Ss),vn=s(Ss,"SPAN",{});var bc=r(vn);Ba=l(bc,"ChineseCLIPModel"),bc.forEach(o),Ss.forEach(o),gs=p(t),E=s(t,"DIV",{class:!0});var X=r(E);b(Vt.$$.fragment,X),Ua=p(X),Dt=s(X,"P",{});var Fs=r(Dt);Ha=l(Fs,"This model is a PyTorch "),Wt=s(Fs,"A",{href:!0,rel:!0});var Ic=r(Wt);Ja=l(Ic,"torch.nn.Module"),Ic.forEach(o),Ga=l(Fs,` subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Fs.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 Vo=r(me);Ka=l(Vo,"The "),zo=s(Vo,"A",{href:!0});var yc=r(zo);Xa=l(yc,"ChineseCLIPModel"),yc.forEach(o),Qa=l(Vo," forward method, overrides the "),Pn=s(Vo,"CODE",{});var $c=r(Pn);ei=l($c,"__call__"),$c.forEach(o),ti=l(Vo," special method."),Vo.forEach(o),oi=p(et),b(Ne.$$.fragment,et),ni=p(et),b(Ve.$$.fragment,et),et.forEach(o),si=p(X),V=s(X,"DIV",{class:!0});var tt=r(V);b(Bt.$$.fragment,tt),ri=p(tt),fe=s(tt,"P",{});var Do=r(fe);ai=l(Do,"The "),jo=s(Do,"A",{href:!0});var Lc=r(jo);ii=l(Lc,"ChineseCLIPModel"),Lc.forEach(o),li=l(Do," forward method, overrides the "),bn=s(Do,"CODE",{});var wc=r(bn);ci=l(wc,"__call__"),wc.forEach(o),di=l(Do," special method."),Do.forEach(o),hi=p(tt),b(De.$$.fragment,tt),pi=p(tt),b(We.$$.fragment,tt),tt.forEach(o),mi=p(X),D=s(X,"DIV",{class:!0});var ot=r(D);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 Vs=r(Gt);Li=l(Vs,`The text model from CHINESE_CLIP without any head or projection on top.
This model is a PyTorch `),Yt=s(Vs,"A",{href:!0,rel:!0});var Ec=r(Yt);wi=l(Ec,"torch.nn.Module"),Ec.forEach(o),Ti=l(Vs,` subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Vs.forEach(o),xi=p(Q),Zt=s(Q,"P",{});var Ds=r(Zt);ki=l(Ds,`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(Ds,"A",{href:!0,rel:!0});var Mc=r(Kt);zi=l(Mc,`Attention is
all you need`),Mc.forEach(o),ji=l(Ds,` by Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit,
Llion Jones, Aidan N. Gomez, Lukasz Kaiser and Illia Polosukhin.`),Ds.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),Si=l(q,". To be used in a Seq2Seq model, the model needs to initialized with both "),Tn=s(q,"CODE",{});var Oc=r(Tn);Fi=l(Oc,"is_decoder"),Oc.forEach(o),Ni=l(q,` argument and
`),xn=s(q,"CODE",{});var Sc=r(xn);Vi=l(Sc,"add_cross_attention"),Sc.forEach(o),Di=l(q," set to "),kn=s(q,"CODE",{});var Fc=r(kn);Wi=l(Fc,"True"),Fc.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 Vc=r(Mo);Yi=l(Vc,"ChineseCLIPTextModel"),Vc.forEach(o),Zi=l(Ro," forward method, overrides the "),jn=s(Ro,"CODE",{});var Dc=r(jn);Ki=l(Dc,"__call__"),Dc.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/v4.27.1/en/model_doc/chinese_clip#transformers.ChineseCLIPConfig"),c(mo,"href","/docs/transformers/v4.27.1/en/model_doc/chinese_clip#transformers.ChineseCLIPModel"),c(vt,"href","https://huggingface.co/OFA-Sys/chinese-clip-vit-base-patch16"),c(vt,"rel","nofollow"),c(fo,"href","/docs/transformers/v4.27.1/en/main_classes/configuration#transformers.PretrainedConfig"),c(go,"href","/docs/transformers/v4.27.1/en/main_classes/configuration#transformers.PretrainedConfig"),c(uo,"href","/docs/transformers/v4.27.1/en/model_doc/chinese_clip#transformers.ChineseCLIPConfig"),c(_o,"href","/docs/transformers/v4.27.1/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/v4.27.1/en/model_doc/chinese_clip#transformers.ChineseCLIPModel"),c(vo,"href","/docs/transformers/v4.27.1/en/main_classes/configuration#transformers.PretrainedConfig"),c(Po,"href","/docs/transformers/v4.27.1/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/v4.27.1/en/model_doc/chinese_clip#transformers.ChineseCLIPModel"),c(Io,"href","/docs/transformers/v4.27.1/en/main_classes/configuration#transformers.PretrainedConfig"),c(yo,"href","/docs/transformers/v4.27.1/en/main_classes/configuration#transformers.PretrainedConfig"),c(S,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(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/v4.27.1/en/model_doc/chinese_clip#transformers.ChineseCLIPProcessor"),c(Lo,"href","/docs/transformers/v4.27.1/en/model_doc/chinese_clip#transformers.ChineseCLIPImageProcessor"),c(wo,"href","/docs/transformers/v4.27.1/en/model_doc/bert#transformers.BertTokenizerFast"),c(To,"href","/docs/transformers/v4.27.1/en/model_doc/chinese_clip#transformers.ChineseCLIPProcessor.decode"),c(xo,"href","/docs/transformers/v4.27.1/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/v4.27.1/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.decode"),c(Se,"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(Fe,"id","transformers.ChineseCLIPModel"),c(Fe,"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(Fe,"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/v4.27.1/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/v4.27.1/en/model_doc/chinese_clip#transformers.ChineseCLIPModel"),c(V,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(Eo,"href","/docs/transformers/v4.27.1/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(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/v4.27.1/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/v4.27.1/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,F,g),e(F,Ko),e(Ko,pt),e(pt,sr),e(F,rr),e(F,Xo),e(Xo,mt),e(mt,ar),e(F,ir),e(F,Qo),e(Qo,ft),e(ft,lr),e(F,cr),e(F,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,Sr),e(re,sn),e(sn,Fr),_(t,rs,g),_(t,O,g),I(It,O,null),e(O,Nr),e(O,yt),e(yt,Vr),e(yt,Co),e(Co,Dr),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,S,g),I(Lt,S,null),e(S,Xr),e(S,wt),e(wt,Qr),e(wt,bo),e(bo,ea),e(wt,ta),e(S,oa),e(S,le),e(le,na),e(le,Io),e(Io,sa),e(le,ra),e(le,yo),e(yo,aa),e(le,ia),e(S,la),I(je,S,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,Sa),e(j,Fa),e(j,Se),I(St,Se,null),e(Se,Na),e(Se,Ft),e(Ft,Va),e(Ft,ko),e(ko,Da),e(Ft,Wa),_(t,fs,g),_(t,pe,g),e(pe,Fe),e(Fe,Cn),I(Nt,Cn,null),e(pe,Ra),e(pe,vn),e(vn,Ba),_(t,gs,g),_(t,E,g),I(Vt,E,null),e(E,Ua),e(E,Dt),e(Dt,Ha),e(Dt,Wt),e(Wt,Ja),e(Dt,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(Ve,N,null),e(E,si),e(E,V),I(Bt,V,null),e(V,ri),e(V,fe),e(fe,ai),e(fe,jo),e(jo,ii),e(fe,li),e(fe,bn),e(bn,ci),e(fe,di),e(V,hi),I(De,V,null),e(V,pi),I(We,V,null),e(E,mi),e(E,D),I(Ut,D,null),e(D,fi),e(D,ge),e(ge,gi),e(ge,Eo),e(Eo,ui),e(ge,_i),e(ge,In),e(In,Ci),e(ge,vi),e(D,Pi),I(Re,D,null),e(D,bi),I(Be,D,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,Si),e(k,Tn),e(Tn,Fi),e(k,Ni),e(k,xn),e(xn,Vi),e(k,Di),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 Sn={};g&2&&(Sn.$$scope={dirty:g,ctx:t}),Ne.$set(Sn);const ro={};g&2&&(ro.$$scope={dirty:g,ctx:t}),Ve.$set(ro);const Fn={};g&2&&(Fn.$$scope={dirty:g,ctx:t}),De.$set(Fn);const Nn={};g&2&&(Nn.$$scope={dirty:g,ctx:t}),We.$set(Nn);const Vn={};g&2&&(Vn.$$scope={dirty:g,ctx:t}),Re.$set(Vn);const Pe={};g&2&&(Pe.$$scope={dirty:g,ctx:t}),Be.$set(Pe);const Dn={};g&2&&(Dn.$$scope={dirty:g,ctx:t}),He.$set(Dn);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(St.$$.fragment,t),y(Nt.$$.fragment,t),y(Vt.$$.fragment,t),y(Rt.$$.fragment,t),y(Ne.$$.fragment,t),y(Ve.$$.fragment,t),y(Bt.$$.fragment,t),y(De.$$.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),$(St.$$.fragment,t),$(Nt.$$.fragment,t),$(Vt.$$.fragment,t),$(Rt.$$.fragment,t),$(Ne.$$.fragment,t),$(Ve.$$.fragment,t),$(Bt.$$.fragment,t),$(De.$$.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(F),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(S),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(St),t&&o(fs),t&&o(pe),L(Nt),t&&o(gs),t&&o(E),L(Vt),L(Rt),L(Ne),L(Ve),L(Bt),L(De),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};
