import{s as xt,A as kt,o as Bt,n as Uo}from"../chunks/scheduler.01eeda35.js";import{S as Zt,i as Gt,g as a,s,r as f,A as zt,h as i,f as t,c as r,j as C,u as h,x as p,k as v,y as l,a as n,v as u,d as g,t as T,w as M}from"../chunks/index.6dd51b66.js";import{T as jt}from"../chunks/Tip.de9bae2b.js";import{D as G}from"../chunks/Docstring.cb556860.js";import{C as Do}from"../chunks/CodeBlock.19ec9b8c.js";import{E as Ct}from"../chunks/ExampleCodeBlock.69db56ad.js";import{H as Y,E as Vt}from"../chunks/index.58fe8f9d.js";function $t(z){let d,b=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code>
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`;return{c(){d=a("p"),d.innerHTML=b},l(m){d=i(m,"P",{"data-svelte-h":!0}),p(d)!=="svelte-fincs2"&&(d.innerHTML=b)},m(m,_){n(m,d,_)},p:Uo,d(m){m&&t(d)}}}function Wt(z){let d,b="Examples:",m,_,y;return _=new Do({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b0NvbmZpZyUyQyUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBUdnBNb2RlbCUwQSUwQW1vZGVsJTIwJTNEJTIwVHZwTW9kZWwuZnJvbV9wcmV0cmFpbmVkKCUyMkppcWluZyUyRnRpbnktcmFuZG9tLXR2cCUyMiklMEElMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJKaXFpbmclMkZ0aW55LXJhbmRvbS10dnAlMjIpJTBBJTBBcGl4ZWxfdmFsdWVzJTIwJTNEJTIwdG9yY2gucmFuZCgxJTJDJTIwMSUyQyUyMDMlMkMlMjA0NDglMkMlMjA0NDgpJTBBdGV4dF9pbnB1dHMlMjAlM0QlMjB0b2tlbml6ZXIoJTIyVGhpcyUyMGlzJTIwYW4lMjBleGFtcGxlJTIwaW5wdXQlMjIlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKSUwQW91dHB1dCUyMCUzRCUyMG1vZGVsKHRleHRfaW5wdXRzLmlucHV0X2lkcyUyQyUyMHBpeGVsX3ZhbHVlcyUyQyUyMHRleHRfaW5wdXRzLmF0dGVudGlvbl9tYXNrKQ==",highlighted:`<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">from</span> transformers <span class="hljs-keyword">import</span> AutoConfig, AutoTokenizer, TvpModel

<span class="hljs-meta">&gt;&gt;&gt; </span>model = TvpModel.from_pretrained(<span class="hljs-string">&quot;Jiqing/tiny-random-tvp&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;Jiqing/tiny-random-tvp&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>pixel_values = torch.rand(<span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">3</span>, <span class="hljs-number">448</span>, <span class="hljs-number">448</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>text_inputs = tokenizer(<span class="hljs-string">&quot;This is an example input&quot;</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>output = model(text_inputs.input_ids, pixel_values, text_inputs.attention_mask)`,wrap:!1}}),{c(){d=a("p"),d.textContent=b,m=s(),f(_.$$.fragment)},l(c){d=i(c,"P",{"data-svelte-h":!0}),p(d)!=="svelte-kvfsh7"&&(d.textContent=b),m=r(c),h(_.$$.fragment,c)},m(c,w){n(c,d,w),n(c,m,w),u(_,c,w),y=!0},p:Uo,i(c){y||(g(_.$$.fragment,c),y=!0)},o(c){T(_.$$.fragment,c),y=!1},d(c){c&&(t(d),t(m)),M(_,c)}}}function Rt(z){let d,b=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code>
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`;return{c(){d=a("p"),d.innerHTML=b},l(m){d=i(m,"P",{"data-svelte-h":!0}),p(d)!=="svelte-fincs2"&&(d.innerHTML=b)},m(m,_){n(m,d,_)},p:Uo,d(m){m&&t(d)}}}function At(z){let d,b="Examples:",m,_,y;return _=new Do({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b0NvbmZpZyUyQyUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBUdnBGb3JWaWRlb0dyb3VuZGluZyUwQSUwQW1vZGVsJTIwJTNEJTIwVHZwRm9yVmlkZW9Hcm91bmRpbmcuZnJvbV9wcmV0cmFpbmVkKCUyMkppcWluZyUyRnRpbnktcmFuZG9tLXR2cCUyMiklMEElMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJKaXFpbmclMkZ0aW55LXJhbmRvbS10dnAlMjIpJTBBJTBBcGl4ZWxfdmFsdWVzJTIwJTNEJTIwdG9yY2gucmFuZCgxJTJDJTIwMSUyQyUyMDMlMkMlMjA0NDglMkMlMjA0NDgpJTBBdGV4dF9pbnB1dHMlMjAlM0QlMjB0b2tlbml6ZXIoJTIyVGhpcyUyMGlzJTIwYW4lMjBleGFtcGxlJTIwaW5wdXQlMjIlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKSUwQW91dHB1dCUyMCUzRCUyMG1vZGVsKHRleHRfaW5wdXRzLmlucHV0X2lkcyUyQyUyMHBpeGVsX3ZhbHVlcyUyQyUyMHRleHRfaW5wdXRzLmF0dGVudGlvbl9tYXNrKQ==",highlighted:`<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">from</span> transformers <span class="hljs-keyword">import</span> AutoConfig, AutoTokenizer, TvpForVideoGrounding

<span class="hljs-meta">&gt;&gt;&gt; </span>model = TvpForVideoGrounding.from_pretrained(<span class="hljs-string">&quot;Jiqing/tiny-random-tvp&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;Jiqing/tiny-random-tvp&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>pixel_values = torch.rand(<span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">3</span>, <span class="hljs-number">448</span>, <span class="hljs-number">448</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>text_inputs = tokenizer(<span class="hljs-string">&quot;This is an example input&quot;</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>output = model(text_inputs.input_ids, pixel_values, text_inputs.attention_mask)`,wrap:!1}}),{c(){d=a("p"),d.textContent=b,m=s(),f(_.$$.fragment)},l(c){d=i(c,"P",{"data-svelte-h":!0}),p(d)!=="svelte-kvfsh7"&&(d.textContent=b),m=r(c),h(_.$$.fragment,c)},m(c,w){n(c,d,w),n(c,m,w),u(_,c,w),y=!0},p:Uo,i(c){y||(g(_.$$.fragment,c),y=!0)},o(c){T(_.$$.fragment,c),y=!1},d(c){c&&(t(d),t(m)),M(_,c)}}}function Ft(z){let d,b,m,_,y,c,w,Ko='<img alt="PyTorch" src="https://img.shields.io/badge/PyTorch-DE3412?style=flat&amp;logo=pytorch&amp;logoColor=white"/>',Se,q,Le,D,Oo='The text-visual prompting (TVP) framework was proposed in the paper <a href="https://arxiv.org/abs/2303.04995" rel="nofollow">Text-Visual Prompting for Efficient 2D Temporal Video Grounding</a> by Yimeng Zhang, Xin Chen, Jinghan Jia, Sijia Liu, Ke Ding.',Ye,K,et="The abstract from the paper is the following:",qe,O,ot="<em>In this paper, we study the problem of temporal video grounding (TVG), which aims to predict the starting/ending time points of moments described by a text sentence within a long untrimmed video. Benefiting from fine-grained 3D visual features, the TVG techniques have achieved remarkable progress in recent years. However, the high complexity of 3D convolutional neural networks (CNNs) makes extracting dense 3D visual features time-consuming, which calls for intensive memory and computing resources. Towards efficient TVG, we propose a novel text-visual prompting (TVP) framework, which incorporates optimized perturbation patterns (that we call ‘prompts’) into both visual inputs and textual features of a TVG model. In sharp contrast to 3D CNNs, we show that TVP allows us to effectively co-train vision encoder and language encoder in a 2D TVG model and improves the performance of cross-modal feature fusion using only low-complexity sparse 2D visual features. Further, we propose a Temporal-Distance IoU (TDIoU) loss for efficient learning of TVG. Experiments on two benchmark datasets, Charades-STA and ActivityNet Captions datasets, empirically show that the proposed TVP significantly boosts the performance of 2D TVG (e.g., 9.79% improvement on Charades-STA and 30.77% improvement on ActivityNet Captions) and achieves 5× inference acceleration over TVG using 3D visual features.</em>",De,ee,tt="This research addresses temporal video grounding (TVG), which is the process of pinpointing the start and end times of specific events in a long video, as described by a text sentence. Text-visual prompting (TVP), is proposed to enhance TVG. TVP involves integrating specially designed patterns, known as ‘prompts’, into both the visual (image-based) and textual (word-based) input components of a TVG model. These prompts provide additional spatial-temporal context, improving the model’s ability to accurately determine event timings in the video. The approach employs 2D visual inputs in place of 3D ones. Although 3D inputs offer more spatial-temporal detail, they are also more time-consuming to process. The use of 2D inputs with the prompting method aims to provide similar levels of context and accuracy more efficiently.",Ke,$,nt,Oe,oe,st='TVP architecture. Taken from the <a href="https://arxiv.org/abs/2303.04995">original paper.</a>',eo,te,rt='This model was contributed by <a href="https://huggingface.co/Jiqing" rel="nofollow">Jiqing Feng</a>. The original code can be found <a href="https://github.com/intel/TVP" rel="nofollow">here</a>.',oo,ne,to,se,at="Prompts are optimized perturbation patterns, which would be added to input video frames or text features. Universal set refers to using the same exact set of prompts for any input, this means that these prompts are added consistently to all video frames and text features, regardless of the input’s content.",no,re,it="TVP consists of a visual encoder and cross-modal encoder. A universal set of visual prompts and text prompts to be integrated into sampled video frames and textual features, respectively. Specially, a set of different visual prompts are applied to uniformly-sampled frames of one untrimmed video in order.",so,ae,lt=`The goal of this model is to incorporate trainable prompts into both visual inputs and textual features to temporal video grounding(TVG) problems.
In principle, one can apply any visual, cross-modal encoder in the proposed architecture.`,ro,ie,dt=`The <a href="/docs/transformers/main/en/model_doc/tvp#transformers.TvpProcessor">TvpProcessor</a> wraps <a href="/docs/transformers/main/en/model_doc/bert#transformers.BertTokenizer">BertTokenizer</a> and <a href="/docs/transformers/main/en/model_doc/tvp#transformers.TvpImageProcessor">TvpImageProcessor</a> into a single instance to both
encode the text and prepare the images respectively.`,ao,le,ct='The following example shows how to run temporal video grounding using <a href="/docs/transformers/main/en/model_doc/tvp#transformers.TvpProcessor">TvpProcessor</a> and <a href="/docs/transformers/main/en/model_doc/tvp#transformers.TvpForVideoGrounding">TvpForVideoGrounding</a>.',io,de,lo,ce,pt="Tips:",co,pe,mt='<li>This implementation of TVP uses <a href="/docs/transformers/main/en/model_doc/bert#transformers.BertTokenizer">BertTokenizer</a> to generate text embeddings and Resnet-50 model to compute visual embeddings.</li> <li>Checkpoints for pre-trained <a href="https://huggingface.co/Intel/tvp-base" rel="nofollow">tvp-base</a> is released.</li> <li>Please refer to <a href="https://arxiv.org/pdf/2303.04995.pdf" rel="nofollow">Table 2</a> for TVP’s performance on Temporal Video Grounding task.</li>',po,me,mo,J,fe,jo,Be,ft=`This is the configuration class to store the configuration of a <a href="/docs/transformers/main/en/model_doc/tvp#transformers.TvpModel">TvpModel</a>. It is used to instantiate an Tvp
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 Tvp
<a href="https://huggingface.co/Intel/tvp-base" rel="nofollow">Intel/tvp-base</a> architecture.`,Co,Ze,ht=`Configuration objects inherit from <a href="/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> and can be used to control the model outputs. Read the
documentation from <a href="/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> for more information.`,xo,W,he,ko,Ge,ut='Instantiate a <a href="/docs/transformers/main/en/model_doc/tvp#transformers.TvpConfig">TvpConfig</a> (or a derived class) from a pre-trained backbone model configuration.',Bo,R,ue,Zo,ze,gt='Serializes this instance to a Python dictionary. Override the default <a href="/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig.to_dict">to_dict()</a>.',fo,ge,ho,B,Te,Go,Ve,Tt="Constructs a Tvp image processor.",zo,A,Me,Vo,$e,Mt="Preprocess an image or batch of images.",uo,_e,go,I,ye,$o,We,_t="Constructs an TVP processor which wraps a TVP image processor and a Bert tokenizer into a single processor.",Wo,Re,yt=`<a href="/docs/transformers/main/en/model_doc/tvp#transformers.TvpProcessor">TvpProcessor</a> offers all the functionalities of <a href="/docs/transformers/main/en/model_doc/tvp#transformers.TvpImageProcessor">TvpImageProcessor</a> and <a href="/docs/transformers/main/en/model_doc/bert#transformers.BertTokenizerFast">BertTokenizerFast</a>. See the
<a href="/docs/transformers/main/en/model_doc/tvp#transformers.TvpProcessor.__call__"><strong>call</strong>()</a> and <code>decode()</code> for more information.`,Ro,F,ve,Ao,Ae,vt=`Main method to prepare for the model one or several sequences(s) and image(s). This method forwards the <code>text</code>
and <code>kwargs</code> arguments to BertTokenizerFast’s <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__"><strong>call</strong>()</a> if <code>text</code> is not <code>None</code> to encode
the text. To prepare the image(s), this method forwards the <code>videos</code> and <code>kwargs</code> arguments to
TvpImageProcessor’s <a href="/docs/transformers/main/en/model_doc/vilt#transformers.ViltFeatureExtractor.__call__"><strong>call</strong>()</a> if <code>videos</code> is not <code>None</code>. Please refer to the docstring of
the above two methods for more information.`,To,be,Mo,Z,we,Fo,Fe,bt=`The bare Tvp Model transformer outputting BaseModelOutputWithPooling object without any specific head on top.
This model is a PyTorch <a href="https://pytorch.org/docs/stable/nn.html#torch.nn.Module" rel="nofollow">torch.nn.Module</a> subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`,Xo,x,Je,No,Xe,wt='The <a href="/docs/transformers/main/en/model_doc/tvp#transformers.TvpModel">TvpModel</a> forward method, overrides the <code>__call__</code> special method.',Po,X,Ho,N,_o,Ie,yo,U,Ue,Eo,Ne,Jt="Tvp Model with a video grounding head on top computing IoU, distance, and duration loss.",Qo,Pe,It=`This model is a PyTorch <a href="https://pytorch.org/docs/stable/nn.html#torch.nn.Module" rel="nofollow">torch.nn.Module</a> subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`,So,k,je,Lo,He,Ut='The <a href="/docs/transformers/main/en/model_doc/tvp#transformers.TvpForVideoGrounding">TvpForVideoGrounding</a> forward method, overrides the <code>__call__</code> special method.',Yo,P,qo,H,vo,Ce,bo,Qe,wo;return y=new Y({props:{title:"TVP",local:"tvp",headingTag:"h1"}}),q=new Y({props:{title:"Overview",local:"overview",headingTag:"h2"}}),ne=new Y({props:{title:"Usage tips and examples",local:"usage-tips-and-examples",headingTag:"h2"}}),de=new Do({props:{code:" ",highlighted:`<span class="hljs-keyword">import</span> av
<span class="hljs-keyword">import</span> cv2
<span class="hljs-keyword">import</span> numpy <span class="hljs-keyword">as</span> np
<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> huggingface_hub <span class="hljs-keyword">import</span> hf_hub_download
<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoProcessor, TvpForVideoGrounding


<span class="hljs-keyword">def</span> <span class="hljs-title function_">pyav_decode</span>(<span class="hljs-params">container, sampling_rate, num_frames, clip_idx, num_clips, target_fps</span>):
    <span class="hljs-string">&#x27;&#x27;&#x27;
    Convert the video from its original fps to the target_fps and decode the video with PyAV decoder.
    Args:
        container (container): pyav container.
        sampling_rate (int): frame sampling rate (interval between two sampled frames).
        num_frames (int): number of frames to sample.
        clip_idx (int): if clip_idx is -1, perform random temporal sampling.
            If clip_idx is larger than -1, uniformly split the video to num_clips
            clips, and select the clip_idx-th video clip.
        num_clips (int): overall number of clips to uniformly sample from the given video.
        target_fps (int): the input video may have different fps, convert it to
            the target video fps before frame sampling.
    Returns:
        frames (tensor): decoded frames from the video. Return None if the no
            video stream was found.
        fps (float): the number of frames per second of the video.
    &#x27;&#x27;&#x27;</span>
    video = container.streams.video[<span class="hljs-number">0</span>]
    fps = <span class="hljs-built_in">float</span>(video.average_rate)
    clip_size = sampling_rate * num_frames / target_fps * fps
    delta = <span class="hljs-built_in">max</span>(num_frames - clip_size, <span class="hljs-number">0</span>)
    start_idx = delta * clip_idx / num_clips
    end_idx = start_idx + clip_size - <span class="hljs-number">1</span>
    timebase = video.duration / num_frames
    video_start_pts = <span class="hljs-built_in">int</span>(start_idx * timebase)
    video_end_pts = <span class="hljs-built_in">int</span>(end_idx * timebase)
    seek_offset = <span class="hljs-built_in">max</span>(video_start_pts - <span class="hljs-number">1024</span>, <span class="hljs-number">0</span>)
    container.seek(seek_offset, any_frame=<span class="hljs-literal">False</span>, backward=<span class="hljs-literal">True</span>, stream=video)
    frames = {}
    <span class="hljs-keyword">for</span> frame <span class="hljs-keyword">in</span> container.decode(video=<span class="hljs-number">0</span>):
        <span class="hljs-keyword">if</span> frame.pts &lt; video_start_pts:
            <span class="hljs-keyword">continue</span>
        frames[frame.pts] = frame
        <span class="hljs-keyword">if</span> frame.pts &gt; video_end_pts:
            <span class="hljs-keyword">break</span>
    frames = [frames[pts] <span class="hljs-keyword">for</span> pts <span class="hljs-keyword">in</span> <span class="hljs-built_in">sorted</span>(frames)]
    <span class="hljs-keyword">return</span> frames, fps


<span class="hljs-keyword">def</span> <span class="hljs-title function_">decode</span>(<span class="hljs-params">container, sampling_rate, num_frames, clip_idx, num_clips, target_fps</span>):
    <span class="hljs-string">&#x27;&#x27;&#x27;
    Decode the video and perform temporal sampling.
    Args:
        container (container): pyav container.
        sampling_rate (int): frame sampling rate (interval between two sampled frames).
        num_frames (int): number of frames to sample.
        clip_idx (int): if clip_idx is -1, perform random temporal sampling.
            If clip_idx is larger than -1, uniformly split the video to num_clips
            clips, and select the clip_idx-th video clip.
        num_clips (int): overall number of clips to uniformly sample from the given video.
        target_fps (int): the input video may have different fps, convert it to
            the target video fps before frame sampling.
    Returns:
        frames (tensor): decoded frames from the video.
    &#x27;&#x27;&#x27;</span>
    <span class="hljs-keyword">assert</span> clip_idx &gt;= -<span class="hljs-number">2</span>, <span class="hljs-string">&quot;Not a valid clip_idx {}&quot;</span>.<span class="hljs-built_in">format</span>(clip_idx)
    frames, fps = pyav_decode(container, sampling_rate, num_frames, clip_idx, num_clips, target_fps)
    clip_size = sampling_rate * num_frames / target_fps * fps
    index = np.linspace(<span class="hljs-number">0</span>, clip_size - <span class="hljs-number">1</span>, num_frames)
    index = np.clip(index, <span class="hljs-number">0</span>, <span class="hljs-built_in">len</span>(frames) - <span class="hljs-number">1</span>).astype(np.int64)
    frames = np.array([frames[idx].to_rgb().to_ndarray() <span class="hljs-keyword">for</span> idx <span class="hljs-keyword">in</span> index])
    frames = frames.transpose(<span class="hljs-number">0</span>, <span class="hljs-number">3</span>, <span class="hljs-number">1</span>, <span class="hljs-number">2</span>)
    <span class="hljs-keyword">return</span> frames


file = hf_hub_download(repo_id=<span class="hljs-string">&quot;Intel/tvp_demo&quot;</span>, filename=<span class="hljs-string">&quot;AK2KG.mp4&quot;</span>, repo_type=<span class="hljs-string">&quot;dataset&quot;</span>)
model = TvpForVideoGrounding.from_pretrained(<span class="hljs-string">&quot;Intel/tvp-base&quot;</span>)

decoder_kwargs = <span class="hljs-built_in">dict</span>(
    container=av.<span class="hljs-built_in">open</span>(file, metadata_errors=<span class="hljs-string">&quot;ignore&quot;</span>),
    sampling_rate=<span class="hljs-number">1</span>,
    num_frames=model.config.num_frames,
    clip_idx=<span class="hljs-number">0</span>,
    num_clips=<span class="hljs-number">1</span>,
    target_fps=<span class="hljs-number">3</span>,
)
raw_sampled_frms = decode(**decoder_kwargs)

text = <span class="hljs-string">&quot;a person is sitting on a bed.&quot;</span>
processor = AutoProcessor.from_pretrained(<span class="hljs-string">&quot;Intel/tvp-base&quot;</span>)
model_inputs = processor(
    text=[text], videos=<span class="hljs-built_in">list</span>(raw_sampled_frms), return_tensors=<span class="hljs-string">&quot;pt&quot;</span>, max_text_length=<span class="hljs-number">100</span><span class="hljs-comment">#, size=size</span>
)

model_inputs[<span class="hljs-string">&quot;pixel_values&quot;</span>] = model_inputs[<span class="hljs-string">&quot;pixel_values&quot;</span>].to(model.dtype)
output = model(**model_inputs)

<span class="hljs-keyword">def</span> <span class="hljs-title function_">get_video_duration</span>(<span class="hljs-params">filename</span>):
    cap = cv2.VideoCapture(filename)
    <span class="hljs-keyword">if</span> cap.isOpened():
        rate = cap.get(<span class="hljs-number">5</span>)
        frame_num = cap.get(<span class="hljs-number">7</span>)
        duration = frame_num/rate
        <span class="hljs-keyword">return</span> duration
    <span class="hljs-keyword">return</span> -<span class="hljs-number">1</span>

duration = get_video_duration(file)
start, end = processor.post_process_video_grounding(output.logits, duration)

<span class="hljs-built_in">print</span>(<span class="hljs-string">f&quot;The time slot of the video corresponding to the text \\&quot;<span class="hljs-subst">{text}</span>\\&quot; is from <span class="hljs-subst">{start}</span>s to <span class="hljs-subst">{end}</span>s&quot;</span>)`,wrap:!1}}),me=new Y({props:{title:"TvpConfig",local:"transformers.TvpConfig",headingTag:"h2"}}),fe=new G({props:{name:"class transformers.TvpConfig",anchor:"transformers.TvpConfig",parameters:[{name:"backbone_config",val:" = None"},{name:"backbone",val:" = None"},{name:"use_pretrained_backbone",val:" = False"},{name:"use_timm_backbone",val:" = False"},{name:"backbone_kwargs",val:" = None"},{name:"distance_loss_weight",val:" = 1.0"},{name:"duration_loss_weight",val:" = 0.1"},{name:"visual_prompter_type",val:" = 'framepad'"},{name:"visual_prompter_apply",val:" = 'replace'"},{name:"visual_prompt_size",val:" = 96"},{name:"max_img_size",val:" = 448"},{name:"num_frames",val:" = 48"},{name:"vocab_size",val:" = 30522"},{name:"hidden_size",val:" = 768"},{name:"intermediate_size",val:" = 3072"},{name:"num_hidden_layers",val:" = 12"},{name:"num_attention_heads",val:" = 12"},{name:"max_position_embeddings",val:" = 512"},{name:"max_grid_col_position_embeddings",val:" = 100"},{name:"max_grid_row_position_embeddings",val:" = 100"},{name:"hidden_dropout_prob",val:" = 0.1"},{name:"hidden_act",val:" = 'gelu'"},{name:"layer_norm_eps",val:" = 1e-12"},{name:"initializer_range",val:" = 0.02"},{name:"attention_probs_dropout_prob",val:" = 0.1"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TvpConfig.backbone_config",description:`<strong>backbone_config</strong> (<code>PretrainedConfig</code> or <code>dict</code>, <em>optional</em>) &#x2014;
The configuration of the backbone model.`,name:"backbone_config"},{anchor:"transformers.TvpConfig.backbone",description:`<strong>backbone</strong> (<code>str</code>, <em>optional</em>) &#x2014;
Name of backbone to use when <code>backbone_config</code> is <code>None</code>. If <code>use_pretrained_backbone</code> is <code>True</code>, this
will load the corresponding pretrained weights from the timm or transformers library. If <code>use_pretrained_backbone</code>
is <code>False</code>, this loads the backbone&#x2019;s config and uses that to initialize the backbone with random weights.`,name:"backbone"},{anchor:"transformers.TvpConfig.use_pretrained_backbone",description:`<strong>use_pretrained_backbone</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to use pretrained weights for the backbone.`,name:"use_pretrained_backbone"},{anchor:"transformers.TvpConfig.use_timm_backbone",description:`<strong>use_timm_backbone</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to load <code>backbone</code> from the timm library. If <code>False</code>, the backbone is loaded from the transformers
library.`,name:"use_timm_backbone"},{anchor:"transformers.TvpConfig.backbone_kwargs",description:`<strong>backbone_kwargs</strong> (<code>dict</code>, <em>optional</em>) &#x2014;
Keyword arguments to be passed to AutoBackbone when loading from a checkpoint
e.g. <code>{&apos;out_indices&apos;: (0, 1, 2, 3)}</code>. Cannot be specified if <code>backbone_config</code> is set.`,name:"backbone_kwargs"},{anchor:"transformers.TvpConfig.distance_loss_weight",description:`<strong>distance_loss_weight</strong> (<code>float</code>, <em>optional</em>, defaults to 1.0) &#x2014;
The weight of distance loss.`,name:"distance_loss_weight"},{anchor:"transformers.TvpConfig.duration_loss_weight",description:`<strong>duration_loss_weight</strong> (<code>float</code>, <em>optional</em>, defaults to 0.1) &#x2014;
The weight of duration loss.`,name:"duration_loss_weight"},{anchor:"transformers.TvpConfig.visual_prompter_type",description:`<strong>visual_prompter_type</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;framepad&quot;</code>) &#x2014;
Visual prompt type. The type of padding. Framepad means padding on each frame. Should be one of &#x201C;framepad&#x201D;
or &#x201C;framedownpad&#x201D;`,name:"visual_prompter_type"},{anchor:"transformers.TvpConfig.visual_prompter_apply",description:`<strong>visual_prompter_apply</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;replace&quot;</code>) &#x2014;
The way of applying visual prompt. Replace means use the value of prompt to change the original value in
visual inputs. Should be one of &#x201C;replace&#x201D;, or &#x201C;add&#x201D;, or &#x201C;remove&#x201D;.`,name:"visual_prompter_apply"},{anchor:"transformers.TvpConfig.visual_prompt_size",description:`<strong>visual_prompt_size</strong> (<code>int</code>, <em>optional</em>, defaults to 96) &#x2014;
The size of visual prompt.`,name:"visual_prompt_size"},{anchor:"transformers.TvpConfig.max_img_size",description:`<strong>max_img_size</strong> (<code>int</code>, <em>optional</em>, defaults to 448) &#x2014;
The maximum size of frame.`,name:"max_img_size"},{anchor:"transformers.TvpConfig.num_frames",description:`<strong>num_frames</strong> (<code>int</code>, <em>optional</em>, defaults to 48) &#x2014;
The number of frames extracted from a video.`,name:"num_frames"},{anchor:"transformers.TvpConfig.vocab_size",description:`<strong>vocab_size</strong> (<code>int</code>, <em>optional</em>, defaults to 30522) &#x2014;
Vocabulary size of the Tvp 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/tvp#transformers.TvpModel">TvpModel</a>.`,name:"vocab_size"},{anchor:"transformers.TvpConfig.hidden_size",description:`<strong>hidden_size</strong> (<code>int</code>, <em>optional</em>, defaults to 768) &#x2014;
Dimensionality of the encoder layers.`,name:"hidden_size"},{anchor:"transformers.TvpConfig.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.TvpConfig.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.TvpConfig.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.TvpConfig.max_position_embeddings",description:`<strong>max_position_embeddings</strong> (<code>int</code>, <em>optional</em>, defaults to 512) &#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.TvpConfig.max_grid_col_position_embeddings",description:`<strong>max_grid_col_position_embeddings</strong> (<code>int</code>, <em>optional</em>, defaults to 100) &#x2014;
The largest number of horizontal patches from a video frame.`,name:"max_grid_col_position_embeddings"},{anchor:"transformers.TvpConfig.max_grid_row_position_embeddings",description:`<strong>max_grid_row_position_embeddings</strong> (<code>int</code>, <em>optional</em>, defaults to 100) &#x2014;
The largest number of vertical patches from a video frame.`,name:"max_grid_row_position_embeddings"},{anchor:"transformers.TvpConfig.hidden_dropout_prob",description:`<strong>hidden_dropout_prob</strong> (<code>float</code>, <em>optional</em>, defaults to 0.1) &#x2014;
The dropout probability of hidden layers.`,name:"hidden_dropout_prob"},{anchor:"transformers.TvpConfig.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> <code>&quot;quick_gelu&quot;</code> are supported.`,name:"hidden_act"},{anchor:"transformers.TvpConfig.layer_norm_eps",description:`<strong>layer_norm_eps</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-12) &#x2014;
The epsilon used by the layer normalization layers.`,name:"layer_norm_eps"},{anchor:"transformers.TvpConfig.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.TvpConfig.attention_probs_dropout_prob",description:`<strong>attention_probs_dropout_prob</strong> (<code>float</code>, <em>optional</em>, defaults to 0.1) &#x2014;
The dropout probability of attention layers.`,name:"attention_probs_dropout_prob"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/tvp/configuration_tvp.py#L28"}}),he=new G({props:{name:"from_backbone_config",anchor:"transformers.TvpConfig.from_backbone_config",parameters:[{name:"backbone_config",val:": PretrainedConfig"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TvpConfig.from_backbone_config.backbone_config",description:`<strong>backbone_config</strong> (<a href="/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a>) &#x2014;
The backbone configuration.`,name:"backbone_config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/tvp/configuration_tvp.py#L175",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


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


<p><a
  href="/docs/transformers/main/en/model_doc/tvp#transformers.TvpConfig"
>TvpConfig</a></p>
`}}),ue=new G({props:{name:"to_dict",anchor:"transformers.TvpConfig.to_dict",parameters:[],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/tvp/configuration_tvp.py#L187",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>Dictionary of all the attributes that make up this configuration instance,</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>Dict[str, any]</code></p>
`}}),ge=new Y({props:{title:"TvpImageProcessor",local:"transformers.TvpImageProcessor",headingTag:"h2"}}),Te=new G({props:{name:"class transformers.TvpImageProcessor",anchor:"transformers.TvpImageProcessor",parameters:[{name:"do_resize",val:": bool = True"},{name:"size",val:": typing.Dict[str, int] = None"},{name:"resample",val:": Resampling = <Resampling.BILINEAR: 2>"},{name:"do_center_crop",val:": bool = True"},{name:"crop_size",val:": typing.Dict[str, int] = None"},{name:"do_rescale",val:": bool = True"},{name:"rescale_factor",val:": typing.Union[int, float] = 0.00392156862745098"},{name:"do_pad",val:": bool = True"},{name:"pad_size",val:": typing.Dict[str, int] = None"},{name:"constant_values",val:": typing.Union[float, typing.Iterable[float]] = 0"},{name:"pad_mode",val:": PaddingMode = <PaddingMode.CONSTANT: 'constant'>"},{name:"do_normalize",val:": bool = True"},{name:"do_flip_channel_order",val:": bool = True"},{name:"image_mean",val:": typing.Union[float, typing.List[float], NoneType] = None"},{name:"image_std",val:": typing.Union[float, typing.List[float], NoneType] = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TvpImageProcessor.do_resize",description:`<strong>do_resize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to resize the image&#x2019;s (height, width) dimensions to the specified <code>size</code>. Can be overridden by the
<code>do_resize</code> parameter in the <code>preprocess</code> method.`,name:"do_resize"},{anchor:"transformers.TvpImageProcessor.size",description:`<strong>size</strong> (<code>Dict[str, int]</code> <em>optional</em>, defaults to <code>{&quot;longest_edge&quot; -- 448}</code>):
Size of the output image after resizing. The longest edge of the image will be resized to
<code>size[&quot;longest_edge&quot;]</code> while maintaining the aspect ratio of the original image. Can be overriden by
<code>size</code> in the <code>preprocess</code> method.`,name:"size"},{anchor:"transformers.TvpImageProcessor.resample",description:`<strong>resample</strong> (<code>PILImageResampling</code>, <em>optional</em>, defaults to <code>Resampling.BILINEAR</code>) &#x2014;
Resampling filter to use if resizing the image. Can be overridden by the <code>resample</code> parameter in the
<code>preprocess</code> method.`,name:"resample"},{anchor:"transformers.TvpImageProcessor.do_center_crop",description:`<strong>do_center_crop</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to center crop the image to the specified <code>crop_size</code>. Can be overridden by the <code>do_center_crop</code>
parameter in the <code>preprocess</code> method.`,name:"do_center_crop"},{anchor:"transformers.TvpImageProcessor.crop_size",description:`<strong>crop_size</strong> (<code>Dict[str, int]</code>, <em>optional</em>, defaults to <code>{&quot;height&quot; -- 448, &quot;width&quot;: 448}</code>):
Size of the image after applying the center crop. Can be overridden by the <code>crop_size</code> parameter in the
<code>preprocess</code> method.`,name:"crop_size"},{anchor:"transformers.TvpImageProcessor.do_rescale",description:`<strong>do_rescale</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to rescale the image by the specified scale <code>rescale_factor</code>. Can be overridden by the <code>do_rescale</code>
parameter in the <code>preprocess</code> method.`,name:"do_rescale"},{anchor:"transformers.TvpImageProcessor.rescale_factor",description:`<strong>rescale_factor</strong> (<code>int</code> or <code>float</code>, <em>optional</em>, defaults to <code>1/255</code>) &#x2014;
Defines the scale factor to use if rescaling the image. Can be overridden by the <code>rescale_factor</code> parameter
in the <code>preprocess</code> method.`,name:"rescale_factor"},{anchor:"transformers.TvpImageProcessor.do_pad",description:`<strong>do_pad</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to pad the image. Can be overridden by the <code>do_pad</code> parameter in the <code>preprocess</code> method.`,name:"do_pad"},{anchor:"transformers.TvpImageProcessor.pad_size",description:`<strong>pad_size</strong> (<code>Dict[str, int]</code>, <em>optional</em>, defaults to <code>{&quot;height&quot; -- 448, &quot;width&quot;: 448}</code>):
Size of the image after applying the padding. Can be overridden by the <code>pad_size</code> parameter in the
<code>preprocess</code> method.`,name:"pad_size"},{anchor:"transformers.TvpImageProcessor.constant_values",description:`<strong>constant_values</strong> (<code>Union[float, Iterable[float]]</code>, <em>optional</em>, defaults to 0) &#x2014;
The fill value to use when padding the image.`,name:"constant_values"},{anchor:"transformers.TvpImageProcessor.pad_mode",description:`<strong>pad_mode</strong> (<code>PaddingMode</code>, <em>optional</em>, defaults to <code>PaddingMode.CONSTANT</code>) &#x2014;
Use what kind of mode in padding.`,name:"pad_mode"},{anchor:"transformers.TvpImageProcessor.do_normalize",description:`<strong>do_normalize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to normalize the image. Can be overridden by the <code>do_normalize</code> parameter in the <code>preprocess</code>
method.`,name:"do_normalize"},{anchor:"transformers.TvpImageProcessor.do_flip_channel_order",description:`<strong>do_flip_channel_order</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to flip the color channels from RGB to BGR. Can be overridden by the <code>do_flip_channel_order</code>
parameter in the <code>preprocess</code> method.`,name:"do_flip_channel_order"},{anchor:"transformers.TvpImageProcessor.image_mean",description:`<strong>image_mean</strong> (<code>float</code> or <code>List[float]</code>, <em>optional</em>, defaults to <code>IMAGENET_STANDARD_MEAN</code>) &#x2014;
Mean to use if normalizing the image. This is a float or list of floats the length of the number of
channels in the image. Can be overridden by the <code>image_mean</code> parameter in the <code>preprocess</code> method.`,name:"image_mean"},{anchor:"transformers.TvpImageProcessor.image_std",description:`<strong>image_std</strong> (<code>float</code> or <code>List[float]</code>, <em>optional</em>, defaults to <code>IMAGENET_STANDARD_STD</code>) &#x2014;
Standard deviation to use if normalizing the image. This is a float or list of floats the length of the
number of channels in the image. Can be overridden by the <code>image_std</code> parameter in the <code>preprocess</code> method.`,name:"image_std"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/tvp/image_processing_tvp.py#L84"}}),Me=new G({props:{name:"preprocess",anchor:"transformers.TvpImageProcessor.preprocess",parameters:[{name:"videos",val:": typing.Union[ForwardRef('PIL.Image.Image'), numpy.ndarray, ForwardRef('torch.Tensor'), list['PIL.Image.Image'], list[numpy.ndarray], list['torch.Tensor'], typing.List[typing.Union[ForwardRef('PIL.Image.Image'), numpy.ndarray, ForwardRef('torch.Tensor'), list['PIL.Image.Image'], list[numpy.ndarray], list['torch.Tensor']]], typing.List[typing.List[typing.Union[ForwardRef('PIL.Image.Image'), numpy.ndarray, ForwardRef('torch.Tensor'), list['PIL.Image.Image'], list[numpy.ndarray], list['torch.Tensor']]]]]"},{name:"do_resize",val:": typing.Optional[bool] = None"},{name:"size",val:": typing.Dict[str, int] = None"},{name:"resample",val:": Resampling = None"},{name:"do_center_crop",val:": typing.Optional[bool] = None"},{name:"crop_size",val:": typing.Dict[str, int] = None"},{name:"do_rescale",val:": typing.Optional[bool] = None"},{name:"rescale_factor",val:": typing.Optional[float] = None"},{name:"do_pad",val:": typing.Optional[bool] = None"},{name:"pad_size",val:": typing.Dict[str, int] = None"},{name:"constant_values",val:": typing.Union[float, typing.Iterable[float]] = None"},{name:"pad_mode",val:": PaddingMode = None"},{name:"do_normalize",val:": typing.Optional[bool] = None"},{name:"do_flip_channel_order",val:": typing.Optional[bool] = None"},{name:"image_mean",val:": typing.Union[float, typing.List[float], NoneType] = None"},{name:"image_std",val:": typing.Union[float, typing.List[float], NoneType] = None"},{name:"return_tensors",val:": typing.Union[str, transformers.utils.generic.TensorType, NoneType] = None"},{name:"data_format",val:": ChannelDimension = <ChannelDimension.FIRST: 'channels_first'>"},{name:"input_data_format",val:": typing.Union[transformers.image_utils.ChannelDimension, str, NoneType] = None"}],parametersDescription:[{anchor:"transformers.TvpImageProcessor.preprocess.videos",description:`<strong>videos</strong> (<code>ImageInput</code> or <code>List[ImageInput]</code> or <code>List[List[ImageInput]]</code>) &#x2014;
Frames to preprocess.`,name:"videos"},{anchor:"transformers.TvpImageProcessor.preprocess.do_resize",description:`<strong>do_resize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>self.do_resize</code>) &#x2014;
Whether to resize the image.`,name:"do_resize"},{anchor:"transformers.TvpImageProcessor.preprocess.size",description:`<strong>size</strong> (<code>Dict[str, int]</code>, <em>optional</em>, defaults to <code>self.size</code>) &#x2014;
Size of the image after applying resize.`,name:"size"},{anchor:"transformers.TvpImageProcessor.preprocess.resample",description:`<strong>resample</strong> (<code>PILImageResampling</code>, <em>optional</em>, defaults to <code>self.resample</code>) &#x2014;
Resampling filter to use if resizing the image. This can be one of the enum <code>PILImageResampling</code>, Only
has an effect if <code>do_resize</code> is set to <code>True</code>.`,name:"resample"},{anchor:"transformers.TvpImageProcessor.preprocess.do_center_crop",description:`<strong>do_center_crop</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>self.do_centre_crop</code>) &#x2014;
Whether to centre crop the image.`,name:"do_center_crop"},{anchor:"transformers.TvpImageProcessor.preprocess.crop_size",description:`<strong>crop_size</strong> (<code>Dict[str, int]</code>, <em>optional</em>, defaults to <code>self.crop_size</code>) &#x2014;
Size of the image after applying the centre crop.`,name:"crop_size"},{anchor:"transformers.TvpImageProcessor.preprocess.do_rescale",description:`<strong>do_rescale</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>self.do_rescale</code>) &#x2014;
Whether to rescale the image values between [0 - 1].`,name:"do_rescale"},{anchor:"transformers.TvpImageProcessor.preprocess.rescale_factor",description:`<strong>rescale_factor</strong> (<code>float</code>, <em>optional</em>, defaults to <code>self.rescale_factor</code>) &#x2014;
Rescale factor to rescale the image by if <code>do_rescale</code> is set to <code>True</code>.`,name:"rescale_factor"},{anchor:"transformers.TvpImageProcessor.preprocess.do_pad",description:`<strong>do_pad</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to pad the image. Can be overridden by the <code>do_pad</code> parameter in the <code>preprocess</code> method.`,name:"do_pad"},{anchor:"transformers.TvpImageProcessor.preprocess.pad_size",description:`<strong>pad_size</strong> (<code>Dict[str, int]</code>, <em>optional</em>, defaults to <code>{&quot;height&quot; -- 448, &quot;width&quot;: 448}</code>):
Size of the image after applying the padding. Can be overridden by the <code>pad_size</code> parameter in the
<code>preprocess</code> method.`,name:"pad_size"},{anchor:"transformers.TvpImageProcessor.preprocess.constant_values",description:`<strong>constant_values</strong> (<code>Union[float, Iterable[float]]</code>, <em>optional</em>, defaults to 0) &#x2014;
The fill value to use when padding the image.`,name:"constant_values"},{anchor:"transformers.TvpImageProcessor.preprocess.pad_mode",description:`<strong>pad_mode</strong> (<code>PaddingMode</code>, <em>optional</em>, defaults to &#x201C;PaddingMode.CONSTANT&#x201D;) &#x2014;
Use what kind of mode in padding.`,name:"pad_mode"},{anchor:"transformers.TvpImageProcessor.preprocess.do_normalize",description:`<strong>do_normalize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>self.do_normalize</code>) &#x2014;
Whether to normalize the image.`,name:"do_normalize"},{anchor:"transformers.TvpImageProcessor.preprocess.do_flip_channel_order",description:`<strong>do_flip_channel_order</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>self.do_flip_channel_order</code>) &#x2014;
Whether to flip the channel order of the image.`,name:"do_flip_channel_order"},{anchor:"transformers.TvpImageProcessor.preprocess.image_mean",description:`<strong>image_mean</strong> (<code>float</code> or <code>List[float]</code>, <em>optional</em>, defaults to <code>self.image_mean</code>) &#x2014;
Image mean.`,name:"image_mean"},{anchor:"transformers.TvpImageProcessor.preprocess.image_std",description:`<strong>image_std</strong> (<code>float</code> or <code>List[float]</code>, <em>optional</em>, defaults to <code>self.image_std</code>) &#x2014;
Image standard deviation.`,name:"image_std"},{anchor:"transformers.TvpImageProcessor.preprocess.return_tensors",description:`<strong>return_tensors</strong> (<code>str</code> or <code>TensorType</code>, <em>optional</em>) &#x2014;
The type of tensors to return. Can be one of:<ul>
<li>Unset: Return a list of <code>np.ndarray</code>.</li>
<li><code>TensorType.TENSORFLOW</code> or <code>&apos;tf&apos;</code>: Return a batch of type <code>tf.Tensor</code>.</li>
<li><code>TensorType.PYTORCH</code> or <code>&apos;pt&apos;</code>: Return a batch of type <code>torch.Tensor</code>.</li>
<li><code>TensorType.NUMPY</code> or <code>&apos;np&apos;</code>: Return a batch of type <code>np.ndarray</code>.</li>
<li><code>TensorType.JAX</code> or <code>&apos;jax&apos;</code>: Return a batch of type <code>jax.numpy.ndarray</code>.</li>
</ul>`,name:"return_tensors"},{anchor:"transformers.TvpImageProcessor.preprocess.data_format",description:`<strong>data_format</strong> (<code>ChannelDimension</code> or <code>str</code>, <em>optional</em>, defaults to <code>ChannelDimension.FIRST</code>) &#x2014;
The channel dimension format for the output image. Can be one of:<ul>
<li><code>ChannelDimension.FIRST</code>: image in (num_channels, height, width) format.</li>
<li><code>ChannelDimension.LAST</code>: image in (height, width, num_channels) format.</li>
<li>Unset: Use the inferred channel dimension format of the input image.</li>
</ul>`,name:"data_format"},{anchor:"transformers.TvpImageProcessor.preprocess.input_data_format",description:`<strong>input_data_format</strong> (<code>ChannelDimension</code> or <code>str</code>, <em>optional</em>) &#x2014;
The channel dimension format for the input image. If unset, the channel dimension format is inferred
from the input image. Can be one of:<ul>
<li><code>&quot;channels_first&quot;</code> or <code>ChannelDimension.FIRST</code>: image in (num_channels, height, width) format.</li>
<li><code>&quot;channels_last&quot;</code> or <code>ChannelDimension.LAST</code>: image in (height, width, num_channels) format.</li>
<li><code>&quot;none&quot;</code> or <code>ChannelDimension.NONE</code>: image in (height, width) format.</li>
</ul>`,name:"input_data_format"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/tvp/image_processing_tvp.py#L339"}}),_e=new Y({props:{title:"TvpProcessor",local:"transformers.TvpProcessor",headingTag:"h2"}}),ye=new G({props:{name:"class transformers.TvpProcessor",anchor:"transformers.TvpProcessor",parameters:[{name:"image_processor",val:" = None"},{name:"tokenizer",val:" = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TvpProcessor.image_processor",description:`<strong>image_processor</strong> (<a href="/docs/transformers/main/en/model_doc/tvp#transformers.TvpImageProcessor">TvpImageProcessor</a>, <em>optional</em>) &#x2014;
The image processor is a required input.`,name:"image_processor"},{anchor:"transformers.TvpProcessor.tokenizer",description:`<strong>tokenizer</strong> (<a href="/docs/transformers/main/en/model_doc/bert#transformers.BertTokenizerFast">BertTokenizerFast</a>, <em>optional</em>) &#x2014;
The tokenizer is a required input.`,name:"tokenizer"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/tvp/processing_tvp.py#L23"}}),ve=new G({props:{name:"__call__",anchor:"transformers.TvpProcessor.__call__",parameters:[{name:"text",val:" = None"},{name:"videos",val:" = None"},{name:"return_tensors",val:" = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TvpProcessor.__call__.text",description:`<strong>text</strong> (<code>str</code>, <code>List[str]</code>, <code>List[List[str]]</code>) &#x2014;
The sequence or batch of sequences to be encoded. Each sequence can be a string or a list of strings
(pretokenized string). If the sequences are provided as list of strings (pretokenized), you must set
<code>is_split_into_words=True</code> (to lift the ambiguity with a batch of sequences).`,name:"text"},{anchor:"transformers.TvpProcessor.__call__.videos",description:`<strong>videos</strong> (<code>List[PIL.Image.Image]</code>, <code>List[np.ndarray]</code>, <code>List[torch.Tensor]</code>, <code>List[List[PIL.Image.Image]]</code>, <code>List[List[np.ndarray]]</code>, &#x2014;
<code>List[List[torch.Tensor]]</code>): The video or batch of videos to be prepared. Each video should be a list
of frames, which can be either PIL images or NumPy arrays. In case of NumPy arrays/PyTorch tensors,
each frame should be of shape (H, W, C), where H and W are frame height and width, and C is a number of
channels.`,name:"videos"},{anchor:"transformers.TvpProcessor.__call__.return_tensors",description:`<strong>return_tensors</strong> (<code>str</code> or <a href="/docs/transformers/main/en/internal/file_utils#transformers.TensorType">TensorType</a>, <em>optional</em>) &#x2014;
If set, will return tensors of a particular framework. Acceptable values are:</p>
<ul>
<li><code>&apos;tf&apos;</code>: Return TensorFlow <code>tf.constant</code> objects.</li>
<li><code>&apos;pt&apos;</code>: Return PyTorch <code>torch.Tensor</code> objects.</li>
<li><code>&apos;np&apos;</code>: Return NumPy <code>np.ndarray</code> objects.</li>
<li><code>&apos;jax&apos;</code>: Return JAX <code>jnp.ndarray</code> objects.</li>
</ul>`,name:"return_tensors"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/tvp/processing_tvp.py#L49",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <a
  href="/docs/transformers/main/en/main_classes/tokenizer#transformers.BatchEncoding"
>BatchEncoding</a> with the following fields:</p>
<ul>
<li><strong>input_ids</strong> — List of token ids to be fed to a model. Returned when <code>text</code> is not <code>None</code>.</li>
<li><strong>attention_mask</strong> — List of indices specifying which tokens should be attended to by the model (when
<code>return_attention_mask=True</code> or if <em>“attention_mask”</em> is in <code>self.model_input_names</code> and if <code>text</code> is not
<code>None</code>).</li>
<li><strong>pixel_values</strong> — Pixel values to be fed to a model. Returned when <code>videos</code> is not <code>None</code>.</li>
</ul>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><a
  href="/docs/transformers/main/en/main_classes/tokenizer#transformers.BatchEncoding"
>BatchEncoding</a></p>
`}}),be=new Y({props:{title:"TvpModel",local:"transformers.TvpModel",headingTag:"h2"}}),we=new G({props:{name:"class transformers.TvpModel",anchor:"transformers.TvpModel",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.TvpModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/tvp#transformers.TvpConfig">TvpConfig</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/tvp/modeling_tvp.py#L775"}}),Je=new G({props:{name:"forward",anchor:"transformers.TvpModel.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.LongTensor] = None"},{name:"head_mask",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"},{name:"interpolate_pos_encoding",val:": bool = False"}],parametersDescription:[{anchor:"transformers.TvpModel.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. 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/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details. <a href="../glossary#input-ids">What are input
IDs?</a>`,name:"input_ids"},{anchor:"transformers.TvpModel.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/tvp#transformers.TvpImageProcessor">TvpImageProcessor</a>. See <a href="/docs/transformers/main/en/model_doc/vilt#transformers.ViltFeatureExtractor.__call__">TvpImageProcessor.<strong>call</strong>()</a>
for details.`,name:"pixel_values"},{anchor:"transformers.TvpModel.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.FloatTensor</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>.
<a href="../glossary#attention-mask">What are attention masks?</a></li>
</ul>`,name:"attention_mask"},{anchor:"transformers.TvpModel.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.TvpModel.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.TvpModel.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.TvpModel.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.TvpModel.forward.interpolate_pos_encoding",description:`<strong>interpolate_pos_encoding</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to interpolate the pre-trained image pad prompter encodings and positional encodings.`,name:"interpolate_pos_encoding"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/tvp/modeling_tvp.py#L809",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


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


<p><a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPooling"
>transformers.modeling_outputs.BaseModelOutputWithPooling</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),X=new jt({props:{$$slots:{default:[$t]},$$scope:{ctx:z}}}),N=new Ct({props:{anchor:"transformers.TvpModel.forward.example",$$slots:{default:[Wt]},$$scope:{ctx:z}}}),Ie=new Y({props:{title:"TvpForVideoGrounding",local:"transformers.TvpForVideoGrounding",headingTag:"h2"}}),Ue=new G({props:{name:"class transformers.TvpForVideoGrounding",anchor:"transformers.TvpForVideoGrounding",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.TvpForVideoGrounding.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/tvp#transformers.TvpConfig">TvpConfig</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/tvp/modeling_tvp.py#L900"}}),je=new G({props:{name:"forward",anchor:"transformers.TvpForVideoGrounding.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.LongTensor] = None"},{name:"labels",val:": typing.Tuple[torch.Tensor] = None"},{name:"head_mask",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"},{name:"interpolate_pos_encoding",val:": bool = False"}],parametersDescription:[{anchor:"transformers.TvpForVideoGrounding.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. 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/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details. <a href="../glossary#input-ids">What are input
IDs?</a>`,name:"input_ids"},{anchor:"transformers.TvpForVideoGrounding.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/tvp#transformers.TvpImageProcessor">TvpImageProcessor</a>. See <a href="/docs/transformers/main/en/model_doc/vilt#transformers.ViltFeatureExtractor.__call__">TvpImageProcessor.<strong>call</strong>()</a>
for details.`,name:"pixel_values"},{anchor:"transformers.TvpForVideoGrounding.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.FloatTensor</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>.
<a href="../glossary#attention-mask">What are attention masks?</a></li>
</ul>`,name:"attention_mask"},{anchor:"transformers.TvpForVideoGrounding.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.TvpForVideoGrounding.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.TvpForVideoGrounding.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.TvpForVideoGrounding.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.TvpForVideoGrounding.forward.interpolate_pos_encoding",description:`<strong>interpolate_pos_encoding</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to interpolate the pre-trained image pad prompter encodings and positional encodings.`,name:"interpolate_pos_encoding"},{anchor:"transformers.TvpForVideoGrounding.forward.labels",description:`<strong>labels</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, 3)</code>, <em>optional</em>) &#x2014;
The labels contains duration, start time, and end time of the video corresponding to the text.`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/tvp/modeling_tvp.py#L915",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <code>transformers.models.tvp.modeling_tvp.TvpVideoGroundingOutput</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.tvp.configuration_tvp.TvpConfig'&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>) — Temporal-Distance IoU loss for video grounding.</li>
<li><strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, 2)</code>) — Contains start_time/duration and end_time/duration. It is the time slot of the videos corresponding to the
input texts.</li>
<li><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) — Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, +
one for the output of each layer) of shape <code>(batch_size, sequence_length, hidden_size)</code>. Hidden-states of
the model at the output of each layer plus the optional initial embedding outputs.</li>
<li><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) — Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</li>
</ul>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>transformers.models.tvp.modeling_tvp.TvpVideoGroundingOutput</code> or <code>tuple(torch.FloatTensor)</code></p>
`}}),P=new jt({props:{$$slots:{default:[Rt]},$$scope:{ctx:z}}}),H=new Ct({props:{anchor:"transformers.TvpForVideoGrounding.forward.example",$$slots:{default:[At]},$$scope:{ctx:z}}}),Ce=new Vt({props:{source:"https://github.com/huggingface/transformers/blob/main/docs/source/en/model_doc/tvp.md"}}),{c(){d=a("meta"),b=s(),m=a("p"),_=s(),f(y.$$.fragment),c=s(),w=a("div"),w.innerHTML=Ko,Se=s(),f(q.$$.fragment),Le=s(),D=a("p"),D.innerHTML=Oo,Ye=s(),K=a("p"),K.textContent=et,qe=s(),O=a("p"),O.innerHTML=ot,De=s(),ee=a("p"),ee.textContent=tt,Ke=s(),$=a("img"),Oe=s(),oe=a("small"),oe.innerHTML=st,eo=s(),te=a("p"),te.innerHTML=rt,oo=s(),f(ne.$$.fragment),to=s(),se=a("p"),se.textContent=at,no=s(),re=a("p"),re.textContent=it,so=s(),ae=a("p"),ae.textContent=lt,ro=s(),ie=a("p"),ie.innerHTML=dt,ao=s(),le=a("p"),le.innerHTML=ct,io=s(),f(de.$$.fragment),lo=s(),ce=a("p"),ce.textContent=pt,co=s(),pe=a("ul"),pe.innerHTML=mt,po=s(),f(me.$$.fragment),mo=s(),J=a("div"),f(fe.$$.fragment),jo=s(),Be=a("p"),Be.innerHTML=ft,Co=s(),Ze=a("p"),Ze.innerHTML=ht,xo=s(),W=a("div"),f(he.$$.fragment),ko=s(),Ge=a("p"),Ge.innerHTML=ut,Bo=s(),R=a("div"),f(ue.$$.fragment),Zo=s(),ze=a("p"),ze.innerHTML=gt,fo=s(),f(ge.$$.fragment),ho=s(),B=a("div"),f(Te.$$.fragment),Go=s(),Ve=a("p"),Ve.textContent=Tt,zo=s(),A=a("div"),f(Me.$$.fragment),Vo=s(),$e=a("p"),$e.textContent=Mt,uo=s(),f(_e.$$.fragment),go=s(),I=a("div"),f(ye.$$.fragment),$o=s(),We=a("p"),We.textContent=_t,Wo=s(),Re=a("p"),Re.innerHTML=yt,Ro=s(),F=a("div"),f(ve.$$.fragment),Ao=s(),Ae=a("p"),Ae.innerHTML=vt,To=s(),f(be.$$.fragment),Mo=s(),Z=a("div"),f(we.$$.fragment),Fo=s(),Fe=a("p"),Fe.innerHTML=bt,Xo=s(),x=a("div"),f(Je.$$.fragment),No=s(),Xe=a("p"),Xe.innerHTML=wt,Po=s(),f(X.$$.fragment),Ho=s(),f(N.$$.fragment),_o=s(),f(Ie.$$.fragment),yo=s(),U=a("div"),f(Ue.$$.fragment),Eo=s(),Ne=a("p"),Ne.textContent=Jt,Qo=s(),Pe=a("p"),Pe.innerHTML=It,So=s(),k=a("div"),f(je.$$.fragment),Lo=s(),He=a("p"),He.innerHTML=Ut,Yo=s(),f(P.$$.fragment),qo=s(),f(H.$$.fragment),vo=s(),f(Ce.$$.fragment),bo=s(),Qe=a("p"),this.h()},l(e){const o=zt("svelte-u9bgzb",document.head);d=i(o,"META",{name:!0,content:!0}),o.forEach(t),b=r(e),m=i(e,"P",{}),C(m).forEach(t),_=r(e),h(y.$$.fragment,e),c=r(e),w=i(e,"DIV",{class:!0,"data-svelte-h":!0}),p(w)!=="svelte-13t8s2t"&&(w.innerHTML=Ko),Se=r(e),h(q.$$.fragment,e),Le=r(e),D=i(e,"P",{"data-svelte-h":!0}),p(D)!=="svelte-ru7f7y"&&(D.innerHTML=Oo),Ye=r(e),K=i(e,"P",{"data-svelte-h":!0}),p(K)!=="svelte-vfdo9a"&&(K.textContent=et),qe=r(e),O=i(e,"P",{"data-svelte-h":!0}),p(O)!=="svelte-ez3ksy"&&(O.innerHTML=ot),De=r(e),ee=i(e,"P",{"data-svelte-h":!0}),p(ee)!=="svelte-e6jl89"&&(ee.textContent=tt),Ke=r(e),$=i(e,"IMG",{src:!0,alt:!0,width:!0}),Oe=r(e),oe=i(e,"SMALL",{"data-svelte-h":!0}),p(oe)!=="svelte-5ezgfp"&&(oe.innerHTML=st),eo=r(e),te=i(e,"P",{"data-svelte-h":!0}),p(te)!=="svelte-3zatzf"&&(te.innerHTML=rt),oo=r(e),h(ne.$$.fragment,e),to=r(e),se=i(e,"P",{"data-svelte-h":!0}),p(se)!=="svelte-1cyrqov"&&(se.textContent=at),no=r(e),re=i(e,"P",{"data-svelte-h":!0}),p(re)!=="svelte-1bgttui"&&(re.textContent=it),so=r(e),ae=i(e,"P",{"data-svelte-h":!0}),p(ae)!=="svelte-1w5jusu"&&(ae.textContent=lt),ro=r(e),ie=i(e,"P",{"data-svelte-h":!0}),p(ie)!=="svelte-1o30d19"&&(ie.innerHTML=dt),ao=r(e),le=i(e,"P",{"data-svelte-h":!0}),p(le)!=="svelte-wnh6z7"&&(le.innerHTML=ct),io=r(e),h(de.$$.fragment,e),lo=r(e),ce=i(e,"P",{"data-svelte-h":!0}),p(ce)!=="svelte-axv494"&&(ce.textContent=pt),co=r(e),pe=i(e,"UL",{"data-svelte-h":!0}),p(pe)!=="svelte-vh5qk9"&&(pe.innerHTML=mt),po=r(e),h(me.$$.fragment,e),mo=r(e),J=i(e,"DIV",{class:!0});var j=C(J);h(fe.$$.fragment,j),jo=r(j),Be=i(j,"P",{"data-svelte-h":!0}),p(Be)!=="svelte-1vsbyuh"&&(Be.innerHTML=ft),Co=r(j),Ze=i(j,"P",{"data-svelte-h":!0}),p(Ze)!=="svelte-o55m63"&&(Ze.innerHTML=ht),xo=r(j),W=i(j,"DIV",{class:!0});var xe=C(W);h(he.$$.fragment,xe),ko=r(xe),Ge=i(xe,"P",{"data-svelte-h":!0}),p(Ge)!=="svelte-1pi4u0y"&&(Ge.innerHTML=ut),xe.forEach(t),Bo=r(j),R=i(j,"DIV",{class:!0});var ke=C(R);h(ue.$$.fragment,ke),Zo=r(ke),ze=i(ke,"P",{"data-svelte-h":!0}),p(ze)!=="svelte-1amdb4q"&&(ze.innerHTML=gt),ke.forEach(t),j.forEach(t),fo=r(e),h(ge.$$.fragment,e),ho=r(e),B=i(e,"DIV",{class:!0});var V=C(B);h(Te.$$.fragment,V),Go=r(V),Ve=i(V,"P",{"data-svelte-h":!0}),p(Ve)!=="svelte-18mjwp8"&&(Ve.textContent=Tt),zo=r(V),A=i(V,"DIV",{class:!0});var Jo=C(A);h(Me.$$.fragment,Jo),Vo=r(Jo),$e=i(Jo,"P",{"data-svelte-h":!0}),p($e)!=="svelte-1x3yxsa"&&($e.textContent=Mt),Jo.forEach(t),V.forEach(t),uo=r(e),h(_e.$$.fragment,e),go=r(e),I=i(e,"DIV",{class:!0});var E=C(I);h(ye.$$.fragment,E),$o=r(E),We=i(E,"P",{"data-svelte-h":!0}),p(We)!=="svelte-zs1zlw"&&(We.textContent=_t),Wo=r(E),Re=i(E,"P",{"data-svelte-h":!0}),p(Re)!=="svelte-a73fly"&&(Re.innerHTML=yt),Ro=r(E),F=i(E,"DIV",{class:!0});var Io=C(F);h(ve.$$.fragment,Io),Ao=r(Io),Ae=i(Io,"P",{"data-svelte-h":!0}),p(Ae)!=="svelte-13t0ows"&&(Ae.innerHTML=vt),Io.forEach(t),E.forEach(t),To=r(e),h(be.$$.fragment,e),Mo=r(e),Z=i(e,"DIV",{class:!0});var Ee=C(Z);h(we.$$.fragment,Ee),Fo=r(Ee),Fe=i(Ee,"P",{"data-svelte-h":!0}),p(Fe)!=="svelte-15idequ"&&(Fe.innerHTML=bt),Xo=r(Ee),x=i(Ee,"DIV",{class:!0});var Q=C(x);h(Je.$$.fragment,Q),No=r(Q),Xe=i(Q,"P",{"data-svelte-h":!0}),p(Xe)!=="svelte-qa69mf"&&(Xe.innerHTML=wt),Po=r(Q),h(X.$$.fragment,Q),Ho=r(Q),h(N.$$.fragment,Q),Q.forEach(t),Ee.forEach(t),_o=r(e),h(Ie.$$.fragment,e),yo=r(e),U=i(e,"DIV",{class:!0});var S=C(U);h(Ue.$$.fragment,S),Eo=r(S),Ne=i(S,"P",{"data-svelte-h":!0}),p(Ne)!=="svelte-sl1gwa"&&(Ne.textContent=Jt),Qo=r(S),Pe=i(S,"P",{"data-svelte-h":!0}),p(Pe)!=="svelte-1gjh92c"&&(Pe.innerHTML=It),So=r(S),k=i(S,"DIV",{class:!0});var L=C(k);h(je.$$.fragment,L),Lo=r(L),He=i(L,"P",{"data-svelte-h":!0}),p(He)!=="svelte-110fgkf"&&(He.innerHTML=Ut),Yo=r(L),h(P.$$.fragment,L),qo=r(L),h(H.$$.fragment,L),L.forEach(t),S.forEach(t),vo=r(e),h(Ce.$$.fragment,e),bo=r(e),Qe=i(e,"P",{}),C(Qe).forEach(t),this.h()},h(){v(d,"name","hf:doc:metadata"),v(d,"content",Xt),v(w,"class","flex flex-wrap space-x-1"),kt($.src,nt="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/model_doc/tvp_architecture.png")||v($,"src",nt),v($,"alt","drawing"),v($,"width","600"),v(W,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(R,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(J,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(A,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(B,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(F,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(I,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(x,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(Z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(k,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(U,"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,o){l(document.head,d),n(e,b,o),n(e,m,o),n(e,_,o),u(y,e,o),n(e,c,o),n(e,w,o),n(e,Se,o),u(q,e,o),n(e,Le,o),n(e,D,o),n(e,Ye,o),n(e,K,o),n(e,qe,o),n(e,O,o),n(e,De,o),n(e,ee,o),n(e,Ke,o),n(e,$,o),n(e,Oe,o),n(e,oe,o),n(e,eo,o),n(e,te,o),n(e,oo,o),u(ne,e,o),n(e,to,o),n(e,se,o),n(e,no,o),n(e,re,o),n(e,so,o),n(e,ae,o),n(e,ro,o),n(e,ie,o),n(e,ao,o),n(e,le,o),n(e,io,o),u(de,e,o),n(e,lo,o),n(e,ce,o),n(e,co,o),n(e,pe,o),n(e,po,o),u(me,e,o),n(e,mo,o),n(e,J,o),u(fe,J,null),l(J,jo),l(J,Be),l(J,Co),l(J,Ze),l(J,xo),l(J,W),u(he,W,null),l(W,ko),l(W,Ge),l(J,Bo),l(J,R),u(ue,R,null),l(R,Zo),l(R,ze),n(e,fo,o),u(ge,e,o),n(e,ho,o),n(e,B,o),u(Te,B,null),l(B,Go),l(B,Ve),l(B,zo),l(B,A),u(Me,A,null),l(A,Vo),l(A,$e),n(e,uo,o),u(_e,e,o),n(e,go,o),n(e,I,o),u(ye,I,null),l(I,$o),l(I,We),l(I,Wo),l(I,Re),l(I,Ro),l(I,F),u(ve,F,null),l(F,Ao),l(F,Ae),n(e,To,o),u(be,e,o),n(e,Mo,o),n(e,Z,o),u(we,Z,null),l(Z,Fo),l(Z,Fe),l(Z,Xo),l(Z,x),u(Je,x,null),l(x,No),l(x,Xe),l(x,Po),u(X,x,null),l(x,Ho),u(N,x,null),n(e,_o,o),u(Ie,e,o),n(e,yo,o),n(e,U,o),u(Ue,U,null),l(U,Eo),l(U,Ne),l(U,Qo),l(U,Pe),l(U,So),l(U,k),u(je,k,null),l(k,Lo),l(k,He),l(k,Yo),u(P,k,null),l(k,qo),u(H,k,null),n(e,vo,o),u(Ce,e,o),n(e,bo,o),n(e,Qe,o),wo=!0},p(e,[o]){const j={};o&2&&(j.$$scope={dirty:o,ctx:e}),X.$set(j);const xe={};o&2&&(xe.$$scope={dirty:o,ctx:e}),N.$set(xe);const ke={};o&2&&(ke.$$scope={dirty:o,ctx:e}),P.$set(ke);const V={};o&2&&(V.$$scope={dirty:o,ctx:e}),H.$set(V)},i(e){wo||(g(y.$$.fragment,e),g(q.$$.fragment,e),g(ne.$$.fragment,e),g(de.$$.fragment,e),g(me.$$.fragment,e),g(fe.$$.fragment,e),g(he.$$.fragment,e),g(ue.$$.fragment,e),g(ge.$$.fragment,e),g(Te.$$.fragment,e),g(Me.$$.fragment,e),g(_e.$$.fragment,e),g(ye.$$.fragment,e),g(ve.$$.fragment,e),g(be.$$.fragment,e),g(we.$$.fragment,e),g(Je.$$.fragment,e),g(X.$$.fragment,e),g(N.$$.fragment,e),g(Ie.$$.fragment,e),g(Ue.$$.fragment,e),g(je.$$.fragment,e),g(P.$$.fragment,e),g(H.$$.fragment,e),g(Ce.$$.fragment,e),wo=!0)},o(e){T(y.$$.fragment,e),T(q.$$.fragment,e),T(ne.$$.fragment,e),T(de.$$.fragment,e),T(me.$$.fragment,e),T(fe.$$.fragment,e),T(he.$$.fragment,e),T(ue.$$.fragment,e),T(ge.$$.fragment,e),T(Te.$$.fragment,e),T(Me.$$.fragment,e),T(_e.$$.fragment,e),T(ye.$$.fragment,e),T(ve.$$.fragment,e),T(be.$$.fragment,e),T(we.$$.fragment,e),T(Je.$$.fragment,e),T(X.$$.fragment,e),T(N.$$.fragment,e),T(Ie.$$.fragment,e),T(Ue.$$.fragment,e),T(je.$$.fragment,e),T(P.$$.fragment,e),T(H.$$.fragment,e),T(Ce.$$.fragment,e),wo=!1},d(e){e&&(t(b),t(m),t(_),t(c),t(w),t(Se),t(Le),t(D),t(Ye),t(K),t(qe),t(O),t(De),t(ee),t(Ke),t($),t(Oe),t(oe),t(eo),t(te),t(oo),t(to),t(se),t(no),t(re),t(so),t(ae),t(ro),t(ie),t(ao),t(le),t(io),t(lo),t(ce),t(co),t(pe),t(po),t(mo),t(J),t(fo),t(ho),t(B),t(uo),t(go),t(I),t(To),t(Mo),t(Z),t(_o),t(yo),t(U),t(vo),t(bo),t(Qe)),t(d),M(y,e),M(q,e),M(ne,e),M(de,e),M(me,e),M(fe),M(he),M(ue),M(ge,e),M(Te),M(Me),M(_e,e),M(ye),M(ve),M(be,e),M(we),M(Je),M(X),M(N),M(Ie,e),M(Ue),M(je),M(P),M(H),M(Ce,e)}}}const Xt='{"title":"TVP","local":"tvp","sections":[{"title":"Overview","local":"overview","sections":[],"depth":2},{"title":"Usage tips and examples","local":"usage-tips-and-examples","sections":[],"depth":2},{"title":"TvpConfig","local":"transformers.TvpConfig","sections":[],"depth":2},{"title":"TvpImageProcessor","local":"transformers.TvpImageProcessor","sections":[],"depth":2},{"title":"TvpProcessor","local":"transformers.TvpProcessor","sections":[],"depth":2},{"title":"TvpModel","local":"transformers.TvpModel","sections":[],"depth":2},{"title":"TvpForVideoGrounding","local":"transformers.TvpForVideoGrounding","sections":[],"depth":2}],"depth":1}';function Nt(z){return Bt(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class qt extends Zt{constructor(d){super(),Gt(this,d,Nt,Ft,xt,{})}}export{qt as component};
