You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

PyTorch分割模型报错及GPU启用配置求助

问题解决方案

1. 解决RuntimeError: applying transform <monai.transforms.spatial.dictionary.Orientationd object...>错误

该错误由缺失nibabel依赖库导致,直接安装即可:

  • 使用pip安装:
    pip install nibabel
    
  • 若使用conda环境:
    conda install -c conda-forge nibabel
    

2. 配置GPU版PyTorch环境(替换CPU版1.13.1)

步骤1:卸载当前CPU版PyTorch

执行命令:

pip uninstall torch torchvision torchaudio -y

如果是conda环境:

conda remove torch torchvision torchaudio -y

步骤2:安装GPU版PyTorch 1.13.1

根据GPU适配的CUDA版本选择安装命令:

  • 推荐使用conda安装(自动适配CUDA toolkit,无需单独安装系统级CUDA):
    conda install pytorch==1.13.1 torchvision==0.14.1 torchaudio==0.13.1 pytorch-cuda=11.7 -c pytorch -c nvidia
    
  • 若使用pip安装:
    pip install torch==1.13.1+cu117 torchvision==0.14.1+cu117 torchaudio==0.13.1
    
    注:pip安装需确保GPU驱动版本满足对应CUDA要求(如CUDA 11.7需要驱动版本≥450.80.02)

步骤3:验证GPU环境是否生效

运行以下代码:

import torch
print(torch.cuda.is_available())
print(torch.cuda.device_count())
print(torch.version.cuda)

若输出True、设备数≥1及对应CUDA版本号,说明配置成功。


内容的提问来源于stack exchange,提问作者boubekeur anis

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.01 09:50:35