My pretrained layer’s name was ‘Conv_pretrain’ so I just change the name in the code so that the first condition never got excuted.
for name, p in res.named_parameters():
    if name.split('.')[0]=='Conv_pretrainn':
      
        p.requires_grad=False
        not_trainables.append(p)
  
    else:
        if name.split('.')[0]=='conv_sp_map' or name.split('.')[0]=='spmap_up':
            spmap.append(p)
        else:
            trainables.append(p)
    
optim1 = optim.SGD([{"params":trainables,"lr":learning_rate},
                    {"params":spmap,"lr":0.001}],
                    ],
                    momentum=0.9,weight_decay=0.0001)
lambda1 = lambda epoch: 1.0 if epoch < 10 else (0.1 if epoch < 31 else 0.01)  
lambda2 = lambda epoch: 1
scheduler=optim.lr_scheduler.LambdaLR(optim1,[lambda1,lambda2])