KeyError when loading any dinov2 model
I am trying to load facebook’s dinov2 models as shown below. However I am gettingKeyError: 'dinov2'error. I have updated my transformers library to the latest version and also made sure that all packages used in thegithub dinov2 repoare installed. I have also tried searching for a model class within transformers but could not find one.Scriptfrom transformers import AutoImageProcessor, AutoModel
from PIL import Image
import requests

url = 'http://images.cocodataset.org/val2017/000000039769.jpg'
image = Image.open(requests.get(url, stream=True).raw)

processor = AutoImageProcessor.from_pretrained('facebook/dinov2-giant')
model = AutoModel.from_pretrained('facebook/dinov2-giant')

inputs = processor(images=image, return_tensors="pt")
outputs = model(**inputs)
last_hidden_states = outputs.last_hidden_stateEnvironmenttransformersversion: 4.31.0Platform: Linux-5.4.0-139-generic-x86_64-with-glibc2.31Python version: 3.11.4Huggingface_hub version: 0.16.4Safetensors version: 0.3.1Accelerate version: 0.21.0Accelerate config: 	- compute_environment: LOCAL_MACHINEdistributed_type: NOmixed_precision: fp16use_cpu: Falsenum_processes: 1machine_rank: 0num_machines: 1gpu_ids: allrdzv_backend: staticsame_network: Truemain_training_function: maindowncast_bf16: notpu_use_cluster: Falsetpu_use_sudo: Falsetpu_env:PyTorch version (GPU?): 2.0.1+cu117 (True)Tensorflow version (GPU?): not installed (NA)Flax version (CPU?/GPU?/TPU?): not installed (NA)Jax version: not installedJaxLib version: not installedUsing GPU in script?: FalseUsing distributed or parallel set-up in script?: False
2023-08-04T07:20:05Z
Hi,You need to install Transformers from source for now:pip install -q git+https://github.com/huggingface/transformers.git