Skip to content

Commit 8f34665

Browse files
committed
adjusted dependencies for Windows 10
1 parent 31f6811 commit 8f34665

File tree

5 files changed

+11
-7
lines changed

5 files changed

+11
-7
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
config
12
# IDE
23
.idea
34
run_*.sh

configure

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ read -p '[1] for CUDA 9.2, [2] for CUDA 10.1, [3] for CUDA 10.2, [4] for CUDA 11
44
echo $CUDA_version > config
55

66
echo 'Configuration completed.'
7-
echo 'Run `pip install .` or `python setup.py install` to install graph4nlp in your environment.'
7+
echo 'Run `python setup.py install` to install graph4nlp in your environment.'

configure.bat

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ echo Please specify your CUDA version
33
set /p cuda_version="[1] for CUDA 9.2, [2] for CUDA 10.1, [3] for CUDA 10.2, [4] for CUDA 11.0, [5] for CUDA 11.1, [6] for CPU: "
44
echo %cuda_version% > config
55
echo Configuration completed.
6-
echo Run `pip install .` to install graph4nlp in your environment.
6+
echo Run `python setup.py install` to install graph4nlp in your environment.

graph4nlp/pytorch/data/data.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -570,14 +570,14 @@ def to_dgl(self) -> dgl.DGLGraph:
570570
g: dgl.DGLGraph
571571
The converted dgl.DGLGraph
572572
"""
573-
dgl_g = dgl.DGLGraph().to(self.device)
573+
u, v = self._edge_indices.src, self._edge_indices.tgt
574+
num_nodes = self.get_node_num()
575+
dgl_g = dgl.graph(u, v, num_nodes=num_nodes).to(self.device)
574576
# Add nodes and their features
575-
dgl_g.add_nodes(num=self.get_node_num())
576577
for key, value in self._node_features.items():
577578
if value is not None:
578579
dgl_g.ndata[key] = value
579580
# Add edges and their features
580-
dgl_g.add_edges(u=self._edge_indices.src, v=self._edge_indices.tgt)
581581
for key, value in self._edge_features.items():
582582
if value is not None:
583583
dgl_g.edata[key] = value

setup.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,10 @@ def finalize_options(self):
3737
cuda_version = cuda_versions[version]
3838

3939
if cuda_version == '11.1':
40-
os.system("pip3 install torch==1.8.1+cu111 -f https://download.pytorch.org/whl/torch_stable.html")
40+
os.system("pip install torch==1.8.1+cu111 -f https://download.pytorch.org/whl/torch_stable.html")
41+
42+
if platform.system() == 'Windows':
43+
os.system('pip install torch==1.8.1+cu102 -f https://download.pytorch.org/whl/torch_stable.html')
4144

4245
if cuda_version == 'none':
4346
cuda_version = ''
@@ -48,7 +51,7 @@ def finalize_options(self):
4851

4952
install_requirement = ['pythonds', 'nltk >= 3.5', 'stanfordcorenlp', 'scipy >= 1.5.2',
5053
'scikit-learn >= 0.23.2', 'networkx >= 2.5', 'dgl{} >= 0.4'.format(cuda_version),
51-
'ogb', 'tqdm >= 4.29.0', 'pyyaml']
54+
'ogb', 'torchtext', 'tqdm >= 4.29.0', 'pyyaml', 'transformers']
5255
pytorch_requirement = 'torch >= 1.6.0' if platform.system() != 'Windows' else 'torch >= 1.8.1'
5356
torchtext_requirement = 'torchtext == 0.7.0' if platform.system() != 'Windows' else 'torchtext == 0.9.0'
5457
install_requirement.append(pytorch_requirement)

0 commit comments

Comments
 (0)