我正在尝试从此网页运行 PyTorch 几何教程;具体来说,关于图分类的教程#3。在运行任何单元之前,我通过选择 Runtime --> change runtime type --> GPU 连接到 GPU,命令!nvidia-smi
返回以下信息:
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 470.74 Driver Version: 460.32.03 CUDA Version: 11.2 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|===============================+======================+======================|
| 0 Tesla K80 Off | 00000000:00:04.0 Off | 0 |
| N/A 44C P8 31W / 149W | 3MiB / 11441MiB | 0% Default |
| | | N/A |
+-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=============================================================================|
| No running processes found |
+-----------------------------------------------------------------------------+
但是,当我从第二个代码块执行以下行时:
import torch
from torch_geometric.datasets import TUDataset
我看到此错误消息:
OSError: libcudart.so.10.2: cannot open shared object file: No such file or directory
我使用的是 Chrome OS 版本 93.0.4577.95(官方版本)(64 位)。有趣的是,我之前在 GPU 上运行过这个教程没有问题;当我今天返回重新运行笔记本时,我才开始看到这个错误。我已尝试将运行时恢复出厂设置,但没有效果。
我可以看到许多其他有类似错误的帮助文章,但最相关的一篇似乎是这篇文章,其中解决方案是连接到 GPU 运行时。我在 colab 教程中找不到其他示例。我的印象是,像这样的 colab 教程通常应该开箱即用,我不确定我需要安装或导入什么来修复它。感谢您的任何建议,谢谢。
完整的堆栈跟踪:
---------------------------------------------------------------------------
OSError Traceback (most recent call last)
<ipython-input-3-00fc1f8d4ac6> in <module>()
1 import torch
----> 2 from torch_geometric.datasets import TUDataset
3
4 dataset = TUDataset(root='data/TUDataset', name='MUTAG')
5
6 frames
/usr/local/lib/python3.7/dist-packages/torch_geometric/__init__.py in <module>()
5 from .debug import is_debug_enabled, debug, set_debug
6
----> 7 import torch_geometric.data
8 import torch_geometric.loader
9 import torch_geometric.transforms
/usr/local/lib/python3.7/dist-packages/torch_geometric/data/__init__.py in <module>()
----> 1 from .data import Data
2 from .hetero_data import HeteroData
3 from .temporal import TemporalData
4 from .batch import Batch
5 from .dataset import Dataset
/usr/local/lib/python3.7/dist-packages/torch_geometric/data/data.py in <module>()
1 from typing import (Optional, Dict, Any, Union, List, Iterable, Tuple,
2 NamedTuple, Callable)
----> 3 from torch_geometric.typing import OptTensor, NodeType, EdgeType
4 from torch_geometric.deprecation import deprecated
5
/usr/local/lib/python3.7/dist-packages/torch_geometric/typing.py in <module>()
2
3 from torch import Tensor
----> 4 from torch_sparse import SparseTensor
5
6 # Types for accessing data ####################################################
/usr/local/lib/python3.7/dist-packages/torch_sparse/__init__.py in <module>()
14 ]:
15 torch.ops.load_library(importlib.machinery.PathFinder().find_spec(
---> 16 f'{library}_{suffix}', [osp.dirname(__file__)]).origin)
17
18 if torch.cuda.is_available(): # pragma: no cover
/usr/local/lib/python3.7/dist-packages/torch/_ops.py in load_library(self, path)
102 # static (global) initialization code in order to register custom
103 # operators with the JIT.
--> 104 ctypes.CDLL(path)
105 self.loaded_libraries.add(path)
106
/usr/lib/python3.7/ctypes/__init__.py in __init__(self, name, mode, handle, use_errno, use_last_error)
362
363 if handle is None:
--> 364 self._handle = _dlopen(self._name, mode)
365 else:
366 self._handle = handle
OSError: libcudart.so.10.2: cannot open shared object file: No such file or directory