在运行代码的当前环境下,找到cuda_to_hip_mappings.py 这个文件,具体来说是 anaconda3/envs/xxx/lib/python3.10/site-packages/torch/utils/hipify/cuda_to_hip_mappings.py
修改第37行,添加一个NotADirectoryError,最终变为
try:
rocm_path = subprocess.check_output(["hipconfig", "--rocmpath"]).decode("utf-8")
except subprocess.CalledProcessError:
print(f"Warning: hipconfig --rocmpath failed, assuming {rocm_path}")
# 修改这一行, 添加 NotADirectoryError
except (FileNotFoundError, PermissionError, NotADirectoryError ):
# Do not print warning. This is okay. This file can also be imported for non-ROCm builds.
pass
原文链接:https://blog.csdn.net/ROokie_online/article/details/133874696