Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to fix feature encoder weights during SS process #52

Open
mengruwg opened this issue May 12, 2021 · 2 comments
Open

how to fix feature encoder weights during SS process #52

mengruwg opened this issue May 12, 2021 · 2 comments

Comments

@mengruwg
Copy link

during pythorch version
new_weight = self.weight.mul(new_mtl_weight)(line 95 in conv2d_mtl.py)
self.weight = Parameter(torch.Tensor(out_channels, in_channels // groups, *kernel_size))(line 42 in conv2d_mtl.py)
How to load pretrained and fix feature encoder weights during SS process?

@mengruwg mengruwg reopened this May 12, 2021
@yaoyao-liu
Copy link
Owner

How to freeze the convolution weights?

If you set mtl=True in the following line:

def __init__(self, layers=[4, 4, 4], mtl=True):

It means that you're using _ConvNdMtl function, so

self.weight.requires_grad=False

i.e., the convolution weights are frozen.

How to load the pre-trained model?

You may directly load normal checkpoints to MTL models like this:

pretrained_dict = torch.load(self.args.init_weights)['params']

If you have any further questions, feel free to ask.

@yaoyao-liu yaoyao-liu reopened this May 12, 2021
@mengruwg
Copy link
Author

mengruwg commented May 12, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants