CLIP icon indicating copy to clipboard operation
CLIP copied to clipboard

out proj weight typo fix

Open louiswang524 opened this issue 1 year ago • 3 comments

Here is a typo for initialize_parameter() function. The output_proj.weight should be output_proj_weight https://github.com/openai/CLIP/blob/dcba3cb2e2827b402d2701e7e1c7d9fed8a20ef1/clip/model.py#L321

louiswang524 avatar Nov 05 '24 06:11 louiswang524

What makes you think so?

99991 avatar Jan 23 '25 13:01 99991

What makes you think so?

@99991 before it is a parameter defined here https://github.com/openai/CLIP/blob/dcba3cb2e2827b402d2701e7e1c7d9fed8a20ef1/clip/model.py#L85

louiswang524 avatar Jan 28 '25 23:01 louiswang524

The line from your first message initializes the member block.attn.out_proj.weight of self.transformer.resblocks

  • https://github.com/openai/CLIP/blob/dcba3cb2e2827b402d2701e7e1c7d9fed8a20ef1/clip/model.py#L321
  • https://github.com/openai/CLIP/blob/dcba3cb2e2827b402d2701e7e1c7d9fed8a20ef1/clip/model.py#L319
  • https://github.com/openai/CLIP/blob/dcba3cb2e2827b402d2701e7e1c7d9fed8a20ef1/clip/model.py#L282
  • https://github.com/openai/CLIP/blob/dcba3cb2e2827b402d2701e7e1c7d9fed8a20ef1/clip/model.py#L200
  • https://github.com/openai/CLIP/blob/dcba3cb2e2827b402d2701e7e1c7d9fed8a20ef1/clip/model.py#L175
  • https://github.com/pytorch/pytorch/blob/3f77002b968c093b2b668fed24d85f6a365d6b3c/torch/nn/modules/activation.py#L1102

But in your last message, you highlight self.c_proj.weight, which is not a member of self.transformer.resblocks. Instead, it is a member of AttentionPool2d, which is only used in ModifiedResNet, i.e. self.visual of CLIP.

  • https://github.com/openai/CLIP/blob/dcba3cb2e2827b402d2701e7e1c7d9fed8a20ef1/clip/model.py#L85
  • https://github.com/openai/CLIP/blob/dcba3cb2e2827b402d2701e7e1c7d9fed8a20ef1/clip/model.py#L58C7-L58C22
  • https://github.com/openai/CLIP/blob/dcba3cb2e2827b402d2701e7e1c7d9fed8a20ef1/clip/model.py#L127
  • https://github.com/openai/CLIP/blob/dcba3cb2e2827b402d2701e7e1c7d9fed8a20ef1/clip/model.py#L264

99991 avatar Jan 29 '25 05:01 99991