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

Zero-Shot Image Classification Guide Missing Dependency and Addition for Local Inputs #30060

Closed
1 of 4 tasks
Tanman2001 opened this issue Apr 4, 2024 · 1 comment · Fixed by #30842
Closed
1 of 4 tasks

Comments

@Tanman2001
Copy link

System Info

  • transformers version: 4.39.2
  • Platform: Windows-10-10.0.22631-SP0
  • Python version: 3.11.1
  • Huggingface_hub version: 0.22.1
  • Safetensors version: 0.4.2
  • Accelerate version: 0.28.0
  • Accelerate config: not found
  • PyTorch version (GPU?): 2.2.2+cu118 (True)
  • Tensorflow version (GPU?): not installed (NA)
  • Flax version (CPU?/GPU?/TPU?): not installed (NA)
  • Jax version: not installed
  • JaxLib version: not installed
  • Using GPU in script?:
  • Using distributed or parallel set-up in script?:

Who can help?

No response

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

Tested using PyTorch only.

  • Missing pip install pillow
  1. Follow Zero-Shot Image Classification guide here: https://huggingface.co/docs/transformers/tasks/zero_shot_image_classification
  2. Error on detector = pipeline(model=checkpoint, task="zero-shot-image-classification") message: CLIPImageProcessor requires the PIL library but it was not found in your environment.

Additional recommendation:

Users should be able to (and likely will attempt to) use locally saved images with their model. Guide only states how to use an image from the internet using a URL.

Add to guide in both sections:

path = “<path of image>”
image = Image.open(path)

as an option to use a locally stored images.

Expected behavior

Following guide as written should not result in crash.

Additionally, users should know how to use the model with their own, locally-saved images.

@ArthurZucker
Copy link
Collaborator

would you like to open a PR for a fix?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants