import{S as _i,i as yi,s as wi,e as a,k as f,w,t as l,M as Ti,c as o,d as s,m as u,a as r,x as T,h as i,b as d,N as bi,G as e,g,y as b,q as j,o as I,B as J,v as ji,L as Gt}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 Et}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as Q}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as $t}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";function Ii(C){let c,y,M,m,_;return m=new Et({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=a("p"),y=l("Example:"),M=f(),w(m.$$.fragment)},l(n){c=o(n,"P",{});var p=r(c);y=i(p,"Example:"),p.forEach(s),M=u(n),T(m.$$.fragment,n)},m(n,p){g(n,c,p),e(c,y),g(n,M,p),b(m,n,p),_=!0},p:Gt,i(n){_||(j(m.$$.fragment,n),_=!0)},o(n){I(m.$$.fragment,n),_=!1},d(n){n&&s(c),n&&s(M),J(m,n)}}}function Ji(C){let c,y,M,m,_;return m=new Et({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=a("p"),y=l("Example:"),M=f(),w(m.$$.fragment)},l(n){c=o(n,"P",{});var p=r(c);y=i(p,"Example:"),p.forEach(s),M=u(n),T(m.$$.fragment,n)},m(n,p){g(n,c,p),e(c,y),g(n,M,p),b(m,n,p),_=!0},p:Gt,i(n){_||(j(m.$$.fragment,n),_=!0)},o(n){I(m.$$.fragment,n),_=!1},d(n){n&&s(c),n&&s(M),J(m,n)}}}function Ci(C){let c,y,M,m,_;return{c(){c=a("p"),y=l("Although the recipe for forward pass needs to be defined within this function, one should call the "),M=a("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=o(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=o(p,"CODE",{});var v=r(M);m=i(v,"Module"),v.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 vi(C){let c,y,M,m,_;return m=new Et({props:{code:" ",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> av
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> numpy <span class="hljs-keyword">as</span> np

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

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


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


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


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

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

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

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

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

<span class="hljs-meta">&gt;&gt;&gt; </span>logits_per_video = outputs.logits_per_video  <span class="hljs-comment"># this is the video-text similarity score</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>probs = logits_per_video.softmax(dim=<span class="hljs-number">1</span>)  <span class="hljs-comment"># we can take the softmax to get the label probabilities</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(probs)
tensor([[<span class="hljs-number">1.9496e-04</span>, <span class="hljs-number">9.9960e-01</span>, <span class="hljs-number">2.0825e-04</span>]])`}}),{c(){c=a("p"),y=l("Examples:"),M=f(),w(m.$$.fragment)},l(n){c=o(n,"P",{});var p=r(c);y=i(p,"Examples:"),p.forEach(s),M=u(n),T(m.$$.fragment,n)},m(n,p){g(n,c,p),e(c,y),g(n,M,p),b(m,n,p),_=!0},p:Gt,i(n){_||(j(m.$$.fragment,n),_=!0)},o(n){I(m.$$.fragment,n),_=!1},d(n){n&&s(c),n&&s(M),J(m,n)}}}function Ui(C){let c,y,M,m,_;return{c(){c=a("p"),y=l("Although the recipe for forward pass needs to be defined within this function, one should call the "),M=a("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=o(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=o(p,"CODE",{});var v=r(M);m=i(v,"Module"),v.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(C){let c,y,M,m,_;return m=new Et({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=a("p"),y=l("Examples:"),M=f(),w(m.$$.fragment)},l(n){c=o(n,"P",{});var p=r(c);y=i(p,"Examples:"),p.forEach(s),M=u(n),T(m.$$.fragment,n)},m(n,p){g(n,c,p),e(c,y),g(n,M,p),b(m,n,p),_=!0},p:Gt,i(n){_||(j(m.$$.fragment,n),_=!0)},o(n){I(m.$$.fragment,n),_=!1},d(n){n&&s(c),n&&s(M),J(m,n)}}}function xi(C){let c,y,M,m,_;return{c(){c=a("p"),y=l("Although the recipe for forward pass needs to be defined within this function, one should call the "),M=a("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=o(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=o(p,"CODE",{});var v=r(M);m=i(v,"Module"),v.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 Zi(C){let c,y,M,m,_;return m=new Et({props:{code:" ",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> av
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> numpy <span class="hljs-keyword">as</span> np

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

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


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


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


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

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

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

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

<span class="hljs-meta">&gt;&gt;&gt; </span>video_features = model.get_video_features(**inputs)`}}),{c(){c=a("p"),y=l("Examples:"),M=f(),w(m.$$.fragment)},l(n){c=o(n,"P",{});var p=r(c);y=i(p,"Examples:"),p.forEach(s),M=u(n),T(m.$$.fragment,n)},m(n,p){g(n,c,p),e(c,y),g(n,M,p),b(m,n,p),_=!0},p:Gt,i(n){_||(j(m.$$.fragment,n),_=!0)},o(n){I(m.$$.fragment,n),_=!1},d(n){n&&s(c),n&&s(M),J(m,n)}}}function Bi(C){let c,y,M,m,_;return{c(){c=a("p"),y=l("Although the recipe for forward pass needs to be defined within this function, one should call the "),M=a("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=o(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=o(p,"CODE",{});var v=r(M);m=i(v,"Module"),v.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(C){let c,y,M,m,_;return m=new Et({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=a("p"),y=l("Examples:"),M=f(),w(m.$$.fragment)},l(n){c=o(n,"P",{});var p=r(c);y=i(p,"Examples:"),p.forEach(s),M=u(n),T(m.$$.fragment,n)},m(n,p){g(n,c,p),e(c,y),g(n,M,p),b(m,n,p),_=!0},p:Gt,i(n){_||(j(m.$$.fragment,n),_=!0)},o(n){I(m.$$.fragment,n),_=!1},d(n){n&&s(c),n&&s(M),J(m,n)}}}function Pi(C){let c,y,M,m,_;return{c(){c=a("p"),y=l("Although the recipe for forward pass needs to be defined within this function, one should call the "),M=a("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=o(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=o(p,"CODE",{});var v=r(M);m=i(v,"Module"),v.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 Wi(C){let c,y,M,m,_;return m=new Et({props:{code:" ",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> av
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> numpy <span class="hljs-keyword">as</span> np

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

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


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


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


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

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

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

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

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

<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(pixel_values)
<span class="hljs-meta">&gt;&gt;&gt; </span>last_hidden_state = outputs.last_hidden_state`}}),{c(){c=a("p"),y=l("Examples:"),M=f(),w(m.$$.fragment)},l(n){c=o(n,"P",{});var p=r(c);y=i(p,"Examples:"),p.forEach(s),M=u(n),T(m.$$.fragment,n)},m(n,p){g(n,c,p),e(c,y),g(n,M,p),b(m,n,p),_=!0},p:Gt,i(n){_||(j(m.$$.fragment,n),_=!0)},o(n){I(m.$$.fragment,n),_=!1},d(n){n&&s(c),n&&s(M),J(m,n)}}}function $i(C){let c,y,M,m,_,n,p,v,aa,pn,F,ue,Us,Se,oa,Xs,ra,mn,L,la,He,ia,ca,Vt,da,pa,hn,At,ma,fn,Lt,xs,ha,un,zt,fa,gn,Nt,qe,ua,Rt,ga,Ma,Mn,ge,sl,_n,De,_a,Yt,ya,yn,z,wa,Ke,Ta,ba,Oe,ja,Ia,wn,S,Me,Zs,et,Ja,Bs,Ca,Tn,Qt,va,bn,Ft,tt,Ua,st,Xa,xa,jn,St,Za,In,H,_e,ks,nt,Ba,Ps,ka,Jn,U,at,Pa,Ws,Wa,$a,Z,Ht,Ga,Ea,qt,Va,Aa,Dt,La,za,$s,Na,Ra,Kt,Ya,Qa,Fa,ye,ot,Sa,rt,Ha,Ot,qa,Da,Ka,we,lt,Oa,it,eo,es,to,so,Cn,q,Te,Gs,ct,no,Es,ao,vn,B,dt,oo,N,ts,ro,lo,ss,io,co,pt,po,mo,ho,D,fo,ns,uo,go,as,Mo,_o,yo,be,mt,wo,ht,To,os,bo,jo,Un,K,je,Vs,ft,Io,As,Jo,Xn,k,ut,Co,O,vo,rs,Uo,Xo,gt,xo,Zo,Bo,ee,ko,ls,Po,Wo,is,$o,Go,Eo,Ie,xn,te,Je,Ls,Mt,Vo,zs,Ao,Zn,P,_t,Lo,se,zo,cs,No,Ro,yt,Yo,Qo,Fo,ne,So,ds,Ho,qo,ps,Do,Ko,Oo,Ce,Bn,ae,ve,Ns,wt,er,Rs,tr,kn,X,Tt,sr,bt,nr,jt,ar,or,rr,W,It,lr,oe,ir,ms,cr,dr,Ys,pr,mr,hr,Ue,fr,Xe,ur,$,Jt,gr,re,Mr,hs,_r,yr,Qs,wr,Tr,br,xe,jr,Ze,Ir,G,Ct,Jr,le,Cr,fs,vr,Ur,Fs,Xr,xr,Zr,Be,Br,ke,Pn,ie,Pe,Ss,vt,kr,Hs,Pr,Wn,ce,Ut,Wr,E,Xt,$r,de,Gr,us,Er,Vr,qs,Ar,Lr,zr,We,Nr,$e,$n,pe,Ge,Ds,xt,Rr,Ks,Yr,Gn,me,Zt,Qr,V,Bt,Fr,he,Sr,gs,Hr,qr,Os,Dr,Kr,Or,Ee,el,Ve,En;return n=new Q({}),Se=new Q({}),et=new Q({}),nt=new Q({}),at=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"}}),ot=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 Q({}),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 Q({}),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"}}),Ie=new $t({props:{anchor:"transformers.XCLIPTextConfig.example",$$slots:{default:[Ii]},$$scope:{ctx:C}}}),Mt=new Q({}),_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"}}),Ce=new $t({props:{anchor:"transformers.XCLIPVisionConfig.example",$$slots:{default:[Ji]},$$scope:{ctx:C}}}),wt=new Q({}),Tt=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#L1292"}}),It=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/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__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/mobilevit#transformers.MobileViTFeatureExtractor.__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#L1501",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>
`}}),Ue=new dn({props:{$$slots:{default:[Ci]},$$scope:{ctx:C}}}),Xe=new $t({props:{anchor:"transformers.XCLIPModel.forward.example",$$slots:{default:[vi]},$$scope:{ctx:C}}}),Jt=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/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__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#L1339",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:[Ui]},$$scope:{ctx:C}}}),Ze=new $t({props:{anchor:"transformers.XCLIPModel.get_text_features.example",$$slots:{default:[Xi]},$$scope:{ctx:C}}}),Ct=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/mobilevit#transformers.MobileViTFeatureExtractor.__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#L1386",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>
`}}),Be=new dn({props:{$$slots:{default:[xi]},$$scope:{ctx:C}}}),ke=new $t({props:{anchor:"transformers.XCLIPModel.get_video_features.example",$$slots:{default:[Zi]},$$scope:{ctx:C}}}),vt=new Q({}),Ut=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/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__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>
`}}),We=new dn({props:{$$slots:{default:[Bi]},$$scope:{ctx:C}}}),$e=new $t({props:{anchor:"transformers.XCLIPTextModel.forward.example",$$slots:{default:[ki]},$$scope:{ctx:C}}}),xt=new Q({}),Zt=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"}}),Bt=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/mobilevit#transformers.MobileViTFeatureExtractor.__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>
`}}),Ee=new dn({props:{$$slots:{default:[Pi]},$$scope:{ctx:C}}}),Ve=new $t({props:{anchor:"transformers.XCLIPVisionModel.forward.example",$$slots:{default:[Wi]},$$scope:{ctx:C}}}),{c(){c=a("meta"),y=f(),M=a("h1"),m=a("a"),_=a("span"),w(n.$$.fragment),p=f(),v=a("span"),aa=l("X-CLIP"),pn=f(),F=a("h2"),ue=a("a"),Us=a("span"),w(Se.$$.fragment),oa=f(),Xs=a("span"),ra=l("Overview"),mn=f(),L=a("p"),la=l("The X-CLIP model was proposed in "),He=a("a"),ia=l("Expanding Language-Image Pretrained Models for General Video Recognition"),ca=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 `),Vt=a("a"),da=l("CLIP"),pa=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=a("p"),ma=l("The abstract from the paper is the following:"),fn=f(),Lt=a("p"),xs=a("em"),ha=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=a("p"),fa=l("Tips:"),gn=f(),Nt=a("ul"),qe=a("li"),ua=l("Usage of X-CLIP is identical to "),Rt=a("a"),ga=l("CLIP"),Ma=l("."),Mn=f(),ge=a("img"),_n=f(),De=a("small"),_a=l("X-CLIP architecture. Taken from the "),Yt=a("a"),ya=l("original paper."),yn=f(),z=a("p"),wa=l("This model was contributed by "),Ke=a("a"),Ta=l("nielsr"),ba=l(`.
The original code can be found `),Oe=a("a"),ja=l("here"),Ia=l("."),wn=f(),S=a("h2"),Me=a("a"),Zs=a("span"),w(et.$$.fragment),Ja=f(),Bs=a("span"),Ca=l("Resources"),Tn=f(),Qt=a("p"),va=l("A list of official Hugging Face and community (indicated by \u{1F30E}) resources to help you get started with X-CLIP."),bn=f(),Ft=a("ul"),tt=a("li"),Ua=l("Demo notebooks for X-CLIP can be found "),st=a("a"),Xa=l("here"),xa=l("."),jn=f(),St=a("p"),Za=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."),In=f(),H=a("h2"),_e=a("a"),ks=a("span"),w(nt.$$.fragment),Ba=f(),Ps=a("span"),ka=l("XCLIPProcessor"),Jn=f(),U=a("div"),w(at.$$.fragment),Pa=f(),Ws=a("p"),Wa=l("Constructs an X-CLIP processor which wraps a VideoMAE image processor and a CLIP tokenizer into a single processor."),$a=f(),Z=a("p"),Ht=a("a"),Ga=l("XCLIPProcessor"),Ea=l(" offers all the functionalities of "),qt=a("a"),Va=l("VideoMAEImageProcessor"),Aa=l(" and "),Dt=a("a"),La=l("CLIPTokenizerFast"),za=l(`. See the
`),$s=a("code"),Na=l("__call__()"),Ra=l(" and "),Kt=a("a"),Ya=l("decode()"),Qa=l(" for more information."),Fa=f(),ye=a("div"),w(ot.$$.fragment),Sa=f(),rt=a("p"),Ha=l("This method forwards all its arguments to CLIPTokenizerFast\u2019s "),Ot=a("a"),qa=l("batch_decode()"),Da=l(`. Please
refer to the docstring of this method for more information.`),Ka=f(),we=a("div"),w(lt.$$.fragment),Oa=f(),it=a("p"),eo=l("This method forwards all its arguments to CLIPTokenizerFast\u2019s "),es=a("a"),to=l("decode()"),so=l(`. Please refer to
the docstring of this method for more information.`),Cn=f(),q=a("h2"),Te=a("a"),Gs=a("span"),w(ct.$$.fragment),no=f(),Es=a("span"),ao=l("XCLIPConfig"),vn=f(),B=a("div"),w(dt.$$.fragment),oo=f(),N=a("p"),ts=a("a"),ro=l("XCLIPConfig"),lo=l(" is the configuration class to store the configuration of a "),ss=a("a"),io=l("XCLIPModel"),co=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=a("a"),po=l("microsoft/xclip-base-patch32"),mo=l(" architecture."),ho=f(),D=a("p"),fo=l("Configuration objects inherit from "),ns=a("a"),uo=l("PretrainedConfig"),go=l(` and can be used to control the model outputs. Read the
documentation from `),as=a("a"),Mo=l("PretrainedConfig"),_o=l(" for more information."),yo=f(),be=a("div"),w(mt.$$.fragment),wo=f(),ht=a("p"),To=l("Instantiate a "),os=a("a"),bo=l("XCLIPConfig"),jo=l(` (or a derived class) from xclip text model configuration and xclip vision model
configuration.`),Un=f(),K=a("h2"),je=a("a"),Vs=a("span"),w(ft.$$.fragment),Io=f(),As=a("span"),Jo=l("XCLIPTextConfig"),Xn=f(),k=a("div"),w(ut.$$.fragment),Co=f(),O=a("p"),vo=l("This is the configuration class to store the configuration of a "),rs=a("a"),Uo=l("XCLIPModel"),Xo=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=a("a"),xo=l("microsoft/xclip-base-patch32"),Zo=l(" architecture."),Bo=f(),ee=a("p"),ko=l("Configuration objects inherit from "),ls=a("a"),Po=l("PretrainedConfig"),Wo=l(` and can be used to control the model outputs. Read the
documentation from `),is=a("a"),$o=l("PretrainedConfig"),Go=l(" for more information."),Eo=f(),w(Ie.$$.fragment),xn=f(),te=a("h2"),Je=a("a"),Ls=a("span"),w(Mt.$$.fragment),Vo=f(),zs=a("span"),Ao=l("XCLIPVisionConfig"),Zn=f(),P=a("div"),w(_t.$$.fragment),Lo=f(),se=a("p"),zo=l("This is the configuration class to store the configuration of a "),cs=a("a"),No=l("XCLIPModel"),Ro=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=a("a"),Yo=l("microsoft/xclip-base-patch32"),Qo=l(" architecture."),Fo=f(),ne=a("p"),So=l("Configuration objects inherit from "),ds=a("a"),Ho=l("PretrainedConfig"),qo=l(` and can be used to control the model outputs. Read the
documentation from `),ps=a("a"),Do=l("PretrainedConfig"),Ko=l(" for more information."),Oo=f(),w(Ce.$$.fragment),Bn=f(),ae=a("h2"),ve=a("a"),Ns=a("span"),w(wt.$$.fragment),er=f(),Rs=a("span"),tr=l("XCLIPModel"),kn=f(),X=a("div"),w(Tt.$$.fragment),sr=f(),bt=a("p"),nr=l("This model is a PyTorch "),jt=a("a"),ar=l("torch.nn.Module"),or=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(),W=a("div"),w(It.$$.fragment),lr=f(),oe=a("p"),ir=l("The "),ms=a("a"),cr=l("XCLIPModel"),dr=l(" forward method, overrides the "),Ys=a("code"),pr=l("__call__"),mr=l(" special method."),hr=f(),w(Ue.$$.fragment),fr=f(),w(Xe.$$.fragment),ur=f(),$=a("div"),w(Jt.$$.fragment),gr=f(),re=a("p"),Mr=l("The "),hs=a("a"),_r=l("XCLIPModel"),yr=l(" forward method, overrides the "),Qs=a("code"),wr=l("__call__"),Tr=l(" special method."),br=f(),w(xe.$$.fragment),jr=f(),w(Ze.$$.fragment),Ir=f(),G=a("div"),w(Ct.$$.fragment),Jr=f(),le=a("p"),Cr=l("The "),fs=a("a"),vr=l("XCLIPModel"),Ur=l(" forward method, overrides the "),Fs=a("code"),Xr=l("__call__"),xr=l(" special method."),Zr=f(),w(Be.$$.fragment),Br=f(),w(ke.$$.fragment),Pn=f(),ie=a("h2"),Pe=a("a"),Ss=a("span"),w(vt.$$.fragment),kr=f(),Hs=a("span"),Pr=l("XCLIPTextModel"),Wn=f(),ce=a("div"),w(Ut.$$.fragment),Wr=f(),E=a("div"),w(Xt.$$.fragment),$r=f(),de=a("p"),Gr=l("The "),us=a("a"),Er=l("XCLIPTextModel"),Vr=l(" forward method, overrides the "),qs=a("code"),Ar=l("__call__"),Lr=l(" special method."),zr=f(),w(We.$$.fragment),Nr=f(),w($e.$$.fragment),$n=f(),pe=a("h2"),Ge=a("a"),Ds=a("span"),w(xt.$$.fragment),Rr=f(),Ks=a("span"),Yr=l("XCLIPVisionModel"),Gn=f(),me=a("div"),w(Zt.$$.fragment),Qr=f(),V=a("div"),w(Bt.$$.fragment),Fr=f(),he=a("p"),Sr=l("The "),gs=a("a"),Hr=l("XCLIPVisionModel"),qr=l(" forward method, overrides the "),Os=a("code"),Dr=l("__call__"),Kr=l(" special method."),Or=f(),w(Ee.$$.fragment),el=f(),w(Ve.$$.fragment),this.h()},l(t){const h=Ti('[data-svelte="svelte-1phssyn"]',document.head);c=o(h,"META",{name:!0,content:!0}),h.forEach(s),y=u(t),M=o(t,"H1",{class:!0});var kt=r(M);m=o(kt,"A",{id:!0,class:!0,href:!0});var en=r(m);_=o(en,"SPAN",{});var tn=r(_);T(n.$$.fragment,tn),tn.forEach(s),en.forEach(s),p=u(kt),v=o(kt,"SPAN",{});var sn=r(v);aa=i(sn,"X-CLIP"),sn.forEach(s),kt.forEach(s),pn=u(t),F=o(t,"H2",{class:!0});var Pt=r(F);ue=o(Pt,"A",{id:!0,class:!0,href:!0});var nn=r(ue);Us=o(nn,"SPAN",{});var an=r(Us);T(Se.$$.fragment,an),an.forEach(s),nn.forEach(s),oa=u(Pt),Xs=o(Pt,"SPAN",{});var on=r(Xs);ra=i(on,"Overview"),on.forEach(s),Pt.forEach(s),mn=u(t),L=o(t,"P",{});var fe=r(L);la=i(fe,"The X-CLIP model was proposed in "),He=o(fe,"A",{href:!0,rel:!0});var rn=r(He);ia=i(rn,"Expanding Language-Image Pretrained Models for General Video Recognition"),rn.forEach(s),ca=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 `),Vt=o(fe,"A",{href:!0});var ln=r(Vt);da=i(ln,"CLIP"),ln.forEach(s),pa=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=o(t,"P",{});var cn=r(At);ma=i(cn,"The abstract from the paper is the following:"),cn.forEach(s),fn=u(t),Lt=o(t,"P",{});var nl=r(Lt);xs=o(nl,"EM",{});var al=r(xs);ha=i(al,"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."),al.forEach(s),nl.forEach(s),un=u(t),zt=o(t,"P",{});var ol=r(zt);fa=i(ol,"Tips:"),ol.forEach(s),gn=u(t),Nt=o(t,"UL",{});var rl=r(Nt);qe=o(rl,"LI",{});var Vn=r(qe);ua=i(Vn,"Usage of X-CLIP is identical to "),Rt=o(Vn,"A",{href:!0});var ll=r(Rt);ga=i(ll,"CLIP"),ll.forEach(s),Ma=i(Vn,"."),Vn.forEach(s),rl.forEach(s),Mn=u(t),ge=o(t,"IMG",{src:!0,alt:!0,width:!0}),_n=u(t),De=o(t,"SMALL",{});var tl=r(De);_a=i(tl,"X-CLIP architecture. Taken from the "),Yt=o(tl,"A",{href:!0});var il=r(Yt);ya=i(il,"original paper."),il.forEach(s),tl.forEach(s),yn=u(t),z=o(t,"P",{});var Ms=r(z);wa=i(Ms,"This model was contributed by "),Ke=o(Ms,"A",{href:!0,rel:!0});var cl=r(Ke);Ta=i(cl,"nielsr"),cl.forEach(s),ba=i(Ms,`.
The original code can be found `),Oe=o(Ms,"A",{href:!0,rel:!0});var dl=r(Oe);ja=i(dl,"here"),dl.forEach(s),Ia=i(Ms,"."),Ms.forEach(s),wn=u(t),S=o(t,"H2",{class:!0});var An=r(S);Me=o(An,"A",{id:!0,class:!0,href:!0});var pl=r(Me);Zs=o(pl,"SPAN",{});var ml=r(Zs);T(et.$$.fragment,ml),ml.forEach(s),pl.forEach(s),Ja=u(An),Bs=o(An,"SPAN",{});var hl=r(Bs);Ca=i(hl,"Resources"),hl.forEach(s),An.forEach(s),Tn=u(t),Qt=o(t,"P",{});var fl=r(Qt);va=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),bn=u(t),Ft=o(t,"UL",{});var ul=r(Ft);tt=o(ul,"LI",{});var Ln=r(tt);Ua=i(Ln,"Demo notebooks for X-CLIP can be found "),st=o(Ln,"A",{href:!0,rel:!0});var gl=r(st);Xa=i(gl,"here"),gl.forEach(s),xa=i(Ln,"."),Ln.forEach(s),ul.forEach(s),jn=u(t),St=o(t,"P",{});var Ml=r(St);Za=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),In=u(t),H=o(t,"H2",{class:!0});var zn=r(H);_e=o(zn,"A",{id:!0,class:!0,href:!0});var _l=r(_e);ks=o(_l,"SPAN",{});var yl=r(ks);T(nt.$$.fragment,yl),yl.forEach(s),_l.forEach(s),Ba=u(zn),Ps=o(zn,"SPAN",{});var wl=r(Ps);ka=i(wl,"XCLIPProcessor"),wl.forEach(s),zn.forEach(s),Jn=u(t),U=o(t,"DIV",{class:!0});var R=r(U);T(at.$$.fragment,R),Pa=u(R),Ws=o(R,"P",{});var Tl=r(Ws);Wa=i(Tl,"Constructs an X-CLIP processor which wraps a VideoMAE image processor and a CLIP tokenizer into a single processor."),Tl.forEach(s),$a=u(R),Z=o(R,"P",{});var A=r(Z);Ht=o(A,"A",{href:!0});var bl=r(Ht);Ga=i(bl,"XCLIPProcessor"),bl.forEach(s),Ea=i(A," offers all the functionalities of "),qt=o(A,"A",{href:!0});var jl=r(qt);Va=i(jl,"VideoMAEImageProcessor"),jl.forEach(s),Aa=i(A," and "),Dt=o(A,"A",{href:!0});var Il=r(Dt);La=i(Il,"CLIPTokenizerFast"),Il.forEach(s),za=i(A,`. See the
`),$s=o(A,"CODE",{});var Jl=r($s);Na=i(Jl,"__call__()"),Jl.forEach(s),Ra=i(A," and "),Kt=o(A,"A",{href:!0});var Cl=r(Kt);Ya=i(Cl,"decode()"),Cl.forEach(s),Qa=i(A," for more information."),A.forEach(s),Fa=u(R),ye=o(R,"DIV",{class:!0});var Nn=r(ye);T(ot.$$.fragment,Nn),Sa=u(Nn),rt=o(Nn,"P",{});var Rn=r(rt);Ha=i(Rn,"This method forwards all its arguments to CLIPTokenizerFast\u2019s "),Ot=o(Rn,"A",{href:!0});var vl=r(Ot);qa=i(vl,"batch_decode()"),vl.forEach(s),Da=i(Rn,`. Please
refer to the docstring of this method for more information.`),Rn.forEach(s),Nn.forEach(s),Ka=u(R),we=o(R,"DIV",{class:!0});var Yn=r(we);T(lt.$$.fragment,Yn),Oa=u(Yn),it=o(Yn,"P",{});var Qn=r(it);eo=i(Qn,"This method forwards all its arguments to CLIPTokenizerFast\u2019s "),es=o(Qn,"A",{href:!0});var Ul=r(es);to=i(Ul,"decode()"),Ul.forEach(s),so=i(Qn,`. Please refer to
the docstring of this method for more information.`),Qn.forEach(s),Yn.forEach(s),R.forEach(s),Cn=u(t),q=o(t,"H2",{class:!0});var Fn=r(q);Te=o(Fn,"A",{id:!0,class:!0,href:!0});var Xl=r(Te);Gs=o(Xl,"SPAN",{});var xl=r(Gs);T(ct.$$.fragment,xl),xl.forEach(s),Xl.forEach(s),no=u(Fn),Es=o(Fn,"SPAN",{});var Zl=r(Es);ao=i(Zl,"XCLIPConfig"),Zl.forEach(s),Fn.forEach(s),vn=u(t),B=o(t,"DIV",{class:!0});var Ae=r(B);T(dt.$$.fragment,Ae),oo=u(Ae),N=o(Ae,"P",{});var Wt=r(N);ts=o(Wt,"A",{href:!0});var Bl=r(ts);ro=i(Bl,"XCLIPConfig"),Bl.forEach(s),lo=i(Wt," is the configuration class to store the configuration of a "),ss=o(Wt,"A",{href:!0});var kl=r(ss);io=i(kl,"XCLIPModel"),kl.forEach(s),co=i(Wt,`. 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(Wt,"A",{href:!0,rel:!0});var Pl=r(pt);po=i(Pl,"microsoft/xclip-base-patch32"),Pl.forEach(s),mo=i(Wt," architecture."),Wt.forEach(s),ho=u(Ae),D=o(Ae,"P",{});var _s=r(D);fo=i(_s,"Configuration objects inherit from "),ns=o(_s,"A",{href:!0});var Wl=r(ns);uo=i(Wl,"PretrainedConfig"),Wl.forEach(s),go=i(_s,` and can be used to control the model outputs. Read the
documentation from `),as=o(_s,"A",{href:!0});var $l=r(as);Mo=i($l,"PretrainedConfig"),$l.forEach(s),_o=i(_s," for more information."),_s.forEach(s),yo=u(Ae),be=o(Ae,"DIV",{class:!0});var Sn=r(be);T(mt.$$.fragment,Sn),wo=u(Sn),ht=o(Sn,"P",{});var Hn=r(ht);To=i(Hn,"Instantiate a "),os=o(Hn,"A",{href:!0});var Gl=r(os);bo=i(Gl,"XCLIPConfig"),Gl.forEach(s),jo=i(Hn,` (or a derived class) from xclip text model configuration and xclip vision model
configuration.`),Hn.forEach(s),Sn.forEach(s),Ae.forEach(s),Un=u(t),K=o(t,"H2",{class:!0});var qn=r(K);je=o(qn,"A",{id:!0,class:!0,href:!0});var El=r(je);Vs=o(El,"SPAN",{});var Vl=r(Vs);T(ft.$$.fragment,Vl),Vl.forEach(s),El.forEach(s),Io=u(qn),As=o(qn,"SPAN",{});var Al=r(As);Jo=i(Al,"XCLIPTextConfig"),Al.forEach(s),qn.forEach(s),Xn=u(t),k=o(t,"DIV",{class:!0});var Le=r(k);T(ut.$$.fragment,Le),Co=u(Le),O=o(Le,"P",{});var ys=r(O);vo=i(ys,"This is the configuration class to store the configuration of a "),rs=o(ys,"A",{href:!0});var Ll=r(rs);Uo=i(Ll,"XCLIPModel"),Ll.forEach(s),Xo=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=o(ys,"A",{href:!0,rel:!0});var zl=r(gt);xo=i(zl,"microsoft/xclip-base-patch32"),zl.forEach(s),Zo=i(ys," architecture."),ys.forEach(s),Bo=u(Le),ee=o(Le,"P",{});var ws=r(ee);ko=i(ws,"Configuration objects inherit from "),ls=o(ws,"A",{href:!0});var Nl=r(ls);Po=i(Nl,"PretrainedConfig"),Nl.forEach(s),Wo=i(ws,` and can be used to control the model outputs. Read the
documentation from `),is=o(ws,"A",{href:!0});var Rl=r(is);$o=i(Rl,"PretrainedConfig"),Rl.forEach(s),Go=i(ws," for more information."),ws.forEach(s),Eo=u(Le),T(Ie.$$.fragment,Le),Le.forEach(s),xn=u(t),te=o(t,"H2",{class:!0});var Dn=r(te);Je=o(Dn,"A",{id:!0,class:!0,href:!0});var Yl=r(Je);Ls=o(Yl,"SPAN",{});var Ql=r(Ls);T(Mt.$$.fragment,Ql),Ql.forEach(s),Yl.forEach(s),Vo=u(Dn),zs=o(Dn,"SPAN",{});var Fl=r(zs);Ao=i(Fl,"XCLIPVisionConfig"),Fl.forEach(s),Dn.forEach(s),Zn=u(t),P=o(t,"DIV",{class:!0});var ze=r(P);T(_t.$$.fragment,ze),Lo=u(ze),se=o(ze,"P",{});var Ts=r(se);zo=i(Ts,"This is the configuration class to store the configuration of a "),cs=o(Ts,"A",{href:!0});var Sl=r(cs);No=i(Sl,"XCLIPModel"),Sl.forEach(s),Ro=i(Ts,`. 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(Ts,"A",{href:!0,rel:!0});var Hl=r(yt);Yo=i(Hl,"microsoft/xclip-base-patch32"),Hl.forEach(s),Qo=i(Ts," architecture."),Ts.forEach(s),Fo=u(ze),ne=o(ze,"P",{});var bs=r(ne);So=i(bs,"Configuration objects inherit from "),ds=o(bs,"A",{href:!0});var ql=r(ds);Ho=i(ql,"PretrainedConfig"),ql.forEach(s),qo=i(bs,` and can be used to control the model outputs. Read the
documentation from `),ps=o(bs,"A",{href:!0});var Dl=r(ps);Do=i(Dl,"PretrainedConfig"),Dl.forEach(s),Ko=i(bs," for more information."),bs.forEach(s),Oo=u(ze),T(Ce.$$.fragment,ze),ze.forEach(s),Bn=u(t),ae=o(t,"H2",{class:!0});var Kn=r(ae);ve=o(Kn,"A",{id:!0,class:!0,href:!0});var Kl=r(ve);Ns=o(Kl,"SPAN",{});var Ol=r(Ns);T(wt.$$.fragment,Ol),Ol.forEach(s),Kl.forEach(s),er=u(Kn),Rs=o(Kn,"SPAN",{});var ei=r(Rs);tr=i(ei,"XCLIPModel"),ei.forEach(s),Kn.forEach(s),kn=u(t),X=o(t,"DIV",{class:!0});var Y=r(X);T(Tt.$$.fragment,Y),sr=u(Y),bt=o(Y,"P",{});var On=r(bt);nr=i(On,"This model is a PyTorch "),jt=o(On,"A",{href:!0,rel:!0});var ti=r(jt);ar=i(ti,"torch.nn.Module"),ti.forEach(s),or=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),W=o(Y,"DIV",{class:!0});var Ne=r(W);T(It.$$.fragment,Ne),lr=u(Ne),oe=o(Ne,"P",{});var js=r(oe);ir=i(js,"The "),ms=o(js,"A",{href:!0});var si=r(ms);cr=i(si,"XCLIPModel"),si.forEach(s),dr=i(js," forward method, overrides the "),Ys=o(js,"CODE",{});var ni=r(Ys);pr=i(ni,"__call__"),ni.forEach(s),mr=i(js," special method."),js.forEach(s),hr=u(Ne),T(Ue.$$.fragment,Ne),fr=u(Ne),T(Xe.$$.fragment,Ne),Ne.forEach(s),ur=u(Y),$=o(Y,"DIV",{class:!0});var Re=r($);T(Jt.$$.fragment,Re),gr=u(Re),re=o(Re,"P",{});var Is=r(re);Mr=i(Is,"The "),hs=o(Is,"A",{href:!0});var ai=r(hs);_r=i(ai,"XCLIPModel"),ai.forEach(s),yr=i(Is," forward method, overrides the "),Qs=o(Is,"CODE",{});var oi=r(Qs);wr=i(oi,"__call__"),oi.forEach(s),Tr=i(Is," special method."),Is.forEach(s),br=u(Re),T(xe.$$.fragment,Re),jr=u(Re),T(Ze.$$.fragment,Re),Re.forEach(s),Ir=u(Y),G=o(Y,"DIV",{class:!0});var Ye=r(G);T(Ct.$$.fragment,Ye),Jr=u(Ye),le=o(Ye,"P",{});var Js=r(le);Cr=i(Js,"The "),fs=o(Js,"A",{href:!0});var ri=r(fs);vr=i(ri,"XCLIPModel"),ri.forEach(s),Ur=i(Js," forward method, overrides the "),Fs=o(Js,"CODE",{});var li=r(Fs);Xr=i(li,"__call__"),li.forEach(s),xr=i(Js," special method."),Js.forEach(s),Zr=u(Ye),T(Be.$$.fragment,Ye),Br=u(Ye),T(ke.$$.fragment,Ye),Ye.forEach(s),Y.forEach(s),Pn=u(t),ie=o(t,"H2",{class:!0});var ea=r(ie);Pe=o(ea,"A",{id:!0,class:!0,href:!0});var ii=r(Pe);Ss=o(ii,"SPAN",{});var ci=r(Ss);T(vt.$$.fragment,ci),ci.forEach(s),ii.forEach(s),kr=u(ea),Hs=o(ea,"SPAN",{});var di=r(Hs);Pr=i(di,"XCLIPTextModel"),di.forEach(s),ea.forEach(s),Wn=u(t),ce=o(t,"DIV",{class:!0});var ta=r(ce);T(Ut.$$.fragment,ta),Wr=u(ta),E=o(ta,"DIV",{class:!0});var Qe=r(E);T(Xt.$$.fragment,Qe),$r=u(Qe),de=o(Qe,"P",{});var Cs=r(de);Gr=i(Cs,"The "),us=o(Cs,"A",{href:!0});var pi=r(us);Er=i(pi,"XCLIPTextModel"),pi.forEach(s),Vr=i(Cs," forward method, overrides the "),qs=o(Cs,"CODE",{});var mi=r(qs);Ar=i(mi,"__call__"),mi.forEach(s),Lr=i(Cs," special method."),Cs.forEach(s),zr=u(Qe),T(We.$$.fragment,Qe),Nr=u(Qe),T($e.$$.fragment,Qe),Qe.forEach(s),ta.forEach(s),$n=u(t),pe=o(t,"H2",{class:!0});var sa=r(pe);Ge=o(sa,"A",{id:!0,class:!0,href:!0});var hi=r(Ge);Ds=o(hi,"SPAN",{});var fi=r(Ds);T(xt.$$.fragment,fi),fi.forEach(s),hi.forEach(s),Rr=u(sa),Ks=o(sa,"SPAN",{});var ui=r(Ks);Yr=i(ui,"XCLIPVisionModel"),ui.forEach(s),sa.forEach(s),Gn=u(t),me=o(t,"DIV",{class:!0});var na=r(me);T(Zt.$$.fragment,na),Qr=u(na),V=o(na,"DIV",{class:!0});var Fe=r(V);T(Bt.$$.fragment,Fe),Fr=u(Fe),he=o(Fe,"P",{});var vs=r(he);Sr=i(vs,"The "),gs=o(vs,"A",{href:!0});var gi=r(gs);Hr=i(gi,"XCLIPVisionModel"),gi.forEach(s),qr=i(vs," forward method, overrides the "),Os=o(vs,"CODE",{});var Mi=r(Os);Dr=i(Mi,"__call__"),Mi.forEach(s),Kr=i(vs," special method."),vs.forEach(s),Or=u(Fe),T(Ee.$$.fragment,Fe),el=u(Fe),T(Ve.$$.fragment,Fe),Fe.forEach(s),na.forEach(s),this.h()},h(){d(c,"name","hf:doc:metadata"),d(c,"content",JSON.stringify(Gi)),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(F,"class","relative group"),d(He,"href","https://arxiv.org/abs/2208.02816"),d(He,"rel","nofollow"),d(Vt,"href","clip"),d(Rt,"href","clip"),bi(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(H,"class","relative group"),d(Ht,"href","/docs/transformers/main/en/model_doc/xclip#transformers.XCLIPProcessor"),d(qt,"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/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.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/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.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(U,"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.XCLIPConfig"),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.XCLIPConfig"),d(q,"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(as,"href","/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig"),d(os,"href","/docs/transformers/main/en/model_doc/xclip#transformers.XCLIPConfig"),d(be,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),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(je,"id","transformers.XCLIPTextConfig"),d(je,"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(je,"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(k,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Je,"id","transformers.XCLIPVisionConfig"),d(Je,"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(Je,"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(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(ve,"id","transformers.XCLIPModel"),d(ve,"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(ve,"href","#transformers.XCLIPModel"),d(ae,"class","relative group"),d(jt,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),d(jt,"rel","nofollow"),d(ms,"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(hs,"href","/docs/transformers/main/en/model_doc/xclip#transformers.XCLIPModel"),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(fs,"href","/docs/transformers/main/en/model_doc/xclip#transformers.XCLIPModel"),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(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(Pe,"id","transformers.XCLIPTextModel"),d(Pe,"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(Pe,"href","#transformers.XCLIPTextModel"),d(ie,"class","relative group"),d(us,"href","/docs/transformers/main/en/model_doc/xclip#transformers.XCLIPTextModel"),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(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(Ge,"id","transformers.XCLIPVisionModel"),d(Ge,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(Ge,"href","#transformers.XCLIPVisionModel"),d(pe,"class","relative group"),d(gs,"href","/docs/transformers/main/en/model_doc/xclip#transformers.XCLIPVisionModel"),d(V,"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,_),b(n,_,null),e(M,p),e(M,v),e(v,aa),g(t,pn,h),g(t,F,h),e(F,ue),e(ue,Us),b(Se,Us,null),e(F,oa),e(F,Xs),e(Xs,ra),g(t,mn,h),g(t,L,h),e(L,la),e(L,He),e(He,ia),e(L,ca),e(L,Vt),e(Vt,da),e(L,pa),g(t,hn,h),g(t,At,h),e(At,ma),g(t,fn,h),g(t,Lt,h),e(Lt,xs),e(xs,ha),g(t,un,h),g(t,zt,h),e(zt,fa),g(t,gn,h),g(t,Nt,h),e(Nt,qe),e(qe,ua),e(qe,Rt),e(Rt,ga),e(qe,Ma),g(t,Mn,h),g(t,ge,h),g(t,_n,h),g(t,De,h),e(De,_a),e(De,Yt),e(Yt,ya),g(t,yn,h),g(t,z,h),e(z,wa),e(z,Ke),e(Ke,Ta),e(z,ba),e(z,Oe),e(Oe,ja),e(z,Ia),g(t,wn,h),g(t,S,h),e(S,Me),e(Me,Zs),b(et,Zs,null),e(S,Ja),e(S,Bs),e(Bs,Ca),g(t,Tn,h),g(t,Qt,h),e(Qt,va),g(t,bn,h),g(t,Ft,h),e(Ft,tt),e(tt,Ua),e(tt,st),e(st,Xa),e(tt,xa),g(t,jn,h),g(t,St,h),e(St,Za),g(t,In,h),g(t,H,h),e(H,_e),e(_e,ks),b(nt,ks,null),e(H,Ba),e(H,Ps),e(Ps,ka),g(t,Jn,h),g(t,U,h),b(at,U,null),e(U,Pa),e(U,Ws),e(Ws,Wa),e(U,$a),e(U,Z),e(Z,Ht),e(Ht,Ga),e(Z,Ea),e(Z,qt),e(qt,Va),e(Z,Aa),e(Z,Dt),e(Dt,La),e(Z,za),e(Z,$s),e($s,Na),e(Z,Ra),e(Z,Kt),e(Kt,Ya),e(Z,Qa),e(U,Fa),e(U,ye),b(ot,ye,null),e(ye,Sa),e(ye,rt),e(rt,Ha),e(rt,Ot),e(Ot,qa),e(rt,Da),e(U,Ka),e(U,we),b(lt,we,null),e(we,Oa),e(we,it),e(it,eo),e(it,es),e(es,to),e(it,so),g(t,Cn,h),g(t,q,h),e(q,Te),e(Te,Gs),b(ct,Gs,null),e(q,no),e(q,Es),e(Es,ao),g(t,vn,h),g(t,B,h),b(dt,B,null),e(B,oo),e(B,N),e(N,ts),e(ts,ro),e(N,lo),e(N,ss),e(ss,io),e(N,co),e(N,pt),e(pt,po),e(N,mo),e(B,ho),e(B,D),e(D,fo),e(D,ns),e(ns,uo),e(D,go),e(D,as),e(as,Mo),e(D,_o),e(B,yo),e(B,be),b(mt,be,null),e(be,wo),e(be,ht),e(ht,To),e(ht,os),e(os,bo),e(ht,jo),g(t,Un,h),g(t,K,h),e(K,je),e(je,Vs),b(ft,Vs,null),e(K,Io),e(K,As),e(As,Jo),g(t,Xn,h),g(t,k,h),b(ut,k,null),e(k,Co),e(k,O),e(O,vo),e(O,rs),e(rs,Uo),e(O,Xo),e(O,gt),e(gt,xo),e(O,Zo),e(k,Bo),e(k,ee),e(ee,ko),e(ee,ls),e(ls,Po),e(ee,Wo),e(ee,is),e(is,$o),e(ee,Go),e(k,Eo),b(Ie,k,null),g(t,xn,h),g(t,te,h),e(te,Je),e(Je,Ls),b(Mt,Ls,null),e(te,Vo),e(te,zs),e(zs,Ao),g(t,Zn,h),g(t,P,h),b(_t,P,null),e(P,Lo),e(P,se),e(se,zo),e(se,cs),e(cs,No),e(se,Ro),e(se,yt),e(yt,Yo),e(se,Qo),e(P,Fo),e(P,ne),e(ne,So),e(ne,ds),e(ds,Ho),e(ne,qo),e(ne,ps),e(ps,Do),e(ne,Ko),e(P,Oo),b(Ce,P,null),g(t,Bn,h),g(t,ae,h),e(ae,ve),e(ve,Ns),b(wt,Ns,null),e(ae,er),e(ae,Rs),e(Rs,tr),g(t,kn,h),g(t,X,h),b(Tt,X,null),e(X,sr),e(X,bt),e(bt,nr),e(bt,jt),e(jt,ar),e(bt,or),e(X,rr),e(X,W),b(It,W,null),e(W,lr),e(W,oe),e(oe,ir),e(oe,ms),e(ms,cr),e(oe,dr),e(oe,Ys),e(Ys,pr),e(oe,mr),e(W,hr),b(Ue,W,null),e(W,fr),b(Xe,W,null),e(X,ur),e(X,$),b(Jt,$,null),e($,gr),e($,re),e(re,Mr),e(re,hs),e(hs,_r),e(re,yr),e(re,Qs),e(Qs,wr),e(re,Tr),e($,br),b(xe,$,null),e($,jr),b(Ze,$,null),e(X,Ir),e(X,G),b(Ct,G,null),e(G,Jr),e(G,le),e(le,Cr),e(le,fs),e(fs,vr),e(le,Ur),e(le,Fs),e(Fs,Xr),e(le,xr),e(G,Zr),b(Be,G,null),e(G,Br),b(ke,G,null),g(t,Pn,h),g(t,ie,h),e(ie,Pe),e(Pe,Ss),b(vt,Ss,null),e(ie,kr),e(ie,Hs),e(Hs,Pr),g(t,Wn,h),g(t,ce,h),b(Ut,ce,null),e(ce,Wr),e(ce,E),b(Xt,E,null),e(E,$r),e(E,de),e(de,Gr),e(de,us),e(us,Er),e(de,Vr),e(de,qs),e(qs,Ar),e(de,Lr),e(E,zr),b(We,E,null),e(E,Nr),b($e,E,null),g(t,$n,h),g(t,pe,h),e(pe,Ge),e(Ge,Ds),b(xt,Ds,null),e(pe,Rr),e(pe,Ks),e(Ks,Yr),g(t,Gn,h),g(t,me,h),b(Zt,me,null),e(me,Qr),e(me,V),b(Bt,V,null),e(V,Fr),e(V,he),e(he,Sr),e(he,gs),e(gs,Hr),e(he,qr),e(he,Os),e(Os,Dr),e(he,Kr),e(V,Or),b(Ee,V,null),e(V,el),b(Ve,V,null),En=!0},p(t,[h]){const kt={};h&2&&(kt.$$scope={dirty:h,ctx:t}),Ie.$set(kt);const en={};h&2&&(en.$$scope={dirty:h,ctx:t}),Ce.$set(en);const tn={};h&2&&(tn.$$scope={dirty:h,ctx:t}),Ue.$set(tn);const sn={};h&2&&(sn.$$scope={dirty:h,ctx:t}),Xe.$set(sn);const Pt={};h&2&&(Pt.$$scope={dirty:h,ctx:t}),xe.$set(Pt);const nn={};h&2&&(nn.$$scope={dirty:h,ctx:t}),Ze.$set(nn);const an={};h&2&&(an.$$scope={dirty:h,ctx:t}),Be.$set(an);const on={};h&2&&(on.$$scope={dirty:h,ctx:t}),ke.$set(on);const fe={};h&2&&(fe.$$scope={dirty:h,ctx:t}),We.$set(fe);const rn={};h&2&&(rn.$$scope={dirty:h,ctx:t}),$e.$set(rn);const ln={};h&2&&(ln.$$scope={dirty:h,ctx:t}),Ee.$set(ln);const cn={};h&2&&(cn.$$scope={dirty:h,ctx:t}),Ve.$set(cn)},i(t){En||(j(n.$$.fragment,t),j(Se.$$.fragment,t),j(et.$$.fragment,t),j(nt.$$.fragment,t),j(at.$$.fragment,t),j(ot.$$.fragment,t),j(lt.$$.fragment,t),j(ct.$$.fragment,t),j(dt.$$.fragment,t),j(mt.$$.fragment,t),j(ft.$$.fragment,t),j(ut.$$.fragment,t),j(Ie.$$.fragment,t),j(Mt.$$.fragment,t),j(_t.$$.fragment,t),j(Ce.$$.fragment,t),j(wt.$$.fragment,t),j(Tt.$$.fragment,t),j(It.$$.fragment,t),j(Ue.$$.fragment,t),j(Xe.$$.fragment,t),j(Jt.$$.fragment,t),j(xe.$$.fragment,t),j(Ze.$$.fragment,t),j(Ct.$$.fragment,t),j(Be.$$.fragment,t),j(ke.$$.fragment,t),j(vt.$$.fragment,t),j(Ut.$$.fragment,t),j(Xt.$$.fragment,t),j(We.$$.fragment,t),j($e.$$.fragment,t),j(xt.$$.fragment,t),j(Zt.$$.fragment,t),j(Bt.$$.fragment,t),j(Ee.$$.fragment,t),j(Ve.$$.fragment,t),En=!0)},o(t){I(n.$$.fragment,t),I(Se.$$.fragment,t),I(et.$$.fragment,t),I(nt.$$.fragment,t),I(at.$$.fragment,t),I(ot.$$.fragment,t),I(lt.$$.fragment,t),I(ct.$$.fragment,t),I(dt.$$.fragment,t),I(mt.$$.fragment,t),I(ft.$$.fragment,t),I(ut.$$.fragment,t),I(Ie.$$.fragment,t),I(Mt.$$.fragment,t),I(_t.$$.fragment,t),I(Ce.$$.fragment,t),I(wt.$$.fragment,t),I(Tt.$$.fragment,t),I(It.$$.fragment,t),I(Ue.$$.fragment,t),I(Xe.$$.fragment,t),I(Jt.$$.fragment,t),I(xe.$$.fragment,t),I(Ze.$$.fragment,t),I(Ct.$$.fragment,t),I(Be.$$.fragment,t),I(ke.$$.fragment,t),I(vt.$$.fragment,t),I(Ut.$$.fragment,t),I(Xt.$$.fragment,t),I(We.$$.fragment,t),I($e.$$.fragment,t),I(xt.$$.fragment,t),I(Zt.$$.fragment,t),I(Bt.$$.fragment,t),I(Ee.$$.fragment,t),I(Ve.$$.fragment,t),En=!1},d(t){s(c),t&&s(y),t&&s(M),J(n),t&&s(pn),t&&s(F),J(Se),t&&s(mn),t&&s(L),t&&s(hn),t&&s(At),t&&s(fn),t&&s(Lt),t&&s(un),t&&s(zt),t&&s(gn),t&&s(Nt),t&&s(Mn),t&&s(ge),t&&s(_n),t&&s(De),t&&s(yn),t&&s(z),t&&s(wn),t&&s(S),J(et),t&&s(Tn),t&&s(Qt),t&&s(bn),t&&s(Ft),t&&s(jn),t&&s(St),t&&s(In),t&&s(H),J(nt),t&&s(Jn),t&&s(U),J(at),J(ot),J(lt),t&&s(Cn),t&&s(q),J(ct),t&&s(vn),t&&s(B),J(dt),J(mt),t&&s(Un),t&&s(K),J(ft),t&&s(Xn),t&&s(k),J(ut),J(Ie),t&&s(xn),t&&s(te),J(Mt),t&&s(Zn),t&&s(P),J(_t),J(Ce),t&&s(Bn),t&&s(ae),J(wt),t&&s(kn),t&&s(X),J(Tt),J(It),J(Ue),J(Xe),J(Jt),J(xe),J(Ze),J(Ct),J(Be),J(ke),t&&s(Pn),t&&s(ie),J(vt),t&&s(Wn),t&&s(ce),J(Ut),J(Xt),J(We),J($e),t&&s($n),t&&s(pe),J(xt),t&&s(Gn),t&&s(me),J(Zt),J(Bt),J(Ee),J(Ve)}}}const Gi={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 Ei(C){return ji(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Yi extends _i{constructor(c){super();yi(this,c,Ei,$i,wi,{})}}export{Yi as default,Gi as metadata};
