开发者社区 > 大数据与机器学习 > 人工智能平台PAI > 正文

启动SD模型时,torch和torchvision版本好像不兼容。可是查资料后是对应的

Python 3.10.10 | packaged by conda-forge | (main, Mar 24 2023, 20:00:38) [MSC v.1934 64 bit (AMD64)]
Commit hash:
Installing requirements for Web UI
Installing requirement for sd-webui-controlnet

Launching Web UI with arguments:
D:\Anaconda3\envs\xd\lib\site-packages\torchvision\transforms\functional_tensor.py:5: UserWarning: The torchvision.transforms.functional_tensor module is deprecated in 0.15 and will be removed in 0.17. Please don't rely on it. You probably just need to use APIs in torchvision.transforms.functional or in torchvision.transforms.v2.functional.
warnings.warn(
Traceback (most recent call last):
File "d:\cvcompte\painting-gallery\stable-diffusion2-webui-master\launch.py", line 361, in
start()
File "d:\cvcompte\painting-gallery\stable-diffusion2-webui-master\launch.py", line 352, in start
import webui
File "d:\cvcompte\painting-gallery\stable-diffusion2-webui-master\webui.py", line 15, in
from modules import import_hook, errors, extra_networks, ui_extra_networks_checkpoints
File "d:\cvcompte\painting-gallery\stable-diffusion2-webui-master\modules\ui_extra_networks_checkpoints.py", line 6, in from modules import shared, ui_extra_networks, sd_models
File "D:\cvcompte\painting-gallery\stable-diffusion2-webui-master\modules\sd_models.py", line 17, in
from modules.sd_hijack_inpainting import do_inpainting_hijack
File "D:\cvcompte\painting-gallery\stable-diffusion2-webui-master\modules\sd_hijack_inpainting.py", line 7, in
import ldm.models.diffusion.ddpm
File "D:\cvcompte\painting-gallery\stable-diffusion2-webui-master\repositories\stable-diffusion-stability-ai\ldm\models\diffusion\ddpm.py", line 12, in
import pytorch_lightning as pl
File "D:\Anaconda3\envs\xd\lib\site-packages\pytorch_lightning__init.py", line 34, in
from pytorch_lightning.callbacks import Callback # noqa: E402
File "D:\Anaconda3\envs\xd\lib\site-packages\pytorch_lightning\callbacks\
init.py", line 25, in
from pytorch_lightning.callbacks.progress import ProgressBarBase, RichProgressBar, TQDMProgressBar
File "D:\Anaconda3\envs\xd\lib\site-packages\pytorch_lightning\callbacks\progress\
init__.py", line 22, in
from pytorch_lightning.callbacks.progress.rich_progress import RichProgressBar # noqa: F401
File "D:\Anaconda3\envs\xd\lib\site-packages\pytorch_lightning\callbacks\progress\rich_progress.py", line 20, in
from torchmetrics.utilities.imports import _compare_version
ImportError: cannot import name '_compare_version' from 'torchmetrics.utilities.imports' (D:\Anaconda3\envs\xd\lib\site-packages\torchmetrics\utilities\imports.py)

展开
收起
游客fpsalvs5h3p6i 2024-03-18 17:19:18 346 0
1 条回答
写回答
取消 提交回答
  • 十分耕耘,一定会有一分收获!

    楼主你好,看了你的报错信息可以看出torch和torchvision的版本兼容性问题导致了错误的发生,是由于模块pytorch_lightning中的torchmetrics库无法导入torchmetrics.utilities.imports模块下的_compare_version函数。

    你可以直接尝试更新torch和torchvision的版本,你可以使用pip或conda命令来更新这两个库,比如:
    conda update torch torchvision

    2024-03-18 18:17:36
    赞同 1 展开评论 打赏

人工智能平台 PAI(Platform for AI,原机器学习平台PAI)是面向开发者和企业的机器学习/深度学习工程平台,提供包含数据标注、模型构建、模型训练、模型部署、推理优化在内的AI开发全链路服务,内置140+种优化算法,具备丰富的行业场景插件,为用户提供低门槛、高性能的云原生AI工程化能力。

热门讨论

热门文章

相关电子书

更多
阿里云MaxCompute百问百答 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载