xmed-lab / CLIP_Surgery

CLIP Surgery for Better Explainability with Enhancement in Open-Vocabulary Tasks
356 stars 24 forks source link

custom pretrained weights #31

Closed Tinaliu123 closed 2 months ago

Tinaliu123 commented 6 months ago

Can I load my custom pretrained weights by providing the path to the weights when I load the mode?

zer0int commented 6 months ago

I just so happened to implement that yesterday in my fork, for the same reasons (using my fine-tune with it). You can replace (temporarily rename) the original pre-trained CLIP model in .cache/clip and put your fine-tune of the same model in place of it (though you could also modify the code to use torch.load and just load the pickle / .pt from somewhere else instead):

https://github.com/zer0int/CLIP_Surgery