import{S as Ji,i as Ki,s as Gi,e as a,k as c,w as T,t as s,M as Xi,c as r,d as t,m as p,a as i,x as b,h as n,b as l,G as e,g as _,y as E,q as w,o as j,B as $,v as Qi,L as xs}from"../../chunks/vendor-hf-doc-builder.js";import{T as Mr}from"../../chunks/Tip-hf-doc-builder.js";import{D as W}from"../../chunks/Docstring-hf-doc-builder.js";import{C as Ts}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as Tt}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as vs}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";function Yi(I){let m,x,f,h,v;return h=new Ts({props:{code:`from transformers import ViTConfig, BertConfig, VisionTextDualEncoderConfig, VisionTextDualEncoderModel

# Initializing a BERT and ViT configuration
config_vision = ViTConfig()
config_text = BertConfig()

config = VisionTextDualEncoderConfig.from_vision_text_configs(config_vision, config_text, projection_dim=512)

# Initializing a BERT and ViT model (with random weights)
model = VisionTextDualEncoderModel(config=config)

# Accessing the model configuration
config_vision = model.config.vision_config
config_text = model.config.text_config

# Saving the model, including its configuration
model.save_pretrained("vit-bert")

# loading model and config from pretrained folder
vision_text_config = VisionTextDualEncoderConfig.from_pretrained("vit-bert")
model = VisionTextDualEncoderModel.from_pretrained("vit-bert", config=vision_text_config)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> ViTConfig, BertConfig, VisionTextDualEncoderConfig, VisionTextDualEncoderModel

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a BERT and ViT configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>config_vision = ViTConfig()
<span class="hljs-meta">&gt;&gt;&gt; </span>config_text = BertConfig()

<span class="hljs-meta">&gt;&gt;&gt; </span>config = VisionTextDualEncoderConfig.from_vision_text_configs(config_vision, config_text, projection_dim=<span class="hljs-number">512</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a BERT and ViT model (with random weights)</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = VisionTextDualEncoderModel(config=config)

<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>config_vision = model.config.vision_config
<span class="hljs-meta">&gt;&gt;&gt; </span>config_text = model.config.text_config

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Saving the model, including its configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model.save_pretrained(<span class="hljs-string">&quot;vit-bert&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># loading model and config from pretrained folder</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>vision_text_config = VisionTextDualEncoderConfig.from_pretrained(<span class="hljs-string">&quot;vit-bert&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = VisionTextDualEncoderModel.from_pretrained(<span class="hljs-string">&quot;vit-bert&quot;</span>, config=vision_text_config)`}}),{c(){m=a("p"),x=s("Examples:"),f=c(),T(h.$$.fragment)},l(d){m=r(d,"P",{});var u=i(m);x=n(u,"Examples:"),u.forEach(t),f=p(d),b(h.$$.fragment,d)},m(d,u){_(d,m,u),e(m,x),_(d,f,u),E(h,d,u),v=!0},p:xs,i(d){v||(w(h.$$.fragment,d),v=!0)},o(d){j(h.$$.fragment,d),v=!1},d(d){d&&t(m),d&&t(f),$(h,d)}}}function el(I){let m,x,f,h,v;return{c(){m=a("p"),x=s("Although the recipe for forward pass needs to be defined within this function, one should call the "),f=a("code"),h=s("Module"),v=s(`
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(d){m=r(d,"P",{});var u=i(m);x=n(u,"Although the recipe for forward pass needs to be defined within this function, one should call the "),f=r(u,"CODE",{});var F=i(f);h=n(F,"Module"),F.forEach(t),v=n(u,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),u.forEach(t)},m(d,u){_(d,m,u),e(m,x),e(m,f),e(f,h),e(m,v)},d(d){d&&t(m)}}}function tl(I){let m,x,f,h,v;return h=new Ts({props:{code:`from PIL import Image
import requests
from transformers import (
    VisionTextDualEncoderModel,
    VisionTextDualEncoderProcessor,
    AutoImageProcessor,
    AutoTokenizer,
)

tokenizer = AutoTokenizer.from_pretrained("bert-base-uncased")
image_processor = AutoImageProcessor.from_pretrained("google/vit-base-patch16-224")
processor = VisionTextDualEncoderProcessor(image_processor, tokenizer)
model = VisionTextDualEncoderModel.from_vision_text_pretrained(
    "google/vit-base-patch16-224", "bert-base-uncased"
)

# contrastive training
urls = [
    "http://images.cocodataset.org/val2017/000000039769.jpg",
    "https://farm3.staticflickr.com/2674/5850229113_4fe05d5265_z.jpg",
]
images = [Image.open(requests.get(url, stream=True).raw) for url in urls]
inputs = processor(
    text=["a photo of a cat", "a photo of a dog"], images=images, return_tensors="pt", padding=True
)
outputs = model(
    input_ids=inputs.input_ids,
    attention_mask=inputs.attention_mask,
    pixel_values=inputs.pixel_values,
    return_loss=True,
)
loss, logits_per_image = outputs.loss, outputs.logits_per_image  # this is the image-text similarity score

# save and load from pretrained
model.save_pretrained("vit-bert")
model = VisionTextDualEncoderModel.from_pretrained("vit-bert")

# inference
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> (
<span class="hljs-meta">... </span>    VisionTextDualEncoderModel,
<span class="hljs-meta">... </span>    VisionTextDualEncoderProcessor,
<span class="hljs-meta">... </span>    AutoImageProcessor,
<span class="hljs-meta">... </span>    AutoTokenizer,
<span class="hljs-meta">... </span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;bert-base-uncased&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>image_processor = AutoImageProcessor.from_pretrained(<span class="hljs-string">&quot;google/vit-base-patch16-224&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>processor = VisionTextDualEncoderProcessor(image_processor, tokenizer)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = VisionTextDualEncoderModel.from_vision_text_pretrained(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;google/vit-base-patch16-224&quot;</span>, <span class="hljs-string">&quot;bert-base-uncased&quot;</span>
<span class="hljs-meta">... </span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># contrastive training</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>urls = [
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;http://images.cocodataset.org/val2017/000000039769.jpg&quot;</span>,
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;https://farm3.staticflickr.com/2674/5850229113_4fe05d5265_z.jpg&quot;</span>,
<span class="hljs-meta">... </span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>images = [Image.<span class="hljs-built_in">open</span>(requests.get(url, stream=<span class="hljs-literal">True</span>).raw) <span class="hljs-keyword">for</span> url <span class="hljs-keyword">in</span> urls]
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = processor(
<span class="hljs-meta">... </span>    text=[<span class="hljs-string">&quot;a photo of a cat&quot;</span>, <span class="hljs-string">&quot;a photo of a dog&quot;</span>], images=images, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>, padding=<span class="hljs-literal">True</span>
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(
<span class="hljs-meta">... </span>    input_ids=inputs.input_ids,
<span class="hljs-meta">... </span>    attention_mask=inputs.attention_mask,
<span class="hljs-meta">... </span>    pixel_values=inputs.pixel_values,
<span class="hljs-meta">... </span>    return_loss=<span class="hljs-literal">True</span>,
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>loss, logits_per_image = outputs.loss, outputs.logits_per_image  <span class="hljs-comment"># this is the image-text similarity score</span>

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># save and load from pretrained</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model.save_pretrained(<span class="hljs-string">&quot;vit-bert&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = VisionTextDualEncoderModel.from_pretrained(<span class="hljs-string">&quot;vit-bert&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># inference</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(){m=a("p"),x=s("Examples:"),f=c(),T(h.$$.fragment)},l(d){m=r(d,"P",{});var u=i(m);x=n(u,"Examples:"),u.forEach(t),f=p(d),b(h.$$.fragment,d)},m(d,u){_(d,m,u),e(m,x),_(d,f,u),E(h,d,u),v=!0},p:xs,i(d){v||(w(h.$$.fragment,d),v=!0)},o(d){j(h.$$.fragment,d),v=!1},d(d){d&&t(m),d&&t(f),$(h,d)}}}function ol(I){let m,x,f,h,v;return{c(){m=a("p"),x=s("Although the recipe for forward pass needs to be defined within this function, one should call the "),f=a("code"),h=s("Module"),v=s(`
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(d){m=r(d,"P",{});var u=i(m);x=n(u,"Although the recipe for forward pass needs to be defined within this function, one should call the "),f=r(u,"CODE",{});var F=i(f);h=n(F,"Module"),F.forEach(t),v=n(u,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),u.forEach(t)},m(d,u){_(d,m,u),e(m,x),e(m,f),e(f,h),e(m,v)},d(d){d&&t(m)}}}function sl(I){let m,x,f,h,v;return h=new Ts({props:{code:`from PIL import Image
import requests
import jax
from transformers import (
    FlaxVisionTextDualEncoderModel,
    VisionTextDualEncoderProcessor,
    AutoImageProcessor,
    AutoTokenizer,
)

tokenizer = AutoTokenizer.from_pretrained("bert-base-uncased")
image_processor = AutoImageProcesor.from_pretrained("google/vit-base-patch16-224")
processor = VisionTextDualEncoderProcessor(image_processor, tokenizer)
model = FlaxVisionTextDualEncoderModel.from_vision_text_pretrained(
    "google/vit-base-patch16-224", "bert-base-uncased"
)

# contrastive training
urls = [
    "http://images.cocodataset.org/val2017/000000039769.jpg",
    "https://farm3.staticflickr.com/2674/5850229113_4fe05d5265_z.jpg",
]
images = [Image.open(requests.get(url, stream=True).raw) for url in urls]
inputs = processor(
    text=["a photo of a cat", "a photo of a dog"], images=images, return_tensors="np", padding=True
)
outputs = model(
    input_ids=inputs.input_ids,
    attention_mask=inputs.attention_mask,
    pixel_values=inputs.pixel_values,
)
logits_per_image = outputs.logits_per_image  # this is the image-text similarity score

# save and load from pretrained
model.save_pretrained("vit-bert")
model = FlaxVisionTextDualEncoderModel.from_pretrained("vit-bert")

# inference
outputs = model(**inputs)
logits_per_image = outputs.logits_per_image  # this is the image-text similarity score
probs = jax.nn.softmax(logits_per_image, axis=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">import</span> jax
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> (
<span class="hljs-meta">... </span>    FlaxVisionTextDualEncoderModel,
<span class="hljs-meta">... </span>    VisionTextDualEncoderProcessor,
<span class="hljs-meta">... </span>    AutoImageProcessor,
<span class="hljs-meta">... </span>    AutoTokenizer,
<span class="hljs-meta">... </span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;bert-base-uncased&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>image_processor = AutoImageProcesor.from_pretrained(<span class="hljs-string">&quot;google/vit-base-patch16-224&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>processor = VisionTextDualEncoderProcessor(image_processor, tokenizer)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = FlaxVisionTextDualEncoderModel.from_vision_text_pretrained(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;google/vit-base-patch16-224&quot;</span>, <span class="hljs-string">&quot;bert-base-uncased&quot;</span>
<span class="hljs-meta">... </span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># contrastive training</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>urls = [
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;http://images.cocodataset.org/val2017/000000039769.jpg&quot;</span>,
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;https://farm3.staticflickr.com/2674/5850229113_4fe05d5265_z.jpg&quot;</span>,
<span class="hljs-meta">... </span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>images = [Image.<span class="hljs-built_in">open</span>(requests.get(url, stream=<span class="hljs-literal">True</span>).raw) <span class="hljs-keyword">for</span> url <span class="hljs-keyword">in</span> urls]
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = processor(
<span class="hljs-meta">... </span>    text=[<span class="hljs-string">&quot;a photo of a cat&quot;</span>, <span class="hljs-string">&quot;a photo of a dog&quot;</span>], images=images, return_tensors=<span class="hljs-string">&quot;np&quot;</span>, padding=<span class="hljs-literal">True</span>
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(
<span class="hljs-meta">... </span>    input_ids=inputs.input_ids,
<span class="hljs-meta">... </span>    attention_mask=inputs.attention_mask,
<span class="hljs-meta">... </span>    pixel_values=inputs.pixel_values,
<span class="hljs-meta">... </span>)
<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><span class="hljs-comment"># save and load from pretrained</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model.save_pretrained(<span class="hljs-string">&quot;vit-bert&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = FlaxVisionTextDualEncoderModel.from_pretrained(<span class="hljs-string">&quot;vit-bert&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># inference</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 = jax.nn.softmax(logits_per_image, axis=<span class="hljs-number">1</span>)  <span class="hljs-comment"># we can take the softmax to get the label probabilities</span>`}}),{c(){m=a("p"),x=s("Examples:"),f=c(),T(h.$$.fragment)},l(d){m=r(d,"P",{});var u=i(m);x=n(u,"Examples:"),u.forEach(t),f=p(d),b(h.$$.fragment,d)},m(d,u){_(d,m,u),e(m,x),_(d,f,u),E(h,d,u),v=!0},p:xs,i(d){v||(w(h.$$.fragment,d),v=!0)},o(d){j(h.$$.fragment,d),v=!1},d(d){d&&t(m),d&&t(f),$(h,d)}}}function nl(I){let m,x,f,h,v;return{c(){m=a("p"),x=s("Although the recipe for forward pass needs to be defined within this function, one should call the "),f=a("code"),h=s("Module"),v=s(`
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(d){m=r(d,"P",{});var u=i(m);x=n(u,"Although the recipe for forward pass needs to be defined within this function, one should call the "),f=r(u,"CODE",{});var F=i(f);h=n(F,"Module"),F.forEach(t),v=n(u,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),u.forEach(t)},m(d,u){_(d,m,u),e(m,x),e(m,f),e(f,h),e(m,v)},d(d){d&&t(m)}}}function al(I){let m,x,f,h,v;return h=new Ts({props:{code:`from PIL import Image
import requests
from transformers import (
    TFVisionTextDualEncoderModel,
    VisionTextDualEncoderProcessor,
    AutoImageProcessor,
    AutoTokenizer,
)

tokenizer = AutoTokenizer.from_pretrained("bert-base-uncased")
image_processor = AutoImageProcessor.from_pretrained("google/vit-base-patch16-224")
processor = VisionTextDualEncoderProcessor(image_processor, tokenizer)
model = TFVisionTextDualEncoderModel.from_vision_text_pretrained(
    "google/vit-base-patch16-224", "bert-base-uncased"
)

# contrastive training
urls = [
    "http://images.cocodataset.org/val2017/000000039769.jpg",
    "https://farm3.staticflickr.com/2674/5850229113_4fe05d5265_z.jpg",
]
images = [Image.open(requests.get(url, stream=True).raw) for url in urls]
inputs = processor(
    text=["a photo of a cat", "a photo of a dog"], images=images, return_tensors="np", padding=True
)
outputs = model(
    input_ids=inputs.input_ids,
    attention_mask=inputs.attention_mask,
    pixel_values=inputs.pixel_values,
    return_loss=True,
)
loss, logits_per_image = outputs.loss, outputs.logits_per_image  # this is the image-text similarity score

# save and load from pretrained
model.save_pretrained("vit-bert")
model = TFVisionTextDualEncoderModel.from_pretrained("vit-bert")

# inference
outputs = model(**inputs)
logits_per_image = outputs.logits_per_image  # this is the image-text similarity score
probs = tf.nn.softmax(logits_per_image, axis=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> (
<span class="hljs-meta">... </span>    TFVisionTextDualEncoderModel,
<span class="hljs-meta">... </span>    VisionTextDualEncoderProcessor,
<span class="hljs-meta">... </span>    AutoImageProcessor,
<span class="hljs-meta">... </span>    AutoTokenizer,
<span class="hljs-meta">... </span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;bert-base-uncased&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>image_processor = AutoImageProcessor.from_pretrained(<span class="hljs-string">&quot;google/vit-base-patch16-224&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>processor = VisionTextDualEncoderProcessor(image_processor, tokenizer)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFVisionTextDualEncoderModel.from_vision_text_pretrained(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;google/vit-base-patch16-224&quot;</span>, <span class="hljs-string">&quot;bert-base-uncased&quot;</span>
<span class="hljs-meta">... </span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># contrastive training</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>urls = [
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;http://images.cocodataset.org/val2017/000000039769.jpg&quot;</span>,
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;https://farm3.staticflickr.com/2674/5850229113_4fe05d5265_z.jpg&quot;</span>,
<span class="hljs-meta">... </span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>images = [Image.<span class="hljs-built_in">open</span>(requests.get(url, stream=<span class="hljs-literal">True</span>).raw) <span class="hljs-keyword">for</span> url <span class="hljs-keyword">in</span> urls]
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = processor(
<span class="hljs-meta">... </span>    text=[<span class="hljs-string">&quot;a photo of a cat&quot;</span>, <span class="hljs-string">&quot;a photo of a dog&quot;</span>], images=images, return_tensors=<span class="hljs-string">&quot;np&quot;</span>, padding=<span class="hljs-literal">True</span>
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(
<span class="hljs-meta">... </span>    input_ids=inputs.input_ids,
<span class="hljs-meta">... </span>    attention_mask=inputs.attention_mask,
<span class="hljs-meta">... </span>    pixel_values=inputs.pixel_values,
<span class="hljs-meta">... </span>    return_loss=<span class="hljs-literal">True</span>,
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>loss, logits_per_image = outputs.loss, outputs.logits_per_image  <span class="hljs-comment"># this is the image-text similarity score</span>

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># save and load from pretrained</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model.save_pretrained(<span class="hljs-string">&quot;vit-bert&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFVisionTextDualEncoderModel.from_pretrained(<span class="hljs-string">&quot;vit-bert&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># inference</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 = tf.nn.softmax(logits_per_image, axis=<span class="hljs-number">1</span>)  <span class="hljs-comment"># we can take the softmax to get the label probabilities</span>`}}),{c(){m=a("p"),x=s("Examples:"),f=c(),T(h.$$.fragment)},l(d){m=r(d,"P",{});var u=i(m);x=n(u,"Examples:"),u.forEach(t),f=p(d),b(h.$$.fragment,d)},m(d,u){_(d,m,u),e(m,x),_(d,f,u),E(h,d,u),v=!0},p:xs,i(d){v||(w(h.$$.fragment,d),v=!0)},o(d){j(h.$$.fragment,d),v=!1},d(d){d&&t(m),d&&t(f),$(h,d)}}}function rl(I){let m,x,f,h,v,d,u,F,bs,zo,J,ne,Yt,ye,Es,eo,ws,Io,k,js,bt,$s,ys,to,ks,Ds,Et,Vs,Ps,wt,Ms,zs,jt,Is,As,oo,Fs,Cs,$t,qs,Ls,yt,Os,Ss,Ao,ae,Ns,ke,Bs,Ws,Fo,K,re,so,De,Rs,no,Us,Co,z,Ve,Zs,Z,kt,Hs,Js,Dt,Ks,Gs,Vt,Xs,Qs,Ys,G,en,Pt,tn,on,Mt,sn,nn,an,ie,rn,le,Pe,ln,Me,dn,zt,cn,pn,mn,de,ze,hn,Ie,un,It,fn,gn,qo,X,ce,ao,Ae,_n,ro,vn,Lo,A,Fe,xn,io,Tn,bn,C,At,En,wn,Ft,jn,$n,Ct,yn,kn,lo,Dn,Vn,qt,Pn,Mn,zn,pe,Ce,In,qe,An,Lt,Fn,Cn,qn,me,Le,Ln,Oe,On,Ot,Sn,Nn,Oo,Q,he,co,Se,Bn,po,Wn,So,D,Ne,Rn,Be,Un,St,Zn,Hn,Jn,We,Kn,Re,Gn,Xn,Qn,mo,Yn,ea,Ue,ta,Nt,oa,sa,na,Ze,aa,He,ra,ia,la,O,Je,da,Y,ca,Bt,pa,ma,ho,ha,ua,fa,ue,ga,fe,No,ee,ge,uo,Ke,_a,fo,va,Bo,y,Ge,xa,Xe,Ta,Wt,ba,Ea,wa,Qe,ja,Ye,$a,ya,ka,go,Da,Va,et,Pa,Rt,Ma,za,Ia,tt,Aa,ot,Fa,Ca,qa,_o,La,Oa,R,vo,st,Sa,Na,xo,nt,Ba,Wa,To,at,Ra,Ua,bo,rt,Za,Ha,S,it,Ja,te,Ka,Ut,Ga,Xa,Eo,Qa,Ya,er,_e,tr,ve,Wo,oe,xe,wo,lt,or,jo,sr,Ro,V,dt,nr,ct,ar,Zt,rr,ir,lr,pt,dr,mt,cr,pr,mr,$o,hr,ur,ht,fr,Ht,gr,_r,vr,ut,xr,ft,Tr,br,Er,N,gt,wr,se,jr,Jt,$r,yr,yo,kr,Dr,Vr,Te,Pr,be,Uo;return d=new Tt({}),ye=new Tt({}),De=new Tt({}),Ve=new W({props:{name:"class transformers.VisionTextDualEncoderConfig",anchor:"transformers.VisionTextDualEncoderConfig",parameters:[{name:"projection_dim",val:" = 512"},{name:"logit_scale_init_value",val:" = 2.6592"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.VisionTextDualEncoderConfig.text_config",description:`<strong>text_config</strong> (<code>dict</code>) &#x2014;
Dictionary of configuration options that defines text model config.`,name:"text_config"},{anchor:"transformers.VisionTextDualEncoderConfig.vision_config",description:`<strong>vision_config</strong> (<code>dict</code>) &#x2014;
Dictionary of configuration options that defines vison model config.`,name:"vision_config"},{anchor:"transformers.VisionTextDualEncoderConfig.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.VisionTextDualEncoderConfig.logit_scale_init_value",description:`<strong>logit_scale_init_value</strong> (<code>float</code>, <em>optional</em>, defaults to 2.6592) &#x2014;
The inital value of the <em>logit_scale</em> paramter. Default is used as per the original CLIP implementation.`,name:"logit_scale_init_value"},{anchor:"transformers.VisionTextDualEncoderConfig.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/vision_text_dual_encoder/configuration_vision_text_dual_encoder.py#L28"}}),ie=new vs({props:{anchor:"transformers.VisionTextDualEncoderConfig.example",$$slots:{default:[Yi]},$$scope:{ctx:I}}}),Pe=new W({props:{name:"from_vision_text_configs",anchor:"transformers.VisionTextDualEncoderConfig.from_vision_text_configs",parameters:[{name:"vision_config",val:": PretrainedConfig"},{name:"text_config",val:": PretrainedConfig"},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/models/vision_text_dual_encoder/configuration_vision_text_dual_encoder.py#L105",returnDescription:`
<p>An instance of a configuration object</p>
`,returnType:`
<p><a
  href="/docs/transformers/v4.27.1/en/model_doc/vision-text-dual-encoder#transformers.VisionTextDualEncoderConfig"
>VisionTextDualEncoderConfig</a></p>
`}}),ze=new W({props:{name:"to_dict",anchor:"transformers.VisionTextDualEncoderConfig.to_dict",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/models/vision_text_dual_encoder/configuration_vision_text_dual_encoder.py#L117",returnDescription:`
<p>Dictionary of all the attributes that make up this configuration instance,</p>
`,returnType:`
<p><code>Dict[str, any]</code></p>
`}}),Ae=new Tt({}),Fe=new W({props:{name:"class transformers.VisionTextDualEncoderProcessor",anchor:"transformers.VisionTextDualEncoderProcessor",parameters:[{name:"image_processor",val:" = None"},{name:"tokenizer",val:" = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.VisionTextDualEncoderProcessor.image_processor",description:`<strong>image_processor</strong> (<a href="/docs/transformers/v4.27.1/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>) &#x2014;
The image processor is a required input.`,name:"image_processor"},{anchor:"transformers.VisionTextDualEncoderProcessor.tokenizer",description:`<strong>tokenizer</strong> (<a href="/docs/transformers/v4.27.1/en/main_classes/tokenizer#transformers.PreTrainedTokenizer">PreTrainedTokenizer</a>) &#x2014;
The tokenizer is a required input.`,name:"tokenizer"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/models/vision_text_dual_encoder/processing_vision_text_dual_encoder.py#L25"}}),Ce=new W({props:{name:"batch_decode",anchor:"transformers.VisionTextDualEncoderProcessor.batch_decode",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/models/vision_text_dual_encoder/processing_vision_text_dual_encoder.py#L115"}}),Le=new W({props:{name:"decode",anchor:"transformers.VisionTextDualEncoderProcessor.decode",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/models/vision_text_dual_encoder/processing_vision_text_dual_encoder.py#L122"}}),Se=new Tt({}),Ne=new W({props:{name:"class transformers.VisionTextDualEncoderModel",anchor:"transformers.VisionTextDualEncoderModel",parameters:[{name:"config",val:": typing.Optional[transformers.models.vision_text_dual_encoder.configuration_vision_text_dual_encoder.VisionTextDualEncoderConfig] = None"},{name:"vision_model",val:": typing.Optional[transformers.modeling_utils.PreTrainedModel] = None"},{name:"text_model",val:": typing.Optional[transformers.modeling_utils.PreTrainedModel] = None"}],parametersDescription:[{anchor:"transformers.VisionTextDualEncoderModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.27.1/en/model_doc/vision-encoder-decoder#transformers.VisionEncoderDecoderConfig">VisionEncoderDecoderConfig</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/vision_text_dual_encoder/modeling_vision_text_dual_encoder.py#L162"}}),Je=new W({props:{name:"forward",anchor:"transformers.VisionTextDualEncoderModel.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"pixel_values",val:": typing.Optional[torch.FloatTensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"position_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"return_loss",val:": typing.Optional[bool] = None"},{name:"token_type_ids",val:": typing.Optional[torch.LongTensor] = 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.VisionTextDualEncoderModel.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.VisionTextDualEncoderModel.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.VisionTextDualEncoderModel.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.VisionTextDualEncoderModel.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
an image processor (e.g. if you use ViT as the encoder, you should use <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__">ViTImageProcessor.<strong>call</strong>()</a> for details.`,name:"pixel_values"},{anchor:"transformers.VisionTextDualEncoderModel.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.VisionTextDualEncoderModel.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.VisionTextDualEncoderModel.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.VisionTextDualEncoderModel.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/vision_text_dual_encoder/modeling_vision_text_dual_encoder.py#L293",returnDescription:`
<p>A <code>transformers.models.clip.modeling_clip.CLIPOutput</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 (<a
  href="/docs/transformers/v4.27.1/en/model_doc/vision-text-dual-encoder#transformers.VisionTextDualEncoderConfig"
>VisionTextDualEncoderConfig</a>) 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/clip#transformers.CLIPTextModel"
>CLIPTextModel</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/clip#transformers.CLIPVisionModel"
>CLIPVisionModel</a>.</li>
<li><strong>text_model_output(<code>BaseModelOutputWithPooling</code>):</strong>
The output of the <a
  href="/docs/transformers/v4.27.1/en/model_doc/clip#transformers.CLIPTextModel"
>CLIPTextModel</a>.</li>
<li><strong>vision_model_output(<code>BaseModelOutputWithPooling</code>):</strong>
The output of the <a
  href="/docs/transformers/v4.27.1/en/model_doc/clip#transformers.CLIPVisionModel"
>CLIPVisionModel</a>.</li>
</ul>
`,returnType:`
<p><code>transformers.models.clip.modeling_clip.CLIPOutput</code> or <code>tuple(torch.FloatTensor)</code></p>
`}}),ue=new Mr({props:{$$slots:{default:[el]},$$scope:{ctx:I}}}),fe=new vs({props:{anchor:"transformers.VisionTextDualEncoderModel.forward.example",$$slots:{default:[tl]},$$scope:{ctx:I}}}),Ke=new Tt({}),Ge=new W({props:{name:"class transformers.FlaxVisionTextDualEncoderModel",anchor:"transformers.FlaxVisionTextDualEncoderModel",parameters:[{name:"config",val:": VisionTextDualEncoderConfig"},{name:"input_shape",val:": typing.Optional[typing.Tuple] = None"},{name:"seed",val:": int = 0"},{name:"dtype",val:": dtype = <class 'jax.numpy.float32'>"},{name:"_do_init",val:": bool = True"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.FlaxVisionTextDualEncoderModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.27.1/en/model_doc/vision-text-dual-encoder#transformers.VisionTextDualEncoderConfig">VisionTextDualEncoderConfig</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.FlaxPreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"},{anchor:"transformers.FlaxVisionTextDualEncoderModel.dtype",description:`<strong>dtype</strong> (<code>jax.numpy.dtype</code>, <em>optional</em>, defaults to <code>jax.numpy.float32</code>) &#x2014;
The data type of the computation. Can be one of <code>jax.numpy.float32</code>, <code>jax.numpy.float16</code> (on GPUs) and
<code>jax.numpy.bfloat16</code> (on TPUs).</p>
<p>This can be used to enable mixed-precision training or half-precision inference on GPUs or TPUs. If
specified all the computation will be performed with the given <code>dtype</code>.</p>
<p><strong>Note that this only specifies the dtype of the computation and does not influence the dtype of model
parameters.</strong></p>
<p>If you wish to change the dtype of the model parameters, see <a href="/docs/transformers/v4.27.1/en/main_classes/model#transformers.FlaxPreTrainedModel.to_fp16">to_fp16()</a> and
<a href="/docs/transformers/v4.27.1/en/main_classes/model#transformers.FlaxPreTrainedModel.to_bf16">to_bf16()</a>.`,name:"dtype"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/models/vision_text_dual_encoder/modeling_flax_vision_text_dual_encoder.py#L219"}}),it=new W({props:{name:"__call__",anchor:"transformers.FlaxVisionTextDualEncoderModel.__call__",parameters:[{name:"input_ids",val:""},{name:"pixel_values",val:""},{name:"attention_mask",val:" = None"},{name:"position_ids",val:" = None"},{name:"token_type_ids",val:" = None"},{name:"params",val:": dict = None"},{name:"dropout_rng",val:": PRNGKey = None"},{name:"train",val:": bool = False"},{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.FlaxVisionTextDualEncoderModel.__call__.input_ids",description:`<strong>input_ids</strong> (<code>numpy.ndarray</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.FlaxVisionTextDualEncoderModel.__call__.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.FlaxVisionTextDualEncoderModel.__call__.position_ids",description:`<strong>position_ids</strong> (<code>numpy.ndarray</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.FlaxVisionTextDualEncoderModel.__call__.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
an image processor (e.g. if you use ViT as the encoder, you should use <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__">ViTImageProcessor.<strong>call</strong>()</a> for details.`,name:"pixel_values"},{anchor:"transformers.FlaxVisionTextDualEncoderModel.__call__.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.FlaxVisionTextDualEncoderModel.__call__.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.FlaxVisionTextDualEncoderModel.__call__.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/vision_text_dual_encoder/modeling_flax_vision_text_dual_encoder.py#L269",returnDescription:`
<p>A <code>transformers.models.clip.modeling_flax_clip.FlaxCLIPOutput</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 (<a
  href="/docs/transformers/v4.27.1/en/model_doc/vision-text-dual-encoder#transformers.VisionTextDualEncoderConfig"
>VisionTextDualEncoderConfig</a>) and inputs.</p>
<ul>
<li><strong>logits_per_image:(<code>jnp.ndarray</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>jnp.ndarray</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>jnp.ndarray</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/clip#transformers.FlaxCLIPTextModel"
>FlaxCLIPTextModel</a>.</li>
<li><strong>image_embeds(<code>jnp.ndarray</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/clip#transformers.FlaxCLIPVisionModel"
>FlaxCLIPVisionModel</a>.</li>
<li><strong>text_model_output(<code>FlaxBaseModelOutputWithPooling</code>):</strong>
The output of the <a
  href="/docs/transformers/v4.27.1/en/model_doc/clip#transformers.FlaxCLIPTextModel"
>FlaxCLIPTextModel</a>.</li>
<li><strong>vision_model_output(<code>FlaxBaseModelOutputWithPooling</code>):</strong>
The output of the <a
  href="/docs/transformers/v4.27.1/en/model_doc/clip#transformers.FlaxCLIPVisionModel"
>FlaxCLIPVisionModel</a>.</li>
</ul>
`,returnType:`
<p><code>transformers.models.clip.modeling_flax_clip.FlaxCLIPOutput</code> or <code>tuple(torch.FloatTensor)</code></p>
`}}),_e=new Mr({props:{$$slots:{default:[ol]},$$scope:{ctx:I}}}),ve=new vs({props:{anchor:"transformers.FlaxVisionTextDualEncoderModel.__call__.example",$$slots:{default:[sl]},$$scope:{ctx:I}}}),lt=new Tt({}),dt=new W({props:{name:"class transformers.TFVisionTextDualEncoderModel",anchor:"transformers.TFVisionTextDualEncoderModel",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TFVisionTextDualEncoderModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.27.1/en/model_doc/vision-encoder-decoder#transformers.VisionEncoderDecoderConfig">VisionEncoderDecoderConfig</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.TFPreTrainedModel.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/vision_text_dual_encoder/modeling_tf_vision_text_dual_encoder.py#L174"}}),gt=new W({props:{name:"call",anchor:"transformers.TFVisionTextDualEncoderModel.call",parameters:[{name:"input_ids",val:": typing.Optional[tensorflow.python.framework.ops.Tensor] = None"},{name:"pixel_values",val:": typing.Optional[tensorflow.python.framework.ops.Tensor] = None"},{name:"attention_mask",val:": typing.Optional[tensorflow.python.framework.ops.Tensor] = None"},{name:"position_ids",val:": typing.Optional[tensorflow.python.framework.ops.Tensor] = None"},{name:"return_loss",val:": typing.Optional[bool] = None"},{name:"token_type_ids",val:": typing.Optional[tensorflow.python.framework.ops.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"},{name:"training",val:": bool = False"}],parametersDescription:[{anchor:"transformers.TFVisionTextDualEncoderModel.call.input_ids",description:`<strong>input_ids</strong> (<code>tf.Tensor</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.TFVisionTextDualEncoderModel.call.attention_mask",description:`<strong>attention_mask</strong> (<code>tf.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.TFVisionTextDualEncoderModel.call.position_ids",description:`<strong>position_ids</strong> (<code>tf.Tensor</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.TFVisionTextDualEncoderModel.call.pixel_values",description:`<strong>pixel_values</strong> (<code>tf.Tensor</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
an image processor (e.g. if you use ViT as the encoder, you should use <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__">ViTImageProcessor.<strong>call</strong>()</a> for details.`,name:"pixel_values"},{anchor:"transformers.TFVisionTextDualEncoderModel.call.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.TFVisionTextDualEncoderModel.call.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.TFVisionTextDualEncoderModel.call.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.TFVisionTextDualEncoderModel.call.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/vision_text_dual_encoder/modeling_tf_vision_text_dual_encoder.py#L338",returnDescription:`
<p>A <code>transformers.models.clip.modeling_tf_clip.TFCLIPOutput</code> or a tuple of <code>tf.Tensor</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/vision-text-dual-encoder#transformers.VisionTextDualEncoderConfig"
>VisionTextDualEncoderConfig</a>) and inputs.</p>
<ul>
<li><strong>loss</strong> (<code>tf.Tensor</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>tf.Tensor</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>tf.Tensor</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>tf.Tensor</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/clip#transformers.TFCLIPTextModel"
>TFCLIPTextModel</a>.</li>
<li><strong>image_embeds(<code>tf.Tensor</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/clip#transformers.TFCLIPVisionModel"
>TFCLIPVisionModel</a>.</li>
<li><strong>text_model_output(<code>~modeling_tf_utils.TFBaseModelOutputWithPooling</code>):</strong>
The output of the <a
  href="/docs/transformers/v4.27.1/en/model_doc/clip#transformers.TFCLIPTextModel"
>TFCLIPTextModel</a>.</li>
<li><strong>vision_model_output(<code>~modeling_tf_utils.TFBaseModelOutputWithPooling</code>):</strong>
The output of the <a
  href="/docs/transformers/v4.27.1/en/model_doc/clip#transformers.TFCLIPVisionModel"
>TFCLIPVisionModel</a>.</li>
</ul>
`,returnType:`
<p><code>transformers.models.clip.modeling_tf_clip.TFCLIPOutput</code> or <code>tuple(tf.Tensor)</code></p>
`}}),Te=new Mr({props:{$$slots:{default:[nl]},$$scope:{ctx:I}}}),be=new vs({props:{anchor:"transformers.TFVisionTextDualEncoderModel.call.example",$$slots:{default:[al]},$$scope:{ctx:I}}}),{c(){m=a("meta"),x=c(),f=a("h1"),h=a("a"),v=a("span"),T(d.$$.fragment),u=c(),F=a("span"),bs=s("VisionTextDualEncoder"),zo=c(),J=a("h2"),ne=a("a"),Yt=a("span"),T(ye.$$.fragment),Es=c(),eo=a("span"),ws=s("Overview"),Io=c(),k=a("p"),js=s("The "),bt=a("a"),$s=s("VisionTextDualEncoderModel"),ys=s(` can be used to initialize a vision-text dual encoder model with
any pretrained vision autoencoding model as the vision encoder (`),to=a("em"),ks=s("e.g."),Ds=c(),Et=a("a"),Vs=s("ViT"),Ps=s(", "),wt=a("a"),Ms=s("BEiT"),zs=s(", "),jt=a("a"),Is=s("DeiT"),As=s(") and any pretrained text autoencoding model as the text encoder ("),oo=a("em"),Fs=s("e.g."),Cs=c(),$t=a("a"),qs=s("RoBERTa"),Ls=s(", "),yt=a("a"),Os=s("BERT"),Ss=s(`). Two projection layers are added on top of both the vision and text encoder to project the output embeddings
to a shared latent space. The projection layers are randomly initialized so the model should be fine-tuned on a
downstream task. This model can be used to align the vision-text embeddings using CLIP like contrastive image-text
training and then can be used for zero-shot vision tasks such image-classification or retrieval.`),Ao=c(),ae=a("p"),Ns=s("In "),ke=a("a"),Bs=s("LiT: Zero-Shot Transfer with Locked-image Text Tuning"),Ws=s(` it is shown how
leveraging pre-trained (locked/frozen) image and text model for contrastive learning yields significant improvement on
new zero-shot vision tasks such as image classification or retrieval.`),Fo=c(),K=a("h2"),re=a("a"),so=a("span"),T(De.$$.fragment),Rs=c(),no=a("span"),Us=s("VisionTextDualEncoderConfig"),Co=c(),z=a("div"),T(Ve.$$.fragment),Zs=c(),Z=a("p"),kt=a("a"),Hs=s("VisionTextDualEncoderConfig"),Js=s(` is the configuration class to store the configuration of a
`),Dt=a("a"),Ks=s("VisionTextDualEncoderModel"),Gs=s(". It is used to instantiate "),Vt=a("a"),Xs=s("VisionTextDualEncoderModel"),Qs=s(` model according to the
specified arguments, defining the text model and vision model configs.`),Ys=c(),G=a("p"),en=s("Configuration objects inherit from "),Pt=a("a"),tn=s("PretrainedConfig"),on=s(` and can be used to control the model outputs. Read the
documentation from `),Mt=a("a"),sn=s("PretrainedConfig"),nn=s(" for more information."),an=c(),T(ie.$$.fragment),rn=c(),le=a("div"),T(Pe.$$.fragment),ln=c(),Me=a("p"),dn=s("Instantiate a "),zt=a("a"),cn=s("VisionTextDualEncoderConfig"),pn=s(` (or a derived class) from text model configuration and vision
model configuration.`),mn=c(),de=a("div"),T(ze.$$.fragment),hn=c(),Ie=a("p"),un=s("Serializes this instance to a Python dictionary. Override the default "),It=a("a"),fn=s("to_dict()"),gn=s("."),qo=c(),X=a("h2"),ce=a("a"),ao=a("span"),T(Ae.$$.fragment),_n=c(),ro=a("span"),vn=s("VisionTextDualEncoderProcessor"),Lo=c(),A=a("div"),T(Fe.$$.fragment),xn=c(),io=a("p"),Tn=s(`Constructs a VisionTextDualEncoder processor which wraps an image processor and a tokenizer into a single
processor.`),bn=c(),C=a("p"),At=a("a"),En=s("VisionTextDualEncoderProcessor"),wn=s(" offers all the functionalities of "),Ft=a("a"),jn=s("AutoImageProcessor"),$n=s(" and "),Ct=a("a"),yn=s("AutoTokenizer"),kn=s(`.
See the `),lo=a("code"),Dn=s("__call__()"),Vn=s(" and "),qt=a("a"),Pn=s("decode()"),Mn=s(` for more
information.`),zn=c(),pe=a("div"),T(Ce.$$.fragment),In=c(),qe=a("p"),An=s(`This method forwards all its arguments to VisionTextDualEncoderTokenizer\u2019s
`),Lt=a("a"),Fn=s("batch_decode()"),Cn=s(". Please refer to the docstring of this method for more information."),qn=c(),me=a("div"),T(Le.$$.fragment),Ln=c(),Oe=a("p"),On=s("This method forwards all its arguments to VisionTextDualEncoderTokenizer\u2019s "),Ot=a("a"),Sn=s("decode()"),Nn=s(`.
Please refer to the docstring of this method for more information.`),Oo=c(),Q=a("h2"),he=a("a"),co=a("span"),T(Se.$$.fragment),Bn=c(),po=a("span"),Wn=s("VisionTextDualEncoderModel"),So=c(),D=a("div"),T(Ne.$$.fragment),Rn=c(),Be=a("p"),Un=s(`This class can be used to initialize a vision-text dual encoder model with any pretrained vision autoencoding model
as the vision encoder and any pretrained text model as the text encoder. The vision and text encoders are loaded
via the `),St=a("a"),Zn=s("from_pretrained()"),Hn=s(` method. The projection layers are automatically added to the model and
should be fine-tuned on a downstream task, like contrastive image-text modeling.`),Jn=c(),We=a("p"),Kn=s("In "),Re=a("a"),Gn=s("LiT: Zero-Shot Transfer with Locked-image Text Tuning"),Xn=s(` it is shown how
leveraging pre-trained (locked/frozen) image and text model for contrastive learning yields significant improvment
on new zero-shot vision tasks such as image classification or retrieval.`),Qn=c(),mo=a("p"),Yn=s(`After such a Vision-Text-Dual-Encoder model has been trained/fine-tuned, it can be saved/loaded just like any other
models (see the examples for more information).`),ea=c(),Ue=a("p"),ta=s("This model inherits from "),Nt=a("a"),oa=s("PreTrainedModel"),sa=s(`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),na=c(),Ze=a("p"),aa=s("This model is also a PyTorch "),He=a("a"),ra=s("torch.nn.Module"),ia=s(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),la=c(),O=a("div"),T(Je.$$.fragment),da=c(),Y=a("p"),ca=s("The "),Bt=a("a"),pa=s("VisionTextDualEncoderModel"),ma=s(" forward method, overrides the "),ho=a("code"),ha=s("__call__"),ua=s(" special method."),fa=c(),T(ue.$$.fragment),ga=c(),T(fe.$$.fragment),No=c(),ee=a("h2"),ge=a("a"),uo=a("span"),T(Ke.$$.fragment),_a=c(),fo=a("span"),va=s("FlaxVisionTextDualEncoderModel"),Bo=c(),y=a("div"),T(Ge.$$.fragment),xa=c(),Xe=a("p"),Ta=s(`This class can be used to initialize a vision-text dual encoder model with any pretrained vision autoencoding model
as the vision encoder and any pretrained text model as the text encoder. The vision and text encoders are loaded
via the `),Wt=a("a"),ba=s("from_pretrained()"),Ea=s(` method. The projection layers are automatically added to the model and
should be fine-tuned on a downstream task, like contrastive image-text modeling.`),wa=c(),Qe=a("p"),ja=s("In "),Ye=a("a"),$a=s("LiT: Zero-Shot Transfer with Locked-image Text Tuning"),ya=s(` it is shown how
leveraging pre-trained (locked/frozen) image and text model for contrastive learning yields significant improvment
on new zero-shot vision tasks such as image classification or retrieval.`),ka=c(),go=a("p"),Da=s(`After such a Vision-Text-Dual-Encoder model has been trained/fine-tuned, it can be saved/loaded just like any other
models (see the examples for more information).`),Va=c(),et=a("p"),Pa=s("This model inherits from "),Rt=a("a"),Ma=s("PreTrainedModel"),za=s(`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),Ia=c(),tt=a("p"),Aa=s("This model is also a Flax Linen "),ot=a("a"),Fa=s("flax.linen.Module"),Ca=s(`
subclass. Use it as a regular Flax linen Module and refer to the Flax documentation for all matter related to
general usage and behavior.`),qa=c(),_o=a("p"),La=s("Finally, this model supports inherent JAX features such as:"),Oa=c(),R=a("ul"),vo=a("li"),st=a("a"),Sa=s("Just-In-Time (JIT) compilation"),Na=c(),xo=a("li"),nt=a("a"),Ba=s("Automatic Differentiation"),Wa=c(),To=a("li"),at=a("a"),Ra=s("Vectorization"),Ua=c(),bo=a("li"),rt=a("a"),Za=s("Parallelization"),Ha=c(),S=a("div"),T(it.$$.fragment),Ja=c(),te=a("p"),Ka=s("The "),Ut=a("a"),Ga=s("FlaxVisionTextDualEncoderModel"),Xa=s(" forward method, overrides the "),Eo=a("code"),Qa=s("__call__"),Ya=s(" special method."),er=c(),T(_e.$$.fragment),tr=c(),T(ve.$$.fragment),Wo=c(),oe=a("h2"),xe=a("a"),wo=a("span"),T(lt.$$.fragment),or=c(),jo=a("span"),sr=s("TFVisionTextDualEncoderModel"),Ro=c(),V=a("div"),T(dt.$$.fragment),nr=c(),ct=a("p"),ar=s(`This class can be used to initialize a vision-text dual encoder model with any pretrained vision autoencoding model
as the vision encoder and any pretrained text model as the text encoder. The vision and text encoders are loaded
via the `),Zt=a("a"),rr=s("from_pretrained()"),ir=s(` method. The projection layers are automatically added to the model and
should be fine-tuned on a downstream task, like contrastive image-text modeling.`),lr=c(),pt=a("p"),dr=s("In "),mt=a("a"),cr=s("LiT: Zero-Shot Transfer with Locked-image Text Tuning"),pr=s(` it is shown how
leveraging pre-trained (locked/frozen) image and text model for contrastive learning yields significant improvment
on new zero-shot vision tasks such as image classification or retrieval.`),mr=c(),$o=a("p"),hr=s(`After such a Vision-Text-Dual-Encoder model has been trained/fine-tuned, it can be saved/loaded just like any other
models (see the examples for more information).`),ur=c(),ht=a("p"),fr=s("This model inherits from "),Ht=a("a"),gr=s("TFPreTrainedModel"),_r=s(`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),vr=c(),ut=a("p"),xr=s("This model is also a Keras "),ft=a("a"),Tr=s("Model"),br=s(` subclass. Use it as a
regular Keras Model and refer to the TF documentation for all matter related to general usage and behavior.`),Er=c(),N=a("div"),T(gt.$$.fragment),wr=c(),se=a("p"),jr=s("The "),Jt=a("a"),$r=s("TFVisionTextDualEncoderModel"),yr=s(" forward method, overrides the "),yo=a("code"),kr=s("__call__"),Dr=s(" special method."),Vr=c(),T(Te.$$.fragment),Pr=c(),T(be.$$.fragment),this.h()},l(o){const g=Xi('[data-svelte="svelte-1phssyn"]',document.head);m=r(g,"META",{name:!0,content:!0}),g.forEach(t),x=p(o),f=r(o,"H1",{class:!0});var _t=i(f);h=r(_t,"A",{id:!0,class:!0,href:!0});var ko=i(h);v=r(ko,"SPAN",{});var Do=i(v);b(d.$$.fragment,Do),Do.forEach(t),ko.forEach(t),u=p(_t),F=r(_t,"SPAN",{});var Vo=i(F);bs=n(Vo,"VisionTextDualEncoder"),Vo.forEach(t),_t.forEach(t),zo=p(o),J=r(o,"H2",{class:!0});var vt=i(J);ne=r(vt,"A",{id:!0,class:!0,href:!0});var Po=i(ne);Yt=r(Po,"SPAN",{});var Mo=i(Yt);b(ye.$$.fragment,Mo),Mo.forEach(t),Po.forEach(t),Es=p(vt),eo=r(vt,"SPAN",{});var zr=i(eo);ws=n(zr,"Overview"),zr.forEach(t),vt.forEach(t),Io=p(o),k=r(o,"P",{});var P=i(k);js=n(P,"The "),bt=r(P,"A",{href:!0});var Ir=i(bt);$s=n(Ir,"VisionTextDualEncoderModel"),Ir.forEach(t),ys=n(P,` can be used to initialize a vision-text dual encoder model with
any pretrained vision autoencoding model as the vision encoder (`),to=r(P,"EM",{});var Ar=i(to);ks=n(Ar,"e.g."),Ar.forEach(t),Ds=p(P),Et=r(P,"A",{href:!0});var Fr=i(Et);Vs=n(Fr,"ViT"),Fr.forEach(t),Ps=n(P,", "),wt=r(P,"A",{href:!0});var Cr=i(wt);Ms=n(Cr,"BEiT"),Cr.forEach(t),zs=n(P,", "),jt=r(P,"A",{href:!0});var qr=i(jt);Is=n(qr,"DeiT"),qr.forEach(t),As=n(P,") and any pretrained text autoencoding model as the text encoder ("),oo=r(P,"EM",{});var Lr=i(oo);Fs=n(Lr,"e.g."),Lr.forEach(t),Cs=p(P),$t=r(P,"A",{href:!0});var Or=i($t);qs=n(Or,"RoBERTa"),Or.forEach(t),Ls=n(P,", "),yt=r(P,"A",{href:!0});var Sr=i(yt);Os=n(Sr,"BERT"),Sr.forEach(t),Ss=n(P,`). Two projection layers are added on top of both the vision and text encoder to project the output embeddings
to a shared latent space. The projection layers are randomly initialized so the model should be fine-tuned on a
downstream task. This model can be used to align the vision-text embeddings using CLIP like contrastive image-text
training and then can be used for zero-shot vision tasks such image-classification or retrieval.`),P.forEach(t),Ao=p(o),ae=r(o,"P",{});var Zo=i(ae);Ns=n(Zo,"In "),ke=r(Zo,"A",{href:!0,rel:!0});var Nr=i(ke);Bs=n(Nr,"LiT: Zero-Shot Transfer with Locked-image Text Tuning"),Nr.forEach(t),Ws=n(Zo,` it is shown how
leveraging pre-trained (locked/frozen) image and text model for contrastive learning yields significant improvement on
new zero-shot vision tasks such as image classification or retrieval.`),Zo.forEach(t),Fo=p(o),K=r(o,"H2",{class:!0});var Ho=i(K);re=r(Ho,"A",{id:!0,class:!0,href:!0});var Br=i(re);so=r(Br,"SPAN",{});var Wr=i(so);b(De.$$.fragment,Wr),Wr.forEach(t),Br.forEach(t),Rs=p(Ho),no=r(Ho,"SPAN",{});var Rr=i(no);Us=n(Rr,"VisionTextDualEncoderConfig"),Rr.forEach(t),Ho.forEach(t),Co=p(o),z=r(o,"DIV",{class:!0});var B=i(z);b(Ve.$$.fragment,B),Zs=p(B),Z=r(B,"P",{});var xt=i(Z);kt=r(xt,"A",{href:!0});var Ur=i(kt);Hs=n(Ur,"VisionTextDualEncoderConfig"),Ur.forEach(t),Js=n(xt,` is the configuration class to store the configuration of a
`),Dt=r(xt,"A",{href:!0});var Zr=i(Dt);Ks=n(Zr,"VisionTextDualEncoderModel"),Zr.forEach(t),Gs=n(xt,". It is used to instantiate "),Vt=r(xt,"A",{href:!0});var Hr=i(Vt);Xs=n(Hr,"VisionTextDualEncoderModel"),Hr.forEach(t),Qs=n(xt,` model according to the
specified arguments, defining the text model and vision model configs.`),xt.forEach(t),Ys=p(B),G=r(B,"P",{});var Kt=i(G);en=n(Kt,"Configuration objects inherit from "),Pt=r(Kt,"A",{href:!0});var Jr=i(Pt);tn=n(Jr,"PretrainedConfig"),Jr.forEach(t),on=n(Kt,` and can be used to control the model outputs. Read the
documentation from `),Mt=r(Kt,"A",{href:!0});var Kr=i(Mt);sn=n(Kr,"PretrainedConfig"),Kr.forEach(t),nn=n(Kt," for more information."),Kt.forEach(t),an=p(B),b(ie.$$.fragment,B),rn=p(B),le=r(B,"DIV",{class:!0});var Jo=i(le);b(Pe.$$.fragment,Jo),ln=p(Jo),Me=r(Jo,"P",{});var Ko=i(Me);dn=n(Ko,"Instantiate a "),zt=r(Ko,"A",{href:!0});var Gr=i(zt);cn=n(Gr,"VisionTextDualEncoderConfig"),Gr.forEach(t),pn=n(Ko,` (or a derived class) from text model configuration and vision
model configuration.`),Ko.forEach(t),Jo.forEach(t),mn=p(B),de=r(B,"DIV",{class:!0});var Go=i(de);b(ze.$$.fragment,Go),hn=p(Go),Ie=r(Go,"P",{});var Xo=i(Ie);un=n(Xo,"Serializes this instance to a Python dictionary. Override the default "),It=r(Xo,"A",{href:!0});var Xr=i(It);fn=n(Xr,"to_dict()"),Xr.forEach(t),gn=n(Xo,"."),Xo.forEach(t),Go.forEach(t),B.forEach(t),qo=p(o),X=r(o,"H2",{class:!0});var Qo=i(X);ce=r(Qo,"A",{id:!0,class:!0,href:!0});var Qr=i(ce);ao=r(Qr,"SPAN",{});var Yr=i(ao);b(Ae.$$.fragment,Yr),Yr.forEach(t),Qr.forEach(t),_n=p(Qo),ro=r(Qo,"SPAN",{});var ei=i(ro);vn=n(ei,"VisionTextDualEncoderProcessor"),ei.forEach(t),Qo.forEach(t),Lo=p(o),A=r(o,"DIV",{class:!0});var H=i(A);b(Fe.$$.fragment,H),xn=p(H),io=r(H,"P",{});var ti=i(io);Tn=n(ti,`Constructs a VisionTextDualEncoder processor which wraps an image processor and a tokenizer into a single
processor.`),ti.forEach(t),bn=p(H),C=r(H,"P",{});var U=i(C);At=r(U,"A",{href:!0});var oi=i(At);En=n(oi,"VisionTextDualEncoderProcessor"),oi.forEach(t),wn=n(U," offers all the functionalities of "),Ft=r(U,"A",{href:!0});var si=i(Ft);jn=n(si,"AutoImageProcessor"),si.forEach(t),$n=n(U," and "),Ct=r(U,"A",{href:!0});var ni=i(Ct);yn=n(ni,"AutoTokenizer"),ni.forEach(t),kn=n(U,`.
See the `),lo=r(U,"CODE",{});var ai=i(lo);Dn=n(ai,"__call__()"),ai.forEach(t),Vn=n(U," and "),qt=r(U,"A",{href:!0});var ri=i(qt);Pn=n(ri,"decode()"),ri.forEach(t),Mn=n(U,` for more
information.`),U.forEach(t),zn=p(H),pe=r(H,"DIV",{class:!0});var Yo=i(pe);b(Ce.$$.fragment,Yo),In=p(Yo),qe=r(Yo,"P",{});var es=i(qe);An=n(es,`This method forwards all its arguments to VisionTextDualEncoderTokenizer\u2019s
`),Lt=r(es,"A",{href:!0});var ii=i(Lt);Fn=n(ii,"batch_decode()"),ii.forEach(t),Cn=n(es,". Please refer to the docstring of this method for more information."),es.forEach(t),Yo.forEach(t),qn=p(H),me=r(H,"DIV",{class:!0});var ts=i(me);b(Le.$$.fragment,ts),Ln=p(ts),Oe=r(ts,"P",{});var os=i(Oe);On=n(os,"This method forwards all its arguments to VisionTextDualEncoderTokenizer\u2019s "),Ot=r(os,"A",{href:!0});var li=i(Ot);Sn=n(li,"decode()"),li.forEach(t),Nn=n(os,`.
Please refer to the docstring of this method for more information.`),os.forEach(t),ts.forEach(t),H.forEach(t),Oo=p(o),Q=r(o,"H2",{class:!0});var ss=i(Q);he=r(ss,"A",{id:!0,class:!0,href:!0});var di=i(he);co=r(di,"SPAN",{});var ci=i(co);b(Se.$$.fragment,ci),ci.forEach(t),di.forEach(t),Bn=p(ss),po=r(ss,"SPAN",{});var pi=i(po);Wn=n(pi,"VisionTextDualEncoderModel"),pi.forEach(t),ss.forEach(t),So=p(o),D=r(o,"DIV",{class:!0});var q=i(D);b(Ne.$$.fragment,q),Rn=p(q),Be=r(q,"P",{});var ns=i(Be);Un=n(ns,`This class can be used to initialize a vision-text dual encoder model with any pretrained vision autoencoding model
as the vision encoder and any pretrained text model as the text encoder. The vision and text encoders are loaded
via the `),St=r(ns,"A",{href:!0});var mi=i(St);Zn=n(mi,"from_pretrained()"),mi.forEach(t),Hn=n(ns,` method. The projection layers are automatically added to the model and
should be fine-tuned on a downstream task, like contrastive image-text modeling.`),ns.forEach(t),Jn=p(q),We=r(q,"P",{});var as=i(We);Kn=n(as,"In "),Re=r(as,"A",{href:!0,rel:!0});var hi=i(Re);Gn=n(hi,"LiT: Zero-Shot Transfer with Locked-image Text Tuning"),hi.forEach(t),Xn=n(as,` it is shown how
leveraging pre-trained (locked/frozen) image and text model for contrastive learning yields significant improvment
on new zero-shot vision tasks such as image classification or retrieval.`),as.forEach(t),Qn=p(q),mo=r(q,"P",{});var ui=i(mo);Yn=n(ui,`After such a Vision-Text-Dual-Encoder model has been trained/fine-tuned, it can be saved/loaded just like any other
models (see the examples for more information).`),ui.forEach(t),ea=p(q),Ue=r(q,"P",{});var rs=i(Ue);ta=n(rs,"This model inherits from "),Nt=r(rs,"A",{href:!0});var fi=i(Nt);oa=n(fi,"PreTrainedModel"),fi.forEach(t),sa=n(rs,`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),rs.forEach(t),na=p(q),Ze=r(q,"P",{});var is=i(Ze);aa=n(is,"This model is also a PyTorch "),He=r(is,"A",{href:!0,rel:!0});var gi=i(He);ra=n(gi,"torch.nn.Module"),gi.forEach(t),ia=n(is,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),is.forEach(t),la=p(q),O=r(q,"DIV",{class:!0});var Ee=i(O);b(Je.$$.fragment,Ee),da=p(Ee),Y=r(Ee,"P",{});var Gt=i(Y);ca=n(Gt,"The "),Bt=r(Gt,"A",{href:!0});var _i=i(Bt);pa=n(_i,"VisionTextDualEncoderModel"),_i.forEach(t),ma=n(Gt," forward method, overrides the "),ho=r(Gt,"CODE",{});var vi=i(ho);ha=n(vi,"__call__"),vi.forEach(t),ua=n(Gt," special method."),Gt.forEach(t),fa=p(Ee),b(ue.$$.fragment,Ee),ga=p(Ee),b(fe.$$.fragment,Ee),Ee.forEach(t),q.forEach(t),No=p(o),ee=r(o,"H2",{class:!0});var ls=i(ee);ge=r(ls,"A",{id:!0,class:!0,href:!0});var xi=i(ge);uo=r(xi,"SPAN",{});var Ti=i(uo);b(Ke.$$.fragment,Ti),Ti.forEach(t),xi.forEach(t),_a=p(ls),fo=r(ls,"SPAN",{});var bi=i(fo);va=n(bi,"FlaxVisionTextDualEncoderModel"),bi.forEach(t),ls.forEach(t),Bo=p(o),y=r(o,"DIV",{class:!0});var M=i(y);b(Ge.$$.fragment,M),xa=p(M),Xe=r(M,"P",{});var ds=i(Xe);Ta=n(ds,`This class can be used to initialize a vision-text dual encoder model with any pretrained vision autoencoding model
as the vision encoder and any pretrained text model as the text encoder. The vision and text encoders are loaded
via the `),Wt=r(ds,"A",{href:!0});var Ei=i(Wt);ba=n(Ei,"from_pretrained()"),Ei.forEach(t),Ea=n(ds,` method. The projection layers are automatically added to the model and
should be fine-tuned on a downstream task, like contrastive image-text modeling.`),ds.forEach(t),wa=p(M),Qe=r(M,"P",{});var cs=i(Qe);ja=n(cs,"In "),Ye=r(cs,"A",{href:!0,rel:!0});var wi=i(Ye);$a=n(wi,"LiT: Zero-Shot Transfer with Locked-image Text Tuning"),wi.forEach(t),ya=n(cs,` it is shown how
leveraging pre-trained (locked/frozen) image and text model for contrastive learning yields significant improvment
on new zero-shot vision tasks such as image classification or retrieval.`),cs.forEach(t),ka=p(M),go=r(M,"P",{});var ji=i(go);Da=n(ji,`After such a Vision-Text-Dual-Encoder model has been trained/fine-tuned, it can be saved/loaded just like any other
models (see the examples for more information).`),ji.forEach(t),Va=p(M),et=r(M,"P",{});var ps=i(et);Pa=n(ps,"This model inherits from "),Rt=r(ps,"A",{href:!0});var $i=i(Rt);Ma=n($i,"PreTrainedModel"),$i.forEach(t),za=n(ps,`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),ps.forEach(t),Ia=p(M),tt=r(M,"P",{});var ms=i(tt);Aa=n(ms,"This model is also a Flax Linen "),ot=r(ms,"A",{href:!0,rel:!0});var yi=i(ot);Fa=n(yi,"flax.linen.Module"),yi.forEach(t),Ca=n(ms,`
subclass. Use it as a regular Flax linen Module and refer to the Flax documentation for all matter related to
general usage and behavior.`),ms.forEach(t),qa=p(M),_o=r(M,"P",{});var ki=i(_o);La=n(ki,"Finally, this model supports inherent JAX features such as:"),ki.forEach(t),Oa=p(M),R=r(M,"UL",{});var we=i(R);vo=r(we,"LI",{});var Di=i(vo);st=r(Di,"A",{href:!0,rel:!0});var Vi=i(st);Sa=n(Vi,"Just-In-Time (JIT) compilation"),Vi.forEach(t),Di.forEach(t),Na=p(we),xo=r(we,"LI",{});var Pi=i(xo);nt=r(Pi,"A",{href:!0,rel:!0});var Mi=i(nt);Ba=n(Mi,"Automatic Differentiation"),Mi.forEach(t),Pi.forEach(t),Wa=p(we),To=r(we,"LI",{});var zi=i(To);at=r(zi,"A",{href:!0,rel:!0});var Ii=i(at);Ra=n(Ii,"Vectorization"),Ii.forEach(t),zi.forEach(t),Ua=p(we),bo=r(we,"LI",{});var Ai=i(bo);rt=r(Ai,"A",{href:!0,rel:!0});var Fi=i(rt);Za=n(Fi,"Parallelization"),Fi.forEach(t),Ai.forEach(t),we.forEach(t),Ha=p(M),S=r(M,"DIV",{class:!0});var je=i(S);b(it.$$.fragment,je),Ja=p(je),te=r(je,"P",{});var Xt=i(te);Ka=n(Xt,"The "),Ut=r(Xt,"A",{href:!0});var Ci=i(Ut);Ga=n(Ci,"FlaxVisionTextDualEncoderModel"),Ci.forEach(t),Xa=n(Xt," forward method, overrides the "),Eo=r(Xt,"CODE",{});var qi=i(Eo);Qa=n(qi,"__call__"),qi.forEach(t),Ya=n(Xt," special method."),Xt.forEach(t),er=p(je),b(_e.$$.fragment,je),tr=p(je),b(ve.$$.fragment,je),je.forEach(t),M.forEach(t),Wo=p(o),oe=r(o,"H2",{class:!0});var hs=i(oe);xe=r(hs,"A",{id:!0,class:!0,href:!0});var Li=i(xe);wo=r(Li,"SPAN",{});var Oi=i(wo);b(lt.$$.fragment,Oi),Oi.forEach(t),Li.forEach(t),or=p(hs),jo=r(hs,"SPAN",{});var Si=i(jo);sr=n(Si,"TFVisionTextDualEncoderModel"),Si.forEach(t),hs.forEach(t),Ro=p(o),V=r(o,"DIV",{class:!0});var L=i(V);b(dt.$$.fragment,L),nr=p(L),ct=r(L,"P",{});var us=i(ct);ar=n(us,`This class can be used to initialize a vision-text dual encoder model with any pretrained vision autoencoding model
as the vision encoder and any pretrained text model as the text encoder. The vision and text encoders are loaded
via the `),Zt=r(us,"A",{href:!0});var Ni=i(Zt);rr=n(Ni,"from_pretrained()"),Ni.forEach(t),ir=n(us,` method. The projection layers are automatically added to the model and
should be fine-tuned on a downstream task, like contrastive image-text modeling.`),us.forEach(t),lr=p(L),pt=r(L,"P",{});var fs=i(pt);dr=n(fs,"In "),mt=r(fs,"A",{href:!0,rel:!0});var Bi=i(mt);cr=n(Bi,"LiT: Zero-Shot Transfer with Locked-image Text Tuning"),Bi.forEach(t),pr=n(fs,` it is shown how
leveraging pre-trained (locked/frozen) image and text model for contrastive learning yields significant improvment
on new zero-shot vision tasks such as image classification or retrieval.`),fs.forEach(t),mr=p(L),$o=r(L,"P",{});var Wi=i($o);hr=n(Wi,`After such a Vision-Text-Dual-Encoder model has been trained/fine-tuned, it can be saved/loaded just like any other
models (see the examples for more information).`),Wi.forEach(t),ur=p(L),ht=r(L,"P",{});var gs=i(ht);fr=n(gs,"This model inherits from "),Ht=r(gs,"A",{href:!0});var Ri=i(Ht);gr=n(Ri,"TFPreTrainedModel"),Ri.forEach(t),_r=n(gs,`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),gs.forEach(t),vr=p(L),ut=r(L,"P",{});var _s=i(ut);xr=n(_s,"This model is also a Keras "),ft=r(_s,"A",{href:!0,rel:!0});var Ui=i(ft);Tr=n(Ui,"Model"),Ui.forEach(t),br=n(_s,` subclass. Use it as a
regular Keras Model and refer to the TF documentation for all matter related to general usage and behavior.`),_s.forEach(t),Er=p(L),N=r(L,"DIV",{class:!0});var $e=i(N);b(gt.$$.fragment,$e),wr=p($e),se=r($e,"P",{});var Qt=i(se);jr=n(Qt,"The "),Jt=r(Qt,"A",{href:!0});var Zi=i(Jt);$r=n(Zi,"TFVisionTextDualEncoderModel"),Zi.forEach(t),yr=n(Qt," forward method, overrides the "),yo=r(Qt,"CODE",{});var Hi=i(yo);kr=n(Hi,"__call__"),Hi.forEach(t),Dr=n(Qt," special method."),Qt.forEach(t),Vr=p($e),b(Te.$$.fragment,$e),Pr=p($e),b(be.$$.fragment,$e),$e.forEach(t),L.forEach(t),this.h()},h(){l(m,"name","hf:doc:metadata"),l(m,"content",JSON.stringify(il)),l(h,"id","visiontextdualencoder"),l(h,"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"),l(h,"href","#visiontextdualencoder"),l(f,"class","relative group"),l(ne,"id","overview"),l(ne,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),l(ne,"href","#overview"),l(J,"class","relative group"),l(bt,"href","/docs/transformers/v4.27.1/en/model_doc/vision-text-dual-encoder#transformers.VisionTextDualEncoderModel"),l(Et,"href","vit"),l(wt,"href","beit"),l(jt,"href","deit"),l($t,"href","roberta"),l(yt,"href","bert"),l(ke,"href","https://arxiv.org/abs/2111.07991"),l(ke,"rel","nofollow"),l(re,"id","transformers.VisionTextDualEncoderConfig"),l(re,"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"),l(re,"href","#transformers.VisionTextDualEncoderConfig"),l(K,"class","relative group"),l(kt,"href","/docs/transformers/v4.27.1/en/model_doc/vision-text-dual-encoder#transformers.VisionTextDualEncoderConfig"),l(Dt,"href","/docs/transformers/v4.27.1/en/model_doc/vision-text-dual-encoder#transformers.VisionTextDualEncoderModel"),l(Vt,"href","/docs/transformers/v4.27.1/en/model_doc/vision-text-dual-encoder#transformers.VisionTextDualEncoderModel"),l(Pt,"href","/docs/transformers/v4.27.1/en/main_classes/configuration#transformers.PretrainedConfig"),l(Mt,"href","/docs/transformers/v4.27.1/en/main_classes/configuration#transformers.PretrainedConfig"),l(zt,"href","/docs/transformers/v4.27.1/en/model_doc/vision-text-dual-encoder#transformers.VisionTextDualEncoderConfig"),l(le,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(It,"href","/docs/transformers/v4.27.1/en/main_classes/configuration#transformers.PretrainedConfig.to_dict"),l(de,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(ce,"id","transformers.VisionTextDualEncoderProcessor"),l(ce,"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"),l(ce,"href","#transformers.VisionTextDualEncoderProcessor"),l(X,"class","relative group"),l(At,"href","/docs/transformers/v4.27.1/en/model_doc/vision-text-dual-encoder#transformers.VisionTextDualEncoderProcessor"),l(Ft,"href","/docs/transformers/v4.27.1/en/model_doc/auto#transformers.AutoImageProcessor"),l(Ct,"href","/docs/transformers/v4.27.1/en/model_doc/auto#transformers.AutoTokenizer"),l(qt,"href","/docs/transformers/v4.27.1/en/model_doc/vision-text-dual-encoder#transformers.VisionTextDualEncoderProcessor.decode"),l(Lt,"href","/docs/transformers/v4.27.1/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.batch_decode"),l(pe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(Ot,"href","/docs/transformers/v4.27.1/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.decode"),l(me,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(A,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(he,"id","transformers.VisionTextDualEncoderModel"),l(he,"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"),l(he,"href","#transformers.VisionTextDualEncoderModel"),l(Q,"class","relative group"),l(St,"href","/docs/transformers/v4.27.1/en/model_doc/auto#transformers.FlaxAutoModelForVision2Seq.from_pretrained"),l(Re,"href","https://arxiv.org/abs/2111.07991"),l(Re,"rel","nofollow"),l(Nt,"href","/docs/transformers/v4.27.1/en/main_classes/model#transformers.PreTrainedModel"),l(He,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),l(He,"rel","nofollow"),l(Bt,"href","/docs/transformers/v4.27.1/en/model_doc/vision-text-dual-encoder#transformers.VisionTextDualEncoderModel"),l(O,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(D,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(ge,"id","transformers.FlaxVisionTextDualEncoderModel"),l(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"),l(ge,"href","#transformers.FlaxVisionTextDualEncoderModel"),l(ee,"class","relative group"),l(Wt,"href","/docs/transformers/v4.27.1/en/model_doc/auto#transformers.FlaxAutoModelForVision2Seq.from_pretrained"),l(Ye,"href","https://arxiv.org/abs/2111.07991"),l(Ye,"rel","nofollow"),l(Rt,"href","/docs/transformers/v4.27.1/en/main_classes/model#transformers.PreTrainedModel"),l(ot,"href","https://flax.readthedocs.io/en/latest/flax.linen.html#module"),l(ot,"rel","nofollow"),l(st,"href","https://jax.readthedocs.io/en/latest/jax.html#just-in-time-compilation-jit"),l(st,"rel","nofollow"),l(nt,"href","https://jax.readthedocs.io/en/latest/jax.html#automatic-differentiation"),l(nt,"rel","nofollow"),l(at,"href","https://jax.readthedocs.io/en/latest/jax.html#vectorization-vmap"),l(at,"rel","nofollow"),l(rt,"href","https://jax.readthedocs.io/en/latest/jax.html#parallelization-pmap"),l(rt,"rel","nofollow"),l(Ut,"href","/docs/transformers/v4.27.1/en/model_doc/vision-text-dual-encoder#transformers.FlaxVisionTextDualEncoderModel"),l(S,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(y,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(xe,"id","transformers.TFVisionTextDualEncoderModel"),l(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"),l(xe,"href","#transformers.TFVisionTextDualEncoderModel"),l(oe,"class","relative group"),l(Zt,"href","/docs/transformers/v4.27.1/en/model_doc/auto#transformers.FlaxAutoModelForVision2Seq.from_pretrained"),l(mt,"href","https://arxiv.org/abs/2111.07991"),l(mt,"rel","nofollow"),l(Ht,"href","/docs/transformers/v4.27.1/en/main_classes/model#transformers.TFPreTrainedModel"),l(ft,"href","https://www.tensorflow.org/api_docs/python/tf/keras/Model"),l(ft,"rel","nofollow"),l(Jt,"href","/docs/transformers/v4.27.1/en/model_doc/vision-text-dual-encoder#transformers.TFVisionTextDualEncoderModel"),l(N,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(V,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(o,g){e(document.head,m),_(o,x,g),_(o,f,g),e(f,h),e(h,v),E(d,v,null),e(f,u),e(f,F),e(F,bs),_(o,zo,g),_(o,J,g),e(J,ne),e(ne,Yt),E(ye,Yt,null),e(J,Es),e(J,eo),e(eo,ws),_(o,Io,g),_(o,k,g),e(k,js),e(k,bt),e(bt,$s),e(k,ys),e(k,to),e(to,ks),e(k,Ds),e(k,Et),e(Et,Vs),e(k,Ps),e(k,wt),e(wt,Ms),e(k,zs),e(k,jt),e(jt,Is),e(k,As),e(k,oo),e(oo,Fs),e(k,Cs),e(k,$t),e($t,qs),e(k,Ls),e(k,yt),e(yt,Os),e(k,Ss),_(o,Ao,g),_(o,ae,g),e(ae,Ns),e(ae,ke),e(ke,Bs),e(ae,Ws),_(o,Fo,g),_(o,K,g),e(K,re),e(re,so),E(De,so,null),e(K,Rs),e(K,no),e(no,Us),_(o,Co,g),_(o,z,g),E(Ve,z,null),e(z,Zs),e(z,Z),e(Z,kt),e(kt,Hs),e(Z,Js),e(Z,Dt),e(Dt,Ks),e(Z,Gs),e(Z,Vt),e(Vt,Xs),e(Z,Qs),e(z,Ys),e(z,G),e(G,en),e(G,Pt),e(Pt,tn),e(G,on),e(G,Mt),e(Mt,sn),e(G,nn),e(z,an),E(ie,z,null),e(z,rn),e(z,le),E(Pe,le,null),e(le,ln),e(le,Me),e(Me,dn),e(Me,zt),e(zt,cn),e(Me,pn),e(z,mn),e(z,de),E(ze,de,null),e(de,hn),e(de,Ie),e(Ie,un),e(Ie,It),e(It,fn),e(Ie,gn),_(o,qo,g),_(o,X,g),e(X,ce),e(ce,ao),E(Ae,ao,null),e(X,_n),e(X,ro),e(ro,vn),_(o,Lo,g),_(o,A,g),E(Fe,A,null),e(A,xn),e(A,io),e(io,Tn),e(A,bn),e(A,C),e(C,At),e(At,En),e(C,wn),e(C,Ft),e(Ft,jn),e(C,$n),e(C,Ct),e(Ct,yn),e(C,kn),e(C,lo),e(lo,Dn),e(C,Vn),e(C,qt),e(qt,Pn),e(C,Mn),e(A,zn),e(A,pe),E(Ce,pe,null),e(pe,In),e(pe,qe),e(qe,An),e(qe,Lt),e(Lt,Fn),e(qe,Cn),e(A,qn),e(A,me),E(Le,me,null),e(me,Ln),e(me,Oe),e(Oe,On),e(Oe,Ot),e(Ot,Sn),e(Oe,Nn),_(o,Oo,g),_(o,Q,g),e(Q,he),e(he,co),E(Se,co,null),e(Q,Bn),e(Q,po),e(po,Wn),_(o,So,g),_(o,D,g),E(Ne,D,null),e(D,Rn),e(D,Be),e(Be,Un),e(Be,St),e(St,Zn),e(Be,Hn),e(D,Jn),e(D,We),e(We,Kn),e(We,Re),e(Re,Gn),e(We,Xn),e(D,Qn),e(D,mo),e(mo,Yn),e(D,ea),e(D,Ue),e(Ue,ta),e(Ue,Nt),e(Nt,oa),e(Ue,sa),e(D,na),e(D,Ze),e(Ze,aa),e(Ze,He),e(He,ra),e(Ze,ia),e(D,la),e(D,O),E(Je,O,null),e(O,da),e(O,Y),e(Y,ca),e(Y,Bt),e(Bt,pa),e(Y,ma),e(Y,ho),e(ho,ha),e(Y,ua),e(O,fa),E(ue,O,null),e(O,ga),E(fe,O,null),_(o,No,g),_(o,ee,g),e(ee,ge),e(ge,uo),E(Ke,uo,null),e(ee,_a),e(ee,fo),e(fo,va),_(o,Bo,g),_(o,y,g),E(Ge,y,null),e(y,xa),e(y,Xe),e(Xe,Ta),e(Xe,Wt),e(Wt,ba),e(Xe,Ea),e(y,wa),e(y,Qe),e(Qe,ja),e(Qe,Ye),e(Ye,$a),e(Qe,ya),e(y,ka),e(y,go),e(go,Da),e(y,Va),e(y,et),e(et,Pa),e(et,Rt),e(Rt,Ma),e(et,za),e(y,Ia),e(y,tt),e(tt,Aa),e(tt,ot),e(ot,Fa),e(tt,Ca),e(y,qa),e(y,_o),e(_o,La),e(y,Oa),e(y,R),e(R,vo),e(vo,st),e(st,Sa),e(R,Na),e(R,xo),e(xo,nt),e(nt,Ba),e(R,Wa),e(R,To),e(To,at),e(at,Ra),e(R,Ua),e(R,bo),e(bo,rt),e(rt,Za),e(y,Ha),e(y,S),E(it,S,null),e(S,Ja),e(S,te),e(te,Ka),e(te,Ut),e(Ut,Ga),e(te,Xa),e(te,Eo),e(Eo,Qa),e(te,Ya),e(S,er),E(_e,S,null),e(S,tr),E(ve,S,null),_(o,Wo,g),_(o,oe,g),e(oe,xe),e(xe,wo),E(lt,wo,null),e(oe,or),e(oe,jo),e(jo,sr),_(o,Ro,g),_(o,V,g),E(dt,V,null),e(V,nr),e(V,ct),e(ct,ar),e(ct,Zt),e(Zt,rr),e(ct,ir),e(V,lr),e(V,pt),e(pt,dr),e(pt,mt),e(mt,cr),e(pt,pr),e(V,mr),e(V,$o),e($o,hr),e(V,ur),e(V,ht),e(ht,fr),e(ht,Ht),e(Ht,gr),e(ht,_r),e(V,vr),e(V,ut),e(ut,xr),e(ut,ft),e(ft,Tr),e(ut,br),e(V,Er),e(V,N),E(gt,N,null),e(N,wr),e(N,se),e(se,jr),e(se,Jt),e(Jt,$r),e(se,yr),e(se,yo),e(yo,kr),e(se,Dr),e(N,Vr),E(Te,N,null),e(N,Pr),E(be,N,null),Uo=!0},p(o,[g]){const _t={};g&2&&(_t.$$scope={dirty:g,ctx:o}),ie.$set(_t);const ko={};g&2&&(ko.$$scope={dirty:g,ctx:o}),ue.$set(ko);const Do={};g&2&&(Do.$$scope={dirty:g,ctx:o}),fe.$set(Do);const Vo={};g&2&&(Vo.$$scope={dirty:g,ctx:o}),_e.$set(Vo);const vt={};g&2&&(vt.$$scope={dirty:g,ctx:o}),ve.$set(vt);const Po={};g&2&&(Po.$$scope={dirty:g,ctx:o}),Te.$set(Po);const Mo={};g&2&&(Mo.$$scope={dirty:g,ctx:o}),be.$set(Mo)},i(o){Uo||(w(d.$$.fragment,o),w(ye.$$.fragment,o),w(De.$$.fragment,o),w(Ve.$$.fragment,o),w(ie.$$.fragment,o),w(Pe.$$.fragment,o),w(ze.$$.fragment,o),w(Ae.$$.fragment,o),w(Fe.$$.fragment,o),w(Ce.$$.fragment,o),w(Le.$$.fragment,o),w(Se.$$.fragment,o),w(Ne.$$.fragment,o),w(Je.$$.fragment,o),w(ue.$$.fragment,o),w(fe.$$.fragment,o),w(Ke.$$.fragment,o),w(Ge.$$.fragment,o),w(it.$$.fragment,o),w(_e.$$.fragment,o),w(ve.$$.fragment,o),w(lt.$$.fragment,o),w(dt.$$.fragment,o),w(gt.$$.fragment,o),w(Te.$$.fragment,o),w(be.$$.fragment,o),Uo=!0)},o(o){j(d.$$.fragment,o),j(ye.$$.fragment,o),j(De.$$.fragment,o),j(Ve.$$.fragment,o),j(ie.$$.fragment,o),j(Pe.$$.fragment,o),j(ze.$$.fragment,o),j(Ae.$$.fragment,o),j(Fe.$$.fragment,o),j(Ce.$$.fragment,o),j(Le.$$.fragment,o),j(Se.$$.fragment,o),j(Ne.$$.fragment,o),j(Je.$$.fragment,o),j(ue.$$.fragment,o),j(fe.$$.fragment,o),j(Ke.$$.fragment,o),j(Ge.$$.fragment,o),j(it.$$.fragment,o),j(_e.$$.fragment,o),j(ve.$$.fragment,o),j(lt.$$.fragment,o),j(dt.$$.fragment,o),j(gt.$$.fragment,o),j(Te.$$.fragment,o),j(be.$$.fragment,o),Uo=!1},d(o){t(m),o&&t(x),o&&t(f),$(d),o&&t(zo),o&&t(J),$(ye),o&&t(Io),o&&t(k),o&&t(Ao),o&&t(ae),o&&t(Fo),o&&t(K),$(De),o&&t(Co),o&&t(z),$(Ve),$(ie),$(Pe),$(ze),o&&t(qo),o&&t(X),$(Ae),o&&t(Lo),o&&t(A),$(Fe),$(Ce),$(Le),o&&t(Oo),o&&t(Q),$(Se),o&&t(So),o&&t(D),$(Ne),$(Je),$(ue),$(fe),o&&t(No),o&&t(ee),$(Ke),o&&t(Bo),o&&t(y),$(Ge),$(it),$(_e),$(ve),o&&t(Wo),o&&t(oe),$(lt),o&&t(Ro),o&&t(V),$(dt),$(gt),$(Te),$(be)}}}const il={local:"visiontextdualencoder",sections:[{local:"overview",title:"Overview"},{local:"transformers.VisionTextDualEncoderConfig",title:"VisionTextDualEncoderConfig"},{local:"transformers.VisionTextDualEncoderProcessor",title:"VisionTextDualEncoderProcessor"},{local:"transformers.VisionTextDualEncoderModel",title:"VisionTextDualEncoderModel"},{local:"transformers.FlaxVisionTextDualEncoderModel",title:"FlaxVisionTextDualEncoderModel"},{local:"transformers.TFVisionTextDualEncoderModel",title:"TFVisionTextDualEncoderModel"}],title:"VisionTextDualEncoder"};function ll(I){return Qi(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class fl extends Ji{constructor(m){super();Ki(this,m,ll,rl,Gi,{})}}export{fl as default,il as metadata};
