facebookresearch / dinov2

PyTorch code and models for the DINOv2 self-supervised learning method.
Apache License 2.0
9.23k stars 822 forks source link

dinov2_vitl14_reg4_pretrain load error #379

Closed laserwave closed 8 months ago

laserwave commented 8 months ago

I download the 'dinov2_vitl14_reg4_pretrain.pth' locally and use the 'vit_large' function to build model. I run the following code. But get the error "RuntimeError: PytorchStreamReader failed reading file data/12: invalid header or archive is corrupted"

from dinov2.models.vision_transformer import vit_large
model = vit_large(
        patch_size=14, 
        img_size=518,
        init_values=1.0,
        block_chunks=0,
        num_register_tokens=4)
state_dict = torch.load('checkpoint/dinov2_vitl14_reg4_pretrain.pth', map_location='cpu') 
model.load_state_dict(state_dict, strict=False) 
jiangxb98 commented 5 months ago

Hello, how did you solve this problem?