CLIP icon indicating copy to clipboard operation
CLIP copied to clipboard

how to load checkpoint trained using openclip codebase

Open lezhang7 opened this issue 2 years ago • 1 comments
trafficstars

Hi, I have a model trained with open clip codebase, and I wonder if I can directly load that checkpoint into the clip model by model, preprocess = clip.load("checkpoints.pt", device=device, jit=False)

lezhang7 avatar Apr 16 '23 13:04 lezhang7

I haven't tried, but it appears that you would need to do the inverse of what's done in:

https://github.com/mlfoundations/open_clip/blob/74a72f3a4829656a9cfd8bae02253e2d28ab05d1/src/open_clip/model.py#L341-L391

In order to get a state_dict object compatible with this repo.

jongwook avatar May 05 '23 09:05 jongwook