Skip to content
This repository has been archived by the owner on Jan 1, 2025. It is now read-only.

Update code for pytorch 1.9.0 #47

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

wanchichen
Copy link

The latest version of pytorch removed some internal code that this repo imports, such as:

  • container_abcs from torch._six
  • int_classes from torch._six

Causing anyone running the current TimeSformer code on new versions of pytorch to receive compile-time errors.
The fix is similar to NVIDIA/apex#1049, checking the user's pytorch version before importing the necessary components.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jun 20, 2021
@smivv
Copy link

smivv commented Sep 20, 2021

Hello, sorry for bothering, but why this PR still wasn't merged?

@wanchichen
Copy link
Author

The original author of the paper/repo (@gberta) no longer works at Facebook, so he doesn’t have permissions to merge it. So unless someone there with the necessary permissions takes notice it likely won’t be merged for the foreseeable future.

@smivv
Copy link

smivv commented Sep 20, 2021

@wanchichen, thank you for your answer!

By the way, does your branch works fine? 😄
I consider your PR as the most recent update, so probably will use it.

@wanchichen
Copy link
Author

Yeah the branch should work without issues.

@ShoufaChen
Copy link

Hi, @wanchichen
Thanks for your sharing.

One small fix:
you should add

import torch

at the top of timesformer/datasets/multigrid_helper.py.

@wanchichen
Copy link
Author

Thank you @ShoufaChen , it has been fixed.

@MeSveta
Copy link

MeSveta commented Jul 11, 2023

hi, I'm trying to set the environment but without any success. How I should update the pull request? manually? since it is not merged.

@wanchichen
Copy link
Author

You can just clone from my fork: git clone https://github.com/wanchichen/TimeSformer.git

@MeSveta
Copy link

MeSveta commented Jul 20, 2023 via email

@jromerooo2
Copy link

jromerooo2 commented Jul 20, 2023

@MeSveta From my understanding you should create your own function that maps those features to an integer and/or viceversa. There should be a file inside of the dataset that contains the video path or video as an array and labels (sometimes the labels are in the actual name of the video, this depends on the structure of the dataset).

An example for the described above could be:
class_labels = sorted({str(path).split("/")[2] for path in all_video_file_paths})
label2id = {label: i for i, label in enumerate(class_labels)}
id2label = {i: label for label, i in label2id.items()}

This splits the path of the file in the current index i of the iteration and assigns it to a set. The set can't contain any duplicates so that is already covered for us.

Note that the code heavily relies on the assumption that your dataset is structured as the following:
'subset/train/Class/class_1.mp4'

So please modify if your dataset looks different.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants