Practical overview
When it fits
Use it when you need a PyTorch model implementation for classifying video frames and want the documented temporal-then-spatial attention variant.
Who it is for
- Python developers adding video classification to an application
- Practitioners prototyping video-understanding models with PyTorch
Documented uses
- Classify batches of videos into configured classes.
- Pass variable-length videos in one batch using a frame mask.
Requirements & limits
The repository is public and lists an MIT license. Its README documents installation with pip.
- The implementation documents only the Divided Space-Time Attention variant.
- The example expects video tensors arranged as batch × frames × channels × height × width.
- The model configuration includes image size, patch size, frame count and number of output classes.
Check current requirements in the official documentation. Source-based guidance does not mean OpenViST has run or independently tested this project.
Set up the library and prepare a model call
Install the package and prepare the documented model, video batch and optional frame mask for a classification call.
Before you start
- Python package installation with pip
- PyTorch, imported as torch
- Video data represented as batch × frames × channels × height × width
Steps
Install the package with the command below.
pip install timesformer-pytorchImport
torchandTimeSformerfromtimesformer_pytorch.Configure
TimeSformerwith model settings such as image size, patch size, frame count and number of classes.Prepare a video tensor and, for variable-length videos batched together, a Boolean frame mask; the example passes both to the model.
Expected outcome
The documented call returns a prediction tensor with one row per video and one output per configured class.
Guide limitations
- The README example uses randomly generated tensors rather than documenting video decoding or preprocessing.
- The guide reflects documented setup and example usage, not an execution test.
Sources & review
Source record details
- Source availability
- Active
- Sources checked
- 16 October 2026
- Original website title
- lucidrains/TimeSformer-pytorch · Official homepage title · retained in its source language

