Error when use transformers library

#4
by Abbasid - opened
---> 3 from transformers import DepthProImageProcessorFast, DepthProForDepthEstimation
      4 
      5 device = torch.device("cuda" if torch.cuda.is_available() else "cpu")

ImportError: cannot import name 'DepthProImageProcessorFast' from 'transformers' (/usr/local/lib/python3.11/dist-packages/transformers/__init__.py)

and


ValueError: The checkpoint you are trying to load has model type `depth_pro` but Transformers does not recognize this architecture. This could be because of an issue with the checkpoint, or because your version of Transformers is out of date.

Yes you are right, you will currently get this error. This is because the code is not merged yet. We are working on a few final checks. Hoping to merge it soon.

This is the open PR which adds the model to transformers: https://github.com/huggingface/transformers/pull/34583

If you want to work with it right now, you can install transformers from this custom branch and it will work

pip install git+https://github.com/geetu040/transformers.git@depth-pro#egg=transformers

Hope that works for you.

Update: the PR is now merged in the main branch and you can simply install transformers from github source

pip install git+https://github.com/huggingface/transformers.git

ImportError: cannot import name 'DepthProImageProcessorFast' from 'transformers'

Hello, I encountered the same problem and then I encountered an issue using the command you just gave:
pip install git+ https://github.com/huggingface/transformers.git

problem:

Collecting git+ https://github.com/huggingface/transformers.git
Cloning https://github.com/huggingface/transformers.git to /tmp/pip-req-build-iw257ht2
Running command git clone --filter=blob:none --quiet https://github.com/huggingface/transformers.git /tmp/pip-req-build-iw257ht2
fatal: unable to access ' https://github.com/huggingface/transformers.git/ ': HTTP/2 stream 1 was not closed cleanly before end of the underlying stream
error: subprocess-exited-with-error

× git clone --filter=blob: none --quiet https://github.com/huggingface/transformers.git /tmp/pip-req-build-iw257ht2 did not run successfully.
│ exit code: one hundred and twenty-eight
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× git clone --filter=blob: none --quiet https://github.com/huggingface/transformers.git /tmp/pip-req-build-iw257ht2 did not run successfully.
│ exit code: one hundred and twenty-eight
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

Then I downloaded transformers myself, version is pip install transformers==4.46.1
My PyTorch version is 1.8.1. How can I successfully use the model? Thank you very much!

Hi @zwqaaa , no need to install from source anymore, try upgrading transformers

pip install --upgrade transformers

or manually set the version bound

pip install transformers>=4.49.0

Sign up or log in to comment