Can't load a ViTPose model using Transformers

Greetings everyone,

I am new to huggingface. I’ve been going through a lot of trouble because of existing ViTPose repository on Github. Currently, All I want to do is to evaluate the model. So, I found “Huggingface” and I think that I can build an evaluation script around an existing ViTPose model.

I went to an existing model that was associated with the transformers library. I copied the code that explains how to use the model within my script.

Here’s what is written in the snippet:

# Load model directly
from transformers import ViTPoseForPoseEstimation
model = ViTPoseForPoseEstimation.from_pretrained("shauray/ViTPose")

I already have a local environment with the right requirements. I am using:

  • transformers 4.37.2
  • torch and torchvision 2.2.0 on Linux Kubuntu, installed using pip3, on cuda 12.1

I’ve tested other models just to check if the problem is caused by the versions of the libraries but they worked fine. e.g. DETR by Facebook.

The error that I am getting is:

Traceback (most recent call last):
  File "/home/haddagart/Codes/huggingface/vitpose/app.py", line 2, in <module>
    from transformers import pipeline, ViTPoseForPoseEstimation
ImportError: cannot import name 'ViTPoseForPoseEstimation' from 'transformers' (/home/haddagart/Codes/huggingface/vitpose/venv/lib/python3.10/site-packages/transformers/__init__.py)

Apparently the ViTPoseForPoseEstimation module isn’t available in the transformers library. I also tried loading it using AutoModel and it says that vitpose is not recognized.

Thank you in advance :hugs: