[GH-ISSUE #350] how to load checkpoint trained using openclip codebase #303

Open
opened 2026-10-31 21:13:37 +00:00 by bsakaguchi · 1 comment
Owner

Originally created by @lezhang7 on GitHub (Apr 16, 2023).
Original GitHub issue: https://github.com/openai/CLIP/issues/350

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)

Originally created by @lezhang7 on GitHub (Apr 16, 2023). Original GitHub issue: https://github.com/openai/CLIP/issues/350 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)`
Author
Owner

@jongwook commented on GitHub (May 5, 2023):

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

github.com/mlfoundations/open_clip@74a72f3a48/src/open_clip/model.py (L341-L391)

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

<!-- gh-comment-id:1535998094 --> @jongwook commented on GitHub (May 5, 2023): 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.
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
openai/CLIP#303
No description provided.