[GH-ISSUE #163] "None" gradients when using fine-tuned CLIP #142

Open
opened 2026-10-31 21:11:39 +00:00 by bsakaguchi · 0 comments
Owner

Originally created by @sarahESL on GitHub (Oct 27, 2021).
Original GitHub issue: https://github.com/openai/CLIP/issues/163

Using the following snippet gives "none" values for some CLIP parameters such as positional_embedding,

for name, p in self.model.named_parameters():
    print(p.grad)

where

    myclip, _ = clip.load(args.clip_vision_encoder, jit=False)
    checkpoint = torch.load(args.clip_path)
    myclip.load_state_dict(checkpoint['state_dict'])
    self.model = myclip.float()

Is this behavior expected?

Originally created by @sarahESL on GitHub (Oct 27, 2021). Original GitHub issue: https://github.com/openai/CLIP/issues/163 Using the following snippet gives "none" values for some CLIP parameters such as `positional_embedding`, ``` for name, p in self.model.named_parameters(): print(p.grad) ``` where ``` myclip, _ = clip.load(args.clip_vision_encoder, jit=False) checkpoint = torch.load(args.clip_path) myclip.load_state_dict(checkpoint['state_dict']) self.model = myclip.float() ``` Is this behavior expected?
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#142
No description provided.