ct = 0
for name, child in model.named_children():
ct += 1
if ct > 2:
for p in child.parameters():
p.requires_grad = False
#model weight key
print(model.state_dict().keys()
#전체 파라미터 false
for p in model.parameters():
p.requires_grad = False
#특정 파라미터 ture
for name, p in model.named_parameters():
if name in ['linear.1.weight', 'linear.2.weight']:
p.reguires.grad = Ture