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

Update code for pytorch 1.9.0#47

Open
wanchichen wants to merge 5 commits into
facebookresearch:mainfrom
wanchichen:main
Open

Update code for pytorch 1.9.0#47
wanchichen wants to merge 5 commits into
facebookresearch:mainfrom
wanchichen:main

Conversation

@wanchichen

Copy link
Copy Markdown

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

smivv commented Sep 20, 2021

Copy link
Copy Markdown

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

@wanchichen

Copy link
Copy Markdown
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

smivv commented Sep 20, 2021

Copy link
Copy Markdown

@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
Copy Markdown
Author

Yeah the branch should work without issues.

@ShoufaChen

Copy link
Copy Markdown

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
Copy Markdown
Author

Thank you @ShoufaChen , it has been fixed.

@MeSveta

MeSveta commented Jul 11, 2023

Copy link
Copy Markdown

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
Copy Markdown
Author

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

@MeSveta

MeSveta commented Jul 20, 2023 via email

Copy link
Copy Markdown

@jromerooo2

jromerooo2 commented Jul 20, 2023

Copy link
Copy Markdown

@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