【问题标题】:Why am I getting an error when a module attempts to import torch?当模块尝试导入 torch 时,为什么会出现错误?
【发布时间】:2022-12-07 18:57:13
【问题描述】:

我正在运行这个 github 上列出的代码:

https://github.com/feitgemel/Python-Code-Cool-Stuff/blob/master/GFPGAN/GFPGAN-Install-instructions.txt#L19

当我运行推理时,我收到以下错误:

File "c:\Users\user\Desktop\DPI_Increaser\GFPGAN\inference_gfpgan.py", line 6, in <module>
    import torch
File "C:\Users\user\anaconda3\lib\site-packages\torch\__init__.py", line 128, in <module>
    raise err
OSError: [WinError 127] The specified procedure could not be found. Error loading "C:\Users\user\anaconda3\lib\site-packages\torch\lib\c10_cuda.dll" or one of its dependencies.

我试图通过从头开始安装 pytorch 来解决这个问题,但这似乎不起作用。有什么建议吗?

【问题讨论】:

    标签: pytorch conda


    【解决方案1】:

    此错误消息表示系统找不到所需的库或其依赖项之一。如果未安装该库或其依赖项未正确安装,则可能会发生这种情况。

    在这种情况下,它指的是 CuDA 库,用于在 GPU 上运行神经网络。在链接的说明文件的顶部,它指出 # Requirements : Nvidia GPU card &amp; and Cuda tool kit install。因此,错误很可能是由以下两种情况之一引起的:

    1. 您没有 Nvidia GPU,这意味着您无法以当前形式运行代码,您必须想出一种方法让代码可以在非 GPU 机器上运行。
    2. 您有一个 Nvidia GPU 但没有安装 Cuda 工具包。在这种情况下,找出您的 GPU 需要哪个 Cuda 工具包。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-02-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-12-06
      • 2012-08-27
      相关资源
      最近更新 更多