import{S as lo,i as mo,s as co,e as a,k as g,w as T,t as i,M as po,c as r,d as s,m as _,a as n,x as w,h as l,b as m,G as t,g as u,y,q as $,o as j,B as x,v as fo,L as Ms}from"../../chunks/vendor-hf-doc-builder.js";import{T as io}from"../../chunks/Tip-hf-doc-builder.js";import{D as Qe}from"../../chunks/Docstring-hf-doc-builder.js";import{C as Fs}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as Xe}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as Es}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";function ho(C){let d,b,h,p,v;return p=new Fs({props:{code:`from transformers import TimesformerConfig, TimesformerModel

# Initializing a TimeSformer timesformer-base style configuration
configuration = TimesformerConfig()

# Randomly initializing a model from the configuration
model = TimesformerModel(configuration)

# Accessing the model configuration
configuration = model.config`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> TimesformerConfig, TimesformerModel

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a TimeSformer timesformer-base style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = TimesformerConfig()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Randomly initializing a model from the configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = TimesformerModel(configuration)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Accessing the model configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = model.config`}}),{c(){d=a("p"),b=i("Example:"),h=g(),T(p.$$.fragment)},l(o){d=r(o,"P",{});var f=n(d);b=l(f,"Example:"),f.forEach(s),h=_(o),w(p.$$.fragment,o)},m(o,f){u(o,d,f),t(d,b),u(o,h,f),y(p,o,f),v=!0},p:Ms,i(o){v||($(p.$$.fragment,o),v=!0)},o(o){j(p.$$.fragment,o),v=!1},d(o){o&&s(d),o&&s(h),x(p,o)}}}function uo(C){let d,b,h,p,v;return{c(){d=a("p"),b=i("Although the recipe for forward pass needs to be defined within this function, one should call the "),h=a("code"),p=i("Module"),v=i(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(o){d=r(o,"P",{});var f=n(d);b=l(f,"Although the recipe for forward pass needs to be defined within this function, one should call the "),h=r(f,"CODE",{});var F=n(h);p=l(F,"Module"),F.forEach(s),v=l(f,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),f.forEach(s)},m(o,f){u(o,d,f),t(d,b),t(d,h),t(h,p),t(d,v)},d(o){o&&s(d)}}}function go(C){let d,b,h,p,v;return p=new Fs({props:{code:`from decord import VideoReader, cpu
import numpy as np

from transformers import AutoFeatureExtractor, TimesformerModel
from huggingface_hub import hf_hub_download


def sample_frame_indices(clip_len, frame_sample_rate, seg_len):
    converted_len = int(clip_len * frame_sample_rate)
    end_idx = np.random.randint(converted_len, seg_len)
    start_idx = end_idx - converted_len
    indices = np.linspace(start_idx, end_idx, num=clip_len)
    indices = np.clip(indices, start_idx, end_idx - 1).astype(np.int64)
    return indices


# video clip consists of 300 frames (10 seconds at 30 FPS)
file_path = hf_hub_download(
    repo_id="nielsr/video-demo", filename="eating_spaghetti.mp4", repo_type="dataset"
)
videoreader = VideoReader(file_path, num_threads=1, ctx=cpu(0))

# sample 8 frames
videoreader.seek(0)
indices = sample_frame_indices(clip_len=8, frame_sample_rate=4, seg_len=len(videoreader))
video = videoreader.get_batch(indices).asnumpy()

feature_extractor = AutoFeatureExtractor.from_pretrained("MCG-NJU/videomae-base")
model = TimesformerModel.from_pretrained("facebook/timesformer-base-finetuned-k400")

# prepare video for the model
inputs = feature_extractor(list(video), return_tensors="pt")

# forward pass
outputs = model(**inputs)
last_hidden_states = outputs.last_hidden_state
list(last_hidden_states.shape)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> decord <span class="hljs-keyword">import</span> VideoReader, cpu
<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> AutoFeatureExtractor, TimesformerModel
<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><span class="hljs-keyword">def</span> <span class="hljs-title function_">sample_frame_indices</span>(<span class="hljs-params">clip_len, frame_sample_rate, seg_len</span>):
<span class="hljs-meta">... </span>    converted_len = <span class="hljs-built_in">int</span>(clip_len * frame_sample_rate)
<span class="hljs-meta">... </span>    end_idx = np.random.randint(converted_len, seg_len)
<span class="hljs-meta">... </span>    start_idx = end_idx - converted_len
<span class="hljs-meta">... </span>    indices = np.linspace(start_idx, end_idx, num=clip_len)
<span class="hljs-meta">... </span>    indices = np.clip(indices, start_idx, end_idx - <span class="hljs-number">1</span>).astype(np.int64)
<span class="hljs-meta">... </span>    <span class="hljs-keyword">return</span> indices


<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># video clip consists of 300 frames (10 seconds at 30 FPS)</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>file_path = hf_hub_download(
<span class="hljs-meta">... </span>    repo_id=<span class="hljs-string">&quot;nielsr/video-demo&quot;</span>, filename=<span class="hljs-string">&quot;eating_spaghetti.mp4&quot;</span>, repo_type=<span class="hljs-string">&quot;dataset&quot;</span>
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>videoreader = VideoReader(file_path, num_threads=<span class="hljs-number">1</span>, ctx=cpu(<span class="hljs-number">0</span>))

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># sample 8 frames</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>videoreader.seek(<span class="hljs-number">0</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">4</span>, seg_len=<span class="hljs-built_in">len</span>(videoreader))
<span class="hljs-meta">&gt;&gt;&gt; </span>video = videoreader.get_batch(indices).asnumpy()

<span class="hljs-meta">&gt;&gt;&gt; </span>feature_extractor = AutoFeatureExtractor.from_pretrained(<span class="hljs-string">&quot;MCG-NJU/videomae-base&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = TimesformerModel.from_pretrained(<span class="hljs-string">&quot;facebook/timesformer-base-finetuned-k400&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># prepare video for the model</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = feature_extractor(<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><span class="hljs-comment"># forward pass</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**inputs)
<span class="hljs-meta">&gt;&gt;&gt; </span>last_hidden_states = outputs.last_hidden_state
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">list</span>(last_hidden_states.shape)
[<span class="hljs-number">1</span>, <span class="hljs-number">1568</span>, <span class="hljs-number">768</span>]`}}),{c(){d=a("p"),b=i("Examples:"),h=g(),T(p.$$.fragment)},l(o){d=r(o,"P",{});var f=n(d);b=l(f,"Examples:"),f.forEach(s),h=_(o),w(p.$$.fragment,o)},m(o,f){u(o,d,f),t(d,b),u(o,h,f),y(p,o,f),v=!0},p:Ms,i(o){v||($(p.$$.fragment,o),v=!0)},o(o){j(p.$$.fragment,o),v=!1},d(o){o&&s(d),o&&s(h),x(p,o)}}}function _o(C){let d,b,h,p,v;return{c(){d=a("p"),b=i("Although the recipe for forward pass needs to be defined within this function, one should call the "),h=a("code"),p=i("Module"),v=i(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(o){d=r(o,"P",{});var f=n(d);b=l(f,"Although the recipe for forward pass needs to be defined within this function, one should call the "),h=r(f,"CODE",{});var F=n(h);p=l(F,"Module"),F.forEach(s),v=l(f,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),f.forEach(s)},m(o,f){u(o,d,f),t(d,b),t(d,h),t(h,p),t(d,v)},d(o){o&&s(d)}}}function vo(C){let d,b,h,p,v;return p=new Fs({props:{code:`from decord import VideoReader, cpu
import torch
import numpy as np

from transformers import AutoFeatureExtractor, TimesformerForVideoClassification
from huggingface_hub import hf_hub_download

np.random.seed(0)


def sample_frame_indices(clip_len, frame_sample_rate, seg_len):
    converted_len = int(clip_len * frame_sample_rate)
    end_idx = np.random.randint(converted_len, seg_len)
    start_idx = end_idx - converted_len
    indices = np.linspace(start_idx, end_idx, num=clip_len)
    indices = np.clip(indices, start_idx, end_idx - 1).astype(np.int64)
    return indices


# video clip consists of 300 frames (10 seconds at 30 FPS)
file_path = hf_hub_download(
    repo_id="nielsr/video-demo", filename="eating_spaghetti.mp4", repo_type="dataset"
)
videoreader = VideoReader(file_path, num_threads=1, ctx=cpu(0))

# sample 8 frames
videoreader.seek(0)
indices = sample_frame_indices(clip_len=8, frame_sample_rate=4, seg_len=len(videoreader))
video = videoreader.get_batch(indices).asnumpy()

feature_extractor = AutoFeatureExtractor.from_pretrained("MCG-NJU/videomae-base-finetuned-kinetics")
model = TimesformerForVideoClassification.from_pretrained("facebook/timesformer-base-finetuned-k400")

inputs = feature_extractor(list(video), return_tensors="pt")

with torch.no_grad():
    outputs = model(**inputs)
    logits = outputs.logits

# model predicts one of the 400 Kinetics-400 classes
predicted_label = logits.argmax(-1).item()
print(model.config.id2label[predicted_label])`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> decord <span class="hljs-keyword">import</span> VideoReader, cpu
<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> AutoFeatureExtractor, TimesformerForVideoClassification
<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_">sample_frame_indices</span>(<span class="hljs-params">clip_len, frame_sample_rate, seg_len</span>):
<span class="hljs-meta">... </span>    converted_len = <span class="hljs-built_in">int</span>(clip_len * frame_sample_rate)
<span class="hljs-meta">... </span>    end_idx = np.random.randint(converted_len, seg_len)
<span class="hljs-meta">... </span>    start_idx = end_idx - converted_len
<span class="hljs-meta">... </span>    indices = np.linspace(start_idx, end_idx, num=clip_len)
<span class="hljs-meta">... </span>    indices = np.clip(indices, start_idx, end_idx - <span class="hljs-number">1</span>).astype(np.int64)
<span class="hljs-meta">... </span>    <span class="hljs-keyword">return</span> indices


<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># video clip consists of 300 frames (10 seconds at 30 FPS)</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>file_path = hf_hub_download(
<span class="hljs-meta">... </span>    repo_id=<span class="hljs-string">&quot;nielsr/video-demo&quot;</span>, filename=<span class="hljs-string">&quot;eating_spaghetti.mp4&quot;</span>, repo_type=<span class="hljs-string">&quot;dataset&quot;</span>
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>videoreader = VideoReader(file_path, num_threads=<span class="hljs-number">1</span>, ctx=cpu(<span class="hljs-number">0</span>))

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># sample 8 frames</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>videoreader.seek(<span class="hljs-number">0</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">4</span>, seg_len=<span class="hljs-built_in">len</span>(videoreader))
<span class="hljs-meta">&gt;&gt;&gt; </span>video = videoreader.get_batch(indices).asnumpy()

<span class="hljs-meta">&gt;&gt;&gt; </span>feature_extractor = AutoFeatureExtractor.from_pretrained(<span class="hljs-string">&quot;MCG-NJU/videomae-base-finetuned-kinetics&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = TimesformerForVideoClassification.from_pretrained(<span class="hljs-string">&quot;facebook/timesformer-base-finetuned-k400&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = feature_extractor(<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><span class="hljs-keyword">with</span> torch.no_grad():
<span class="hljs-meta">... </span>    outputs = model(**inputs)
<span class="hljs-meta">... </span>    logits = outputs.logits

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># model predicts one of the 400 Kinetics-400 classes</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>predicted_label = logits.argmax(-<span class="hljs-number">1</span>).item()
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(model.config.id2label[predicted_label])
eating spaghetti`}}),{c(){d=a("p"),b=i("Examples:"),h=g(),T(p.$$.fragment)},l(o){d=r(o,"P",{});var f=n(d);b=l(f,"Examples:"),f.forEach(s),h=_(o),w(p.$$.fragment,o)},m(o,f){u(o,d,f),t(d,b),u(o,h,f),y(p,o,f),v=!0},p:Ms,i(o){v||($(p.$$.fragment,o),v=!0)},o(o){j(p.$$.fragment,o),v=!1},d(o){o&&s(d),o&&s(h),x(p,o)}}}function bo(C){let d,b,h,p,v,o,f,F,Tt,Ze,S,L,Ne,te,wt,Oe,yt,et,U,$t,se,jt,xt,tt,ye,kt,st,$e,oe,Ct,ae,Et,Mt,ot,je,Ft,at,xe,qt,rt,A,Pt,re,At,St,ne,zt,Vt,nt,z,W,De,ie,It,Re,Nt,it,k,le,Ot,V,Dt,ke,Rt,Lt,de,Ut,Wt,Bt,I,Ht,Ce,Kt,Gt,Ee,Jt,Yt,Qt,B,lt,N,H,Le,me,Xt,Ue,Zt,dt,q,ce,es,pe,ts,fe,ss,os,as,E,he,rs,O,ns,Me,is,ls,We,ds,ms,cs,K,ps,G,mt,D,J,Be,ue,fs,He,hs,ct,P,ge,us,_e,gs,ve,_s,vs,bs,M,be,Ts,R,ws,Fe,ys,$s,Ke,js,xs,ks,Y,Cs,Q,pt;return o=new Xe({}),te=new Xe({}),ie=new Xe({}),le=new Qe({props:{name:"class transformers.TimesformerConfig",anchor:"transformers.TimesformerConfig",parameters:[{name:"image_size",val:" = 224"},{name:"patch_size",val:" = 16"},{name:"num_channels",val:" = 3"},{name:"num_frames",val:" = 8"},{name:"hidden_size",val:" = 768"},{name:"num_hidden_layers",val:" = 12"},{name:"num_attention_heads",val:" = 12"},{name:"intermediate_size",val:" = 3072"},{name:"hidden_act",val:" = 'gelu'"},{name:"hidden_dropout_prob",val:" = 0.0"},{name:"attention_probs_dropout_prob",val:" = 0.0"},{name:"initializer_range",val:" = 0.02"},{name:"layer_norm_eps",val:" = 1e-06"},{name:"qkv_bias",val:" = True"},{name:"attention_type",val:" = 'divided_space_time'"},{name:"drop_path_rate",val:" = 0"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TimesformerConfig.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.TimesformerConfig.patch_size",description:`<strong>patch_size</strong> (<code>int</code>, <em>optional</em>, defaults to 16) &#x2014;
The size (resolution) of each patch.`,name:"patch_size"},{anchor:"transformers.TimesformerConfig.num_channels",description:`<strong>num_channels</strong> (<code>int</code>, <em>optional</em>, defaults to 3) &#x2014;
The number of input channels.`,name:"num_channels"},{anchor:"transformers.TimesformerConfig.num_frames",description:`<strong>num_frames</strong> (<code>int</code>, <em>optional</em>, defaults to 8) &#x2014;
The number of frames in each video.`,name:"num_frames"},{anchor:"transformers.TimesformerConfig.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.TimesformerConfig.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.TimesformerConfig.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.TimesformerConfig.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.TimesformerConfig.hidden_act",description:`<strong>hidden_act</strong> (<code>str</code> or <code>function</code>, <em>optional</em>, defaults to <code>&quot;gelu&quot;</code>) &#x2014;
The non-linear activation function (function or string) in the encoder and pooler. If string, <code>&quot;gelu&quot;</code>,
<code>&quot;relu&quot;</code>, <code>&quot;selu&quot;</code> and <code>&quot;gelu_new&quot;</code> are supported.`,name:"hidden_act"},{anchor:"transformers.TimesformerConfig.hidden_dropout_prob",description:`<strong>hidden_dropout_prob</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
The dropout probabilitiy for all fully connected layers in the embeddings, encoder, and pooler.`,name:"hidden_dropout_prob"},{anchor:"transformers.TimesformerConfig.attention_probs_dropout_prob",description:`<strong>attention_probs_dropout_prob</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
The dropout ratio for the attention probabilities.`,name:"attention_probs_dropout_prob"},{anchor:"transformers.TimesformerConfig.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.TimesformerConfig.layer_norm_eps",description:`<strong>layer_norm_eps</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-6) &#x2014;
The epsilon used by the layer normalization layers.`,name:"layer_norm_eps"},{anchor:"transformers.TimesformerConfig.qkv_bias",description:`<strong>qkv_bias</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to add a bias to the queries, keys and values.`,name:"qkv_bias"},{anchor:"transformers.TimesformerConfig.attention_type",description:`<strong>attention_type</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;divided_space_time&quot;</code>) &#x2014;
The attention type to use. Must be one of <code>&quot;divided_space_time&quot;</code>, <code>&quot;space_only&quot;</code>, <code>&quot;joint_space_time&quot;</code>.`,name:"attention_type"},{anchor:"transformers.TimesformerConfig.drop_path_rate",description:`<strong>drop_path_rate</strong> (<code>float</code>, <em>optional</em>, defaults to 0) &#x2014;
The dropout ratio for stochastic depth.`,name:"drop_path_rate"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/timesformer/configuration_timesformer.py#L28"}}),B=new Es({props:{anchor:"transformers.TimesformerConfig.example",$$slots:{default:[ho]},$$scope:{ctx:C}}}),me=new Xe({}),ce=new Qe({props:{name:"class transformers.TimesformerModel",anchor:"transformers.TimesformerModel",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.TimesformerModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/timesformer#transformers.TimesformerConfig">TimesformerConfig</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/timesformer/modeling_timesformer.py#L536"}}),he=new Qe({props:{name:"forward",anchor:"transformers.TimesformerModel.forward",parameters:[{name:"pixel_values",val:""},{name:"output_attentions",val:" = None"},{name:"output_hidden_states",val:" = None"},{name:"return_dict",val:" = None"}],parametersDescription:[{anchor:"transformers.TimesformerModel.forward.pixel_values",description:`<strong>pixel_values</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_frames, num_channels, height, width)</code>) &#x2014;
Pixel values. Pixel values can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoFeatureExtractor">AutoFeatureExtractor</a>. See
<a href="/docs/transformers/main/en/model_doc/poolformer#transformers.PoolFormerFeatureExtractor.__call__">VideoMAEFeatureExtractor.<strong>call</strong>()</a> for details.`,name:"pixel_values"},{anchor:"transformers.TimesformerModel.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.TimesformerModel.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.TimesformerModel.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/timesformer/modeling_timesformer.py#L560",returnDescription:`
<p>A <a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.BaseModelOutput"
>transformers.modeling_outputs.BaseModelOutput</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/main/en/model_doc/timesformer#transformers.TimesformerConfig"
>TimesformerConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>last_hidden_state</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>) \u2014 Sequence of hidden-states at the output of the last layer of the model.</p>
</li>
<li>
<p><strong>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.BaseModelOutput"
>transformers.modeling_outputs.BaseModelOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),K=new io({props:{$$slots:{default:[uo]},$$scope:{ctx:C}}}),G=new Es({props:{anchor:"transformers.TimesformerModel.forward.example",$$slots:{default:[go]},$$scope:{ctx:C}}}),ue=new Xe({}),ge=new Qe({props:{name:"class transformers.TimesformerForVideoClassification",anchor:"transformers.TimesformerForVideoClassification",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.TimesformerForVideoClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/timesformer#transformers.TimesformerConfig">TimesformerConfig</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/timesformer/modeling_timesformer.py#L647"}}),be=new Qe({props:{name:"forward",anchor:"transformers.TimesformerForVideoClassification.forward",parameters:[{name:"pixel_values",val:": typing.Optional[torch.Tensor] = None"},{name:"labels",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.TimesformerForVideoClassification.forward.pixel_values",description:`<strong>pixel_values</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_frames, num_channels, height, width)</code>) &#x2014;
Pixel values. Pixel values can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoFeatureExtractor">AutoFeatureExtractor</a>. See
<a href="/docs/transformers/main/en/model_doc/poolformer#transformers.PoolFormerFeatureExtractor.__call__">VideoMAEFeatureExtractor.<strong>call</strong>()</a> for details.`,name:"pixel_values"},{anchor:"transformers.TimesformerForVideoClassification.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.TimesformerForVideoClassification.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.TimesformerForVideoClassification.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"},{anchor:"transformers.TimesformerForVideoClassification.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) &#x2014;
Labels for computing the image classification/regression loss. Indices should be in <code>[0, ..., config.num_labels - 1]</code>. If <code>config.num_labels == 1</code> a regression loss is computed (Mean-Square loss), If
<code>config.num_labels &gt; 1</code> a classification loss is computed (Cross-Entropy).`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/timesformer/modeling_timesformer.py#L660",returnDescription:`
<p>A <a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.ImageClassifierOutput"
>transformers.modeling_outputs.ImageClassifierOutput</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/main/en/model_doc/timesformer#transformers.TimesformerConfig"
>TimesformerConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>loss</strong> (<code>torch.FloatTensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>labels</code> is provided) \u2014 Classification (or regression if config.num_labels==1) loss.</p>
</li>
<li>
<p><strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, config.num_labels)</code>) \u2014 Classification (or regression if config.num_labels==1) scores (before SoftMax).</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 stage) of shape <code>(batch_size, sequence_length, hidden_size)</code>. Hidden-states
(also called feature maps) of the model at the output of each stage.</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, patch_size, 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.ImageClassifierOutput"
>transformers.modeling_outputs.ImageClassifierOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Y=new io({props:{$$slots:{default:[_o]},$$scope:{ctx:C}}}),Q=new Es({props:{anchor:"transformers.TimesformerForVideoClassification.forward.example",$$slots:{default:[vo]},$$scope:{ctx:C}}}),{c(){d=a("meta"),b=g(),h=a("h1"),p=a("a"),v=a("span"),T(o.$$.fragment),f=g(),F=a("span"),Tt=i("TimeSformer"),Ze=g(),S=a("h2"),L=a("a"),Ne=a("span"),T(te.$$.fragment),wt=g(),Oe=a("span"),yt=i("Overview"),et=g(),U=a("p"),$t=i("The TimeSformer model was proposed in "),se=a("a"),jt=i("TimeSformer: Is Space-Time Attention All You Need for Video Understanding?"),xt=i(` by Facebook Research.
This work is a milestone in action-recognition field being the first video transformer. It inspired many transformer based video understanding and classification papers.`),tt=g(),ye=a("p"),kt=i("The abstract from the paper is the following:"),st=g(),$e=a("p"),oe=a("em"),Ct=i("We present a convolution-free approach to video classification built exclusively on self-attention over space and time. Our method, named \u201CTimeSformer,\u201D adapts the standard Transformer architecture to video by enabling spatiotemporal feature learning directly from a sequence of frame-level patches. Our experimental study compares different self-attention schemes and suggests that \u201Cdivided attention,\u201D where temporal attention and spatial attention are separately applied within each block, leads to the best video classification accuracy among the design choices considered. Despite the radically new design, TimeSformer achieves state-of-the-art results on several action recognition benchmarks, including the best reported accuracy on Kinetics-400 and Kinetics-600. Finally, compared to 3D convolutional networks, our model is faster to train, it can achieve dramatically higher test efficiency (at a small drop in accuracy), and it can also be applied to much longer video clips (over one minute long). Code and models are available at: "),ae=a("a"),Et=i("this https URL"),Mt=i("."),ot=g(),je=a("p"),Ft=i("Tips:"),at=g(),xe=a("p"),qt=i("There are many pretrained variants. Select your pretrained model based on the dataset it is trained on. Moreover, the number of input frames per clip changes based on the model size so you should consider this parameter while selecting your pretrained model."),rt=g(),A=a("p"),Pt=i("This model was contributed by "),re=a("a"),At=i("fcakyon"),St=i(`.
The original code can be found `),ne=a("a"),zt=i("here"),Vt=i("."),nt=g(),z=a("h2"),W=a("a"),De=a("span"),T(ie.$$.fragment),It=g(),Re=a("span"),Nt=i("TimesformerConfig"),it=g(),k=a("div"),T(le.$$.fragment),Ot=g(),V=a("p"),Dt=i("This is the configuration class to store the configuration of a "),ke=a("a"),Rt=i("TimesformerModel"),Lt=i(`. It is used to instantiate a
TimeSformer 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 TimeSformer
`),de=a("a"),Ut=i("facebook/timesformer"),Wt=i(" architecture."),Bt=g(),I=a("p"),Ht=i("Configuration objects inherit from "),Ce=a("a"),Kt=i("PretrainedConfig"),Gt=i(` and can be used to control the model outputs. Read the
documentation from `),Ee=a("a"),Jt=i("PretrainedConfig"),Yt=i(" for more information."),Qt=g(),T(B.$$.fragment),lt=g(),N=a("h2"),H=a("a"),Le=a("span"),T(me.$$.fragment),Xt=g(),Ue=a("span"),Zt=i("TimesformerModel"),dt=g(),q=a("div"),T(ce.$$.fragment),es=g(),pe=a("p"),ts=i(`The bare TimeSformer Model transformer outputting raw hidden-states without any specific head on top.
This model is a PyTorch `),fe=a("a"),ss=i("torch.nn.Module"),os=i(` subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),as=g(),E=a("div"),T(he.$$.fragment),rs=g(),O=a("p"),ns=i("The "),Me=a("a"),is=i("TimesformerModel"),ls=i(" forward method, overrides the "),We=a("code"),ds=i("__call__"),ms=i(" special method."),cs=g(),T(K.$$.fragment),ps=g(),T(G.$$.fragment),mt=g(),D=a("h2"),J=a("a"),Be=a("span"),T(ue.$$.fragment),fs=g(),He=a("span"),hs=i("TimesformerForVideoClassification"),ct=g(),P=a("div"),T(ge.$$.fragment),us=g(),_e=a("p"),gs=i(`TimeSformer Model transformer with a video classification head on top (a linear layer on top of the final hidden state
of the [CLS] token) e.g. for ImageNet.
This model is a PyTorch `),ve=a("a"),_s=i("torch.nn.Module"),vs=i(` subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),bs=g(),M=a("div"),T(be.$$.fragment),Ts=g(),R=a("p"),ws=i("The "),Fe=a("a"),ys=i("TimesformerForVideoClassification"),$s=i(" forward method, overrides the "),Ke=a("code"),js=i("__call__"),xs=i(" special method."),ks=g(),T(Y.$$.fragment),Cs=g(),T(Q.$$.fragment),this.h()},l(e){const c=po('[data-svelte="svelte-1phssyn"]',document.head);d=r(c,"META",{name:!0,content:!0}),c.forEach(s),b=_(e),h=r(e,"H1",{class:!0});var Te=n(h);p=r(Te,"A",{id:!0,class:!0,href:!0});var Ge=n(p);v=r(Ge,"SPAN",{});var Je=n(v);w(o.$$.fragment,Je),Je.forEach(s),Ge.forEach(s),f=_(Te),F=r(Te,"SPAN",{});var Ye=n(F);Tt=l(Ye,"TimeSformer"),Ye.forEach(s),Te.forEach(s),Ze=_(e),S=r(e,"H2",{class:!0});var we=n(S);L=r(we,"A",{id:!0,class:!0,href:!0});var qs=n(L);Ne=r(qs,"SPAN",{});var Ps=n(Ne);w(te.$$.fragment,Ps),Ps.forEach(s),qs.forEach(s),wt=_(we),Oe=r(we,"SPAN",{});var As=n(Oe);yt=l(As,"Overview"),As.forEach(s),we.forEach(s),et=_(e),U=r(e,"P",{});var ft=n(U);$t=l(ft,"The TimeSformer model was proposed in "),se=r(ft,"A",{href:!0,rel:!0});var Ss=n(se);jt=l(Ss,"TimeSformer: Is Space-Time Attention All You Need for Video Understanding?"),Ss.forEach(s),xt=l(ft,` by Facebook Research.
This work is a milestone in action-recognition field being the first video transformer. It inspired many transformer based video understanding and classification papers.`),ft.forEach(s),tt=_(e),ye=r(e,"P",{});var zs=n(ye);kt=l(zs,"The abstract from the paper is the following:"),zs.forEach(s),st=_(e),$e=r(e,"P",{});var Vs=n($e);oe=r(Vs,"EM",{});var ht=n(oe);Ct=l(ht,"We present a convolution-free approach to video classification built exclusively on self-attention over space and time. Our method, named \u201CTimeSformer,\u201D adapts the standard Transformer architecture to video by enabling spatiotemporal feature learning directly from a sequence of frame-level patches. Our experimental study compares different self-attention schemes and suggests that \u201Cdivided attention,\u201D where temporal attention and spatial attention are separately applied within each block, leads to the best video classification accuracy among the design choices considered. Despite the radically new design, TimeSformer achieves state-of-the-art results on several action recognition benchmarks, including the best reported accuracy on Kinetics-400 and Kinetics-600. Finally, compared to 3D convolutional networks, our model is faster to train, it can achieve dramatically higher test efficiency (at a small drop in accuracy), and it can also be applied to much longer video clips (over one minute long). Code and models are available at: "),ae=r(ht,"A",{href:!0,rel:!0});var Is=n(ae);Et=l(Is,"this https URL"),Is.forEach(s),Mt=l(ht,"."),ht.forEach(s),Vs.forEach(s),ot=_(e),je=r(e,"P",{});var Ns=n(je);Ft=l(Ns,"Tips:"),Ns.forEach(s),at=_(e),xe=r(e,"P",{});var Os=n(xe);qt=l(Os,"There are many pretrained variants. Select your pretrained model based on the dataset it is trained on. Moreover, the number of input frames per clip changes based on the model size so you should consider this parameter while selecting your pretrained model."),Os.forEach(s),rt=_(e),A=r(e,"P",{});var qe=n(A);Pt=l(qe,"This model was contributed by "),re=r(qe,"A",{href:!0,rel:!0});var Ds=n(re);At=l(Ds,"fcakyon"),Ds.forEach(s),St=l(qe,`.
The original code can be found `),ne=r(qe,"A",{href:!0,rel:!0});var Rs=n(ne);zt=l(Rs,"here"),Rs.forEach(s),Vt=l(qe,"."),qe.forEach(s),nt=_(e),z=r(e,"H2",{class:!0});var ut=n(z);W=r(ut,"A",{id:!0,class:!0,href:!0});var Ls=n(W);De=r(Ls,"SPAN",{});var Us=n(De);w(ie.$$.fragment,Us),Us.forEach(s),Ls.forEach(s),It=_(ut),Re=r(ut,"SPAN",{});var Ws=n(Re);Nt=l(Ws,"TimesformerConfig"),Ws.forEach(s),ut.forEach(s),it=_(e),k=r(e,"DIV",{class:!0});var X=n(k);w(le.$$.fragment,X),Ot=_(X),V=r(X,"P",{});var Pe=n(V);Dt=l(Pe,"This is the configuration class to store the configuration of a "),ke=r(Pe,"A",{href:!0});var Bs=n(ke);Rt=l(Bs,"TimesformerModel"),Bs.forEach(s),Lt=l(Pe,`. It is used to instantiate a
TimeSformer 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 TimeSformer
`),de=r(Pe,"A",{href:!0,rel:!0});var Hs=n(de);Ut=l(Hs,"facebook/timesformer"),Hs.forEach(s),Wt=l(Pe," architecture."),Pe.forEach(s),Bt=_(X),I=r(X,"P",{});var Ae=n(I);Ht=l(Ae,"Configuration objects inherit from "),Ce=r(Ae,"A",{href:!0});var Ks=n(Ce);Kt=l(Ks,"PretrainedConfig"),Ks.forEach(s),Gt=l(Ae,` and can be used to control the model outputs. Read the
documentation from `),Ee=r(Ae,"A",{href:!0});var Gs=n(Ee);Jt=l(Gs,"PretrainedConfig"),Gs.forEach(s),Yt=l(Ae," for more information."),Ae.forEach(s),Qt=_(X),w(B.$$.fragment,X),X.forEach(s),lt=_(e),N=r(e,"H2",{class:!0});var gt=n(N);H=r(gt,"A",{id:!0,class:!0,href:!0});var Js=n(H);Le=r(Js,"SPAN",{});var Ys=n(Le);w(me.$$.fragment,Ys),Ys.forEach(s),Js.forEach(s),Xt=_(gt),Ue=r(gt,"SPAN",{});var Qs=n(Ue);Zt=l(Qs,"TimesformerModel"),Qs.forEach(s),gt.forEach(s),dt=_(e),q=r(e,"DIV",{class:!0});var Se=n(q);w(ce.$$.fragment,Se),es=_(Se),pe=r(Se,"P",{});var _t=n(pe);ts=l(_t,`The bare TimeSformer Model transformer outputting raw hidden-states without any specific head on top.
This model is a PyTorch `),fe=r(_t,"A",{href:!0,rel:!0});var Xs=n(fe);ss=l(Xs,"torch.nn.Module"),Xs.forEach(s),os=l(_t,` subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),_t.forEach(s),as=_(Se),E=r(Se,"DIV",{class:!0});var Z=n(E);w(he.$$.fragment,Z),rs=_(Z),O=r(Z,"P",{});var ze=n(O);ns=l(ze,"The "),Me=r(ze,"A",{href:!0});var Zs=n(Me);is=l(Zs,"TimesformerModel"),Zs.forEach(s),ls=l(ze," forward method, overrides the "),We=r(ze,"CODE",{});var eo=n(We);ds=l(eo,"__call__"),eo.forEach(s),ms=l(ze," special method."),ze.forEach(s),cs=_(Z),w(K.$$.fragment,Z),ps=_(Z),w(G.$$.fragment,Z),Z.forEach(s),Se.forEach(s),mt=_(e),D=r(e,"H2",{class:!0});var vt=n(D);J=r(vt,"A",{id:!0,class:!0,href:!0});var to=n(J);Be=r(to,"SPAN",{});var so=n(Be);w(ue.$$.fragment,so),so.forEach(s),to.forEach(s),fs=_(vt),He=r(vt,"SPAN",{});var oo=n(He);hs=l(oo,"TimesformerForVideoClassification"),oo.forEach(s),vt.forEach(s),ct=_(e),P=r(e,"DIV",{class:!0});var Ve=n(P);w(ge.$$.fragment,Ve),us=_(Ve),_e=r(Ve,"P",{});var bt=n(_e);gs=l(bt,`TimeSformer Model transformer with a video classification head on top (a linear layer on top of the final hidden state
of the [CLS] token) e.g. for ImageNet.
This model is a PyTorch `),ve=r(bt,"A",{href:!0,rel:!0});var ao=n(ve);_s=l(ao,"torch.nn.Module"),ao.forEach(s),vs=l(bt,` subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),bt.forEach(s),bs=_(Ve),M=r(Ve,"DIV",{class:!0});var ee=n(M);w(be.$$.fragment,ee),Ts=_(ee),R=r(ee,"P",{});var Ie=n(R);ws=l(Ie,"The "),Fe=r(Ie,"A",{href:!0});var ro=n(Fe);ys=l(ro,"TimesformerForVideoClassification"),ro.forEach(s),$s=l(Ie," forward method, overrides the "),Ke=r(Ie,"CODE",{});var no=n(Ke);js=l(no,"__call__"),no.forEach(s),xs=l(Ie," special method."),Ie.forEach(s),ks=_(ee),w(Y.$$.fragment,ee),Cs=_(ee),w(Q.$$.fragment,ee),ee.forEach(s),Ve.forEach(s),this.h()},h(){m(d,"name","hf:doc:metadata"),m(d,"content",JSON.stringify(To)),m(p,"id","timesformer"),m(p,"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"),m(p,"href","#timesformer"),m(h,"class","relative group"),m(L,"id","overview"),m(L,"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"),m(L,"href","#overview"),m(S,"class","relative group"),m(se,"href","https://arxiv.org/abs/2102.05095"),m(se,"rel","nofollow"),m(ae,"href","https://github.com/facebookresearch/TimeSformer"),m(ae,"rel","nofollow"),m(re,"href","https://huggingface.co/fcakyon"),m(re,"rel","nofollow"),m(ne,"href","https://github.com/facebookresearch/TimeSformer"),m(ne,"rel","nofollow"),m(W,"id","transformers.TimesformerConfig"),m(W,"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"),m(W,"href","#transformers.TimesformerConfig"),m(z,"class","relative group"),m(ke,"href","/docs/transformers/main/en/model_doc/timesformer#transformers.TimesformerModel"),m(de,"href","https://huggingface.co/facebook/timesformer-base-finetuned-k600"),m(de,"rel","nofollow"),m(Ce,"href","/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig"),m(Ee,"href","/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig"),m(k,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(H,"id","transformers.TimesformerModel"),m(H,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),m(H,"href","#transformers.TimesformerModel"),m(N,"class","relative group"),m(fe,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),m(fe,"rel","nofollow"),m(Me,"href","/docs/transformers/main/en/model_doc/timesformer#transformers.TimesformerModel"),m(E,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(q,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(J,"id","transformers.TimesformerForVideoClassification"),m(J,"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"),m(J,"href","#transformers.TimesformerForVideoClassification"),m(D,"class","relative group"),m(ve,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),m(ve,"rel","nofollow"),m(Fe,"href","/docs/transformers/main/en/model_doc/timesformer#transformers.TimesformerForVideoClassification"),m(M,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(P,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(e,c){t(document.head,d),u(e,b,c),u(e,h,c),t(h,p),t(p,v),y(o,v,null),t(h,f),t(h,F),t(F,Tt),u(e,Ze,c),u(e,S,c),t(S,L),t(L,Ne),y(te,Ne,null),t(S,wt),t(S,Oe),t(Oe,yt),u(e,et,c),u(e,U,c),t(U,$t),t(U,se),t(se,jt),t(U,xt),u(e,tt,c),u(e,ye,c),t(ye,kt),u(e,st,c),u(e,$e,c),t($e,oe),t(oe,Ct),t(oe,ae),t(ae,Et),t(oe,Mt),u(e,ot,c),u(e,je,c),t(je,Ft),u(e,at,c),u(e,xe,c),t(xe,qt),u(e,rt,c),u(e,A,c),t(A,Pt),t(A,re),t(re,At),t(A,St),t(A,ne),t(ne,zt),t(A,Vt),u(e,nt,c),u(e,z,c),t(z,W),t(W,De),y(ie,De,null),t(z,It),t(z,Re),t(Re,Nt),u(e,it,c),u(e,k,c),y(le,k,null),t(k,Ot),t(k,V),t(V,Dt),t(V,ke),t(ke,Rt),t(V,Lt),t(V,de),t(de,Ut),t(V,Wt),t(k,Bt),t(k,I),t(I,Ht),t(I,Ce),t(Ce,Kt),t(I,Gt),t(I,Ee),t(Ee,Jt),t(I,Yt),t(k,Qt),y(B,k,null),u(e,lt,c),u(e,N,c),t(N,H),t(H,Le),y(me,Le,null),t(N,Xt),t(N,Ue),t(Ue,Zt),u(e,dt,c),u(e,q,c),y(ce,q,null),t(q,es),t(q,pe),t(pe,ts),t(pe,fe),t(fe,ss),t(pe,os),t(q,as),t(q,E),y(he,E,null),t(E,rs),t(E,O),t(O,ns),t(O,Me),t(Me,is),t(O,ls),t(O,We),t(We,ds),t(O,ms),t(E,cs),y(K,E,null),t(E,ps),y(G,E,null),u(e,mt,c),u(e,D,c),t(D,J),t(J,Be),y(ue,Be,null),t(D,fs),t(D,He),t(He,hs),u(e,ct,c),u(e,P,c),y(ge,P,null),t(P,us),t(P,_e),t(_e,gs),t(_e,ve),t(ve,_s),t(_e,vs),t(P,bs),t(P,M),y(be,M,null),t(M,Ts),t(M,R),t(R,ws),t(R,Fe),t(Fe,ys),t(R,$s),t(R,Ke),t(Ke,js),t(R,xs),t(M,ks),y(Y,M,null),t(M,Cs),y(Q,M,null),pt=!0},p(e,[c]){const Te={};c&2&&(Te.$$scope={dirty:c,ctx:e}),B.$set(Te);const Ge={};c&2&&(Ge.$$scope={dirty:c,ctx:e}),K.$set(Ge);const Je={};c&2&&(Je.$$scope={dirty:c,ctx:e}),G.$set(Je);const Ye={};c&2&&(Ye.$$scope={dirty:c,ctx:e}),Y.$set(Ye);const we={};c&2&&(we.$$scope={dirty:c,ctx:e}),Q.$set(we)},i(e){pt||($(o.$$.fragment,e),$(te.$$.fragment,e),$(ie.$$.fragment,e),$(le.$$.fragment,e),$(B.$$.fragment,e),$(me.$$.fragment,e),$(ce.$$.fragment,e),$(he.$$.fragment,e),$(K.$$.fragment,e),$(G.$$.fragment,e),$(ue.$$.fragment,e),$(ge.$$.fragment,e),$(be.$$.fragment,e),$(Y.$$.fragment,e),$(Q.$$.fragment,e),pt=!0)},o(e){j(o.$$.fragment,e),j(te.$$.fragment,e),j(ie.$$.fragment,e),j(le.$$.fragment,e),j(B.$$.fragment,e),j(me.$$.fragment,e),j(ce.$$.fragment,e),j(he.$$.fragment,e),j(K.$$.fragment,e),j(G.$$.fragment,e),j(ue.$$.fragment,e),j(ge.$$.fragment,e),j(be.$$.fragment,e),j(Y.$$.fragment,e),j(Q.$$.fragment,e),pt=!1},d(e){s(d),e&&s(b),e&&s(h),x(o),e&&s(Ze),e&&s(S),x(te),e&&s(et),e&&s(U),e&&s(tt),e&&s(ye),e&&s(st),e&&s($e),e&&s(ot),e&&s(je),e&&s(at),e&&s(xe),e&&s(rt),e&&s(A),e&&s(nt),e&&s(z),x(ie),e&&s(it),e&&s(k),x(le),x(B),e&&s(lt),e&&s(N),x(me),e&&s(dt),e&&s(q),x(ce),x(he),x(K),x(G),e&&s(mt),e&&s(D),x(ue),e&&s(ct),e&&s(P),x(ge),x(be),x(Y),x(Q)}}}const To={local:"timesformer",sections:[{local:"overview",title:"Overview"},{local:"transformers.TimesformerConfig",title:"TimesformerConfig"},{local:"transformers.TimesformerModel",title:"TimesformerModel"},{local:"transformers.TimesformerForVideoClassification",title:"TimesformerForVideoClassification"}],title:"TimeSformer"};function wo(C){return fo(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Eo extends lo{constructor(d){super();mo(this,d,wo,bo,co,{})}}export{Eo as default,To as metadata};
