import{s as on,f as rn,o as ln,n as L}from"../chunks/scheduler.25b97de1.js";import{S as cn,i as pn,g as d,s as o,r as h,A as dn,h as m,f as a,c as r,j as C,u as f,x as w,k as J,y as p,a as c,v as u,d as g,t as M,w as _}from"../chunks/index.d9030fc9.js";import{T as Mt}from"../chunks/Tip.baa67368.js";import{D as v}from"../chunks/Docstring.e257edda.js";import{C as Ke}from"../chunks/CodeBlock.e6cd0d95.js";import{E as De}from"../chunks/ExampleCodeBlock.20db4b6e.js";import{H as E,E as mn}from"../chunks/EditOnGithub.91d95064.js";function hn(b){let s,T="Example:",l,i,y;return i=new Ke({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFhDTElQVGV4dE1vZGVsJTJDJTIwWENMSVBUZXh0Q29uZmlnJTBBJTBBJTIzJTIwSW5pdGlhbGl6aW5nJTIwYSUyMFhDTElQVGV4dE1vZGVsJTIwd2l0aCUyMG1pY3Jvc29mdCUyRnhjbGlwLWJhc2UtcGF0Y2gzMiUyMHN0eWxlJTIwY29uZmlndXJhdGlvbiUwQWNvbmZpZ3VyYXRpb24lMjAlM0QlMjBYQ0xJUFRleHRDb25maWcoKSUwQSUwQSUyMyUyMEluaXRpYWxpemluZyUyMGElMjBYQ0xJUFRleHRDb25maWclMjBmcm9tJTIwdGhlJTIwbWljcm9zb2Z0JTJGeGNsaXAtYmFzZS1wYXRjaDMyJTIwc3R5bGUlMjBjb25maWd1cmF0aW9uJTBBbW9kZWwlMjAlM0QlMjBYQ0xJUFRleHRNb2RlbChjb25maWd1cmF0aW9uKSUwQSUwQSUyMyUyMEFjY2Vzc2luZyUyMHRoZSUyMG1vZGVsJTIwY29uZmlndXJhdGlvbiUwQWNvbmZpZ3VyYXRpb24lMjAlM0QlMjBtb2RlbC5jb25maWc=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> XCLIPTextModel, XCLIPTextConfig

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a XCLIPTextModel with microsoft/xclip-base-patch32 style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = XCLIPTextConfig()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a XCLIPTextConfig from the microsoft/xclip-base-patch32 style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = XCLIPTextModel(configuration)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Accessing the model configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = model.config`,wrap:!1}}),{c(){s=d("p"),s.textContent=T,l=o(),h(i.$$.fragment)},l(t){s=m(t,"P",{"data-svelte-h":!0}),w(s)!=="svelte-11lpom8"&&(s.textContent=T),l=r(t),f(i.$$.fragment,t)},m(t,j){c(t,s,j),c(t,l,j),u(i,t,j),y=!0},p:L,i(t){y||(g(i.$$.fragment,t),y=!0)},o(t){M(i.$$.fragment,t),y=!1},d(t){t&&(a(s),a(l)),_(i,t)}}}function fn(b){let s,T="Example:",l,i,y;return i=new Ke({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFhDTElQVmlzaW9uTW9kZWwlMkMlMjBYQ0xJUFZpc2lvbkNvbmZpZyUwQSUwQSUyMyUyMEluaXRpYWxpemluZyUyMGElMjBYQ0xJUFZpc2lvbk1vZGVsJTIwd2l0aCUyMG1pY3Jvc29mdCUyRnhjbGlwLWJhc2UtcGF0Y2gzMiUyMHN0eWxlJTIwY29uZmlndXJhdGlvbiUwQWNvbmZpZ3VyYXRpb24lMjAlM0QlMjBYQ0xJUFZpc2lvbkNvbmZpZygpJTBBJTBBJTIzJTIwSW5pdGlhbGl6aW5nJTIwYSUyMFhDTElQVmlzaW9uTW9kZWwlMjBtb2RlbCUyMGZyb20lMjB0aGUlMjBtaWNyb3NvZnQlMkZ4Y2xpcC1iYXNlLXBhdGNoMzIlMjBzdHlsZSUyMGNvbmZpZ3VyYXRpb24lMEFtb2RlbCUyMCUzRCUyMFhDTElQVmlzaW9uTW9kZWwoY29uZmlndXJhdGlvbiklMEElMEElMjMlMjBBY2Nlc3NpbmclMjB0aGUlMjBtb2RlbCUyMGNvbmZpZ3VyYXRpb24lMEFjb25maWd1cmF0aW9uJTIwJTNEJTIwbW9kZWwuY29uZmln",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> XCLIPVisionModel, XCLIPVisionConfig

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a XCLIPVisionModel with microsoft/xclip-base-patch32 style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = XCLIPVisionConfig()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a XCLIPVisionModel model from the microsoft/xclip-base-patch32 style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = XCLIPVisionModel(configuration)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Accessing the model configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = model.config`,wrap:!1}}),{c(){s=d("p"),s.textContent=T,l=o(),h(i.$$.fragment)},l(t){s=m(t,"P",{"data-svelte-h":!0}),w(s)!=="svelte-11lpom8"&&(s.textContent=T),l=r(t),f(i.$$.fragment,t)},m(t,j){c(t,s,j),c(t,l,j),u(i,t,j),y=!0},p:L,i(t){y||(g(i.$$.fragment,t),y=!0)},o(t){M(i.$$.fragment,t),y=!1},d(t){t&&(a(s),a(l)),_(i,t)}}}function un(b){let s,T=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code>
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`;return{c(){s=d("p"),s.innerHTML=T},l(l){s=m(l,"P",{"data-svelte-h":!0}),w(s)!=="svelte-fincs2"&&(s.innerHTML=T)},m(l,i){c(l,s,i)},p:L,d(l){l&&a(s)}}}function gn(b){let s,T="Examples:",l,i,y;return i=new Ke({props:{code:" ",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> av
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> numpy <span class="hljs-keyword">as</span> np

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoProcessor, AutoModel
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> huggingface_hub <span class="hljs-keyword">import</span> hf_hub_download

<span class="hljs-meta">&gt;&gt;&gt; </span>np.random.seed(<span class="hljs-number">0</span>)


<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">def</span> <span class="hljs-title function_">read_video_pyav</span>(<span class="hljs-params">container, indices</span>):
<span class="hljs-meta">... </span>    <span class="hljs-string">&#x27;&#x27;&#x27;
<span class="hljs-meta">... </span>    Decode the video with PyAV decoder.
<span class="hljs-meta">... </span>    Args:
<span class="hljs-meta">... </span>        container (\`av.container.input.InputContainer\`): PyAV container.
<span class="hljs-meta">... </span>        indices (\`List[int]\`): List of frame indices to decode.
<span class="hljs-meta">... </span>    Returns:
<span class="hljs-meta">... </span>        result (np.ndarray): np array of decoded frames of shape (num_frames, height, width, 3).
<span class="hljs-meta">... </span>    &#x27;&#x27;&#x27;</span>
<span class="hljs-meta">... </span>    frames = []
<span class="hljs-meta">... </span>    container.seek(<span class="hljs-number">0</span>)
<span class="hljs-meta">... </span>    start_index = indices[<span class="hljs-number">0</span>]
<span class="hljs-meta">... </span>    end_index = indices[-<span class="hljs-number">1</span>]
<span class="hljs-meta">... </span>    <span class="hljs-keyword">for</span> i, frame <span class="hljs-keyword">in</span> <span class="hljs-built_in">enumerate</span>(container.decode(video=<span class="hljs-number">0</span>)):
<span class="hljs-meta">... </span>        <span class="hljs-keyword">if</span> i &gt; end_index:
<span class="hljs-meta">... </span>            <span class="hljs-keyword">break</span>
<span class="hljs-meta">... </span>        <span class="hljs-keyword">if</span> i &gt;= start_index <span class="hljs-keyword">and</span> i <span class="hljs-keyword">in</span> indices:
<span class="hljs-meta">... </span>            frames.append(frame)
<span class="hljs-meta">... </span>    <span class="hljs-keyword">return</span> np.stack([x.to_ndarray(<span class="hljs-built_in">format</span>=<span class="hljs-string">&quot;rgb24&quot;</span>) <span class="hljs-keyword">for</span> x <span class="hljs-keyword">in</span> frames])


<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">def</span> <span class="hljs-title function_">sample_frame_indices</span>(<span class="hljs-params">clip_len, frame_sample_rate, seg_len</span>):
<span class="hljs-meta">... </span>    <span class="hljs-string">&#x27;&#x27;&#x27;
<span class="hljs-meta">... </span>    Sample a given number of frame indices from the video.
<span class="hljs-meta">... </span>    Args:
<span class="hljs-meta">... </span>        clip_len (\`int\`): Total number of frames to sample.
<span class="hljs-meta">... </span>        frame_sample_rate (\`int\`): Sample every n-th frame.
<span class="hljs-meta">... </span>        seg_len (\`int\`): Maximum allowed index of sample&#x27;s last frame.
<span class="hljs-meta">... </span>    Returns:
<span class="hljs-meta">... </span>        indices (\`List[int]\`): List of sampled frame indices
<span class="hljs-meta">... </span>    &#x27;&#x27;&#x27;</span>
<span class="hljs-meta">... </span>    converted_len = <span class="hljs-built_in">int</span>(clip_len * frame_sample_rate)
<span class="hljs-meta">... </span>    end_idx = np.random.randint(converted_len, seg_len)
<span class="hljs-meta">... </span>    start_idx = end_idx - converted_len
<span class="hljs-meta">... </span>    indices = np.linspace(start_idx, end_idx, num=clip_len)
<span class="hljs-meta">... </span>    indices = np.clip(indices, start_idx, end_idx - <span class="hljs-number">1</span>).astype(np.int64)
<span class="hljs-meta">... </span>    <span class="hljs-keyword">return</span> indices


<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># video clip consists of 300 frames (10 seconds at 30 FPS)</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>file_path = hf_hub_download(
<span class="hljs-meta">... </span>    repo_id=<span class="hljs-string">&quot;nielsr/video-demo&quot;</span>, filename=<span class="hljs-string">&quot;eating_spaghetti.mp4&quot;</span>, repo_type=<span class="hljs-string">&quot;dataset&quot;</span>
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>container = av.<span class="hljs-built_in">open</span>(file_path)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># sample 8 frames</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>indices = sample_frame_indices(clip_len=<span class="hljs-number">8</span>, frame_sample_rate=<span class="hljs-number">1</span>, seg_len=container.streams.video[<span class="hljs-number">0</span>].frames)
<span class="hljs-meta">&gt;&gt;&gt; </span>video = read_video_pyav(container, indices)

<span class="hljs-meta">&gt;&gt;&gt; </span>processor = AutoProcessor.from_pretrained(<span class="hljs-string">&quot;microsoft/xclip-base-patch32&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = AutoModel.from_pretrained(<span class="hljs-string">&quot;microsoft/xclip-base-patch32&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = processor(
<span class="hljs-meta">... </span>    text=[<span class="hljs-string">&quot;playing sports&quot;</span>, <span class="hljs-string">&quot;eating spaghetti&quot;</span>, <span class="hljs-string">&quot;go shopping&quot;</span>],
<span class="hljs-meta">... </span>    videos=<span class="hljs-built_in">list</span>(video),
<span class="hljs-meta">... </span>    return_tensors=<span class="hljs-string">&quot;pt&quot;</span>,
<span class="hljs-meta">... </span>    padding=<span class="hljs-literal">True</span>,
<span class="hljs-meta">... </span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># forward pass</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">with</span> torch.no_grad():
<span class="hljs-meta">... </span>    outputs = model(**inputs)

<span class="hljs-meta">&gt;&gt;&gt; </span>logits_per_video = outputs.logits_per_video  <span class="hljs-comment"># this is the video-text similarity score</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>probs = logits_per_video.softmax(dim=<span class="hljs-number">1</span>)  <span class="hljs-comment"># we can take the softmax to get the label probabilities</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(probs)
tensor([[<span class="hljs-number">1.9496e-04</span>, <span class="hljs-number">9.9960e-01</span>, <span class="hljs-number">2.0825e-04</span>]])`,wrap:!1}}),{c(){s=d("p"),s.textContent=T,l=o(),h(i.$$.fragment)},l(t){s=m(t,"P",{"data-svelte-h":!0}),w(s)!=="svelte-kvfsh7"&&(s.textContent=T),l=r(t),f(i.$$.fragment,t)},m(t,j){c(t,s,j),c(t,l,j),u(i,t,j),y=!0},p:L,i(t){y||(g(i.$$.fragment,t),y=!0)},o(t){M(i.$$.fragment,t),y=!1},d(t){t&&(a(s),a(l)),_(i,t)}}}function Mn(b){let s,T=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code>
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`;return{c(){s=d("p"),s.innerHTML=T},l(l){s=m(l,"P",{"data-svelte-h":!0}),w(s)!=="svelte-fincs2"&&(s.innerHTML=T)},m(l,i){c(l,s,i)},p:L,d(l){l&&a(s)}}}function _n(b){let s,T="Examples:",l,i,y;return i=new Ke({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBBdXRvTW9kZWwlMEElMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJtaWNyb3NvZnQlMkZ4Y2xpcC1iYXNlLXBhdGNoMzIlMjIpJTBBbW9kZWwlMjAlM0QlMjBBdXRvTW9kZWwuZnJvbV9wcmV0cmFpbmVkKCUyMm1pY3Jvc29mdCUyRnhjbGlwLWJhc2UtcGF0Y2gzMiUyMiklMEElMEFpbnB1dHMlMjAlM0QlMjB0b2tlbml6ZXIoJTVCJTIyYSUyMHBob3RvJTIwb2YlMjBhJTIwY2F0JTIyJTJDJTIwJTIyYSUyMHBob3RvJTIwb2YlMjBhJTIwZG9nJTIyJTVEJTJDJTIwcGFkZGluZyUzRFRydWUlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKSUwQXRleHRfZmVhdHVyZXMlMjAlM0QlMjBtb2RlbC5nZXRfdGV4dF9mZWF0dXJlcygqKmlucHV0cyk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, AutoModel

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;microsoft/xclip-base-patch32&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = AutoModel.from_pretrained(<span class="hljs-string">&quot;microsoft/xclip-base-patch32&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer([<span class="hljs-string">&quot;a photo of a cat&quot;</span>, <span class="hljs-string">&quot;a photo of a dog&quot;</span>], padding=<span class="hljs-literal">True</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>text_features = model.get_text_features(**inputs)`,wrap:!1}}),{c(){s=d("p"),s.textContent=T,l=o(),h(i.$$.fragment)},l(t){s=m(t,"P",{"data-svelte-h":!0}),w(s)!=="svelte-kvfsh7"&&(s.textContent=T),l=r(t),f(i.$$.fragment,t)},m(t,j){c(t,s,j),c(t,l,j),u(i,t,j),y=!0},p:L,i(t){y||(g(i.$$.fragment,t),y=!0)},o(t){M(i.$$.fragment,t),y=!1},d(t){t&&(a(s),a(l)),_(i,t)}}}function yn(b){let s,T=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code>
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`;return{c(){s=d("p"),s.innerHTML=T},l(l){s=m(l,"P",{"data-svelte-h":!0}),w(s)!=="svelte-fincs2"&&(s.innerHTML=T)},m(l,i){c(l,s,i)},p:L,d(l){l&&a(s)}}}function Tn(b){let s,T="Examples:",l,i,y;return i=new Ke({props:{code:" ",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> av
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> numpy <span class="hljs-keyword">as</span> np

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoProcessor, AutoModel
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> huggingface_hub <span class="hljs-keyword">import</span> hf_hub_download

<span class="hljs-meta">&gt;&gt;&gt; </span>np.random.seed(<span class="hljs-number">0</span>)


<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">def</span> <span class="hljs-title function_">read_video_pyav</span>(<span class="hljs-params">container, indices</span>):
<span class="hljs-meta">... </span>    <span class="hljs-string">&#x27;&#x27;&#x27;
<span class="hljs-meta">... </span>    Decode the video with PyAV decoder.
<span class="hljs-meta">... </span>    Args:
<span class="hljs-meta">... </span>        container (\`av.container.input.InputContainer\`): PyAV container.
<span class="hljs-meta">... </span>        indices (\`List[int]\`): List of frame indices to decode.
<span class="hljs-meta">... </span>    Returns:
<span class="hljs-meta">... </span>        result (np.ndarray): np array of decoded frames of shape (num_frames, height, width, 3).
<span class="hljs-meta">... </span>    &#x27;&#x27;&#x27;</span>
<span class="hljs-meta">... </span>    frames = []
<span class="hljs-meta">... </span>    container.seek(<span class="hljs-number">0</span>)
<span class="hljs-meta">... </span>    start_index = indices[<span class="hljs-number">0</span>]
<span class="hljs-meta">... </span>    end_index = indices[-<span class="hljs-number">1</span>]
<span class="hljs-meta">... </span>    <span class="hljs-keyword">for</span> i, frame <span class="hljs-keyword">in</span> <span class="hljs-built_in">enumerate</span>(container.decode(video=<span class="hljs-number">0</span>)):
<span class="hljs-meta">... </span>        <span class="hljs-keyword">if</span> i &gt; end_index:
<span class="hljs-meta">... </span>            <span class="hljs-keyword">break</span>
<span class="hljs-meta">... </span>        <span class="hljs-keyword">if</span> i &gt;= start_index <span class="hljs-keyword">and</span> i <span class="hljs-keyword">in</span> indices:
<span class="hljs-meta">... </span>            frames.append(frame)
<span class="hljs-meta">... </span>    <span class="hljs-keyword">return</span> np.stack([x.to_ndarray(<span class="hljs-built_in">format</span>=<span class="hljs-string">&quot;rgb24&quot;</span>) <span class="hljs-keyword">for</span> x <span class="hljs-keyword">in</span> frames])


<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">def</span> <span class="hljs-title function_">sample_frame_indices</span>(<span class="hljs-params">clip_len, frame_sample_rate, seg_len</span>):
<span class="hljs-meta">... </span>    <span class="hljs-string">&#x27;&#x27;&#x27;
<span class="hljs-meta">... </span>    Sample a given number of frame indices from the video.
<span class="hljs-meta">... </span>    Args:
<span class="hljs-meta">... </span>        clip_len (\`int\`): Total number of frames to sample.
<span class="hljs-meta">... </span>        frame_sample_rate (\`int\`): Sample every n-th frame.
<span class="hljs-meta">... </span>        seg_len (\`int\`): Maximum allowed index of sample&#x27;s last frame.
<span class="hljs-meta">... </span>    Returns:
<span class="hljs-meta">... </span>        indices (\`List[int]\`): List of sampled frame indices
<span class="hljs-meta">... </span>    &#x27;&#x27;&#x27;</span>
<span class="hljs-meta">... </span>    converted_len = <span class="hljs-built_in">int</span>(clip_len * frame_sample_rate)
<span class="hljs-meta">... </span>    end_idx = np.random.randint(converted_len, seg_len)
<span class="hljs-meta">... </span>    start_idx = end_idx - converted_len
<span class="hljs-meta">... </span>    indices = np.linspace(start_idx, end_idx, num=clip_len)
<span class="hljs-meta">... </span>    indices = np.clip(indices, start_idx, end_idx - <span class="hljs-number">1</span>).astype(np.int64)
<span class="hljs-meta">... </span>    <span class="hljs-keyword">return</span> indices


<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># video clip consists of 300 frames (10 seconds at 30 FPS)</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>file_path = hf_hub_download(
<span class="hljs-meta">... </span>    repo_id=<span class="hljs-string">&quot;nielsr/video-demo&quot;</span>, filename=<span class="hljs-string">&quot;eating_spaghetti.mp4&quot;</span>, repo_type=<span class="hljs-string">&quot;dataset&quot;</span>
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>container = av.<span class="hljs-built_in">open</span>(file_path)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># sample 8 frames</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>indices = sample_frame_indices(clip_len=<span class="hljs-number">8</span>, frame_sample_rate=<span class="hljs-number">1</span>, seg_len=container.streams.video[<span class="hljs-number">0</span>].frames)
<span class="hljs-meta">&gt;&gt;&gt; </span>video = read_video_pyav(container, indices)

<span class="hljs-meta">&gt;&gt;&gt; </span>processor = AutoProcessor.from_pretrained(<span class="hljs-string">&quot;microsoft/xclip-base-patch32&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = AutoModel.from_pretrained(<span class="hljs-string">&quot;microsoft/xclip-base-patch32&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = processor(videos=<span class="hljs-built_in">list</span>(video), return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>video_features = model.get_video_features(**inputs)`,wrap:!1}}),{c(){s=d("p"),s.textContent=T,l=o(),h(i.$$.fragment)},l(t){s=m(t,"P",{"data-svelte-h":!0}),w(s)!=="svelte-kvfsh7"&&(s.textContent=T),l=r(t),f(i.$$.fragment,t)},m(t,j){c(t,s,j),c(t,l,j),u(i,t,j),y=!0},p:L,i(t){y||(g(i.$$.fragment,t),y=!0)},o(t){M(i.$$.fragment,t),y=!1},d(t){t&&(a(s),a(l)),_(i,t)}}}function wn(b){let s,T=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code>
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`;return{c(){s=d("p"),s.innerHTML=T},l(l){s=m(l,"P",{"data-svelte-h":!0}),w(s)!=="svelte-fincs2"&&(s.innerHTML=T)},m(l,i){c(l,s,i)},p:L,d(l){l&&a(s)}}}function jn(b){let s,T="Examples:",l,i,y;return i=new Ke({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBYQ0xJUFRleHRNb2RlbCUwQSUwQW1vZGVsJTIwJTNEJTIwWENMSVBUZXh0TW9kZWwuZnJvbV9wcmV0cmFpbmVkKCUyMm1pY3Jvc29mdCUyRnhjbGlwLWJhc2UtcGF0Y2gzMiUyMiklMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJtaWNyb3NvZnQlMkZ4Y2xpcC1iYXNlLXBhdGNoMzIlMjIpJTBBJTBBaW5wdXRzJTIwJTNEJTIwdG9rZW5pemVyKCU1QiUyMmElMjBwaG90byUyMG9mJTIwYSUyMGNhdCUyMiUyQyUyMCUyMmElMjBwaG90byUyMG9mJTIwYSUyMGRvZyUyMiU1RCUyQyUyMHBhZGRpbmclM0RUcnVlJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMiklMEElMEFvdXRwdXRzJTIwJTNEJTIwbW9kZWwoKippbnB1dHMpJTBBbGFzdF9oaWRkZW5fc3RhdGUlMjAlM0QlMjBvdXRwdXRzLmxhc3RfaGlkZGVuX3N0YXRlJTBBcG9vbGVkX291dHB1dCUyMCUzRCUyMG91dHB1dHMucG9vbGVyX291dHB1dCUyMCUyMCUyMyUyMHBvb2xlZCUyMChFT1MlMjB0b2tlbiklMjBzdGF0ZXM=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, XCLIPTextModel

<span class="hljs-meta">&gt;&gt;&gt; </span>model = XCLIPTextModel.from_pretrained(<span class="hljs-string">&quot;microsoft/xclip-base-patch32&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;microsoft/xclip-base-patch32&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer([<span class="hljs-string">&quot;a photo of a cat&quot;</span>, <span class="hljs-string">&quot;a photo of a dog&quot;</span>], padding=<span class="hljs-literal">True</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**inputs)
<span class="hljs-meta">&gt;&gt;&gt; </span>last_hidden_state = outputs.last_hidden_state
<span class="hljs-meta">&gt;&gt;&gt; </span>pooled_output = outputs.pooler_output  <span class="hljs-comment"># pooled (EOS token) states</span>`,wrap:!1}}),{c(){s=d("p"),s.textContent=T,l=o(),h(i.$$.fragment)},l(t){s=m(t,"P",{"data-svelte-h":!0}),w(s)!=="svelte-kvfsh7"&&(s.textContent=T),l=r(t),f(i.$$.fragment,t)},m(t,j){c(t,s,j),c(t,l,j),u(i,t,j),y=!0},p:L,i(t){y||(g(i.$$.fragment,t),y=!0)},o(t){M(i.$$.fragment,t),y=!1},d(t){t&&(a(s),a(l)),_(i,t)}}}function bn(b){let s,T=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code>
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`;return{c(){s=d("p"),s.innerHTML=T},l(l){s=m(l,"P",{"data-svelte-h":!0}),w(s)!=="svelte-fincs2"&&(s.innerHTML=T)},m(l,i){c(l,s,i)},p:L,d(l){l&&a(s)}}}function Jn(b){let s,T="Examples:",l,i,y;return i=new Ke({props:{code:" ",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> av
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> numpy <span class="hljs-keyword">as</span> np

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoProcessor, XCLIPVisionModel
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> huggingface_hub <span class="hljs-keyword">import</span> hf_hub_download

<span class="hljs-meta">&gt;&gt;&gt; </span>np.random.seed(<span class="hljs-number">0</span>)


<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">def</span> <span class="hljs-title function_">read_video_pyav</span>(<span class="hljs-params">container, indices</span>):
<span class="hljs-meta">... </span>    <span class="hljs-string">&#x27;&#x27;&#x27;
<span class="hljs-meta">... </span>    Decode the video with PyAV decoder.
<span class="hljs-meta">... </span>    Args:
<span class="hljs-meta">... </span>        container (\`av.container.input.InputContainer\`): PyAV container.
<span class="hljs-meta">... </span>        indices (\`List[int]\`): List of frame indices to decode.
<span class="hljs-meta">... </span>    Returns:
<span class="hljs-meta">... </span>        result (np.ndarray): np array of decoded frames of shape (num_frames, height, width, 3).
<span class="hljs-meta">... </span>    &#x27;&#x27;&#x27;</span>
<span class="hljs-meta">... </span>    frames = []
<span class="hljs-meta">... </span>    container.seek(<span class="hljs-number">0</span>)
<span class="hljs-meta">... </span>    start_index = indices[<span class="hljs-number">0</span>]
<span class="hljs-meta">... </span>    end_index = indices[-<span class="hljs-number">1</span>]
<span class="hljs-meta">... </span>    <span class="hljs-keyword">for</span> i, frame <span class="hljs-keyword">in</span> <span class="hljs-built_in">enumerate</span>(container.decode(video=<span class="hljs-number">0</span>)):
<span class="hljs-meta">... </span>        <span class="hljs-keyword">if</span> i &gt; end_index:
<span class="hljs-meta">... </span>            <span class="hljs-keyword">break</span>
<span class="hljs-meta">... </span>        <span class="hljs-keyword">if</span> i &gt;= start_index <span class="hljs-keyword">and</span> i <span class="hljs-keyword">in</span> indices:
<span class="hljs-meta">... </span>            frames.append(frame)
<span class="hljs-meta">... </span>    <span class="hljs-keyword">return</span> np.stack([x.to_ndarray(<span class="hljs-built_in">format</span>=<span class="hljs-string">&quot;rgb24&quot;</span>) <span class="hljs-keyword">for</span> x <span class="hljs-keyword">in</span> frames])


<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">def</span> <span class="hljs-title function_">sample_frame_indices</span>(<span class="hljs-params">clip_len, frame_sample_rate, seg_len</span>):
<span class="hljs-meta">... </span>    <span class="hljs-string">&#x27;&#x27;&#x27;
<span class="hljs-meta">... </span>    Sample a given number of frame indices from the video.
<span class="hljs-meta">... </span>    Args:
<span class="hljs-meta">... </span>        clip_len (\`int\`): Total number of frames to sample.
<span class="hljs-meta">... </span>        frame_sample_rate (\`int\`): Sample every n-th frame.
<span class="hljs-meta">... </span>        seg_len (\`int\`): Maximum allowed index of sample&#x27;s last frame.
<span class="hljs-meta">... </span>    Returns:
<span class="hljs-meta">... </span>        indices (\`List[int]\`): List of sampled frame indices
<span class="hljs-meta">... </span>    &#x27;&#x27;&#x27;</span>
<span class="hljs-meta">... </span>    converted_len = <span class="hljs-built_in">int</span>(clip_len * frame_sample_rate)
<span class="hljs-meta">... </span>    end_idx = np.random.randint(converted_len, seg_len)
<span class="hljs-meta">... </span>    start_idx = end_idx - converted_len
<span class="hljs-meta">... </span>    indices = np.linspace(start_idx, end_idx, num=clip_len)
<span class="hljs-meta">... </span>    indices = np.clip(indices, start_idx, end_idx - <span class="hljs-number">1</span>).astype(np.int64)
<span class="hljs-meta">... </span>    <span class="hljs-keyword">return</span> indices


<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># video clip consists of 300 frames (10 seconds at 30 FPS)</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>file_path = hf_hub_download(
<span class="hljs-meta">... </span>    repo_id=<span class="hljs-string">&quot;nielsr/video-demo&quot;</span>, filename=<span class="hljs-string">&quot;eating_spaghetti.mp4&quot;</span>, repo_type=<span class="hljs-string">&quot;dataset&quot;</span>
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>container = av.<span class="hljs-built_in">open</span>(file_path)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># sample 16 frames</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>indices = sample_frame_indices(clip_len=<span class="hljs-number">8</span>, frame_sample_rate=<span class="hljs-number">1</span>, seg_len=container.streams.video[<span class="hljs-number">0</span>].frames)
<span class="hljs-meta">&gt;&gt;&gt; </span>video = read_video_pyav(container, indices)

<span class="hljs-meta">&gt;&gt;&gt; </span>processor = AutoProcessor.from_pretrained(<span class="hljs-string">&quot;microsoft/xclip-base-patch32&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = XCLIPVisionModel.from_pretrained(<span class="hljs-string">&quot;microsoft/xclip-base-patch32&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>pixel_values = processor(videos=<span class="hljs-built_in">list</span>(video), return_tensors=<span class="hljs-string">&quot;pt&quot;</span>).pixel_values

<span class="hljs-meta">&gt;&gt;&gt; </span>batch_size, num_frames, num_channels, height, width = pixel_values.shape
<span class="hljs-meta">&gt;&gt;&gt; </span>pixel_values = pixel_values.reshape(-<span class="hljs-number">1</span>, num_channels, height, width)

<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(pixel_values)
<span class="hljs-meta">&gt;&gt;&gt; </span>last_hidden_state = outputs.last_hidden_state`,wrap:!1}}),{c(){s=d("p"),s.textContent=T,l=o(),h(i.$$.fragment)},l(t){s=m(t,"P",{"data-svelte-h":!0}),w(s)!=="svelte-kvfsh7"&&(s.textContent=T),l=r(t),f(i.$$.fragment,t)},m(t,j){c(t,s,j),c(t,l,j),u(i,t,j),y=!0},p:L,i(t){y||(g(i.$$.fragment,t),y=!0)},o(t){M(i.$$.fragment,t),y=!1},d(t){t&&(a(s),a(l)),_(i,t)}}}function Cn(b){let s,T,l,i,y,t,j,_t,he,Zs=`The X-CLIP model was proposed in <a href="https://arxiv.org/abs/2208.02816" rel="nofollow">Expanding Language-Image Pretrained Models for General Video Recognition</a> by Bolin Ni, Houwen Peng, Minghao Chen, Songyang Zhang, Gaofeng Meng, Jianlong Fu, Shiming Xiang, Haibin Ling.
X-CLIP is a minimal extension of <a href="clip">CLIP</a> for video. The model consists of a text encoder, a cross-frame vision encoder, a multi-frame integration Transformer, and a video-specific prompt generator.`,yt,fe,Bs="The abstract from the paper is the following:",Tt,ue,Ws="<em>Contrastive language-image pretraining has shown great success in learning visual-textual joint representation from web-scale data, demonstrating remarkable “zero-shot” generalization ability for various image tasks. However, how to effectively expand such new language-image pretraining methods to video domains is still an open problem. In this work, we present a simple yet effective approach that adapts the pretrained language-image models to video recognition directly, instead of pretraining a new model from scratch. More concretely, to capture the long-range dependencies of frames along the temporal dimension, we propose a cross-frame attention mechanism that explicitly exchanges information across frames. Such module is lightweight and can be plugged into pretrained language-image models seamlessly. Moreover, we propose a video-specific prompting scheme, which leverages video content information for generating discriminative textual prompts. Extensive experiments demonstrate that our approach is effective and can be generalized to different video recognition scenarios. In particular, under fully-supervised settings, our approach achieves a top-1 accuracy of 87.1% on Kinectics-400, while using 12 times fewer FLOPs compared with Swin-L and ViViT-H. In zero-shot experiments, our approach surpasses the current state-of-the-art methods by +7.6% and +14.9% in terms of top-1 accuracy under two popular protocols. In few-shot scenarios, our approach outperforms previous best methods by +32.1% and +23.1% when the labeled data is extremely limited.</em>",wt,ge,ks="Tips:",jt,Me,$s='<li>Usage of X-CLIP is identical to <a href="clip">CLIP</a>.</li>',bt,H,Gs,Jt,_e,Ps='X-CLIP architecture. Taken from the <a href="https://arxiv.org/abs/2208.02816">original paper.</a>',Ct,ye,Vs=`This model was contributed by <a href="https://huggingface.co/nielsr" rel="nofollow">nielsr</a>.
The original code can be found <a href="https://github.com/microsoft/VideoX/tree/master/X-CLIP" rel="nofollow">here</a>.`,It,Te,Ut,we,Ls="A list of official Hugging Face and community (indicated by 🌎) resources to help you get started with X-CLIP.",vt,je,zs='<li>Demo notebooks for X-CLIP can be found <a href="https://github.com/NielsRogge/Transformers-Tutorials/tree/master/X-CLIP" rel="nofollow">here</a>.</li>',xt,be,As="If you’re interested in submitting a resource to be included here, please feel free to open a Pull Request and we’ll review it! The resource should ideally demonstrate something new instead of duplicating an existing resource.",Xt,Je,Zt,I,Ce,St,Oe,Rs="Constructs an X-CLIP processor which wraps a VideoMAE image processor and a CLIP tokenizer into a single processor.",Ht,et,Ns=`<a href="/docs/transformers/pr_29693/en/model_doc/xclip#transformers.XCLIPProcessor">XCLIPProcessor</a> offers all the functionalities of <a href="/docs/transformers/pr_29693/en/model_doc/videomae#transformers.VideoMAEImageProcessor">VideoMAEImageProcessor</a> and <a href="/docs/transformers/pr_29693/en/model_doc/clip#transformers.CLIPTokenizerFast">CLIPTokenizerFast</a>. See the
<code>__call__()</code> and <a href="/docs/transformers/pr_29693/en/model_doc/xclip#transformers.XCLIPProcessor.decode">decode()</a> for more information.`,qt,q,Ie,Dt,tt,Ys=`This method forwards all its arguments to CLIPTokenizerFast’s <a href="/docs/transformers/pr_29693/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.batch_decode">batch_decode()</a>. Please
refer to the docstring of this method for more information.`,Kt,D,Ue,Ot,st,Qs=`This method forwards all its arguments to CLIPTokenizerFast’s <a href="/docs/transformers/pr_29693/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.decode">decode()</a>. Please refer to
the docstring of this method for more information.`,Bt,ve,Wt,x,xe,es,nt,Es=`<a href="/docs/transformers/pr_29693/en/model_doc/xclip#transformers.XCLIPConfig">XCLIPConfig</a> is the configuration class to store the configuration of a <a href="/docs/transformers/pr_29693/en/model_doc/xclip#transformers.XCLIPModel">XCLIPModel</a>. It is used to
instantiate X-CLIP model according to the specified arguments, defining the text model and vision model configs.
Instantiating a configuration with the defaults will yield a similar configuration to that of the X-CLIP
<a href="https://huggingface.co/microsoft/xclip-base-patch32" rel="nofollow">microsoft/xclip-base-patch32</a> architecture.`,ts,at,Fs=`Configuration objects inherit from <a href="/docs/transformers/pr_29693/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> and can be used to control the model outputs. Read the
documentation from <a href="/docs/transformers/pr_29693/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> for more information.`,ss,K,Xe,ns,ot,Ss=`Instantiate a <a href="/docs/transformers/pr_29693/en/model_doc/xclip#transformers.XCLIPConfig">XCLIPConfig</a> (or a derived class) from xclip text model configuration and xclip vision model
configuration.`,kt,Ze,$t,X,Be,as,rt,Hs=`This is the configuration class to store the configuration of a <a href="/docs/transformers/pr_29693/en/model_doc/xclip#transformers.XCLIPModel">XCLIPModel</a>. It is used to instantiate an X-CLIP
model according to the specified arguments, defining the model architecture. Instantiating a configuration with the
defaults will yield a similar configuration to that of the X-CLIP
<a href="https://huggingface.co/microsoft/xclip-base-patch32" rel="nofollow">microsoft/xclip-base-patch32</a> architecture.`,os,lt,qs=`Configuration objects inherit from <a href="/docs/transformers/pr_29693/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> and can be used to control the model outputs. Read the
documentation from <a href="/docs/transformers/pr_29693/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> for more information.`,rs,O,Gt,We,Pt,Z,ke,ls,it,Ds=`This is the configuration class to store the configuration of a <a href="/docs/transformers/pr_29693/en/model_doc/xclip#transformers.XCLIPModel">XCLIPModel</a>. It is used to instantiate an X-CLIP
model according to the specified arguments, defining the model architecture. Instantiating a configuration with the
defaults will yield a similar configuration to that of the X-CLIP
<a href="https://huggingface.co/microsoft/xclip-base-patch32" rel="nofollow">microsoft/xclip-base-patch32</a> architecture.`,is,ct,Ks=`Configuration objects inherit from <a href="/docs/transformers/pr_29693/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> and can be used to control the model outputs. Read the
documentation from <a href="/docs/transformers/pr_29693/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> for more information.`,cs,ee,Vt,$e,Lt,U,Ge,ps,pt,Os=`This model is a PyTorch <a href="https://pytorch.org/docs/stable/nn.html#torch.nn.Module" rel="nofollow">torch.nn.Module</a> subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`,ds,k,Pe,ms,dt,en='The <a href="/docs/transformers/pr_29693/en/model_doc/xclip#transformers.XCLIPModel">XCLIPModel</a> forward method, overrides the <code>__call__</code> special method.',hs,te,fs,se,us,$,Ve,gs,mt,tn='The <a href="/docs/transformers/pr_29693/en/model_doc/xclip#transformers.XCLIPModel">XCLIPModel</a> forward method, overrides the <code>__call__</code> special method.',Ms,ne,_s,ae,ys,G,Le,Ts,ht,sn='The <a href="/docs/transformers/pr_29693/en/model_doc/xclip#transformers.XCLIPModel">XCLIPModel</a> forward method, overrides the <code>__call__</code> special method.',ws,oe,js,re,zt,ze,At,F,Ae,bs,P,Re,Js,ft,nn='The <a href="/docs/transformers/pr_29693/en/model_doc/xclip#transformers.XCLIPTextModel">XCLIPTextModel</a> forward method, overrides the <code>__call__</code> special method.',Cs,le,Is,ie,Rt,Ne,Nt,S,Ye,Us,V,Qe,vs,ut,an='The <a href="/docs/transformers/pr_29693/en/model_doc/xclip#transformers.XCLIPVisionModel">XCLIPVisionModel</a> forward method, overrides the <code>__call__</code> special method.',xs,ce,Xs,pe,Yt,Ee,Qt,gt,Et;return y=new E({props:{title:"X-CLIP",local:"x-clip",headingTag:"h1"}}),j=new E({props:{title:"Overview",local:"overview",headingTag:"h2"}}),Te=new E({props:{title:"Resources",local:"resources",headingTag:"h2"}}),Je=new E({props:{title:"XCLIPProcessor",local:"transformers.XCLIPProcessor",headingTag:"h2"}}),Ce=new v({props:{name:"class transformers.XCLIPProcessor",anchor:"transformers.XCLIPProcessor",parameters:[{name:"image_processor",val:" = None"},{name:"tokenizer",val:" = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.XCLIPProcessor.image_processor",description:`<strong>image_processor</strong> (<a href="/docs/transformers/pr_29693/en/model_doc/videomae#transformers.VideoMAEImageProcessor">VideoMAEImageProcessor</a>, <em>optional</em>) &#x2014;
The image processor is a required input.`,name:"image_processor"},{anchor:"transformers.XCLIPProcessor.tokenizer",description:`<strong>tokenizer</strong> (<a href="/docs/transformers/pr_29693/en/model_doc/clip#transformers.CLIPTokenizerFast">CLIPTokenizerFast</a>, <em>optional</em>) &#x2014;
The tokenizer is a required input.`,name:"tokenizer"}],source:"https://github.com/huggingface/transformers/blob/vr_29693/src/transformers/models/x_clip/processing_x_clip.py#L25"}}),Ie=new v({props:{name:"batch_decode",anchor:"transformers.XCLIPProcessor.batch_decode",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/vr_29693/src/transformers/models/x_clip/processing_x_clip.py#L116"}}),Ue=new v({props:{name:"decode",anchor:"transformers.XCLIPProcessor.decode",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/vr_29693/src/transformers/models/x_clip/processing_x_clip.py#L123"}}),ve=new E({props:{title:"XCLIPConfig",local:"transformers.XCLIPConfig",headingTag:"h2"}}),xe=new v({props:{name:"class transformers.XCLIPConfig",anchor:"transformers.XCLIPConfig",parameters:[{name:"text_config",val:" = None"},{name:"vision_config",val:" = None"},{name:"projection_dim",val:" = 512"},{name:"prompt_layers",val:" = 2"},{name:"prompt_alpha",val:" = 0.1"},{name:"prompt_hidden_act",val:" = 'quick_gelu'"},{name:"prompt_num_attention_heads",val:" = 8"},{name:"prompt_attention_dropout",val:" = 0.0"},{name:"prompt_projection_dropout",val:" = 0.0"},{name:"logit_scale_init_value",val:" = 2.6592"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.XCLIPConfig.text_config",description:`<strong>text_config</strong> (<code>dict</code>, <em>optional</em>) &#x2014;
Dictionary of configuration options used to initialize <a href="/docs/transformers/pr_29693/en/model_doc/xclip#transformers.XCLIPTextConfig">XCLIPTextConfig</a>.`,name:"text_config"},{anchor:"transformers.XCLIPConfig.vision_config",description:`<strong>vision_config</strong> (<code>dict</code>, <em>optional</em>) &#x2014;
Dictionary of configuration options used to initialize <a href="/docs/transformers/pr_29693/en/model_doc/xclip#transformers.XCLIPVisionConfig">XCLIPVisionConfig</a>.`,name:"vision_config"},{anchor:"transformers.XCLIPConfig.projection_dim",description:`<strong>projection_dim</strong> (<code>int</code>, <em>optional</em>, defaults to 512) &#x2014;
Dimensionality of text and vision projection layers.`,name:"projection_dim"},{anchor:"transformers.XCLIPConfig.prompt_layers",description:`<strong>prompt_layers</strong> (<code>int</code>, <em>optional</em>, defaults to 2) &#x2014;
Number of layers in the video specific prompt generator.`,name:"prompt_layers"},{anchor:"transformers.XCLIPConfig.prompt_alpha",description:`<strong>prompt_alpha</strong> (<code>float</code>, <em>optional</em>, defaults to 0.1) &#x2014;
Alpha value to use in the video specific prompt generator.`,name:"prompt_alpha"},{anchor:"transformers.XCLIPConfig.prompt_hidden_act",description:`<strong>prompt_hidden_act</strong> (<code>str</code> or <code>function</code>, <em>optional</em>, defaults to <code>&quot;quick_gelu&quot;</code>) &#x2014;
The non-linear activation function (function or string) in the video specific prompt generator. If string,
<code>&quot;gelu&quot;</code>, <code>&quot;relu&quot;</code>, <code>&quot;selu&quot;</code> and <code>&quot;gelu_new&quot;</code> <code>&quot;quick_gelu&quot;</code> are supported.`,name:"prompt_hidden_act"},{anchor:"transformers.XCLIPConfig.prompt_num_attention_heads",description:`<strong>prompt_num_attention_heads</strong> (<code>int</code>, <em>optional</em>, defaults to 8) &#x2014;
Number of attention heads in the cross-attention of the video specific prompt generator.`,name:"prompt_num_attention_heads"},{anchor:"transformers.XCLIPConfig.prompt_attention_dropout",description:`<strong>prompt_attention_dropout</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
The dropout probability for the attention layers in the video specific prompt generator.`,name:"prompt_attention_dropout"},{anchor:"transformers.XCLIPConfig.prompt_projection_dropout",description:`<strong>prompt_projection_dropout</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
The dropout probability for the projection layers in the video specific prompt generator.`,name:"prompt_projection_dropout"},{anchor:"transformers.XCLIPConfig.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> parameter. Default is used as per the original XCLIP implementation.`,name:"logit_scale_init_value"},{anchor:"transformers.XCLIPConfig.kwargs",description:`<strong>kwargs</strong> (<em>optional</em>) &#x2014;
Dictionary of keyword arguments.`,name:"kwargs"}],source:"https://github.com/huggingface/transformers/blob/vr_29693/src/transformers/models/x_clip/configuration_x_clip.py#L261"}}),Xe=new v({props:{name:"from_text_vision_configs",anchor:"transformers.XCLIPConfig.from_text_vision_configs",parameters:[{name:"text_config",val:": XCLIPTextConfig"},{name:"vision_config",val:": XCLIPVisionConfig"},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/vr_29693/src/transformers/models/x_clip/configuration_x_clip.py#L404",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>An instance of a configuration object</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><a
  href="/docs/transformers/pr_29693/en/model_doc/xclip#transformers.XCLIPConfig"
>XCLIPConfig</a></p>
`}}),Ze=new E({props:{title:"XCLIPTextConfig",local:"transformers.XCLIPTextConfig",headingTag:"h2"}}),Be=new v({props:{name:"class transformers.XCLIPTextConfig",anchor:"transformers.XCLIPTextConfig",parameters:[{name:"vocab_size",val:" = 49408"},{name:"hidden_size",val:" = 512"},{name:"intermediate_size",val:" = 2048"},{name:"num_hidden_layers",val:" = 12"},{name:"num_attention_heads",val:" = 8"},{name:"max_position_embeddings",val:" = 77"},{name:"hidden_act",val:" = 'quick_gelu'"},{name:"layer_norm_eps",val:" = 1e-05"},{name:"attention_dropout",val:" = 0.0"},{name:"initializer_range",val:" = 0.02"},{name:"initializer_factor",val:" = 1.0"},{name:"pad_token_id",val:" = 1"},{name:"bos_token_id",val:" = 0"},{name:"eos_token_id",val:" = 2"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.XCLIPTextConfig.vocab_size",description:`<strong>vocab_size</strong> (<code>int</code>, <em>optional</em>, defaults to 49408) &#x2014;
Vocabulary size of the X-CLIP text model. Defines the number of different tokens that can be represented by
the <code>inputs_ids</code> passed when calling <a href="/docs/transformers/pr_29693/en/model_doc/xclip#transformers.XCLIPModel">XCLIPModel</a>.`,name:"vocab_size"},{anchor:"transformers.XCLIPTextConfig.hidden_size",description:`<strong>hidden_size</strong> (<code>int</code>, <em>optional</em>, defaults to 512) &#x2014;
Dimensionality of the encoder layers and the pooler layer.`,name:"hidden_size"},{anchor:"transformers.XCLIPTextConfig.intermediate_size",description:`<strong>intermediate_size</strong> (<code>int</code>, <em>optional</em>, defaults to 2048) &#x2014;
Dimensionality of the &#x201C;intermediate&#x201D; (i.e., feed-forward) layer in the Transformer encoder.`,name:"intermediate_size"},{anchor:"transformers.XCLIPTextConfig.num_hidden_layers",description:`<strong>num_hidden_layers</strong> (<code>int</code>, <em>optional</em>, defaults to 12) &#x2014;
Number of hidden layers in the Transformer encoder.`,name:"num_hidden_layers"},{anchor:"transformers.XCLIPTextConfig.num_attention_heads",description:`<strong>num_attention_heads</strong> (<code>int</code>, <em>optional</em>, defaults to 8) &#x2014;
Number of attention heads for each attention layer in the Transformer encoder.`,name:"num_attention_heads"},{anchor:"transformers.XCLIPTextConfig.max_position_embeddings",description:`<strong>max_position_embeddings</strong> (<code>int</code>, <em>optional</em>, defaults to 77) &#x2014;
The maximum sequence length that this model might ever be used with. Typically set this to something large
just in case (e.g., 512 or 1024 or 2048).`,name:"max_position_embeddings"},{anchor:"transformers.XCLIPTextConfig.hidden_act",description:`<strong>hidden_act</strong> (<code>str</code> or <code>function</code>, <em>optional</em>, defaults to <code>&quot;quick_gelu&quot;</code>) &#x2014;
The non-linear activation function (function or string) in the encoder and pooler. If string, <code>&quot;gelu&quot;</code>,
<code>&quot;relu&quot;</code>, <code>&quot;selu&quot;</code> and <code>&quot;gelu_new&quot;</code> <code>&quot;quick_gelu&quot;</code> are supported.`,name:"hidden_act"},{anchor:"transformers.XCLIPTextConfig.layer_norm_eps",description:`<strong>layer_norm_eps</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-5) &#x2014;
The epsilon used by the layer normalization layers.`,name:"layer_norm_eps"},{anchor:"transformers.XCLIPTextConfig.attention_dropout",description:`<strong>attention_dropout</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
The dropout ratio for the attention probabilities.`,name:"attention_dropout"},{anchor:"transformers.XCLIPTextConfig.initializer_range",description:`<strong>initializer_range</strong> (<code>float</code>, <em>optional</em>, defaults to 0.02) &#x2014;
The standard deviation of the truncated_normal_initializer for initializing all weight matrices.`,name:"initializer_range"},{anchor:"transformers.XCLIPTextConfig.initializer_factor",description:`<strong>initializer_factor</strong> (<code>float</code>, <em>optional</em>, defaults to 1) &#x2014;
A factor for initializing all weight matrices (should be kept to 1, used internally for initialization
testing).`,name:"initializer_factor"}],source:"https://github.com/huggingface/transformers/blob/vr_29693/src/transformers/models/x_clip/configuration_x_clip.py#L27"}}),O=new De({props:{anchor:"transformers.XCLIPTextConfig.example",$$slots:{default:[hn]},$$scope:{ctx:b}}}),We=new E({props:{title:"XCLIPVisionConfig",local:"transformers.XCLIPVisionConfig",headingTag:"h2"}}),ke=new v({props:{name:"class transformers.XCLIPVisionConfig",anchor:"transformers.XCLIPVisionConfig",parameters:[{name:"hidden_size",val:" = 768"},{name:"intermediate_size",val:" = 3072"},{name:"num_hidden_layers",val:" = 12"},{name:"num_attention_heads",val:" = 12"},{name:"mit_hidden_size",val:" = 512"},{name:"mit_intermediate_size",val:" = 2048"},{name:"mit_num_hidden_layers",val:" = 1"},{name:"mit_num_attention_heads",val:" = 8"},{name:"num_channels",val:" = 3"},{name:"image_size",val:" = 224"},{name:"patch_size",val:" = 32"},{name:"num_frames",val:" = 8"},{name:"hidden_act",val:" = 'quick_gelu'"},{name:"layer_norm_eps",val:" = 1e-05"},{name:"attention_dropout",val:" = 0.0"},{name:"initializer_range",val:" = 0.02"},{name:"initializer_factor",val:" = 1.0"},{name:"drop_path_rate",val:" = 0.0"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.XCLIPVisionConfig.hidden_size",description:`<strong>hidden_size</strong> (<code>int</code>, <em>optional</em>, defaults to 768) &#x2014;
Dimensionality of the encoder layers and the pooler layer.`,name:"hidden_size"},{anchor:"transformers.XCLIPVisionConfig.intermediate_size",description:`<strong>intermediate_size</strong> (<code>int</code>, <em>optional</em>, defaults to 3072) &#x2014;
Dimensionality of the &#x201C;intermediate&#x201D; (i.e., feed-forward) layer in the Transformer encoder.`,name:"intermediate_size"},{anchor:"transformers.XCLIPVisionConfig.num_hidden_layers",description:`<strong>num_hidden_layers</strong> (<code>int</code>, <em>optional</em>, defaults to 12) &#x2014;
Number of hidden layers in the Transformer encoder.`,name:"num_hidden_layers"},{anchor:"transformers.XCLIPVisionConfig.num_attention_heads",description:`<strong>num_attention_heads</strong> (<code>int</code>, <em>optional</em>, defaults to 12) &#x2014;
Number of attention heads for each attention layer in the Transformer encoder.`,name:"num_attention_heads"},{anchor:"transformers.XCLIPVisionConfig.mit_hidden_size",description:`<strong>mit_hidden_size</strong> (<code>int</code>, <em>optional</em>, defaults to 512) &#x2014;
Dimensionality of the encoder layers of the Multiframe Integration Transformer (MIT).`,name:"mit_hidden_size"},{anchor:"transformers.XCLIPVisionConfig.mit_intermediate_size",description:`<strong>mit_intermediate_size</strong> (<code>int</code>, <em>optional</em>, defaults to 2048) &#x2014;
Dimensionality of the &#x201C;intermediate&#x201D; (i.e., feed-forward) layer in the Multiframe Integration Transformer
(MIT).`,name:"mit_intermediate_size"},{anchor:"transformers.XCLIPVisionConfig.mit_num_hidden_layers",description:`<strong>mit_num_hidden_layers</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
Number of hidden layers in the Multiframe Integration Transformer (MIT).`,name:"mit_num_hidden_layers"},{anchor:"transformers.XCLIPVisionConfig.mit_num_attention_heads",description:`<strong>mit_num_attention_heads</strong> (<code>int</code>, <em>optional</em>, defaults to 8) &#x2014;
Number of attention heads for each attention layer in the Multiframe Integration Transformer (MIT).`,name:"mit_num_attention_heads"},{anchor:"transformers.XCLIPVisionConfig.image_size",description:`<strong>image_size</strong> (<code>int</code>, <em>optional</em>, defaults to 224) &#x2014;
The size (resolution) of each image.`,name:"image_size"},{anchor:"transformers.XCLIPVisionConfig.patch_size",description:`<strong>patch_size</strong> (<code>int</code>, <em>optional</em>, defaults to 32) &#x2014;
The size (resolution) of each patch.`,name:"patch_size"},{anchor:"transformers.XCLIPVisionConfig.hidden_act",description:`<strong>hidden_act</strong> (<code>str</code> or <code>function</code>, <em>optional</em>, defaults to <code>&quot;quick_gelu&quot;</code>) &#x2014;
The non-linear activation function (function or string) in the encoder and pooler. If string, <code>&quot;gelu&quot;</code>,
<code>&quot;relu&quot;</code>, <code>&quot;selu&quot;</code>, <code>&quot;gelu_new&quot;</code> and <code>&quot;quick_gelu&quot;</code> are supported.`,name:"hidden_act"},{anchor:"transformers.XCLIPVisionConfig.layer_norm_eps",description:`<strong>layer_norm_eps</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-5) &#x2014;
The epsilon used by the layer normalization layers.`,name:"layer_norm_eps"},{anchor:"transformers.XCLIPVisionConfig.attention_dropout",description:`<strong>attention_dropout</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
The dropout ratio for the attention probabilities.`,name:"attention_dropout"},{anchor:"transformers.XCLIPVisionConfig.initializer_range",description:`<strong>initializer_range</strong> (<code>float</code>, <em>optional</em>, defaults to 0.02) &#x2014;
The standard deviation of the truncated_normal_initializer for initializing all weight matrices.`,name:"initializer_range"},{anchor:"transformers.XCLIPVisionConfig.initializer_factor",description:`<strong>initializer_factor</strong> (<code>float</code>, <em>optional</em>, defaults to 1) &#x2014;
A factor for initializing all weight matrices (should be kept to 1, used internally for initialization
testing).`,name:"initializer_factor"},{anchor:"transformers.XCLIPVisionConfig.drop_path_rate",description:`<strong>drop_path_rate</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
Stochastic depth rate.`,name:"drop_path_rate"}],source:"https://github.com/huggingface/transformers/blob/vr_29693/src/transformers/models/x_clip/configuration_x_clip.py#L134"}}),ee=new De({props:{anchor:"transformers.XCLIPVisionConfig.example",$$slots:{default:[fn]},$$scope:{ctx:b}}}),$e=new E({props:{title:"XCLIPModel",local:"transformers.XCLIPModel",headingTag:"h2"}}),Ge=new v({props:{name:"class transformers.XCLIPModel",anchor:"transformers.XCLIPModel",parameters:[{name:"config",val:": XCLIPConfig"}],parametersDescription:[{anchor:"transformers.XCLIPModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/pr_29693/en/model_doc/xclip#transformers.XCLIPConfig">XCLIPConfig</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/pr_29693/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/vr_29693/src/transformers/models/x_clip/modeling_x_clip.py#L1237"}}),Pe=new v({props:{name:"forward",anchor:"transformers.XCLIPModel.forward",parameters:[{name:"input_ids",val:": Optional = None"},{name:"pixel_values",val:": Optional = None"},{name:"attention_mask",val:": Optional = None"},{name:"position_ids",val:": Optional = None"},{name:"return_loss",val:": Optional = None"},{name:"output_attentions",val:": Optional = None"},{name:"output_hidden_states",val:": Optional = None"},{name:"return_dict",val:": Optional = None"}],parametersDescription:[{anchor:"transformers.XCLIPModel.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/pr_29693/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/pr_29693/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/pr_29693/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.XCLIPModel.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.XCLIPModel.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.XCLIPModel.forward.pixel_values",description:`<strong>pixel_values</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
Pixel values. Padding will be ignored by default should you provide it. Pixel values can be obtained using
<a href="/docs/transformers/pr_29693/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <a href="/docs/transformers/pr_29693/en/model_doc/perceiver#transformers.PerceiverFeatureExtractor.__call__">CLIPImageProcessor.<strong>call</strong>()</a> for details.`,name:"pixel_values"},{anchor:"transformers.XCLIPModel.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.XCLIPModel.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.XCLIPModel.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.XCLIPModel.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/pr_29693/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/vr_29693/src/transformers/models/x_clip/modeling_x_clip.py#L1447",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <code>transformers.models.x_clip.modeling_x_clip.XCLIPOutput</code> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<code>&lt;class 'transformers.models.x_clip.configuration_x_clip.XCLIPConfig'&gt;</code>) and inputs.</p>
<ul>
<li><strong>loss</strong> (<code>torch.FloatTensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>return_loss</code> is <code>True</code>) — Contrastive loss for video-text similarity.</li>
<li><strong>logits_per_video</strong> (<code>torch.FloatTensor</code> of shape <code>(video_batch_size, text_batch_size)</code>) — The scaled dot product scores between <code>video_embeds</code> and <code>text_embeds</code>. This represents the video-text
similarity scores.</li>
<li><strong>logits_per_text</strong> (<code>torch.FloatTensor</code> of shape <code>(text_batch_size, video_batch_size)</code>) — The scaled dot product scores between <code>text_embeds</code> and <code>video_embeds</code>. This represents the text-video
similarity scores.</li>
<li><strong>text_embeds(<code>torch.FloatTensor</code></strong> of shape <code>(batch_size, output_dim</code>) — The text embeddings obtained by applying the projection layer to the pooled output of <a
  href="/docs/transformers/pr_29693/en/model_doc/xclip#transformers.XCLIPTextModel"
>XCLIPTextModel</a>.</li>
<li><strong>video_embeds(<code>torch.FloatTensor</code></strong> of shape <code>(batch_size, output_dim</code>) — The video embeddings obtained by applying the projection layer to the pooled output of
<a
  href="/docs/transformers/pr_29693/en/model_doc/xclip#transformers.XCLIPVisionModel"
>XCLIPVisionModel</a>.</li>
<li><strong>text_model_output</strong> (<code>BaseModelOutputWithPooling</code>) — The output of the <a
  href="/docs/transformers/pr_29693/en/model_doc/xclip#transformers.XCLIPTextModel"
>XCLIPTextModel</a>.</li>
<li><strong>vision_model_output</strong> (<code>BaseModelOutputWithPooling</code>) — The output of the <a
  href="/docs/transformers/pr_29693/en/model_doc/xclip#transformers.XCLIPVisionModel"
>XCLIPVisionModel</a>.</li>
<li><strong>mit_output</strong> (<code>BaseModelOutputWithPooling</code>) — The output of <code>XCLIPMultiframeIntegrationTransformer</code> (MIT for short).</li>
</ul>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>transformers.models.x_clip.modeling_x_clip.XCLIPOutput</code> or <code>tuple(torch.FloatTensor)</code></p>
`}}),te=new Mt({props:{$$slots:{default:[un]},$$scope:{ctx:b}}}),se=new De({props:{anchor:"transformers.XCLIPModel.forward.example",$$slots:{default:[gn]},$$scope:{ctx:b}}}),Ve=new v({props:{name:"get_text_features",anchor:"transformers.XCLIPModel.get_text_features",parameters:[{name:"input_ids",val:": Optional = None"},{name:"attention_mask",val:": Optional = None"},{name:"position_ids",val:": Optional = None"},{name:"output_attentions",val:": Optional = None"},{name:"output_hidden_states",val:": Optional = None"},{name:"return_dict",val:": Optional = None"}],parametersDescription:[{anchor:"transformers.XCLIPModel.get_text_features.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary. Padding will be ignored by default should you provide
it.</p>
<p>Indices can be obtained using <a href="/docs/transformers/pr_29693/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/pr_29693/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/pr_29693/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.XCLIPModel.get_text_features.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.XCLIPModel.get_text_features.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.XCLIPModel.get_text_features.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.XCLIPModel.get_text_features.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail.`,name:"output_hidden_states"},{anchor:"transformers.XCLIPModel.get_text_features.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/pr_29693/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/vr_29693/src/transformers/models/x_clip/modeling_x_clip.py#L1285",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>The text embeddings obtained by
applying the projection layer to the pooled output of <a
  href="/docs/transformers/pr_29693/en/model_doc/xclip#transformers.XCLIPTextModel"
>XCLIPTextModel</a>.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p>text_features (<code>torch.FloatTensor</code> of shape <code>(batch_size, output_dim</code>)</p>
`}}),ne=new Mt({props:{$$slots:{default:[Mn]},$$scope:{ctx:b}}}),ae=new De({props:{anchor:"transformers.XCLIPModel.get_text_features.example",$$slots:{default:[_n]},$$scope:{ctx:b}}}),Le=new v({props:{name:"get_video_features",anchor:"transformers.XCLIPModel.get_video_features",parameters:[{name:"pixel_values",val:": Optional = None"},{name:"output_attentions",val:": Optional = None"},{name:"output_hidden_states",val:": Optional = None"},{name:"return_dict",val:": Optional = None"}],parametersDescription:[{anchor:"transformers.XCLIPModel.get_video_features.pixel_values",description:`<strong>pixel_values</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
Pixel values. Padding will be ignored by default should you provide it. Pixel values can be obtained using
<a href="/docs/transformers/pr_29693/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <a href="/docs/transformers/pr_29693/en/model_doc/perceiver#transformers.PerceiverFeatureExtractor.__call__">CLIPImageProcessor.<strong>call</strong>()</a> for details.`,name:"pixel_values"},{anchor:"transformers.XCLIPModel.get_video_features.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.XCLIPModel.get_video_features.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail.`,name:"output_hidden_states"},{anchor:"transformers.XCLIPModel.get_video_features.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/pr_29693/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/vr_29693/src/transformers/models/x_clip/modeling_x_clip.py#L1332",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>The video embeddings obtained by
applying the projection layer to the pooled output of <a
  href="/docs/transformers/pr_29693/en/model_doc/xclip#transformers.XCLIPVisionModel"
>XCLIPVisionModel</a> and
<code>XCLIPMultiframeIntegrationTransformer</code>.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p>video_features (<code>torch.FloatTensor</code> of shape <code>(batch_size, output_dim</code>)</p>
`}}),oe=new Mt({props:{$$slots:{default:[yn]},$$scope:{ctx:b}}}),re=new De({props:{anchor:"transformers.XCLIPModel.get_video_features.example",$$slots:{default:[Tn]},$$scope:{ctx:b}}}),ze=new E({props:{title:"XCLIPTextModel",local:"transformers.XCLIPTextModel",headingTag:"h2"}}),Ae=new v({props:{name:"class transformers.XCLIPTextModel",anchor:"transformers.XCLIPTextModel",parameters:[{name:"config",val:": XCLIPTextConfig"}],source:"https://github.com/huggingface/transformers/blob/vr_29693/src/transformers/models/x_clip/modeling_x_clip.py#L785"}}),Re=new v({props:{name:"forward",anchor:"transformers.XCLIPTextModel.forward",parameters:[{name:"input_ids",val:": Optional = None"},{name:"attention_mask",val:": Optional = None"},{name:"position_ids",val:": Optional = None"},{name:"output_attentions",val:": Optional = None"},{name:"output_hidden_states",val:": Optional = None"},{name:"return_dict",val:": Optional = None"}],parametersDescription:[{anchor:"transformers.XCLIPTextModel.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/pr_29693/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/pr_29693/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/pr_29693/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.XCLIPTextModel.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.XCLIPTextModel.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.XCLIPTextModel.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.XCLIPTextModel.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.XCLIPTextModel.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/pr_29693/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/vr_29693/src/transformers/models/x_clip/modeling_x_clip.py#L800",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <a
  href="/docs/transformers/pr_29693/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPooling"
>transformers.modeling_outputs.BaseModelOutputWithPooling</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<code>&lt;class 'transformers.models.x_clip.configuration_x_clip.XCLIPTextConfig'&gt;</code>) and inputs.</p>
<ul>
<li>
<p><strong>last_hidden_state</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>) — Sequence of hidden-states at the output of the last layer of the model.</p>
</li>
<li>
<p><strong>pooler_output</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, hidden_size)</code>) — Last layer hidden-state of the first token of the sequence (classification token) after further processing
through the layers used for the auxiliary pretraining task. E.g. for BERT-family of models, this returns
the classification token after processing through a linear layer and a tanh activation function. The linear
layer weights are trained from the next sentence prediction (classification) objective during pretraining.</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) — Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, +
one for the output of each layer) of shape <code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) — Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><a
  href="/docs/transformers/pr_29693/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPooling"
>transformers.modeling_outputs.BaseModelOutputWithPooling</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),le=new Mt({props:{$$slots:{default:[wn]},$$scope:{ctx:b}}}),ie=new De({props:{anchor:"transformers.XCLIPTextModel.forward.example",$$slots:{default:[jn]},$$scope:{ctx:b}}}),Ne=new E({props:{title:"XCLIPVisionModel",local:"transformers.XCLIPVisionModel",headingTag:"h2"}}),Ye=new v({props:{name:"class transformers.XCLIPVisionModel",anchor:"transformers.XCLIPVisionModel",parameters:[{name:"config",val:": XCLIPVisionConfig"}],source:"https://github.com/huggingface/transformers/blob/vr_29693/src/transformers/models/x_clip/modeling_x_clip.py#L994"}}),Qe=new v({props:{name:"forward",anchor:"transformers.XCLIPVisionModel.forward",parameters:[{name:"pixel_values",val:": Optional = None"},{name:"output_attentions",val:": Optional = None"},{name:"output_hidden_states",val:": Optional = None"},{name:"return_dict",val:": Optional = None"}],parametersDescription:[{anchor:"transformers.XCLIPVisionModel.forward.pixel_values",description:`<strong>pixel_values</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
Pixel values. Padding will be ignored by default should you provide it. Pixel values can be obtained using
<a href="/docs/transformers/pr_29693/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <a href="/docs/transformers/pr_29693/en/model_doc/perceiver#transformers.PerceiverFeatureExtractor.__call__">CLIPImageProcessor.<strong>call</strong>()</a> for details.`,name:"pixel_values"},{anchor:"transformers.XCLIPVisionModel.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.XCLIPVisionModel.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.XCLIPVisionModel.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/pr_29693/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/vr_29693/src/transformers/models/x_clip/modeling_x_clip.py#L1007",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <a
  href="/docs/transformers/pr_29693/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPooling"
>transformers.modeling_outputs.BaseModelOutputWithPooling</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<code>&lt;class 'transformers.models.x_clip.configuration_x_clip.XCLIPVisionConfig'&gt;</code>) and inputs.</p>
<ul>
<li>
<p><strong>last_hidden_state</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>) — Sequence of hidden-states at the output of the last layer of the model.</p>
</li>
<li>
<p><strong>pooler_output</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, hidden_size)</code>) — Last layer hidden-state of the first token of the sequence (classification token) after further processing
through the layers used for the auxiliary pretraining task. E.g. for BERT-family of models, this returns
the classification token after processing through a linear layer and a tanh activation function. The linear
layer weights are trained from the next sentence prediction (classification) objective during pretraining.</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) — Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, +
one for the output of each layer) of shape <code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) — Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><a
  href="/docs/transformers/pr_29693/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPooling"
>transformers.modeling_outputs.BaseModelOutputWithPooling</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),ce=new Mt({props:{$$slots:{default:[bn]},$$scope:{ctx:b}}}),pe=new De({props:{anchor:"transformers.XCLIPVisionModel.forward.example",$$slots:{default:[Jn]},$$scope:{ctx:b}}}),Ee=new mn({props:{source:"https://github.com/huggingface/transformers/blob/main/docs/source/en/model_doc/xclip.md"}}),{c(){s=d("meta"),T=o(),l=d("p"),i=o(),h(y.$$.fragment),t=o(),h(j.$$.fragment),_t=o(),he=d("p"),he.innerHTML=Zs,yt=o(),fe=d("p"),fe.textContent=Bs,Tt=o(),ue=d("p"),ue.innerHTML=Ws,wt=o(),ge=d("p"),ge.textContent=ks,jt=o(),Me=d("ul"),Me.innerHTML=$s,bt=o(),H=d("img"),Jt=o(),_e=d("small"),_e.innerHTML=Ps,Ct=o(),ye=d("p"),ye.innerHTML=Vs,It=o(),h(Te.$$.fragment),Ut=o(),we=d("p"),we.textContent=Ls,vt=o(),je=d("ul"),je.innerHTML=zs,xt=o(),be=d("p"),be.textContent=As,Xt=o(),h(Je.$$.fragment),Zt=o(),I=d("div"),h(Ce.$$.fragment),St=o(),Oe=d("p"),Oe.textContent=Rs,Ht=o(),et=d("p"),et.innerHTML=Ns,qt=o(),q=d("div"),h(Ie.$$.fragment),Dt=o(),tt=d("p"),tt.innerHTML=Ys,Kt=o(),D=d("div"),h(Ue.$$.fragment),Ot=o(),st=d("p"),st.innerHTML=Qs,Bt=o(),h(ve.$$.fragment),Wt=o(),x=d("div"),h(xe.$$.fragment),es=o(),nt=d("p"),nt.innerHTML=Es,ts=o(),at=d("p"),at.innerHTML=Fs,ss=o(),K=d("div"),h(Xe.$$.fragment),ns=o(),ot=d("p"),ot.innerHTML=Ss,kt=o(),h(Ze.$$.fragment),$t=o(),X=d("div"),h(Be.$$.fragment),as=o(),rt=d("p"),rt.innerHTML=Hs,os=o(),lt=d("p"),lt.innerHTML=qs,rs=o(),h(O.$$.fragment),Gt=o(),h(We.$$.fragment),Pt=o(),Z=d("div"),h(ke.$$.fragment),ls=o(),it=d("p"),it.innerHTML=Ds,is=o(),ct=d("p"),ct.innerHTML=Ks,cs=o(),h(ee.$$.fragment),Vt=o(),h($e.$$.fragment),Lt=o(),U=d("div"),h(Ge.$$.fragment),ps=o(),pt=d("p"),pt.innerHTML=Os,ds=o(),k=d("div"),h(Pe.$$.fragment),ms=o(),dt=d("p"),dt.innerHTML=en,hs=o(),h(te.$$.fragment),fs=o(),h(se.$$.fragment),us=o(),$=d("div"),h(Ve.$$.fragment),gs=o(),mt=d("p"),mt.innerHTML=tn,Ms=o(),h(ne.$$.fragment),_s=o(),h(ae.$$.fragment),ys=o(),G=d("div"),h(Le.$$.fragment),Ts=o(),ht=d("p"),ht.innerHTML=sn,ws=o(),h(oe.$$.fragment),js=o(),h(re.$$.fragment),zt=o(),h(ze.$$.fragment),At=o(),F=d("div"),h(Ae.$$.fragment),bs=o(),P=d("div"),h(Re.$$.fragment),Js=o(),ft=d("p"),ft.innerHTML=nn,Cs=o(),h(le.$$.fragment),Is=o(),h(ie.$$.fragment),Rt=o(),h(Ne.$$.fragment),Nt=o(),S=d("div"),h(Ye.$$.fragment),Us=o(),V=d("div"),h(Qe.$$.fragment),vs=o(),ut=d("p"),ut.innerHTML=an,xs=o(),h(ce.$$.fragment),Xs=o(),h(pe.$$.fragment),Yt=o(),h(Ee.$$.fragment),Qt=o(),gt=d("p"),this.h()},l(e){const n=dn("svelte-u9bgzb",document.head);s=m(n,"META",{name:!0,content:!0}),n.forEach(a),T=r(e),l=m(e,"P",{}),C(l).forEach(a),i=r(e),f(y.$$.fragment,e),t=r(e),f(j.$$.fragment,e),_t=r(e),he=m(e,"P",{"data-svelte-h":!0}),w(he)!=="svelte-6enh90"&&(he.innerHTML=Zs),yt=r(e),fe=m(e,"P",{"data-svelte-h":!0}),w(fe)!=="svelte-vfdo9a"&&(fe.textContent=Bs),Tt=r(e),ue=m(e,"P",{"data-svelte-h":!0}),w(ue)!=="svelte-1lxzml7"&&(ue.innerHTML=Ws),wt=r(e),ge=m(e,"P",{"data-svelte-h":!0}),w(ge)!=="svelte-axv494"&&(ge.textContent=ks),jt=r(e),Me=m(e,"UL",{"data-svelte-h":!0}),w(Me)!=="svelte-165fpm9"&&(Me.innerHTML=$s),bt=r(e),H=m(e,"IMG",{src:!0,alt:!0,width:!0}),Jt=r(e),_e=m(e,"SMALL",{"data-svelte-h":!0}),w(_e)!=="svelte-1x5olh0"&&(_e.innerHTML=Ps),Ct=r(e),ye=m(e,"P",{"data-svelte-h":!0}),w(ye)!=="svelte-4a2p64"&&(ye.innerHTML=Vs),It=r(e),f(Te.$$.fragment,e),Ut=r(e),we=m(e,"P",{"data-svelte-h":!0}),w(we)!=="svelte-6o9lse"&&(we.textContent=Ls),vt=r(e),je=m(e,"UL",{"data-svelte-h":!0}),w(je)!=="svelte-17fq4se"&&(je.innerHTML=zs),xt=r(e),be=m(e,"P",{"data-svelte-h":!0}),w(be)!=="svelte-1xesile"&&(be.textContent=As),Xt=r(e),f(Je.$$.fragment,e),Zt=r(e),I=m(e,"DIV",{class:!0});var B=C(I);f(Ce.$$.fragment,B),St=r(B),Oe=m(B,"P",{"data-svelte-h":!0}),w(Oe)!=="svelte-75agku"&&(Oe.textContent=Rs),Ht=r(B),et=m(B,"P",{"data-svelte-h":!0}),w(et)!=="svelte-13dkuqa"&&(et.innerHTML=Ns),qt=r(B),q=m(B,"DIV",{class:!0});var Fe=C(q);f(Ie.$$.fragment,Fe),Dt=r(Fe),tt=m(Fe,"P",{"data-svelte-h":!0}),w(tt)!=="svelte-dvwxgy"&&(tt.innerHTML=Ys),Fe.forEach(a),Kt=r(B),D=m(B,"DIV",{class:!0});var Se=C(D);f(Ue.$$.fragment,Se),Ot=r(Se),st=m(Se,"P",{"data-svelte-h":!0}),w(st)!=="svelte-1vdhupo"&&(st.innerHTML=Qs),Se.forEach(a),B.forEach(a),Bt=r(e),f(ve.$$.fragment,e),Wt=r(e),x=m(e,"DIV",{class:!0});var z=C(x);f(xe.$$.fragment,z),es=r(z),nt=m(z,"P",{"data-svelte-h":!0}),w(nt)!=="svelte-1w1swvi"&&(nt.innerHTML=Es),ts=r(z),at=m(z,"P",{"data-svelte-h":!0}),w(at)!=="svelte-jtolpf"&&(at.innerHTML=Fs),ss=r(z),K=m(z,"DIV",{class:!0});var He=C(K);f(Xe.$$.fragment,He),ns=r(He),ot=m(He,"P",{"data-svelte-h":!0}),w(ot)!=="svelte-1gcp6i1"&&(ot.innerHTML=Ss),He.forEach(a),z.forEach(a),kt=r(e),f(Ze.$$.fragment,e),$t=r(e),X=m(e,"DIV",{class:!0});var A=C(X);f(Be.$$.fragment,A),as=r(A),rt=m(A,"P",{"data-svelte-h":!0}),w(rt)!=="svelte-1teuukm"&&(rt.innerHTML=Hs),os=r(A),lt=m(A,"P",{"data-svelte-h":!0}),w(lt)!=="svelte-jtolpf"&&(lt.innerHTML=qs),rs=r(A),f(O.$$.fragment,A),A.forEach(a),Gt=r(e),f(We.$$.fragment,e),Pt=r(e),Z=m(e,"DIV",{class:!0});var R=C(Z);f(ke.$$.fragment,R),ls=r(R),it=m(R,"P",{"data-svelte-h":!0}),w(it)!=="svelte-1teuukm"&&(it.innerHTML=Ds),is=r(R),ct=m(R,"P",{"data-svelte-h":!0}),w(ct)!=="svelte-jtolpf"&&(ct.innerHTML=Ks),cs=r(R),f(ee.$$.fragment,R),R.forEach(a),Vt=r(e),f($e.$$.fragment,e),Lt=r(e),U=m(e,"DIV",{class:!0});var W=C(U);f(Ge.$$.fragment,W),ps=r(W),pt=m(W,"P",{"data-svelte-h":!0}),w(pt)!=="svelte-1gjh92c"&&(pt.innerHTML=Os),ds=r(W),k=m(W,"DIV",{class:!0});var N=C(k);f(Pe.$$.fragment,N),ms=r(N),dt=m(N,"P",{"data-svelte-h":!0}),w(dt)!=="svelte-yg2lyk"&&(dt.innerHTML=en),hs=r(N),f(te.$$.fragment,N),fs=r(N),f(se.$$.fragment,N),N.forEach(a),us=r(W),$=m(W,"DIV",{class:!0});var Y=C($);f(Ve.$$.fragment,Y),gs=r(Y),mt=m(Y,"P",{"data-svelte-h":!0}),w(mt)!=="svelte-yg2lyk"&&(mt.innerHTML=tn),Ms=r(Y),f(ne.$$.fragment,Y),_s=r(Y),f(ae.$$.fragment,Y),Y.forEach(a),ys=r(W),G=m(W,"DIV",{class:!0});var Q=C(G);f(Le.$$.fragment,Q),Ts=r(Q),ht=m(Q,"P",{"data-svelte-h":!0}),w(ht)!=="svelte-yg2lyk"&&(ht.innerHTML=sn),ws=r(Q),f(oe.$$.fragment,Q),js=r(Q),f(re.$$.fragment,Q),Q.forEach(a),W.forEach(a),zt=r(e),f(ze.$$.fragment,e),At=r(e),F=m(e,"DIV",{class:!0});var qe=C(F);f(Ae.$$.fragment,qe),bs=r(qe),P=m(qe,"DIV",{class:!0});var de=C(P);f(Re.$$.fragment,de),Js=r(de),ft=m(de,"P",{"data-svelte-h":!0}),w(ft)!=="svelte-1ew93pa"&&(ft.innerHTML=nn),Cs=r(de),f(le.$$.fragment,de),Is=r(de),f(ie.$$.fragment,de),de.forEach(a),qe.forEach(a),Rt=r(e),f(Ne.$$.fragment,e),Nt=r(e),S=m(e,"DIV",{class:!0});var Ft=C(S);f(Ye.$$.fragment,Ft),Us=r(Ft),V=m(Ft,"DIV",{class:!0});var me=C(V);f(Qe.$$.fragment,me),vs=r(me),ut=m(me,"P",{"data-svelte-h":!0}),w(ut)!=="svelte-wp17w8"&&(ut.innerHTML=an),xs=r(me),f(ce.$$.fragment,me),Xs=r(me),f(pe.$$.fragment,me),me.forEach(a),Ft.forEach(a),Yt=r(e),f(Ee.$$.fragment,e),Qt=r(e),gt=m(e,"P",{}),C(gt).forEach(a),this.h()},h(){J(s,"name","hf:doc:metadata"),J(s,"content",In),rn(H.src,Gs="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/model_doc/xclip_architecture.png")||J(H,"src",Gs),J(H,"alt","drawing"),J(H,"width","600"),J(q,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),J(D,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),J(I,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),J(K,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),J(x,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),J(X,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),J(Z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),J(k,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),J($,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),J(G,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),J(U,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),J(P,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),J(F,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),J(V,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),J(S,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(e,n){p(document.head,s),c(e,T,n),c(e,l,n),c(e,i,n),u(y,e,n),c(e,t,n),u(j,e,n),c(e,_t,n),c(e,he,n),c(e,yt,n),c(e,fe,n),c(e,Tt,n),c(e,ue,n),c(e,wt,n),c(e,ge,n),c(e,jt,n),c(e,Me,n),c(e,bt,n),c(e,H,n),c(e,Jt,n),c(e,_e,n),c(e,Ct,n),c(e,ye,n),c(e,It,n),u(Te,e,n),c(e,Ut,n),c(e,we,n),c(e,vt,n),c(e,je,n),c(e,xt,n),c(e,be,n),c(e,Xt,n),u(Je,e,n),c(e,Zt,n),c(e,I,n),u(Ce,I,null),p(I,St),p(I,Oe),p(I,Ht),p(I,et),p(I,qt),p(I,q),u(Ie,q,null),p(q,Dt),p(q,tt),p(I,Kt),p(I,D),u(Ue,D,null),p(D,Ot),p(D,st),c(e,Bt,n),u(ve,e,n),c(e,Wt,n),c(e,x,n),u(xe,x,null),p(x,es),p(x,nt),p(x,ts),p(x,at),p(x,ss),p(x,K),u(Xe,K,null),p(K,ns),p(K,ot),c(e,kt,n),u(Ze,e,n),c(e,$t,n),c(e,X,n),u(Be,X,null),p(X,as),p(X,rt),p(X,os),p(X,lt),p(X,rs),u(O,X,null),c(e,Gt,n),u(We,e,n),c(e,Pt,n),c(e,Z,n),u(ke,Z,null),p(Z,ls),p(Z,it),p(Z,is),p(Z,ct),p(Z,cs),u(ee,Z,null),c(e,Vt,n),u($e,e,n),c(e,Lt,n),c(e,U,n),u(Ge,U,null),p(U,ps),p(U,pt),p(U,ds),p(U,k),u(Pe,k,null),p(k,ms),p(k,dt),p(k,hs),u(te,k,null),p(k,fs),u(se,k,null),p(U,us),p(U,$),u(Ve,$,null),p($,gs),p($,mt),p($,Ms),u(ne,$,null),p($,_s),u(ae,$,null),p(U,ys),p(U,G),u(Le,G,null),p(G,Ts),p(G,ht),p(G,ws),u(oe,G,null),p(G,js),u(re,G,null),c(e,zt,n),u(ze,e,n),c(e,At,n),c(e,F,n),u(Ae,F,null),p(F,bs),p(F,P),u(Re,P,null),p(P,Js),p(P,ft),p(P,Cs),u(le,P,null),p(P,Is),u(ie,P,null),c(e,Rt,n),u(Ne,e,n),c(e,Nt,n),c(e,S,n),u(Ye,S,null),p(S,Us),p(S,V),u(Qe,V,null),p(V,vs),p(V,ut),p(V,xs),u(ce,V,null),p(V,Xs),u(pe,V,null),c(e,Yt,n),u(Ee,e,n),c(e,Qt,n),c(e,gt,n),Et=!0},p(e,[n]){const B={};n&2&&(B.$$scope={dirty:n,ctx:e}),O.$set(B);const Fe={};n&2&&(Fe.$$scope={dirty:n,ctx:e}),ee.$set(Fe);const Se={};n&2&&(Se.$$scope={dirty:n,ctx:e}),te.$set(Se);const z={};n&2&&(z.$$scope={dirty:n,ctx:e}),se.$set(z);const He={};n&2&&(He.$$scope={dirty:n,ctx:e}),ne.$set(He);const A={};n&2&&(A.$$scope={dirty:n,ctx:e}),ae.$set(A);const R={};n&2&&(R.$$scope={dirty:n,ctx:e}),oe.$set(R);const W={};n&2&&(W.$$scope={dirty:n,ctx:e}),re.$set(W);const N={};n&2&&(N.$$scope={dirty:n,ctx:e}),le.$set(N);const Y={};n&2&&(Y.$$scope={dirty:n,ctx:e}),ie.$set(Y);const Q={};n&2&&(Q.$$scope={dirty:n,ctx:e}),ce.$set(Q);const qe={};n&2&&(qe.$$scope={dirty:n,ctx:e}),pe.$set(qe)},i(e){Et||(g(y.$$.fragment,e),g(j.$$.fragment,e),g(Te.$$.fragment,e),g(Je.$$.fragment,e),g(Ce.$$.fragment,e),g(Ie.$$.fragment,e),g(Ue.$$.fragment,e),g(ve.$$.fragment,e),g(xe.$$.fragment,e),g(Xe.$$.fragment,e),g(Ze.$$.fragment,e),g(Be.$$.fragment,e),g(O.$$.fragment,e),g(We.$$.fragment,e),g(ke.$$.fragment,e),g(ee.$$.fragment,e),g($e.$$.fragment,e),g(Ge.$$.fragment,e),g(Pe.$$.fragment,e),g(te.$$.fragment,e),g(se.$$.fragment,e),g(Ve.$$.fragment,e),g(ne.$$.fragment,e),g(ae.$$.fragment,e),g(Le.$$.fragment,e),g(oe.$$.fragment,e),g(re.$$.fragment,e),g(ze.$$.fragment,e),g(Ae.$$.fragment,e),g(Re.$$.fragment,e),g(le.$$.fragment,e),g(ie.$$.fragment,e),g(Ne.$$.fragment,e),g(Ye.$$.fragment,e),g(Qe.$$.fragment,e),g(ce.$$.fragment,e),g(pe.$$.fragment,e),g(Ee.$$.fragment,e),Et=!0)},o(e){M(y.$$.fragment,e),M(j.$$.fragment,e),M(Te.$$.fragment,e),M(Je.$$.fragment,e),M(Ce.$$.fragment,e),M(Ie.$$.fragment,e),M(Ue.$$.fragment,e),M(ve.$$.fragment,e),M(xe.$$.fragment,e),M(Xe.$$.fragment,e),M(Ze.$$.fragment,e),M(Be.$$.fragment,e),M(O.$$.fragment,e),M(We.$$.fragment,e),M(ke.$$.fragment,e),M(ee.$$.fragment,e),M($e.$$.fragment,e),M(Ge.$$.fragment,e),M(Pe.$$.fragment,e),M(te.$$.fragment,e),M(se.$$.fragment,e),M(Ve.$$.fragment,e),M(ne.$$.fragment,e),M(ae.$$.fragment,e),M(Le.$$.fragment,e),M(oe.$$.fragment,e),M(re.$$.fragment,e),M(ze.$$.fragment,e),M(Ae.$$.fragment,e),M(Re.$$.fragment,e),M(le.$$.fragment,e),M(ie.$$.fragment,e),M(Ne.$$.fragment,e),M(Ye.$$.fragment,e),M(Qe.$$.fragment,e),M(ce.$$.fragment,e),M(pe.$$.fragment,e),M(Ee.$$.fragment,e),Et=!1},d(e){e&&(a(T),a(l),a(i),a(t),a(_t),a(he),a(yt),a(fe),a(Tt),a(ue),a(wt),a(ge),a(jt),a(Me),a(bt),a(H),a(Jt),a(_e),a(Ct),a(ye),a(It),a(Ut),a(we),a(vt),a(je),a(xt),a(be),a(Xt),a(Zt),a(I),a(Bt),a(Wt),a(x),a(kt),a($t),a(X),a(Gt),a(Pt),a(Z),a(Vt),a(Lt),a(U),a(zt),a(At),a(F),a(Rt),a(Nt),a(S),a(Yt),a(Qt),a(gt)),a(s),_(y,e),_(j,e),_(Te,e),_(Je,e),_(Ce),_(Ie),_(Ue),_(ve,e),_(xe),_(Xe),_(Ze,e),_(Be),_(O),_(We,e),_(ke),_(ee),_($e,e),_(Ge),_(Pe),_(te),_(se),_(Ve),_(ne),_(ae),_(Le),_(oe),_(re),_(ze,e),_(Ae),_(Re),_(le),_(ie),_(Ne,e),_(Ye),_(Qe),_(ce),_(pe),_(Ee,e)}}}const In='{"title":"X-CLIP","local":"x-clip","sections":[{"title":"Overview","local":"overview","sections":[],"depth":2},{"title":"Resources","local":"resources","sections":[],"depth":2},{"title":"XCLIPProcessor","local":"transformers.XCLIPProcessor","sections":[],"depth":2},{"title":"XCLIPConfig","local":"transformers.XCLIPConfig","sections":[],"depth":2},{"title":"XCLIPTextConfig","local":"transformers.XCLIPTextConfig","sections":[],"depth":2},{"title":"XCLIPVisionConfig","local":"transformers.XCLIPVisionConfig","sections":[],"depth":2},{"title":"XCLIPModel","local":"transformers.XCLIPModel","sections":[],"depth":2},{"title":"XCLIPTextModel","local":"transformers.XCLIPTextModel","sections":[],"depth":2},{"title":"XCLIPVisionModel","local":"transformers.XCLIPVisionModel","sections":[],"depth":2}],"depth":1}';function Un(b){return ln(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class $n extends cn{constructor(s){super(),pn(this,s,Un,Cn,on,{})}}export{$n as component};
