Skip to content

A Question about Parameter Freezing #4

@cyoungx

Description

@cyoungx

Hello, your work is valuable and I am very inspired by it.

However, I have a question I need to ask. After reading through the paper and the code, I have found an area that confuses me.
In /PROOF/utils/inc_net.py, the last few lines,

    def freeze_projection_weight_new(self):
        if len(self.projs_img)>1:
            for i in range(len(self.projs_img)):
                for param in self.projs_img[i].parameters():
                    param.requires_grad = False
                for param in self.projs_text[i].parameters():
                    param.requires_grad = True
            for param in self.projs_img[-1].parameters():
                param.requires_grad = True
        for param in self.sel_attn.parameters():
            param.requires_grad = True

The logic I see in the code is that when self.projs_img is greater than 1, first all the image projection layers are frozen, while the text projection layer is kept trainable, and finally the corresponding image projection layer of the current incremental stage is kept trained. And I read the paper, according to the explanation of the paper, in the incremental stage, i.e. the number of self.projs_img is greater than 1, need to freeze the parameters of the image and text projection layer of the previous stage, to keep the image and text projection layer of the current and incremental stage in the trainable stage. I modified it to the following code.

    def freeze_projection_weight_new(self):
        if len(self.projs_img)>1:
            for i in range(len(self.projs_img)):
                for param in self.projs_img[i].parameters():
                    param.requires_grad = False
                for param in self.projs_text[i].parameters():
                    param.requires_grad = False
            for param in self.projs_img[-1].parameters():
                param.requires_grad = True
            for param in self.projs_text[-1].parameters():
                param.requires_grad = True
        for param in self.sel_attn.parameters():
            param.requires_grad = True

Am I understanding this correctly?Looking forward to your reply.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions