Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Video Classification Task Guide Using Undeclared Variables #29817

Closed
2 of 4 tasks
astern21 opened this issue Mar 22, 2024 · 8 comments
Closed
2 of 4 tasks

Video Classification Task Guide Using Undeclared Variables #29817

astern21 opened this issue Mar 22, 2024 · 8 comments

Comments

@astern21
Copy link

System Info

  • transformers version: 4.32.1
  • Platform: macOS-10.16-x86_64-i386-64bit
  • Python version: 3.11.4
  • Huggingface_hub version: 0.17.2
  • Safetensors version: 0.3.2
  • Accelerate version: 0.24.1
  • Accelerate config: not found
  • PyTorch version (GPU?): 2.0.1 (False)
  • Tensorflow version (GPU?): 2.13.0 (False)
  • Flax version (CPU?/GPU?/TPU?): 0.7.4 (cpu)
  • Jax version: 0.4.16
  • JaxLib version: 0.4.16
  • Using GPU in script?: No
  • Using distributed or parallel set-up in script?: No

Who can help?

@amyeroberts

Information

  • The official example scripts
  • My own modified scripts

Tasks

  • An officially supported task in the examples folder (such as GLUE/SQuAD, ...)
  • My own task or dataset (give details below)

Reproduction

  1. Follow the Video Classification example in the HuggingFace docs:
    https://huggingface.co/docs/transformers/tasks/video_classification

  2. When Reaching the step

`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()}

print(f"Unique classes: {list(label2id.keys())}.")
`

The variable all_video_file_paths is not previously defined in the example docs. I had to write a function to retrieve the video file paths myself, as seen below:

`import os

dataset_path = "UCF101_subset"

all_video_file_paths = []

for split in ["train", "val", "test"]:
split_path = os.path.join(dataset_path, split)
for category in os.listdir(split_path):
category_path = os.path.join(split_path, category)
for video_file in os.listdir(category_path):
video_file_path = os.path.join(category_path, video_file)
all_video_file_paths.append(video_file_path)`

  1. When preparing the dataset for training, the variable dataset_root_path is not previously defined.

Expected behavior

I assume that these variables should have been previously defined to not cause errors for people following the example docs.

@NielsRogge
Copy link
Contributor

Thanks for reporting, would you be able to open a PR to fix this?

@astern21
Copy link
Author

Sure, I'd be happy to help.

@manju-rangam
Copy link
Contributor

manju-rangam commented Apr 24, 2024

Hi @amyeroberts , the main version of video classification notebook seems to define the all_video_file_paths. Should this issue be considered fixed?

@amyeroberts
Copy link
Collaborator

Hi @manju-rangam - the issue is referencing the examples in the docs, which should still be updated.

manju-rangam pushed a commit to manju-rangam/transformers that referenced this issue Apr 24, 2024
Video Classification Task Guide Using Undeclared Variables
@manju-rangam
Copy link
Contributor

@amyeroberts, I've created a PR related to this

manju-rangam pushed a commit to manju-rangam/transformers that referenced this issue Apr 25, 2024
Video Classification Task Guide Using Undeclared Variables
manju-rangam pushed a commit to manju-rangam/transformers that referenced this issue Apr 25, 2024
Add line space following PR comments
@manju-rangam
Copy link
Contributor

updated based on review comments @amyeroberts

amyeroberts added a commit that referenced this issue Apr 25, 2024
…riables (#30457)

* Fix issue #29817

Video Classification Task Guide Using Undeclared Variables

* Update docs/source/en/tasks/video_classification.md

updated with review comments

Co-authored-by: amyeroberts <[email protected]>

* Fix issue #29817

Add line space following PR comments

---------

Co-authored-by: manju-rangam <Manju1@Git>
Co-authored-by: amyeroberts <[email protected]>
@anirudh2781998
Copy link

Hey @amyeroberts new to open source community can i be considered to work on this issue if its not fixed?

@NielsRogge
Copy link
Contributor

The PR above has been merged, so will close this issue. @anirudh2781998 feel free to take a look at other issues labeled with "good first issue" or "good first documentation issue"

itazap pushed a commit that referenced this issue May 14, 2024
…riables (#30457)

* Fix issue #29817

Video Classification Task Guide Using Undeclared Variables

* Update docs/source/en/tasks/video_classification.md

updated with review comments

Co-authored-by: amyeroberts <[email protected]>

* Fix issue #29817

Add line space following PR comments

---------

Co-authored-by: manju-rangam <Manju1@Git>
Co-authored-by: amyeroberts <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants