mahmoodlab / HIPT

Hierarchical Image Pyramid Transformer - CVPR 2022 (Oral)
Other
498 stars 86 forks source link

cannot load pretrained model weights #36

Closed RedekopEP closed 1 year ago

RedekopEP commented 1 year ago

Hi! I am trying to load pretrained dino weights found in HIPT/HIPT_4K/Checkpoints using the following code:

pretrained_weights4k = 'vit256_small_dino.pth'
state_dict = torch.load(pretrained_weights4k)['teacher']

but i am getting an error: UnpicklingError: invalid load key, 'v'.

Also running the notebook HIPT_4K Inference + Attention Visualization I have checked that when get_vit256 or get_vit4k are called,os.path.isfile(pretrained_weights) returns False inside these functions, so the code doesn't load model weights.

Can you please help with this issue

Thank you!

JuanDuranMcgill commented 1 year ago

Hello, I also have this problem. I'll let you know if I find something

Richarizardd commented 1 year ago

Hi @RedekopEP @JuanDuranMcgill - did you download the weights via Git LFS? (can you check the size of the model weights file)? If you the pretrained weights is only a few kb, it could be that you did not download the weights correctly