Stop weight update use .requires_grad = False
.requires_grad = False
for name, param in model.named_parameters(): if name.startswith("2"): param.requires_grad = False else: param.requires_grad = True #make it explicit # 0.weight # 0.bias # 2.weight # 2.bias
Last updated 3 years ago