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

size mismatch for linear.weight when running "adaptive_FitNet_teacher-level.ipynb" #2

Open
Masterchef2000 opened this issue May 5, 2023 · 1 comment

Comments

@Masterchef2000
Copy link

Hey, I try to run the code of "adaptive_FitNet_teacher-level.ipynb", however, an error occurs

RuntimeError: Error(s) in loading state_dict for ResNet:
	size mismatch for linear.weight: copying a param with shape torch.Size([3, 64]) from checkpoint, the shape in current model is torch.Size([10, 64]).
	size mismatch for linear.bias: copying a param with shape torch.Size([3]) from checkpoint, the shape in current model is torch.Size([10]).

It seems that the checkpoint is not correctly satisfy the code, could you please tell me how to solve it?

@ShristiDasBiswas
Copy link

def train_adapter(n_epochs=70, model=st_model): print('Training adapter:') start_time = time.time() model.train() adapter.eval() for ep in range(n_epochs): lr_scheduler2.step() lr_scheduler3.step() for i, (input, target) in enumerate(train_loader):

why is adaptor set to eval mode for adaptor training?

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