1.最近用kaggle复现别人的程序,在train时报错:
opt/conda/lib/python3.10/site-packages/torch/optim/lr_scheduler.py:139: UserWarning: Detected call of `lr_scheduler.step()` before `optimizer.step()`. In PyTorch 1.1.0 and later, you should call them in the opposite order: `optimizer.step()` before `lr_scheduler.step()`. Failure to do this will result in PyTorch skipping the first value of the learning rate schedule. See more details at torch.optim — PyTorch 2.1 documentation warnings.warn("Detected call of `lr_scheduler.step()` before `optimizer.step()`. "
显示大致意思是torch/optim/lr_scheduler.py文件中 应将optimizer.step()在lr_scheduler.step()前调用,这是应为torch版本不对应,搜了半天,大都说最简单的方法是重新安装torch和CUDA。
可在kaggle 安装时又遇到了麻烦!!!
!conda create -n pytorch1 python=3.7 !conda activate pytorch1 !conda install pytorch=1.1 torchvision=0.3 cudatoolkit=9.0 -c pytorch !pip install matplotlib scikit-image opencv-python yacs joblib natsort h5py tqdm
然后它一直在saving evenment 打转,换成镜像源也很慢 怎么搞得,那位大佬教教我这个菜鸡!!