[GH-ISSUE #403] How to only fine-tune the image encoder? #345

Closed
opened 2026-10-31 21:14:08 +00:00 by bsakaguchi · 3 comments
Owner

Originally created by @GA-17a on GitHub (Nov 17, 2023).
Original GitHub issue: https://github.com/openai/CLIP/issues/403

When I want to feed only the parameters of the image encoder (self.model.encode_image.parameters()) into the optimizer, it shows that "AttributeError: 'function' object has no attribute 'parameters'". It's ok for "self.model.parameters()".

Anyone knows how to solve this problem?

Originally created by @GA-17a on GitHub (Nov 17, 2023). Original GitHub issue: https://github.com/openai/CLIP/issues/403 When I want to feed only the parameters of the image encoder (self.model.encode_image.parameters()) into the optimizer, it shows that "AttributeError: 'function' object has no attribute 'parameters'". It's ok for "self.model.parameters()". Anyone knows how to solve this problem?
Author
Owner

@Danny-1-8 commented on GitHub (Nov 27, 2023):

man,cause that's a function not A module,try with the "self.model.visual"

<!-- gh-comment-id:1827606075 --> @Danny-1-8 commented on GitHub (Nov 27, 2023): man,cause that's a function not A module,try with the "self.model.visual"
Author
Owner

@GA-17a commented on GitHub (Nov 27, 2023):

man,cause that's a function not A module,try with the "self.model.visual"
It has been solved in the same way, thank you.

<!-- gh-comment-id:1827629682 --> @GA-17a commented on GitHub (Nov 27, 2023): > man,cause that's a function not A module,try with the "self.model.visual" It has been solved in the same way, thank you.
Author
Owner

@Dinosaurcubs commented on GitHub (Dec 25, 2023):

When I want to feed only the parameters of the image encoder (self.model.encode_image.parameters()) into the optimizer, it shows that "AttributeError: 'function' object has no attribute 'parameters'". It's ok for "self.model.parameters()".

Anyone knows how to solve this problem?

I met the same question,bro. Could u please help me about the solution you took

<!-- gh-comment-id:1868768188 --> @Dinosaurcubs commented on GitHub (Dec 25, 2023): > When I want to feed only the parameters of the image encoder (self.model.encode_image.parameters()) into the optimizer, it shows that "AttributeError: 'function' object has no attribute 'parameters'". It's ok for "self.model.parameters()". > > Anyone knows how to solve this problem? I met the same question,bro. Could u please help me about the solution you took
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#345
No description provided.