29/5000
Thank you for answering my question so patiently. My code should not have this problem。
If I use following code,the error will not appear( it will appear when using the annotating code):
for epoch in epochs:
     for batch in train_loader:
          #scheduler.step()
     scheduler.step()

Here is my complete training code(When you put scheduler. Step () into each batch iteration,error will apear)：
for epoch in range(epochs):
        model.train()
        epoch_loss=0
        epoch_mask_loss=0
        epoch_label_loss=0
        for image,mask,label in train_dl:
            optimizer.zero_grad()
            r=np.random.rand(1)

            #cutmix transform
            if r>threshold:
                lam=np.random.beta(50,50)
                image,mask,cutmix_label=make_cutmix(image,mask,lam)
                image=image.to(device).float()
                mask_prediction,label_prediction=model(image)
                label_prediction=label_prediction.to('cpu')
                label_loss=lam*label_criterion(label_prediction,label)+(1-lam)*label_criterion(label_prediction,cutmix_label)
            else:
                image = image.to(device).float()
                mask_prediction,label_prediction=model(image)
                label_prediction=label_prediction.to('cpu')
                label_loss=label_criterion(label_prediction,label)

            mask_prediction=torch.sigmoid(mask_prediction)
            mask_prediction = mask_prediction.to('cpu')
            mask_loss=mask_criterion(mask_prediction,mask)
            epoch_mask_loss+=mask_loss
            epoch_label_loss+=label_loss
            loss=label_loss+mask_loss
            epoch_loss+=loss
            loss.backward()
            optimizer.step()



        epoch_loss = epoch_loss / total_steps
        epoch_label_loss=epoch_label_loss/total_steps
        epoch_mask_loss=epoch_mask_loss/total_steps
        print('epoch:{},epoch_loss:{},epoch_label_loss:{},epoch_mask_loss:{}'.format(epoch,epoch_loss,epoch_label_loss,epoch_mask_loss))
        model.eval()
        metric,metric2,valid_loss=evalue(model,valid_dl)
        if metric2>best_score:
            state={'state':model.state_dict(),'best_score':metric2}
            torch.save(state,checkpoint_path)
            best_score=metric2

        logging.warning('epoch_loss:{},metric1:{},metric2:{}'.format(epoch_loss,metric,metric2))
        scheduler.step()