AttributeError: module 'torch.optim.lr_scheduler' has no attribute 'LinearLR'

AttributeError: module 'torch.optim.lr_scheduler' has no attribute 'LinearLR'

我正在尝试使用 Pytorch 训练我自己的对象检测模型。但我总是收到这个错误。我尝试更改 torch 版本,但这没有帮助。
我的软件包:torchvision-0.11.1 和 torch-1.10.0

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-10-9e52b782b448> in <module>()
      4 for epoch in range(num_epochs):
      5     # training for one epoch
----> 6     train_one_epoch(model, optimizer, data_loader, device, epoch, print_freq=10)
      7     # update the learning rate
      8     lr_scheduler.step()

/content/engine.py in train_one_epoch(model, optimizer, data_loader, device, epoch, print_freq)
     21         warmup_iters = min(1000, len(data_loader) - 1)
     22 
---> 23         lr_scheduler = torch.optim.lr_scheduler.LinearLR(
     24             optimizer, start_factor=warmup_factor, total_iters=warmup_iters
     25         )

AttributeError: module 'torch.optim.lr_scheduler' has no attribute 'LinearLR'

LinearLR 调度程序是最近才引入的 (v1.10.0)。请确保您的 pytorch 版本是最新的,然后重试。