RuntimeError cannot import name 'compare_version' from torchmetrics.utilities.imports

615 词

RuntimeError cannot import name ‘compare_version’ from torchmetrics.utilities.imports

1、RuntimeError: cannot import name ‘_compare_version’ from ‘torchmetrics.utilities.imports’

需要降级一下torchmetrics包,运行

  1. conda install torchmetrics==0.11.4

2、orch is not able to use GPU; add --skip-torch-cuda-test to COMMANDLINE_ARGS variable to disable this check

说明torch的版本与cuda版本冲突,此时pytorch并不能使用GPU。

执行下面指令

  1. python

  2. import torch

  3. torch.cuda.is_available()

会输出False

这时候可以试着从pytorch官网复制对应版本指令重新安装一遍torch,

如果还不行的话就再建虚拟环境重新跑一遍脚本

3 执行bash start.sh的时候卡在 installing clip

先执行

  1. pip install clip

再执行一遍bash start.sh

4 执行bash start.sh的时候卡在 installing open_clip

先执行

  1. pip install open_clip_torch

再执行一遍bash start.sh