Safetensors
custom_code

ImportError: cannot import name 'dinov2_arch' from 'transformers_modules.nvidia.C-RADIOv3-g.2fe762d575015f66f564b7b7f7360bed80413de5'

#4
by charliech - opened

use the code that present in the Model card, but encountered the error below

image.png

import torch
from PIL import Image
from transformers import AutoModel, CLIPImageProcessor

hf_repo = "nvidia/C-RADIOv3-g"

image_processor = CLIPImageProcessor.from_pretrained(hf_repo)
model = AutoModel.from_pretrained(hf_repo, trust_remote_code=True)
model.eval().cuda()

image = Image.open('./assets/radio.png').convert('RGB')
pixel_values = image_processor(images=image, return_tensors='pt', do_resize=True).pixel_values
pixel_values = pixel_values.cuda()

summary, features = model(pixel_values)

It looks like it lack some code from another repo https://github.com/NVlabs/RADIO/tree/main/radio , but after i copyed it to the current folder, it will report another error.

vit_patch_generator.py line 302 
assert (src_patch_size ** 2) * 3 == chk_weight.shape[1], 'Unable to interpolate non-square patch size'
NVIDIA org

Hi, sorry for missing this comment. Notifications were hitting my junk filter. I have fixed the dinov2_arch.py missing error. Could you try running again?

I haven't seen the second error before. Can you give me more details such as the version of transformers you have?

NVIDIA org

@mranzinger fixed now. thx~

Sign up or log in to comment