partially_observed:

my_list = [‘classifier.3.weight’, ‘classifier.3.bias’] params = list(filter(lambda kv: kv[0] in my_list, vgg16.named_parameters()))


Hi,
You are passing also the name that way as params contains tuples of (name,parameters)
could you please use
from torchvision.models import vgg16
from torch.optim import SGD
model = vgg16()
my_list = ['classifier.3.weight', 'classifier.3.bias']
params = list(map(lambda x: x[1],list(filter(lambda kv: kv[0] in my_list, model.named_parameters()))))
base_params = list(map(lambda x: x[1],list(filter(lambda kv: kv[0] not in my_list, model.named_parameters()))))
optimizer = SGD([{'params': base_params}, {'params': params, 'lr': '1e-4'}], lr=3e-6, momentum=0.9)

This is ok, I promise