ImportError Traceback (most recent call last)
in ()
----> 1 model = Node2Vec(pygraph.edge_index, embedding_dim=128, walk_length=20,context_size=10, walks_per_node=10, num_negative_samples=1, p=1, q=1, sparse=True).to(device)
/usr/local/lib/python3.7/dist-packages/torch_geometric/nn/models/node2vec.py in __init__(self, edge_index, embedding_dim, walk_length, context_size, walks_per_node, p, q, num_negative_samples, num_nodes, sparse)
53
54 if random_walk is None:
---> 55 raise ImportError('`Node2Vec` requires `torch-cluster`.')
56
57 N = maybe_num_nodes(edge_index, num_nodes)
ImportError: `Node2Vec` requires `torch-cluster`.
---------------------------------------------------------------------------
NOTE: If your import is failing due to a missing package, you can
manually install dependencies using either !pip or !apt.
To view examples of installing some common dependencies, click the
"Open Examples" button below.
---------------------------------------------------------------------------
Я просмотрел географическую документацию PyTorch, указанную здесь.
Ошибка возникает в следующих строках кода:
Я пытаюсь использовать Node2Vec из PyG и сталкиваюсь со следующей ошибкой: [code]ImportError Traceback (most recent call last) in () ----> 1 model = Node2Vec(pygraph.edge_index, embedding_dim=128, walk_length=20,context_size=10, walks_per_node=10, num_negative_samples=1, p=1, q=1, sparse=True).to(device)
/usr/local/lib/python3.7/dist-packages/torch_geometric/nn/models/node2vec.py in __init__(self, edge_index, embedding_dim, walk_length, context_size, walks_per_node, p, q, num_negative_samples, num_nodes, sparse) 53 54 if random_walk is None: ---> 55 raise ImportError('`Node2Vec` requires `torch-cluster`.') 56 57 N = maybe_num_nodes(edge_index, num_nodes)
ImportError: `Node2Vec` requires `torch-cluster`.
--------------------------------------------------------------------------- NOTE: If your import is failing due to a missing package, you can manually install dependencies using either !pip or !apt.
To view examples of installing some common dependencies, click the "Open Examples" button below. --------------------------------------------------------------------------- [/code] Я просмотрел географическую документацию PyTorch, указанную здесь. Ошибка возникает в следующих строках кода: [code]if random_walk is None: raise ImportError('`Node2Vec` requires `torch-cluster`.') [/code] Чтобы бороться с этим, я импортировал random_walk аналогично тому, как это сделано в документации Вот мой код: [code]import os import torch os.environ['TORCH'] = torch.__version__ print(torch.__version__)