mirror of
https://github.com/openai/CLIP.git
synced 2026-11-05 01:37:26 +00:00
[GH-ISSUE #250] [Question] Compatibility with Huggingface CLIPModel #219
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
openai/CLIP#219
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @saga1214 on GitHub (Jun 6, 2022).
Original GitHub issue: https://github.com/openai/CLIP/issues/250
Hi,
I am trying to use a training script from another repo, where it uses Huggingface models.
There exists a model card at Huggingface about CLIP, and it seems that the pretrained weight at HF CLIP and this original repo are almost same; the resulting features of input data have a very small difference while the total number of parameters are equal.
However, there is a discripancy between the model name via model.named_parameters(). The modules from this repo contains 302 modules while the ones from HF contains 398.
So, my question is: Is it able to load the saved models from HF to this repo or vice versa? If available, I would like to train the HF CLIP models and load to the model of this repo.
Thanks.
@wren93 commented on GitHub (Nov 4, 2022):
Some of the weight implementations are different. E.g. for the vision transformer part, in the HF model each transformer layer has the query, key and value weights. In this repo these three weight matrices are concatenated as a single matrix called "attn.in_proj_weight". It's possible to load weights from the HF model but requires some modification to the state dict.
@junwang-wish commented on GitHub (Apr 1, 2023):
The resulting image features seem to be completely different between Huggingface and OpenAI CLIP, is it expected? cross-posted to https://github.com/huggingface/transformers/issues/22505