import{S as _i,i as yi,s as wi,e as o,k as f,w,t as l,M as bi,c as a,d as s,m as u,a as r,x as b,h as i,b as d,N as ji,G as e,g,y as j,q as C,o as v,B as T,v as Ci,L as Et}from"../../chunks/vendor-hf-doc-builder.js";import{T as dn}from"../../chunks/Tip-hf-doc-builder.js";import{D as x}from"../../chunks/Docstring-hf-doc-builder.js";import{C as Lt}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as F}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as Wt}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";function vi(I){let c,y,M,m,_;return m=new Lt({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`}}),{c(){c=o("p"),y=l("Example:"),M=f(),w(m.$$.fragment)},l(n){c=a(n,"P",{});var p=r(c);y=i(p,"Example:"),p.forEach(s),M=u(n),b(m.$$.fragment,n)},m(n,p){g(n,c,p),e(c,y),g(n,M,p),j(m,n,p),_=!0},p:Et,i(n){_||(C(m.$$.fragment,n),_=!0)},o(n){v(m.$$.fragment,n),_=!1},d(n){n&&s(c),n&&s(M),T(m,n)}}}function Ti(I){let c,y,M,m,_;return m=new Lt({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`}}),{c(){c=o("p"),y=l("Example:"),M=f(),w(m.$$.fragment)},l(n){c=a(n,"P",{});var p=r(c);y=i(p,"Example:"),p.forEach(s),M=u(n),b(m.$$.fragment,n)},m(n,p){g(n,c,p),e(c,y),g(n,M,p),j(m,n,p),_=!0},p:Et,i(n){_||(C(m.$$.fragment,n),_=!0)},o(n){v(m.$$.fragment,n),_=!1},d(n){n&&s(c),n&&s(M),T(m,n)}}}function Ii(I){let c,y,M,m,_;return{c(){c=o("p"),y=l("Although the recipe for forward pass needs to be defined within this function, one should call the "),M=o("code"),m=l("Module"),_=l(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(n){c=a(n,"P",{});var p=r(c);y=i(p,"Although the recipe for forward pass needs to be defined within this function, one should call the "),M=a(p,"CODE",{});var U=r(M);m=i(U,"Module"),U.forEach(s),_=i(p,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),p.forEach(s)},m(n,p){g(n,c,p),e(c,y),e(c,M),e(M,m),e(c,_)},d(n){n&&s(c)}}}function Ui(I){let c,y,M,m,_;return m=new Lt({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>    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>]])`}}),{c(){c=o("p"),y=l("Examples:"),M=f(),w(m.$$.fragment)},l(n){c=a(n,"P",{});var p=r(c);y=i(p,"Examples:"),p.forEach(s),M=u(n),b(m.$$.fragment,n)},m(n,p){g(n,c,p),e(c,y),g(n,M,p),j(m,n,p),_=!0},p:Et,i(n){_||(C(m.$$.fragment,n),_=!0)},o(n){v(m.$$.fragment,n),_=!1},d(n){n&&s(c),n&&s(M),T(m,n)}}}function Ji(I){let c,y,M,m,_;return{c(){c=o("p"),y=l("Although the recipe for forward pass needs to be defined within this function, one should call the "),M=o("code"),m=l("Module"),_=l(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(n){c=a(n,"P",{});var p=r(c);y=i(p,"Although the recipe for forward pass needs to be defined within this function, one should call the "),M=a(p,"CODE",{});var U=r(M);m=i(U,"Module"),U.forEach(s),_=i(p,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),p.forEach(s)},m(n,p){g(n,c,p),e(c,y),e(c,M),e(M,m),e(c,_)},d(n){n&&s(c)}}}function Xi(I){let c,y,M,m,_;return m=new Lt({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)`}}),{c(){c=o("p"),y=l("Examples:"),M=f(),w(m.$$.fragment)},l(n){c=a(n,"P",{});var p=r(c);y=i(p,"Examples:"),p.forEach(s),M=u(n),b(m.$$.fragment,n)},m(n,p){g(n,c,p),e(c,y),g(n,M,p),j(m,n,p),_=!0},p:Et,i(n){_||(C(m.$$.fragment,n),_=!0)},o(n){v(m.$$.fragment,n),_=!1},d(n){n&&s(c),n&&s(M),T(m,n)}}}function xi(I){let c,y,M,m,_;return{c(){c=o("p"),y=l("Although the recipe for forward pass needs to be defined within this function, one should call the "),M=o("code"),m=l("Module"),_=l(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(n){c=a(n,"P",{});var p=r(c);y=i(p,"Although the recipe for forward pass needs to be defined within this function, one should call the "),M=a(p,"CODE",{});var U=r(M);m=i(U,"Module"),U.forEach(s),_=i(p,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),p.forEach(s)},m(n,p){g(n,c,p),e(c,y),e(c,M),e(M,m),e(c,_)},d(n){n&&s(c)}}}function ki(I){let c,y,M,m,_;return m=new Lt({props:{code:"aW1wb3J0JTIwYXYlMEFpbXBvcnQlMjB0b3JjaCUwQWltcG9ydCUyMG51bXB5JTIwYXMlMjBucCUwQSUwQWZyb20lMjB0cmFuc2Zvcm1lcnMlMjBpbXBvcnQlMjBBdXRvUHJvY2Vzc29yJTJDJTIwQXV0b01vZGVsJTBBZnJvbSUyMGh1Z2dpbmdmYWNlX2h1YiUyMGltcG9ydCUyMGhmX2h1Yl9kb3dubG9hZCUwQSUwQW5wLnJhbmRvbS5zZWVkKDApJTBBJTBBJTBBZGVmJTIwcmVhZF92aWRlb19weWF2KGNvbnRhaW5lciUyQyUyMGluZGljZXMpJTNBJTBBJTIwJTIwJTIwJTIwJycnJTBBJTIwJTIwJTIwJTIwRGVjb2RlJTIwdGhlJTIwdmlkZW8lMjB3aXRoJTIwUHlBViUyMGRlY29kZXIuJTBBJTIwJTIwJTIwJTIwQXJncyUzQSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGNvbnRhaW5lciUyMCglNjBhdi5jb250YWluZXIuaW5wdXQuSW5wdXRDb250YWluZXIlNjApJTNBJTIwUHlBViUyMGNvbnRhaW5lci4lMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBpbmRpY2VzJTIwKCU2MExpc3QlNUJpbnQlNUQlNjApJTNBJTIwTGlzdCUyMG9mJTIwZnJhbWUlMjBpbmRpY2VzJTIwdG8lMjBkZWNvZGUuJTBBJTIwJTIwJTIwJTIwUmV0dXJucyUzQSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMHJlc3VsdCUyMChucC5uZGFycmF5KSUzQSUyMG5wJTIwYXJyYXklMjBvZiUyMGRlY29kZWQlMjBmcmFtZXMlMjBvZiUyMHNoYXBlJTIwKG51bV9mcmFtZXMlMkMlMjBoZWlnaHQlMkMlMjB3aWR0aCUyQyUyMDMpLiUwQSUyMCUyMCUyMCUyMCcnJyUwQSUyMCUyMCUyMCUyMGZyYW1lcyUyMCUzRCUyMCU1QiU1RCUwQSUyMCUyMCUyMCUyMGNvbnRhaW5lci5zZWVrKDApJTBBJTIwJTIwJTIwJTIwc3RhcnRfaW5kZXglMjAlM0QlMjBpbmRpY2VzJTVCMCU1RCUwQSUyMCUyMCUyMCUyMGVuZF9pbmRleCUyMCUzRCUyMGluZGljZXMlNUItMSU1RCUwQSUyMCUyMCUyMCUyMGZvciUyMGklMkMlMjBmcmFtZSUyMGluJTIwZW51bWVyYXRlKGNvbnRhaW5lci5kZWNvZGUodmlkZW8lM0QwKSklM0ElMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBpZiUyMGklMjAlM0UlMjBlbmRfaW5kZXglM0ElMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBicmVhayUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGlmJTIwaSUyMCUzRSUzRCUyMHN0YXJ0X2luZGV4JTIwYW5kJTIwaSUyMGluJTIwaW5kaWNlcyUzQSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGZyYW1lcy5hcHBlbmQoZnJhbWUpJTBBJTIwJTIwJTIwJTIwcmV0dXJuJTIwbnAuc3RhY2soJTVCeC50b19uZGFycmF5KGZvcm1hdCUzRCUyMnJnYjI0JTIyKSUyMGZvciUyMHglMjBpbiUyMGZyYW1lcyU1RCklMEElMEElMEFkZWYlMjBzYW1wbGVfZnJhbWVfaW5kaWNlcyhjbGlwX2xlbiUyQyUyMGZyYW1lX3NhbXBsZV9yYXRlJTJDJTIwc2VnX2xlbiklM0ElMEElMjAlMjAlMjAlMjBjb252ZXJ0ZWRfbGVuJTIwJTNEJTIwaW50KGNsaXBfbGVuJTIwKiUyMGZyYW1lX3NhbXBsZV9yYXRlKSUwQSUyMCUyMCUyMCUyMGVuZF9pZHglMjAlM0QlMjBucC5yYW5kb20ucmFuZGludChjb252ZXJ0ZWRfbGVuJTJDJTIwc2VnX2xlbiklMEElMjAlMjAlMjAlMjBzdGFydF9pZHglMjAlM0QlMjBlbmRfaWR4JTIwLSUyMGNvbnZlcnRlZF9sZW4lMEElMjAlMjAlMjAlMjBpbmRpY2VzJTIwJTNEJTIwbnAubGluc3BhY2Uoc3RhcnRfaWR4JTJDJTIwZW5kX2lkeCUyQyUyMG51bSUzRGNsaXBfbGVuKSUwQSUyMCUyMCUyMCUyMGluZGljZXMlMjAlM0QlMjBucC5jbGlwKGluZGljZXMlMkMlMjBzdGFydF9pZHglMkMlMjBlbmRfaWR4JTIwLSUyMDEpLmFzdHlwZShucC5pbnQ2NCklMEElMjAlMjAlMjAlMjByZXR1cm4lMjBpbmRpY2VzJTBBJTBBJTBBJTIzJTIwdmlkZW8lMjBjbGlwJTIwY29uc2lzdHMlMjBvZiUyMDMwMCUyMGZyYW1lcyUyMCgxMCUyMHNlY29uZHMlMjBhdCUyMDMwJTIwRlBTKSUwQWZpbGVfcGF0aCUyMCUzRCUyMGhmX2h1Yl9kb3dubG9hZCglMEElMjAlMjAlMjAlMjByZXBvX2lkJTNEJTIybmllbHNyJTJGdmlkZW8tZGVtbyUyMiUyQyUyMGZpbGVuYW1lJTNEJTIyZWF0aW5nX3NwYWdoZXR0aS5tcDQlMjIlMkMlMjByZXBvX3R5cGUlM0QlMjJkYXRhc2V0JTIyJTBBKSUwQWNvbnRhaW5lciUyMCUzRCUyMGF2Lm9wZW4oZmlsZV9wYXRoKSUwQSUwQSUyMyUyMHNhbXBsZSUyMDglMjBmcmFtZXMlMEFpbmRpY2VzJTIwJTNEJTIwc2FtcGxlX2ZyYW1lX2luZGljZXMoY2xpcF9sZW4lM0Q4JTJDJTIwZnJhbWVfc2FtcGxlX3JhdGUlM0QxJTJDJTIwc2VnX2xlbiUzRGNvbnRhaW5lci5zdHJlYW1zLnZpZGVvJTVCMCU1RC5mcmFtZXMpJTBBdmlkZW8lMjAlM0QlMjByZWFkX3ZpZGVvX3B5YXYoY29udGFpbmVyJTJDJTIwaW5kaWNlcyklMEElMEFwcm9jZXNzb3IlMjAlM0QlMjBBdXRvUHJvY2Vzc29yLmZyb21fcHJldHJhaW5lZCglMjJtaWNyb3NvZnQlMkZ4Y2xpcC1iYXNlLXBhdGNoMzIlMjIpJTBBbW9kZWwlMjAlM0QlMjBBdXRvTW9kZWwuZnJvbV9wcmV0cmFpbmVkKCUyMm1pY3Jvc29mdCUyRnhjbGlwLWJhc2UtcGF0Y2gzMiUyMiklMEElMEFpbnB1dHMlMjAlM0QlMjBwcm9jZXNzb3IodmlkZW9zJTNEbGlzdCh2aWRlbyklMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKSUwQSUwQXZpZGVvX2ZlYXR1cmVzJTIwJTNEJTIwbW9kZWwuZ2V0X3ZpZGVvX2ZlYXR1cmVzKCoqaW5wdXRzKQ==",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>    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)`}}),{c(){c=o("p"),y=l("Examples:"),M=f(),w(m.$$.fragment)},l(n){c=a(n,"P",{});var p=r(c);y=i(p,"Examples:"),p.forEach(s),M=u(n),b(m.$$.fragment,n)},m(n,p){g(n,c,p),e(c,y),g(n,M,p),j(m,n,p),_=!0},p:Et,i(n){_||(C(m.$$.fragment,n),_=!0)},o(n){v(m.$$.fragment,n),_=!1},d(n){n&&s(c),n&&s(M),T(m,n)}}}function Zi(I){let c,y,M,m,_;return{c(){c=o("p"),y=l("Although the recipe for forward pass needs to be defined within this function, one should call the "),M=o("code"),m=l("Module"),_=l(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(n){c=a(n,"P",{});var p=r(c);y=i(p,"Although the recipe for forward pass needs to be defined within this function, one should call the "),M=a(p,"CODE",{});var U=r(M);m=i(U,"Module"),U.forEach(s),_=i(p,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),p.forEach(s)},m(n,p){g(n,c,p),e(c,y),e(c,M),e(M,m),e(c,_)},d(n){n&&s(c)}}}function Pi(I){let c,y,M,m,_;return m=new Lt({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>`}}),{c(){c=o("p"),y=l("Examples:"),M=f(),w(m.$$.fragment)},l(n){c=a(n,"P",{});var p=r(c);y=i(p,"Examples:"),p.forEach(s),M=u(n),b(m.$$.fragment,n)},m(n,p){g(n,c,p),e(c,y),g(n,M,p),j(m,n,p),_=!0},p:Et,i(n){_||(C(m.$$.fragment,n),_=!0)},o(n){v(m.$$.fragment,n),_=!1},d(n){n&&s(c),n&&s(M),T(m,n)}}}function $i(I){let c,y,M,m,_;return{c(){c=o("p"),y=l("Although the recipe for forward pass needs to be defined within this function, one should call the "),M=o("code"),m=l("Module"),_=l(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(n){c=a(n,"P",{});var p=r(c);y=i(p,"Although the recipe for forward pass needs to be defined within this function, one should call the "),M=a(p,"CODE",{});var U=r(M);m=i(U,"Module"),U.forEach(s),_=i(p,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),p.forEach(s)},m(n,p){g(n,c,p),e(c,y),e(c,M),e(M,m),e(c,_)},d(n){n&&s(c)}}}function Bi(I){let c,y,M,m,_;return m=new Lt({props:{code:"aW1wb3J0JTIwYXYlMEFpbXBvcnQlMjB0b3JjaCUwQWltcG9ydCUyMG51bXB5JTIwYXMlMjBucCUwQSUwQWZyb20lMjB0cmFuc2Zvcm1lcnMlMjBpbXBvcnQlMjBBdXRvUHJvY2Vzc29yJTJDJTIwWENMSVBWaXNpb25Nb2RlbCUwQWZyb20lMjBodWdnaW5nZmFjZV9odWIlMjBpbXBvcnQlMjBoZl9odWJfZG93bmxvYWQlMEElMEFucC5yYW5kb20uc2VlZCgwKSUwQSUwQSUwQWRlZiUyMHJlYWRfdmlkZW9fcHlhdihjb250YWluZXIlMkMlMjBpbmRpY2VzKSUzQSUwQSUyMCUyMCUyMCUyMCcnJyUwQSUyMCUyMCUyMCUyMERlY29kZSUyMHRoZSUyMHZpZGVvJTIwd2l0aCUyMFB5QVYlMjBkZWNvZGVyLiUwQSUyMCUyMCUyMCUyMEFyZ3MlM0ElMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBjb250YWluZXIlMjAoJTYwYXYuY29udGFpbmVyLmlucHV0LklucHV0Q29udGFpbmVyJTYwKSUzQSUyMFB5QVYlMjBjb250YWluZXIuJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwaW5kaWNlcyUyMCglNjBMaXN0JTVCaW50JTVEJTYwKSUzQSUyMExpc3QlMjBvZiUyMGZyYW1lJTIwaW5kaWNlcyUyMHRvJTIwZGVjb2RlLiUwQSUyMCUyMCUyMCUyMFJldHVybnMlM0ElMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjByZXN1bHQlMjAobnAubmRhcnJheSklM0ElMjBucCUyMGFycmF5JTIwb2YlMjBkZWNvZGVkJTIwZnJhbWVzJTIwb2YlMjBzaGFwZSUyMChudW1fZnJhbWVzJTJDJTIwaGVpZ2h0JTJDJTIwd2lkdGglMkMlMjAzKS4lMEElMjAlMjAlMjAlMjAnJyclMEElMjAlMjAlMjAlMjBmcmFtZXMlMjAlM0QlMjAlNUIlNUQlMEElMjAlMjAlMjAlMjBjb250YWluZXIuc2VlaygwKSUwQSUyMCUyMCUyMCUyMHN0YXJ0X2luZGV4JTIwJTNEJTIwaW5kaWNlcyU1QjAlNUQlMEElMjAlMjAlMjAlMjBlbmRfaW5kZXglMjAlM0QlMjBpbmRpY2VzJTVCLTElNUQlMEElMjAlMjAlMjAlMjBmb3IlMjBpJTJDJTIwZnJhbWUlMjBpbiUyMGVudW1lcmF0ZShjb250YWluZXIuZGVjb2RlKHZpZGVvJTNEMCkpJTNBJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwaWYlMjBpJTIwJTNFJTIwZW5kX2luZGV4JTNBJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwYnJlYWslMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBpZiUyMGklMjAlM0UlM0QlMjBzdGFydF9pbmRleCUyMGFuZCUyMGklMjBpbiUyMGluZGljZXMlM0ElMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBmcmFtZXMuYXBwZW5kKGZyYW1lKSUwQSUyMCUyMCUyMCUyMHJldHVybiUyMG5wLnN0YWNrKCU1QngudG9fbmRhcnJheShmb3JtYXQlM0QlMjJyZ2IyNCUyMiklMjBmb3IlMjB4JTIwaW4lMjBmcmFtZXMlNUQpJTBBJTBBJTBBZGVmJTIwc2FtcGxlX2ZyYW1lX2luZGljZXMoY2xpcF9sZW4lMkMlMjBmcmFtZV9zYW1wbGVfcmF0ZSUyQyUyMHNlZ19sZW4pJTNBJTBBJTIwJTIwJTIwJTIwY29udmVydGVkX2xlbiUyMCUzRCUyMGludChjbGlwX2xlbiUyMColMjBmcmFtZV9zYW1wbGVfcmF0ZSklMEElMjAlMjAlMjAlMjBlbmRfaWR4JTIwJTNEJTIwbnAucmFuZG9tLnJhbmRpbnQoY29udmVydGVkX2xlbiUyQyUyMHNlZ19sZW4pJTBBJTIwJTIwJTIwJTIwc3RhcnRfaWR4JTIwJTNEJTIwZW5kX2lkeCUyMC0lMjBjb252ZXJ0ZWRfbGVuJTBBJTIwJTIwJTIwJTIwaW5kaWNlcyUyMCUzRCUyMG5wLmxpbnNwYWNlKHN0YXJ0X2lkeCUyQyUyMGVuZF9pZHglMkMlMjBudW0lM0RjbGlwX2xlbiklMEElMjAlMjAlMjAlMjBpbmRpY2VzJTIwJTNEJTIwbnAuY2xpcChpbmRpY2VzJTJDJTIwc3RhcnRfaWR4JTJDJTIwZW5kX2lkeCUyMC0lMjAxKS5hc3R5cGUobnAuaW50NjQpJTBBJTIwJTIwJTIwJTIwcmV0dXJuJTIwaW5kaWNlcyUwQSUwQSUwQSUyMyUyMHZpZGVvJTIwY2xpcCUyMGNvbnNpc3RzJTIwb2YlMjAzMDAlMjBmcmFtZXMlMjAoMTAlMjBzZWNvbmRzJTIwYXQlMjAzMCUyMEZQUyklMEFmaWxlX3BhdGglMjAlM0QlMjBoZl9odWJfZG93bmxvYWQoJTBBJTIwJTIwJTIwJTIwcmVwb19pZCUzRCUyMm5pZWxzciUyRnZpZGVvLWRlbW8lMjIlMkMlMjBmaWxlbmFtZSUzRCUyMmVhdGluZ19zcGFnaGV0dGkubXA0JTIyJTJDJTIwcmVwb190eXBlJTNEJTIyZGF0YXNldCUyMiUwQSklMEFjb250YWluZXIlMjAlM0QlMjBhdi5vcGVuKGZpbGVfcGF0aCklMEElMEElMjMlMjBzYW1wbGUlMjAxNiUyMGZyYW1lcyUwQWluZGljZXMlMjAlM0QlMjBzYW1wbGVfZnJhbWVfaW5kaWNlcyhjbGlwX2xlbiUzRDglMkMlMjBmcmFtZV9zYW1wbGVfcmF0ZSUzRDElMkMlMjBzZWdfbGVuJTNEY29udGFpbmVyLnN0cmVhbXMudmlkZW8lNUIwJTVELmZyYW1lcyklMEF2aWRlbyUyMCUzRCUyMHJlYWRfdmlkZW9fcHlhdihjb250YWluZXIlMkMlMjBpbmRpY2VzKSUwQSUwQXByb2Nlc3NvciUyMCUzRCUyMEF1dG9Qcm9jZXNzb3IuZnJvbV9wcmV0cmFpbmVkKCUyMm1pY3Jvc29mdCUyRnhjbGlwLWJhc2UtcGF0Y2gzMiUyMiklMEFtb2RlbCUyMCUzRCUyMFhDTElQVmlzaW9uTW9kZWwuZnJvbV9wcmV0cmFpbmVkKCUyMm1pY3Jvc29mdCUyRnhjbGlwLWJhc2UtcGF0Y2gzMiUyMiklMEElMEFwaXhlbF92YWx1ZXMlMjAlM0QlMjBwcm9jZXNzb3IodmlkZW9zJTNEbGlzdCh2aWRlbyklMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKS5waXhlbF92YWx1ZXMlMEElMEFiYXRjaF9zaXplJTJDJTIwbnVtX2ZyYW1lcyUyQyUyMG51bV9jaGFubmVscyUyQyUyMGhlaWdodCUyQyUyMHdpZHRoJTIwJTNEJTIwcGl4ZWxfdmFsdWVzLnNoYXBlJTBBcGl4ZWxfdmFsdWVzJTIwJTNEJTIwcGl4ZWxfdmFsdWVzLnJlc2hhcGUoLTElMkMlMjBudW1fY2hhbm5lbHMlMkMlMjBoZWlnaHQlMkMlMjB3aWR0aCklMEElMEFvdXRwdXRzJTIwJTNEJTIwbW9kZWwocGl4ZWxfdmFsdWVzKSUwQWxhc3RfaGlkZGVuX3N0YXRlJTIwJTNEJTIwb3V0cHV0cy5sYXN0X2hpZGRlbl9zdGF0ZQ==",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>    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`}}),{c(){c=o("p"),y=l("Examples:"),M=f(),w(m.$$.fragment)},l(n){c=a(n,"P",{});var p=r(c);y=i(p,"Examples:"),p.forEach(s),M=u(n),b(m.$$.fragment,n)},m(n,p){g(n,c,p),e(c,y),g(n,M,p),j(m,n,p),_=!0},p:Et,i(n){_||(C(m.$$.fragment,n),_=!0)},o(n){v(m.$$.fragment,n),_=!1},d(n){n&&s(c),n&&s(M),T(m,n)}}}function Wi(I){let c,y,M,m,_,n,p,U,oo,pn,Q,ue,Js,Se,ao,Xs,ro,mn,V,lo,qe,io,co,Gt,po,mo,hn,At,ho,fn,Vt,xs,fo,un,zt,uo,gn,Rt,He,go,Nt,Mo,_o,Mn,ge,sl,_n,De,yo,Yt,wo,yn,z,bo,Ke,jo,Co,Oe,vo,To,wn,S,Me,ks,et,Io,Zs,Uo,bn,Ft,Jo,jn,Qt,tt,Xo,st,xo,ko,Cn,St,Zo,vn,q,_e,Ps,nt,Po,$s,$o,Tn,J,ot,Bo,Bs,Wo,Eo,k,qt,Lo,Go,Ht,Ao,Vo,Dt,zo,Ro,Ws,No,Yo,Kt,Fo,Qo,So,ye,at,qo,rt,Ho,Ot,Do,Ko,Oo,we,lt,ea,it,ta,es,sa,na,In,H,be,Es,ct,oa,Ls,aa,Un,Z,dt,ra,R,ts,la,ia,ss,ca,da,pt,pa,ma,ha,D,fa,ns,ua,ga,os,Ma,_a,ya,je,mt,wa,ht,ba,as,ja,Ca,Jn,K,Ce,Gs,ft,va,As,Ta,Xn,P,ut,Ia,O,Ua,rs,Ja,Xa,gt,xa,ka,Za,ee,Pa,ls,$a,Ba,is,Wa,Ea,La,ve,xn,te,Te,Vs,Mt,Ga,zs,Aa,kn,$,_t,Va,se,za,cs,Ra,Na,yt,Ya,Fa,Qa,ne,Sa,ds,qa,Ha,ps,Da,Ka,Oa,Ie,Zn,oe,Ue,Rs,wt,er,Ns,tr,Pn,X,bt,sr,jt,nr,Ct,or,ar,rr,B,vt,lr,ae,ir,ms,cr,dr,Ys,pr,mr,hr,Je,fr,Xe,ur,W,Tt,gr,re,Mr,hs,_r,yr,Fs,wr,br,jr,xe,Cr,ke,vr,E,It,Tr,le,Ir,fs,Ur,Jr,Qs,Xr,xr,kr,Ze,Zr,Pe,$n,ie,$e,Ss,Ut,Pr,qs,$r,Bn,ce,Jt,Br,L,Xt,Wr,de,Er,us,Lr,Gr,Hs,Ar,Vr,zr,Be,Rr,We,Wn,pe,Ee,Ds,xt,Nr,Ks,Yr,En,me,kt,Fr,G,Zt,Qr,he,Sr,gs,qr,Hr,Os,Dr,Kr,Or,Le,el,Ge,Ln;return n=new F({}),Se=new F({}),et=new F({}),nt=new F({}),ot=new x({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/main/en/model_doc/videomae#transformers.VideoMAEImageProcessor">VideoMAEImageProcessor</a>) &#x2014;
The image processor is a required input.`,name:"image_processor"},{anchor:"transformers.XCLIPProcessor.tokenizer",description:`<strong>tokenizer</strong> (<a href="/docs/transformers/main/en/model_doc/clip#transformers.CLIPTokenizerFast">CLIPTokenizerFast</a>) &#x2014;
The tokenizer is a required input.`,name:"tokenizer"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/x_clip/processing_x_clip.py#L25"}}),at=new x({props:{name:"batch_decode",anchor:"transformers.XCLIPProcessor.batch_decode",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/x_clip/processing_x_clip.py#L115"}}),lt=new x({props:{name:"decode",anchor:"transformers.XCLIPProcessor.decode",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/x_clip/processing_x_clip.py#L122"}}),ct=new F({}),dt=new x({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/main/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/main/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;
Dimentionality 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/main/src/transformers/models/x_clip/configuration_x_clip.py#L264"}}),mt=new x({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/main/src/transformers/models/x_clip/configuration_x_clip.py#L407",returnDescription:`
<p>An instance of a configuration object</p>
`,returnType:`
<p><a
  href="/docs/transformers/main/en/model_doc/xclip#transformers.XCLIPConfig"
>XCLIPConfig</a></p>
`}}),ft=new F({}),ut=new x({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/main/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> (\`float&#x201C;, <em>optional</em>, defaults to 1) &#x2014;
A factor for initializing all weight matrices (should be kept to 1, used internally for initialization
testing).`,name:"initializer_factor"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/x_clip/configuration_x_clip.py#L31"}}),ve=new Wt({props:{anchor:"transformers.XCLIPTextConfig.example",$$slots:{default:[vi]},$$scope:{ctx:I}}}),Mt=new F({}),_t=new x({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> (\`float&#x201C;, <em>optional</em>, defaults to 1) &#x2014;
A factor for initializing all weight matrices (should be kept to 1, used internally for initialization
testing).`,name:"initializer_factor"},{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/main/src/transformers/models/x_clip/configuration_x_clip.py#L137"}}),Ie=new Wt({props:{anchor:"transformers.XCLIPVisionConfig.example",$$slots:{default:[Ti]},$$scope:{ctx:I}}}),wt=new F({}),bt=new x({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/main/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/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/x_clip/modeling_x_clip.py#L1283"}}),vt=new x({props:{name:"forward",anchor:"transformers.XCLIPModel.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"pixel_values",val:": typing.Optional[torch.FloatTensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"position_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"return_loss",val:": typing.Optional[bool] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.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/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/model_doc/perceiver#transformers.PerceiverTokenizer.__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/main/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <a href="/docs/transformers/main/en/model_doc/levit#transformers.LevitFeatureExtractor.__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/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/x_clip/modeling_x_clip.py#L1483",returnDescription:`
<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>) \u2014 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>) \u2014 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>) \u2014 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>) \u2014 The text embeddings obtained by applying the projection layer to the pooled output of <a
  href="/docs/transformers/main/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>) \u2014 The video embeddings obtained by applying the projection layer to the pooled output of
<a
  href="/docs/transformers/main/en/model_doc/xclip#transformers.XCLIPVisionModel"
>XCLIPVisionModel</a>.</li>
<li><strong>text_model_output</strong> (<code>BaseModelOutputWithPooling</code>) \u2014 The output of the <a
  href="/docs/transformers/main/en/model_doc/xclip#transformers.XCLIPTextModel"
>XCLIPTextModel</a>.</li>
<li><strong>vision_model_output</strong> (<code>BaseModelOutputWithPooling</code>) \u2014 The output of the <a
  href="/docs/transformers/main/en/model_doc/xclip#transformers.XCLIPVisionModel"
>XCLIPVisionModel</a>.</li>
<li><strong>mit_output</strong> (<code>BaseModelOutputWithPooling</code>) \u2014 The output of <code>XCLIPMultiframeIntegrationTransformer</code> (MIT for short).</li>
</ul>
`,returnType:`
<p><code>transformers.models.x_clip.modeling_x_clip.XCLIPOutput</code> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Je=new dn({props:{$$slots:{default:[Ii]},$$scope:{ctx:I}}}),Xe=new Wt({props:{anchor:"transformers.XCLIPModel.forward.example",$$slots:{default:[Ui]},$$scope:{ctx:I}}}),Tt=new x({props:{name:"get_text_features",anchor:"transformers.XCLIPModel.get_text_features",parameters:[{name:"input_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"position_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.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/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/model_doc/perceiver#transformers.PerceiverTokenizer.__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/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/x_clip/modeling_x_clip.py#L1330",returnDescription:`
<p>The text embeddings obtained by
applying the projection layer to the pooled output of <a
  href="/docs/transformers/main/en/model_doc/xclip#transformers.XCLIPTextModel"
>XCLIPTextModel</a>.</p>
`,returnType:`
<p>text_features (<code>torch.FloatTensor</code> of shape <code>(batch_size, output_dim</code>)</p>
`}}),xe=new dn({props:{$$slots:{default:[Ji]},$$scope:{ctx:I}}}),ke=new Wt({props:{anchor:"transformers.XCLIPModel.get_text_features.example",$$slots:{default:[Xi]},$$scope:{ctx:I}}}),It=new x({props:{name:"get_video_features",anchor:"transformers.XCLIPModel.get_video_features",parameters:[{name:"pixel_values",val:": typing.Optional[torch.FloatTensor] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.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/main/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <a href="/docs/transformers/main/en/model_doc/levit#transformers.LevitFeatureExtractor.__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/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/x_clip/modeling_x_clip.py#L1377",returnDescription:`
<p>The video embeddings obtained by
applying the projection layer to the pooled output of <a
  href="/docs/transformers/main/en/model_doc/xclip#transformers.XCLIPVisionModel"
>XCLIPVisionModel</a> and
<code>XCLIPMultiframeIntegrationTransformer</code>.</p>
`,returnType:`
<p>video_features (<code>torch.FloatTensor</code> of shape <code>(batch_size, output_dim</code>)</p>
`}}),Ze=new dn({props:{$$slots:{default:[xi]},$$scope:{ctx:I}}}),Pe=new Wt({props:{anchor:"transformers.XCLIPModel.get_video_features.example",$$slots:{default:[ki]},$$scope:{ctx:I}}}),Ut=new F({}),Jt=new x({props:{name:"class transformers.XCLIPTextModel",anchor:"transformers.XCLIPTextModel",parameters:[{name:"config",val:": XCLIPTextConfig"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/x_clip/modeling_x_clip.py#L833"}}),Xt=new x({props:{name:"forward",anchor:"transformers.XCLIPTextModel.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"position_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.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/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/model_doc/perceiver#transformers.PerceiverTokenizer.__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/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/x_clip/modeling_x_clip.py#L848",returnDescription:`
<p>A <a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPooling"
>transformers.modeling_outputs.BaseModelOutputWithPooling</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<code>&lt;class 'transformers.models.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>) \u2014 Sequence of hidden-states at the output of the last layer of the model.</p>
</li>
<li>
<p><strong>pooler_output</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, hidden_size)</code>) \u2014 Last layer hidden-state of the first token of the sequence (classification token) after further processing
through the layers used for the auxiliary pretraining task. E.g. for BERT-family of models, this returns
the classification token after processing through a linear layer and a tanh activation function. The linear
layer weights are trained from the next sentence prediction (classification) objective during pretraining.</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, +
one for the output of each layer) of shape <code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPooling"
>transformers.modeling_outputs.BaseModelOutputWithPooling</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Be=new dn({props:{$$slots:{default:[Zi]},$$scope:{ctx:I}}}),We=new Wt({props:{anchor:"transformers.XCLIPTextModel.forward.example",$$slots:{default:[Pi]},$$scope:{ctx:I}}}),xt=new F({}),kt=new x({props:{name:"class transformers.XCLIPVisionModel",anchor:"transformers.XCLIPVisionModel",parameters:[{name:"config",val:": XCLIPVisionConfig"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/x_clip/modeling_x_clip.py#L1048"}}),Zt=new x({props:{name:"forward",anchor:"transformers.XCLIPVisionModel.forward",parameters:[{name:"pixel_values",val:": typing.Optional[torch.FloatTensor] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.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/main/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <a href="/docs/transformers/main/en/model_doc/levit#transformers.LevitFeatureExtractor.__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/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/x_clip/modeling_x_clip.py#L1061",returnDescription:`
<p>A <a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPooling"
>transformers.modeling_outputs.BaseModelOutputWithPooling</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<code>&lt;class 'transformers.models.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>) \u2014 Sequence of hidden-states at the output of the last layer of the model.</p>
</li>
<li>
<p><strong>pooler_output</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, hidden_size)</code>) \u2014 Last layer hidden-state of the first token of the sequence (classification token) after further processing
through the layers used for the auxiliary pretraining task. E.g. for BERT-family of models, this returns
the classification token after processing through a linear layer and a tanh activation function. The linear
layer weights are trained from the next sentence prediction (classification) objective during pretraining.</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, +
one for the output of each layer) of shape <code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPooling"
>transformers.modeling_outputs.BaseModelOutputWithPooling</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Le=new dn({props:{$$slots:{default:[$i]},$$scope:{ctx:I}}}),Ge=new Wt({props:{anchor:"transformers.XCLIPVisionModel.forward.example",$$slots:{default:[Bi]},$$scope:{ctx:I}}}),{c(){c=o("meta"),y=f(),M=o("h1"),m=o("a"),_=o("span"),w(n.$$.fragment),p=f(),U=o("span"),oo=l("X-CLIP"),pn=f(),Q=o("h2"),ue=o("a"),Js=o("span"),w(Se.$$.fragment),ao=f(),Xs=o("span"),ro=l("Overview"),mn=f(),V=o("p"),lo=l("The X-CLIP model was proposed in "),qe=o("a"),io=l("Expanding Language-Image Pretrained Models for General Video Recognition"),co=l(` by Bolin Ni, Houwen Peng, Minghao Chen, Songyang Zhang, Gaofeng Meng, Jianlong Fu, Shiming Xiang, Haibin Ling.
X-CLIP is a minimal extension of `),Gt=o("a"),po=l("CLIP"),mo=l(" 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."),hn=f(),At=o("p"),ho=l("The abstract from the paper is the following:"),fn=f(),Vt=o("p"),xs=o("em"),fo=l("Contrastive language-image pretraining has shown great success in learning visual-textual joint representation from web-scale data, demonstrating remarkable \u201Czero-shot\u201D 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."),un=f(),zt=o("p"),uo=l("Tips:"),gn=f(),Rt=o("ul"),He=o("li"),go=l("Usage of X-CLIP is identical to "),Nt=o("a"),Mo=l("CLIP"),_o=l("."),Mn=f(),ge=o("img"),_n=f(),De=o("small"),yo=l("X-CLIP architecture. Taken from the "),Yt=o("a"),wo=l("original paper."),yn=f(),z=o("p"),bo=l("This model was contributed by "),Ke=o("a"),jo=l("nielsr"),Co=l(`.
The original code can be found `),Oe=o("a"),vo=l("here"),To=l("."),wn=f(),S=o("h2"),Me=o("a"),ks=o("span"),w(et.$$.fragment),Io=f(),Zs=o("span"),Uo=l("Resources"),bn=f(),Ft=o("p"),Jo=l("A list of official Hugging Face and community (indicated by \u{1F30E}) resources to help you get started with X-CLIP."),jn=f(),Qt=o("ul"),tt=o("li"),Xo=l("Demo notebooks for X-CLIP can be found "),st=o("a"),xo=l("here"),ko=l("."),Cn=f(),St=o("p"),Zo=l("If you\u2019re interested in submitting a resource to be included here, please feel free to open a Pull Request and we\u2019ll review it! The resource should ideally demonstrate something new instead of duplicating an existing resource."),vn=f(),q=o("h2"),_e=o("a"),Ps=o("span"),w(nt.$$.fragment),Po=f(),$s=o("span"),$o=l("XCLIPProcessor"),Tn=f(),J=o("div"),w(ot.$$.fragment),Bo=f(),Bs=o("p"),Wo=l("Constructs an X-CLIP processor which wraps a VideoMAE image processor and a CLIP tokenizer into a single processor."),Eo=f(),k=o("p"),qt=o("a"),Lo=l("XCLIPProcessor"),Go=l(" offers all the functionalities of "),Ht=o("a"),Ao=l("VideoMAEImageProcessor"),Vo=l(" and "),Dt=o("a"),zo=l("CLIPTokenizerFast"),Ro=l(`. See the
`),Ws=o("code"),No=l("__call__()"),Yo=l(" and "),Kt=o("a"),Fo=l("decode()"),Qo=l(" for more information."),So=f(),ye=o("div"),w(at.$$.fragment),qo=f(),rt=o("p"),Ho=l("This method forwards all its arguments to CLIPTokenizerFast\u2019s "),Ot=o("a"),Do=l("batch_decode()"),Ko=l(`. Please
refer to the docstring of this method for more information.`),Oo=f(),we=o("div"),w(lt.$$.fragment),ea=f(),it=o("p"),ta=l("This method forwards all its arguments to CLIPTokenizerFast\u2019s "),es=o("a"),sa=l("decode()"),na=l(`. Please refer to
the docstring of this method for more information.`),In=f(),H=o("h2"),be=o("a"),Es=o("span"),w(ct.$$.fragment),oa=f(),Ls=o("span"),aa=l("XCLIPConfig"),Un=f(),Z=o("div"),w(dt.$$.fragment),ra=f(),R=o("p"),ts=o("a"),la=l("XCLIPConfig"),ia=l(" is the configuration class to store the configuration of a "),ss=o("a"),ca=l("XCLIPModel"),da=l(`. 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
`),pt=o("a"),pa=l("microsoft/xclip-base-patch32"),ma=l(" architecture."),ha=f(),D=o("p"),fa=l("Configuration objects inherit from "),ns=o("a"),ua=l("PretrainedConfig"),ga=l(` and can be used to control the model outputs. Read the
documentation from `),os=o("a"),Ma=l("PretrainedConfig"),_a=l(" for more information."),ya=f(),je=o("div"),w(mt.$$.fragment),wa=f(),ht=o("p"),ba=l("Instantiate a "),as=o("a"),ja=l("XCLIPConfig"),Ca=l(` (or a derived class) from xclip text model configuration and xclip vision model
configuration.`),Jn=f(),K=o("h2"),Ce=o("a"),Gs=o("span"),w(ft.$$.fragment),va=f(),As=o("span"),Ta=l("XCLIPTextConfig"),Xn=f(),P=o("div"),w(ut.$$.fragment),Ia=f(),O=o("p"),Ua=l("This is the configuration class to store the configuration of a "),rs=o("a"),Ja=l("XCLIPModel"),Xa=l(`. 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
`),gt=o("a"),xa=l("microsoft/xclip-base-patch32"),ka=l(" architecture."),Za=f(),ee=o("p"),Pa=l("Configuration objects inherit from "),ls=o("a"),$a=l("PretrainedConfig"),Ba=l(` and can be used to control the model outputs. Read the
documentation from `),is=o("a"),Wa=l("PretrainedConfig"),Ea=l(" for more information."),La=f(),w(ve.$$.fragment),xn=f(),te=o("h2"),Te=o("a"),Vs=o("span"),w(Mt.$$.fragment),Ga=f(),zs=o("span"),Aa=l("XCLIPVisionConfig"),kn=f(),$=o("div"),w(_t.$$.fragment),Va=f(),se=o("p"),za=l("This is the configuration class to store the configuration of a "),cs=o("a"),Ra=l("XCLIPModel"),Na=l(`. 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
`),yt=o("a"),Ya=l("microsoft/xclip-base-patch32"),Fa=l(" architecture."),Qa=f(),ne=o("p"),Sa=l("Configuration objects inherit from "),ds=o("a"),qa=l("PretrainedConfig"),Ha=l(` and can be used to control the model outputs. Read the
documentation from `),ps=o("a"),Da=l("PretrainedConfig"),Ka=l(" for more information."),Oa=f(),w(Ie.$$.fragment),Zn=f(),oe=o("h2"),Ue=o("a"),Rs=o("span"),w(wt.$$.fragment),er=f(),Ns=o("span"),tr=l("XCLIPModel"),Pn=f(),X=o("div"),w(bt.$$.fragment),sr=f(),jt=o("p"),nr=l("This model is a PyTorch "),Ct=o("a"),or=l("torch.nn.Module"),ar=l(` subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),rr=f(),B=o("div"),w(vt.$$.fragment),lr=f(),ae=o("p"),ir=l("The "),ms=o("a"),cr=l("XCLIPModel"),dr=l(" forward method, overrides the "),Ys=o("code"),pr=l("__call__"),mr=l(" special method."),hr=f(),w(Je.$$.fragment),fr=f(),w(Xe.$$.fragment),ur=f(),W=o("div"),w(Tt.$$.fragment),gr=f(),re=o("p"),Mr=l("The "),hs=o("a"),_r=l("XCLIPModel"),yr=l(" forward method, overrides the "),Fs=o("code"),wr=l("__call__"),br=l(" special method."),jr=f(),w(xe.$$.fragment),Cr=f(),w(ke.$$.fragment),vr=f(),E=o("div"),w(It.$$.fragment),Tr=f(),le=o("p"),Ir=l("The "),fs=o("a"),Ur=l("XCLIPModel"),Jr=l(" forward method, overrides the "),Qs=o("code"),Xr=l("__call__"),xr=l(" special method."),kr=f(),w(Ze.$$.fragment),Zr=f(),w(Pe.$$.fragment),$n=f(),ie=o("h2"),$e=o("a"),Ss=o("span"),w(Ut.$$.fragment),Pr=f(),qs=o("span"),$r=l("XCLIPTextModel"),Bn=f(),ce=o("div"),w(Jt.$$.fragment),Br=f(),L=o("div"),w(Xt.$$.fragment),Wr=f(),de=o("p"),Er=l("The "),us=o("a"),Lr=l("XCLIPTextModel"),Gr=l(" forward method, overrides the "),Hs=o("code"),Ar=l("__call__"),Vr=l(" special method."),zr=f(),w(Be.$$.fragment),Rr=f(),w(We.$$.fragment),Wn=f(),pe=o("h2"),Ee=o("a"),Ds=o("span"),w(xt.$$.fragment),Nr=f(),Ks=o("span"),Yr=l("XCLIPVisionModel"),En=f(),me=o("div"),w(kt.$$.fragment),Fr=f(),G=o("div"),w(Zt.$$.fragment),Qr=f(),he=o("p"),Sr=l("The "),gs=o("a"),qr=l("XCLIPVisionModel"),Hr=l(" forward method, overrides the "),Os=o("code"),Dr=l("__call__"),Kr=l(" special method."),Or=f(),w(Le.$$.fragment),el=f(),w(Ge.$$.fragment),this.h()},l(t){const h=bi('[data-svelte="svelte-1phssyn"]',document.head);c=a(h,"META",{name:!0,content:!0}),h.forEach(s),y=u(t),M=a(t,"H1",{class:!0});var Pt=r(M);m=a(Pt,"A",{id:!0,class:!0,href:!0});var en=r(m);_=a(en,"SPAN",{});var tn=r(_);b(n.$$.fragment,tn),tn.forEach(s),en.forEach(s),p=u(Pt),U=a(Pt,"SPAN",{});var sn=r(U);oo=i(sn,"X-CLIP"),sn.forEach(s),Pt.forEach(s),pn=u(t),Q=a(t,"H2",{class:!0});var $t=r(Q);ue=a($t,"A",{id:!0,class:!0,href:!0});var nn=r(ue);Js=a(nn,"SPAN",{});var on=r(Js);b(Se.$$.fragment,on),on.forEach(s),nn.forEach(s),ao=u($t),Xs=a($t,"SPAN",{});var an=r(Xs);ro=i(an,"Overview"),an.forEach(s),$t.forEach(s),mn=u(t),V=a(t,"P",{});var fe=r(V);lo=i(fe,"The X-CLIP model was proposed in "),qe=a(fe,"A",{href:!0,rel:!0});var rn=r(qe);io=i(rn,"Expanding Language-Image Pretrained Models for General Video Recognition"),rn.forEach(s),co=i(fe,` by Bolin Ni, Houwen Peng, Minghao Chen, Songyang Zhang, Gaofeng Meng, Jianlong Fu, Shiming Xiang, Haibin Ling.
X-CLIP is a minimal extension of `),Gt=a(fe,"A",{href:!0});var ln=r(Gt);po=i(ln,"CLIP"),ln.forEach(s),mo=i(fe," 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."),fe.forEach(s),hn=u(t),At=a(t,"P",{});var cn=r(At);ho=i(cn,"The abstract from the paper is the following:"),cn.forEach(s),fn=u(t),Vt=a(t,"P",{});var nl=r(Vt);xs=a(nl,"EM",{});var ol=r(xs);fo=i(ol,"Contrastive language-image pretraining has shown great success in learning visual-textual joint representation from web-scale data, demonstrating remarkable \u201Czero-shot\u201D 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."),ol.forEach(s),nl.forEach(s),un=u(t),zt=a(t,"P",{});var al=r(zt);uo=i(al,"Tips:"),al.forEach(s),gn=u(t),Rt=a(t,"UL",{});var rl=r(Rt);He=a(rl,"LI",{});var Gn=r(He);go=i(Gn,"Usage of X-CLIP is identical to "),Nt=a(Gn,"A",{href:!0});var ll=r(Nt);Mo=i(ll,"CLIP"),ll.forEach(s),_o=i(Gn,"."),Gn.forEach(s),rl.forEach(s),Mn=u(t),ge=a(t,"IMG",{src:!0,alt:!0,width:!0}),_n=u(t),De=a(t,"SMALL",{});var tl=r(De);yo=i(tl,"X-CLIP architecture. Taken from the "),Yt=a(tl,"A",{href:!0});var il=r(Yt);wo=i(il,"original paper."),il.forEach(s),tl.forEach(s),yn=u(t),z=a(t,"P",{});var Ms=r(z);bo=i(Ms,"This model was contributed by "),Ke=a(Ms,"A",{href:!0,rel:!0});var cl=r(Ke);jo=i(cl,"nielsr"),cl.forEach(s),Co=i(Ms,`.
The original code can be found `),Oe=a(Ms,"A",{href:!0,rel:!0});var dl=r(Oe);vo=i(dl,"here"),dl.forEach(s),To=i(Ms,"."),Ms.forEach(s),wn=u(t),S=a(t,"H2",{class:!0});var An=r(S);Me=a(An,"A",{id:!0,class:!0,href:!0});var pl=r(Me);ks=a(pl,"SPAN",{});var ml=r(ks);b(et.$$.fragment,ml),ml.forEach(s),pl.forEach(s),Io=u(An),Zs=a(An,"SPAN",{});var hl=r(Zs);Uo=i(hl,"Resources"),hl.forEach(s),An.forEach(s),bn=u(t),Ft=a(t,"P",{});var fl=r(Ft);Jo=i(fl,"A list of official Hugging Face and community (indicated by \u{1F30E}) resources to help you get started with X-CLIP."),fl.forEach(s),jn=u(t),Qt=a(t,"UL",{});var ul=r(Qt);tt=a(ul,"LI",{});var Vn=r(tt);Xo=i(Vn,"Demo notebooks for X-CLIP can be found "),st=a(Vn,"A",{href:!0,rel:!0});var gl=r(st);xo=i(gl,"here"),gl.forEach(s),ko=i(Vn,"."),Vn.forEach(s),ul.forEach(s),Cn=u(t),St=a(t,"P",{});var Ml=r(St);Zo=i(Ml,"If you\u2019re interested in submitting a resource to be included here, please feel free to open a Pull Request and we\u2019ll review it! The resource should ideally demonstrate something new instead of duplicating an existing resource."),Ml.forEach(s),vn=u(t),q=a(t,"H2",{class:!0});var zn=r(q);_e=a(zn,"A",{id:!0,class:!0,href:!0});var _l=r(_e);Ps=a(_l,"SPAN",{});var yl=r(Ps);b(nt.$$.fragment,yl),yl.forEach(s),_l.forEach(s),Po=u(zn),$s=a(zn,"SPAN",{});var wl=r($s);$o=i(wl,"XCLIPProcessor"),wl.forEach(s),zn.forEach(s),Tn=u(t),J=a(t,"DIV",{class:!0});var N=r(J);b(ot.$$.fragment,N),Bo=u(N),Bs=a(N,"P",{});var bl=r(Bs);Wo=i(bl,"Constructs an X-CLIP processor which wraps a VideoMAE image processor and a CLIP tokenizer into a single processor."),bl.forEach(s),Eo=u(N),k=a(N,"P",{});var A=r(k);qt=a(A,"A",{href:!0});var jl=r(qt);Lo=i(jl,"XCLIPProcessor"),jl.forEach(s),Go=i(A," offers all the functionalities of "),Ht=a(A,"A",{href:!0});var Cl=r(Ht);Ao=i(Cl,"VideoMAEImageProcessor"),Cl.forEach(s),Vo=i(A," and "),Dt=a(A,"A",{href:!0});var vl=r(Dt);zo=i(vl,"CLIPTokenizerFast"),vl.forEach(s),Ro=i(A,`. See the
`),Ws=a(A,"CODE",{});var Tl=r(Ws);No=i(Tl,"__call__()"),Tl.forEach(s),Yo=i(A," and "),Kt=a(A,"A",{href:!0});var Il=r(Kt);Fo=i(Il,"decode()"),Il.forEach(s),Qo=i(A," for more information."),A.forEach(s),So=u(N),ye=a(N,"DIV",{class:!0});var Rn=r(ye);b(at.$$.fragment,Rn),qo=u(Rn),rt=a(Rn,"P",{});var Nn=r(rt);Ho=i(Nn,"This method forwards all its arguments to CLIPTokenizerFast\u2019s "),Ot=a(Nn,"A",{href:!0});var Ul=r(Ot);Do=i(Ul,"batch_decode()"),Ul.forEach(s),Ko=i(Nn,`. Please
refer to the docstring of this method for more information.`),Nn.forEach(s),Rn.forEach(s),Oo=u(N),we=a(N,"DIV",{class:!0});var Yn=r(we);b(lt.$$.fragment,Yn),ea=u(Yn),it=a(Yn,"P",{});var Fn=r(it);ta=i(Fn,"This method forwards all its arguments to CLIPTokenizerFast\u2019s "),es=a(Fn,"A",{href:!0});var Jl=r(es);sa=i(Jl,"decode()"),Jl.forEach(s),na=i(Fn,`. Please refer to
the docstring of this method for more information.`),Fn.forEach(s),Yn.forEach(s),N.forEach(s),In=u(t),H=a(t,"H2",{class:!0});var Qn=r(H);be=a(Qn,"A",{id:!0,class:!0,href:!0});var Xl=r(be);Es=a(Xl,"SPAN",{});var xl=r(Es);b(ct.$$.fragment,xl),xl.forEach(s),Xl.forEach(s),oa=u(Qn),Ls=a(Qn,"SPAN",{});var kl=r(Ls);aa=i(kl,"XCLIPConfig"),kl.forEach(s),Qn.forEach(s),Un=u(t),Z=a(t,"DIV",{class:!0});var Ae=r(Z);b(dt.$$.fragment,Ae),ra=u(Ae),R=a(Ae,"P",{});var Bt=r(R);ts=a(Bt,"A",{href:!0});var Zl=r(ts);la=i(Zl,"XCLIPConfig"),Zl.forEach(s),ia=i(Bt," is the configuration class to store the configuration of a "),ss=a(Bt,"A",{href:!0});var Pl=r(ss);ca=i(Pl,"XCLIPModel"),Pl.forEach(s),da=i(Bt,`. 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
`),pt=a(Bt,"A",{href:!0,rel:!0});var $l=r(pt);pa=i($l,"microsoft/xclip-base-patch32"),$l.forEach(s),ma=i(Bt," architecture."),Bt.forEach(s),ha=u(Ae),D=a(Ae,"P",{});var _s=r(D);fa=i(_s,"Configuration objects inherit from "),ns=a(_s,"A",{href:!0});var Bl=r(ns);ua=i(Bl,"PretrainedConfig"),Bl.forEach(s),ga=i(_s,` and can be used to control the model outputs. Read the
documentation from `),os=a(_s,"A",{href:!0});var Wl=r(os);Ma=i(Wl,"PretrainedConfig"),Wl.forEach(s),_a=i(_s," for more information."),_s.forEach(s),ya=u(Ae),je=a(Ae,"DIV",{class:!0});var Sn=r(je);b(mt.$$.fragment,Sn),wa=u(Sn),ht=a(Sn,"P",{});var qn=r(ht);ba=i(qn,"Instantiate a "),as=a(qn,"A",{href:!0});var El=r(as);ja=i(El,"XCLIPConfig"),El.forEach(s),Ca=i(qn,` (or a derived class) from xclip text model configuration and xclip vision model
configuration.`),qn.forEach(s),Sn.forEach(s),Ae.forEach(s),Jn=u(t),K=a(t,"H2",{class:!0});var Hn=r(K);Ce=a(Hn,"A",{id:!0,class:!0,href:!0});var Ll=r(Ce);Gs=a(Ll,"SPAN",{});var Gl=r(Gs);b(ft.$$.fragment,Gl),Gl.forEach(s),Ll.forEach(s),va=u(Hn),As=a(Hn,"SPAN",{});var Al=r(As);Ta=i(Al,"XCLIPTextConfig"),Al.forEach(s),Hn.forEach(s),Xn=u(t),P=a(t,"DIV",{class:!0});var Ve=r(P);b(ut.$$.fragment,Ve),Ia=u(Ve),O=a(Ve,"P",{});var ys=r(O);Ua=i(ys,"This is the configuration class to store the configuration of a "),rs=a(ys,"A",{href:!0});var Vl=r(rs);Ja=i(Vl,"XCLIPModel"),Vl.forEach(s),Xa=i(ys,`. 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
`),gt=a(ys,"A",{href:!0,rel:!0});var zl=r(gt);xa=i(zl,"microsoft/xclip-base-patch32"),zl.forEach(s),ka=i(ys," architecture."),ys.forEach(s),Za=u(Ve),ee=a(Ve,"P",{});var ws=r(ee);Pa=i(ws,"Configuration objects inherit from "),ls=a(ws,"A",{href:!0});var Rl=r(ls);$a=i(Rl,"PretrainedConfig"),Rl.forEach(s),Ba=i(ws,` and can be used to control the model outputs. Read the
documentation from `),is=a(ws,"A",{href:!0});var Nl=r(is);Wa=i(Nl,"PretrainedConfig"),Nl.forEach(s),Ea=i(ws," for more information."),ws.forEach(s),La=u(Ve),b(ve.$$.fragment,Ve),Ve.forEach(s),xn=u(t),te=a(t,"H2",{class:!0});var Dn=r(te);Te=a(Dn,"A",{id:!0,class:!0,href:!0});var Yl=r(Te);Vs=a(Yl,"SPAN",{});var Fl=r(Vs);b(Mt.$$.fragment,Fl),Fl.forEach(s),Yl.forEach(s),Ga=u(Dn),zs=a(Dn,"SPAN",{});var Ql=r(zs);Aa=i(Ql,"XCLIPVisionConfig"),Ql.forEach(s),Dn.forEach(s),kn=u(t),$=a(t,"DIV",{class:!0});var ze=r($);b(_t.$$.fragment,ze),Va=u(ze),se=a(ze,"P",{});var bs=r(se);za=i(bs,"This is the configuration class to store the configuration of a "),cs=a(bs,"A",{href:!0});var Sl=r(cs);Ra=i(Sl,"XCLIPModel"),Sl.forEach(s),Na=i(bs,`. 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
`),yt=a(bs,"A",{href:!0,rel:!0});var ql=r(yt);Ya=i(ql,"microsoft/xclip-base-patch32"),ql.forEach(s),Fa=i(bs," architecture."),bs.forEach(s),Qa=u(ze),ne=a(ze,"P",{});var js=r(ne);Sa=i(js,"Configuration objects inherit from "),ds=a(js,"A",{href:!0});var Hl=r(ds);qa=i(Hl,"PretrainedConfig"),Hl.forEach(s),Ha=i(js,` and can be used to control the model outputs. Read the
documentation from `),ps=a(js,"A",{href:!0});var Dl=r(ps);Da=i(Dl,"PretrainedConfig"),Dl.forEach(s),Ka=i(js," for more information."),js.forEach(s),Oa=u(ze),b(Ie.$$.fragment,ze),ze.forEach(s),Zn=u(t),oe=a(t,"H2",{class:!0});var Kn=r(oe);Ue=a(Kn,"A",{id:!0,class:!0,href:!0});var Kl=r(Ue);Rs=a(Kl,"SPAN",{});var Ol=r(Rs);b(wt.$$.fragment,Ol),Ol.forEach(s),Kl.forEach(s),er=u(Kn),Ns=a(Kn,"SPAN",{});var ei=r(Ns);tr=i(ei,"XCLIPModel"),ei.forEach(s),Kn.forEach(s),Pn=u(t),X=a(t,"DIV",{class:!0});var Y=r(X);b(bt.$$.fragment,Y),sr=u(Y),jt=a(Y,"P",{});var On=r(jt);nr=i(On,"This model is a PyTorch "),Ct=a(On,"A",{href:!0,rel:!0});var ti=r(Ct);or=i(ti,"torch.nn.Module"),ti.forEach(s),ar=i(On,` subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),On.forEach(s),rr=u(Y),B=a(Y,"DIV",{class:!0});var Re=r(B);b(vt.$$.fragment,Re),lr=u(Re),ae=a(Re,"P",{});var Cs=r(ae);ir=i(Cs,"The "),ms=a(Cs,"A",{href:!0});var si=r(ms);cr=i(si,"XCLIPModel"),si.forEach(s),dr=i(Cs," forward method, overrides the "),Ys=a(Cs,"CODE",{});var ni=r(Ys);pr=i(ni,"__call__"),ni.forEach(s),mr=i(Cs," special method."),Cs.forEach(s),hr=u(Re),b(Je.$$.fragment,Re),fr=u(Re),b(Xe.$$.fragment,Re),Re.forEach(s),ur=u(Y),W=a(Y,"DIV",{class:!0});var Ne=r(W);b(Tt.$$.fragment,Ne),gr=u(Ne),re=a(Ne,"P",{});var vs=r(re);Mr=i(vs,"The "),hs=a(vs,"A",{href:!0});var oi=r(hs);_r=i(oi,"XCLIPModel"),oi.forEach(s),yr=i(vs," forward method, overrides the "),Fs=a(vs,"CODE",{});var ai=r(Fs);wr=i(ai,"__call__"),ai.forEach(s),br=i(vs," special method."),vs.forEach(s),jr=u(Ne),b(xe.$$.fragment,Ne),Cr=u(Ne),b(ke.$$.fragment,Ne),Ne.forEach(s),vr=u(Y),E=a(Y,"DIV",{class:!0});var Ye=r(E);b(It.$$.fragment,Ye),Tr=u(Ye),le=a(Ye,"P",{});var Ts=r(le);Ir=i(Ts,"The "),fs=a(Ts,"A",{href:!0});var ri=r(fs);Ur=i(ri,"XCLIPModel"),ri.forEach(s),Jr=i(Ts," forward method, overrides the "),Qs=a(Ts,"CODE",{});var li=r(Qs);Xr=i(li,"__call__"),li.forEach(s),xr=i(Ts," special method."),Ts.forEach(s),kr=u(Ye),b(Ze.$$.fragment,Ye),Zr=u(Ye),b(Pe.$$.fragment,Ye),Ye.forEach(s),Y.forEach(s),$n=u(t),ie=a(t,"H2",{class:!0});var eo=r(ie);$e=a(eo,"A",{id:!0,class:!0,href:!0});var ii=r($e);Ss=a(ii,"SPAN",{});var ci=r(Ss);b(Ut.$$.fragment,ci),ci.forEach(s),ii.forEach(s),Pr=u(eo),qs=a(eo,"SPAN",{});var di=r(qs);$r=i(di,"XCLIPTextModel"),di.forEach(s),eo.forEach(s),Bn=u(t),ce=a(t,"DIV",{class:!0});var to=r(ce);b(Jt.$$.fragment,to),Br=u(to),L=a(to,"DIV",{class:!0});var Fe=r(L);b(Xt.$$.fragment,Fe),Wr=u(Fe),de=a(Fe,"P",{});var Is=r(de);Er=i(Is,"The "),us=a(Is,"A",{href:!0});var pi=r(us);Lr=i(pi,"XCLIPTextModel"),pi.forEach(s),Gr=i(Is," forward method, overrides the "),Hs=a(Is,"CODE",{});var mi=r(Hs);Ar=i(mi,"__call__"),mi.forEach(s),Vr=i(Is," special method."),Is.forEach(s),zr=u(Fe),b(Be.$$.fragment,Fe),Rr=u(Fe),b(We.$$.fragment,Fe),Fe.forEach(s),to.forEach(s),Wn=u(t),pe=a(t,"H2",{class:!0});var so=r(pe);Ee=a(so,"A",{id:!0,class:!0,href:!0});var hi=r(Ee);Ds=a(hi,"SPAN",{});var fi=r(Ds);b(xt.$$.fragment,fi),fi.forEach(s),hi.forEach(s),Nr=u(so),Ks=a(so,"SPAN",{});var ui=r(Ks);Yr=i(ui,"XCLIPVisionModel"),ui.forEach(s),so.forEach(s),En=u(t),me=a(t,"DIV",{class:!0});var no=r(me);b(kt.$$.fragment,no),Fr=u(no),G=a(no,"DIV",{class:!0});var Qe=r(G);b(Zt.$$.fragment,Qe),Qr=u(Qe),he=a(Qe,"P",{});var Us=r(he);Sr=i(Us,"The "),gs=a(Us,"A",{href:!0});var gi=r(gs);qr=i(gi,"XCLIPVisionModel"),gi.forEach(s),Hr=i(Us," forward method, overrides the "),Os=a(Us,"CODE",{});var Mi=r(Os);Dr=i(Mi,"__call__"),Mi.forEach(s),Kr=i(Us," special method."),Us.forEach(s),Or=u(Qe),b(Le.$$.fragment,Qe),el=u(Qe),b(Ge.$$.fragment,Qe),Qe.forEach(s),no.forEach(s),this.h()},h(){d(c,"name","hf:doc:metadata"),d(c,"content",JSON.stringify(Ei)),d(m,"id","xclip"),d(m,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(m,"href","#xclip"),d(M,"class","relative group"),d(ue,"id","overview"),d(ue,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(ue,"href","#overview"),d(Q,"class","relative group"),d(qe,"href","https://arxiv.org/abs/2208.02816"),d(qe,"rel","nofollow"),d(Gt,"href","clip"),d(Nt,"href","clip"),ji(ge.src,sl="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/model_doc/xclip_architecture.png")||d(ge,"src",sl),d(ge,"alt","drawing"),d(ge,"width","600"),d(Yt,"href","https://arxiv.org/abs/2208.02816"),d(Ke,"href","https://huggingface.co/nielsr"),d(Ke,"rel","nofollow"),d(Oe,"href","https://github.com/microsoft/VideoX/tree/master/X-CLIP"),d(Oe,"rel","nofollow"),d(Me,"id","resources"),d(Me,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(Me,"href","#resources"),d(S,"class","relative group"),d(st,"href","https://github.com/NielsRogge/Transformers-Tutorials/tree/master/X-CLIP"),d(st,"rel","nofollow"),d(_e,"id","transformers.XCLIPProcessor"),d(_e,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(_e,"href","#transformers.XCLIPProcessor"),d(q,"class","relative group"),d(qt,"href","/docs/transformers/main/en/model_doc/xclip#transformers.XCLIPProcessor"),d(Ht,"href","/docs/transformers/main/en/model_doc/videomae#transformers.VideoMAEImageProcessor"),d(Dt,"href","/docs/transformers/main/en/model_doc/clip#transformers.CLIPTokenizerFast"),d(Kt,"href","/docs/transformers/main/en/model_doc/xclip#transformers.XCLIPProcessor.decode"),d(Ot,"href","/docs/transformers/main/en/model_doc/speecht5#transformers.SpeechT5Tokenizer.batch_decode"),d(ye,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(es,"href","/docs/transformers/main/en/model_doc/speecht5#transformers.SpeechT5Tokenizer.decode"),d(we,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(J,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(be,"id","transformers.XCLIPConfig"),d(be,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(be,"href","#transformers.XCLIPConfig"),d(H,"class","relative group"),d(ts,"href","/docs/transformers/main/en/model_doc/xclip#transformers.XCLIPConfig"),d(ss,"href","/docs/transformers/main/en/model_doc/xclip#transformers.XCLIPModel"),d(pt,"href","https://huggingface.co/microsoft/xclip-base-patch32"),d(pt,"rel","nofollow"),d(ns,"href","/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig"),d(os,"href","/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig"),d(as,"href","/docs/transformers/main/en/model_doc/xclip#transformers.XCLIPConfig"),d(je,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Ce,"id","transformers.XCLIPTextConfig"),d(Ce,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(Ce,"href","#transformers.XCLIPTextConfig"),d(K,"class","relative group"),d(rs,"href","/docs/transformers/main/en/model_doc/xclip#transformers.XCLIPModel"),d(gt,"href","https://huggingface.co/microsoft/xclip-base-patch32"),d(gt,"rel","nofollow"),d(ls,"href","/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig"),d(is,"href","/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig"),d(P,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Te,"id","transformers.XCLIPVisionConfig"),d(Te,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(Te,"href","#transformers.XCLIPVisionConfig"),d(te,"class","relative group"),d(cs,"href","/docs/transformers/main/en/model_doc/xclip#transformers.XCLIPModel"),d(yt,"href","https://huggingface.co/microsoft/xclip-base-patch32"),d(yt,"rel","nofollow"),d(ds,"href","/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig"),d(ps,"href","/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig"),d($,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Ue,"id","transformers.XCLIPModel"),d(Ue,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(Ue,"href","#transformers.XCLIPModel"),d(oe,"class","relative group"),d(Ct,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),d(Ct,"rel","nofollow"),d(ms,"href","/docs/transformers/main/en/model_doc/xclip#transformers.XCLIPModel"),d(B,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(hs,"href","/docs/transformers/main/en/model_doc/xclip#transformers.XCLIPModel"),d(W,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(fs,"href","/docs/transformers/main/en/model_doc/xclip#transformers.XCLIPModel"),d(E,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(X,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d($e,"id","transformers.XCLIPTextModel"),d($e,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d($e,"href","#transformers.XCLIPTextModel"),d(ie,"class","relative group"),d(us,"href","/docs/transformers/main/en/model_doc/xclip#transformers.XCLIPTextModel"),d(L,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(ce,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Ee,"id","transformers.XCLIPVisionModel"),d(Ee,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(Ee,"href","#transformers.XCLIPVisionModel"),d(pe,"class","relative group"),d(gs,"href","/docs/transformers/main/en/model_doc/xclip#transformers.XCLIPVisionModel"),d(G,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(me,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(t,h){e(document.head,c),g(t,y,h),g(t,M,h),e(M,m),e(m,_),j(n,_,null),e(M,p),e(M,U),e(U,oo),g(t,pn,h),g(t,Q,h),e(Q,ue),e(ue,Js),j(Se,Js,null),e(Q,ao),e(Q,Xs),e(Xs,ro),g(t,mn,h),g(t,V,h),e(V,lo),e(V,qe),e(qe,io),e(V,co),e(V,Gt),e(Gt,po),e(V,mo),g(t,hn,h),g(t,At,h),e(At,ho),g(t,fn,h),g(t,Vt,h),e(Vt,xs),e(xs,fo),g(t,un,h),g(t,zt,h),e(zt,uo),g(t,gn,h),g(t,Rt,h),e(Rt,He),e(He,go),e(He,Nt),e(Nt,Mo),e(He,_o),g(t,Mn,h),g(t,ge,h),g(t,_n,h),g(t,De,h),e(De,yo),e(De,Yt),e(Yt,wo),g(t,yn,h),g(t,z,h),e(z,bo),e(z,Ke),e(Ke,jo),e(z,Co),e(z,Oe),e(Oe,vo),e(z,To),g(t,wn,h),g(t,S,h),e(S,Me),e(Me,ks),j(et,ks,null),e(S,Io),e(S,Zs),e(Zs,Uo),g(t,bn,h),g(t,Ft,h),e(Ft,Jo),g(t,jn,h),g(t,Qt,h),e(Qt,tt),e(tt,Xo),e(tt,st),e(st,xo),e(tt,ko),g(t,Cn,h),g(t,St,h),e(St,Zo),g(t,vn,h),g(t,q,h),e(q,_e),e(_e,Ps),j(nt,Ps,null),e(q,Po),e(q,$s),e($s,$o),g(t,Tn,h),g(t,J,h),j(ot,J,null),e(J,Bo),e(J,Bs),e(Bs,Wo),e(J,Eo),e(J,k),e(k,qt),e(qt,Lo),e(k,Go),e(k,Ht),e(Ht,Ao),e(k,Vo),e(k,Dt),e(Dt,zo),e(k,Ro),e(k,Ws),e(Ws,No),e(k,Yo),e(k,Kt),e(Kt,Fo),e(k,Qo),e(J,So),e(J,ye),j(at,ye,null),e(ye,qo),e(ye,rt),e(rt,Ho),e(rt,Ot),e(Ot,Do),e(rt,Ko),e(J,Oo),e(J,we),j(lt,we,null),e(we,ea),e(we,it),e(it,ta),e(it,es),e(es,sa),e(it,na),g(t,In,h),g(t,H,h),e(H,be),e(be,Es),j(ct,Es,null),e(H,oa),e(H,Ls),e(Ls,aa),g(t,Un,h),g(t,Z,h),j(dt,Z,null),e(Z,ra),e(Z,R),e(R,ts),e(ts,la),e(R,ia),e(R,ss),e(ss,ca),e(R,da),e(R,pt),e(pt,pa),e(R,ma),e(Z,ha),e(Z,D),e(D,fa),e(D,ns),e(ns,ua),e(D,ga),e(D,os),e(os,Ma),e(D,_a),e(Z,ya),e(Z,je),j(mt,je,null),e(je,wa),e(je,ht),e(ht,ba),e(ht,as),e(as,ja),e(ht,Ca),g(t,Jn,h),g(t,K,h),e(K,Ce),e(Ce,Gs),j(ft,Gs,null),e(K,va),e(K,As),e(As,Ta),g(t,Xn,h),g(t,P,h),j(ut,P,null),e(P,Ia),e(P,O),e(O,Ua),e(O,rs),e(rs,Ja),e(O,Xa),e(O,gt),e(gt,xa),e(O,ka),e(P,Za),e(P,ee),e(ee,Pa),e(ee,ls),e(ls,$a),e(ee,Ba),e(ee,is),e(is,Wa),e(ee,Ea),e(P,La),j(ve,P,null),g(t,xn,h),g(t,te,h),e(te,Te),e(Te,Vs),j(Mt,Vs,null),e(te,Ga),e(te,zs),e(zs,Aa),g(t,kn,h),g(t,$,h),j(_t,$,null),e($,Va),e($,se),e(se,za),e(se,cs),e(cs,Ra),e(se,Na),e(se,yt),e(yt,Ya),e(se,Fa),e($,Qa),e($,ne),e(ne,Sa),e(ne,ds),e(ds,qa),e(ne,Ha),e(ne,ps),e(ps,Da),e(ne,Ka),e($,Oa),j(Ie,$,null),g(t,Zn,h),g(t,oe,h),e(oe,Ue),e(Ue,Rs),j(wt,Rs,null),e(oe,er),e(oe,Ns),e(Ns,tr),g(t,Pn,h),g(t,X,h),j(bt,X,null),e(X,sr),e(X,jt),e(jt,nr),e(jt,Ct),e(Ct,or),e(jt,ar),e(X,rr),e(X,B),j(vt,B,null),e(B,lr),e(B,ae),e(ae,ir),e(ae,ms),e(ms,cr),e(ae,dr),e(ae,Ys),e(Ys,pr),e(ae,mr),e(B,hr),j(Je,B,null),e(B,fr),j(Xe,B,null),e(X,ur),e(X,W),j(Tt,W,null),e(W,gr),e(W,re),e(re,Mr),e(re,hs),e(hs,_r),e(re,yr),e(re,Fs),e(Fs,wr),e(re,br),e(W,jr),j(xe,W,null),e(W,Cr),j(ke,W,null),e(X,vr),e(X,E),j(It,E,null),e(E,Tr),e(E,le),e(le,Ir),e(le,fs),e(fs,Ur),e(le,Jr),e(le,Qs),e(Qs,Xr),e(le,xr),e(E,kr),j(Ze,E,null),e(E,Zr),j(Pe,E,null),g(t,$n,h),g(t,ie,h),e(ie,$e),e($e,Ss),j(Ut,Ss,null),e(ie,Pr),e(ie,qs),e(qs,$r),g(t,Bn,h),g(t,ce,h),j(Jt,ce,null),e(ce,Br),e(ce,L),j(Xt,L,null),e(L,Wr),e(L,de),e(de,Er),e(de,us),e(us,Lr),e(de,Gr),e(de,Hs),e(Hs,Ar),e(de,Vr),e(L,zr),j(Be,L,null),e(L,Rr),j(We,L,null),g(t,Wn,h),g(t,pe,h),e(pe,Ee),e(Ee,Ds),j(xt,Ds,null),e(pe,Nr),e(pe,Ks),e(Ks,Yr),g(t,En,h),g(t,me,h),j(kt,me,null),e(me,Fr),e(me,G),j(Zt,G,null),e(G,Qr),e(G,he),e(he,Sr),e(he,gs),e(gs,qr),e(he,Hr),e(he,Os),e(Os,Dr),e(he,Kr),e(G,Or),j(Le,G,null),e(G,el),j(Ge,G,null),Ln=!0},p(t,[h]){const Pt={};h&2&&(Pt.$$scope={dirty:h,ctx:t}),ve.$set(Pt);const en={};h&2&&(en.$$scope={dirty:h,ctx:t}),Ie.$set(en);const tn={};h&2&&(tn.$$scope={dirty:h,ctx:t}),Je.$set(tn);const sn={};h&2&&(sn.$$scope={dirty:h,ctx:t}),Xe.$set(sn);const $t={};h&2&&($t.$$scope={dirty:h,ctx:t}),xe.$set($t);const nn={};h&2&&(nn.$$scope={dirty:h,ctx:t}),ke.$set(nn);const on={};h&2&&(on.$$scope={dirty:h,ctx:t}),Ze.$set(on);const an={};h&2&&(an.$$scope={dirty:h,ctx:t}),Pe.$set(an);const fe={};h&2&&(fe.$$scope={dirty:h,ctx:t}),Be.$set(fe);const rn={};h&2&&(rn.$$scope={dirty:h,ctx:t}),We.$set(rn);const ln={};h&2&&(ln.$$scope={dirty:h,ctx:t}),Le.$set(ln);const cn={};h&2&&(cn.$$scope={dirty:h,ctx:t}),Ge.$set(cn)},i(t){Ln||(C(n.$$.fragment,t),C(Se.$$.fragment,t),C(et.$$.fragment,t),C(nt.$$.fragment,t),C(ot.$$.fragment,t),C(at.$$.fragment,t),C(lt.$$.fragment,t),C(ct.$$.fragment,t),C(dt.$$.fragment,t),C(mt.$$.fragment,t),C(ft.$$.fragment,t),C(ut.$$.fragment,t),C(ve.$$.fragment,t),C(Mt.$$.fragment,t),C(_t.$$.fragment,t),C(Ie.$$.fragment,t),C(wt.$$.fragment,t),C(bt.$$.fragment,t),C(vt.$$.fragment,t),C(Je.$$.fragment,t),C(Xe.$$.fragment,t),C(Tt.$$.fragment,t),C(xe.$$.fragment,t),C(ke.$$.fragment,t),C(It.$$.fragment,t),C(Ze.$$.fragment,t),C(Pe.$$.fragment,t),C(Ut.$$.fragment,t),C(Jt.$$.fragment,t),C(Xt.$$.fragment,t),C(Be.$$.fragment,t),C(We.$$.fragment,t),C(xt.$$.fragment,t),C(kt.$$.fragment,t),C(Zt.$$.fragment,t),C(Le.$$.fragment,t),C(Ge.$$.fragment,t),Ln=!0)},o(t){v(n.$$.fragment,t),v(Se.$$.fragment,t),v(et.$$.fragment,t),v(nt.$$.fragment,t),v(ot.$$.fragment,t),v(at.$$.fragment,t),v(lt.$$.fragment,t),v(ct.$$.fragment,t),v(dt.$$.fragment,t),v(mt.$$.fragment,t),v(ft.$$.fragment,t),v(ut.$$.fragment,t),v(ve.$$.fragment,t),v(Mt.$$.fragment,t),v(_t.$$.fragment,t),v(Ie.$$.fragment,t),v(wt.$$.fragment,t),v(bt.$$.fragment,t),v(vt.$$.fragment,t),v(Je.$$.fragment,t),v(Xe.$$.fragment,t),v(Tt.$$.fragment,t),v(xe.$$.fragment,t),v(ke.$$.fragment,t),v(It.$$.fragment,t),v(Ze.$$.fragment,t),v(Pe.$$.fragment,t),v(Ut.$$.fragment,t),v(Jt.$$.fragment,t),v(Xt.$$.fragment,t),v(Be.$$.fragment,t),v(We.$$.fragment,t),v(xt.$$.fragment,t),v(kt.$$.fragment,t),v(Zt.$$.fragment,t),v(Le.$$.fragment,t),v(Ge.$$.fragment,t),Ln=!1},d(t){s(c),t&&s(y),t&&s(M),T(n),t&&s(pn),t&&s(Q),T(Se),t&&s(mn),t&&s(V),t&&s(hn),t&&s(At),t&&s(fn),t&&s(Vt),t&&s(un),t&&s(zt),t&&s(gn),t&&s(Rt),t&&s(Mn),t&&s(ge),t&&s(_n),t&&s(De),t&&s(yn),t&&s(z),t&&s(wn),t&&s(S),T(et),t&&s(bn),t&&s(Ft),t&&s(jn),t&&s(Qt),t&&s(Cn),t&&s(St),t&&s(vn),t&&s(q),T(nt),t&&s(Tn),t&&s(J),T(ot),T(at),T(lt),t&&s(In),t&&s(H),T(ct),t&&s(Un),t&&s(Z),T(dt),T(mt),t&&s(Jn),t&&s(K),T(ft),t&&s(Xn),t&&s(P),T(ut),T(ve),t&&s(xn),t&&s(te),T(Mt),t&&s(kn),t&&s($),T(_t),T(Ie),t&&s(Zn),t&&s(oe),T(wt),t&&s(Pn),t&&s(X),T(bt),T(vt),T(Je),T(Xe),T(Tt),T(xe),T(ke),T(It),T(Ze),T(Pe),t&&s($n),t&&s(ie),T(Ut),t&&s(Bn),t&&s(ce),T(Jt),T(Xt),T(Be),T(We),t&&s(Wn),t&&s(pe),T(xt),t&&s(En),t&&s(me),T(kt),T(Zt),T(Le),T(Ge)}}}const Ei={local:"xclip",sections:[{local:"overview",title:"Overview"},{local:"resources",title:"Resources"},{local:"transformers.XCLIPProcessor",title:"XCLIPProcessor"},{local:"transformers.XCLIPConfig",title:"XCLIPConfig"},{local:"transformers.XCLIPTextConfig",title:"XCLIPTextConfig"},{local:"transformers.XCLIPVisionConfig",title:"XCLIPVisionConfig"},{local:"transformers.XCLIPModel",title:"XCLIPModel"},{local:"transformers.XCLIPTextModel",title:"XCLIPTextModel"},{local:"transformers.XCLIPVisionModel",title:"XCLIPVisionModel"}],title:"X-CLIP"};function Li(I){return Ci(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Yi extends _i{constructor(c){super();yi(this,c,Li,Wi,wi,{})}}export{Yi as default,Ei as metadata};
