Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
dgl
Commits
df3683a2
Unverified
Commit
df3683a2
authored
Jul 17, 2020
by
Quan (Andy) Gan
Committed by
GitHub
Jul 17, 2020
Browse files
fix (#1817)
parent
63feb47c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
1 addition
and
14 deletions
+1
-14
examples/pytorch/gcmc/data.py
examples/pytorch/gcmc/data.py
+1
-1
examples/pytorch/graphsage/train_cv_multi_gpu.py
examples/pytorch/graphsage/train_cv_multi_gpu.py
+0
-6
examples/pytorch/graphsage/train_sampling_multi_gpu.py
examples/pytorch/graphsage/train_sampling_multi_gpu.py
+0
-7
No files found.
examples/pytorch/gcmc/data.py
View file @
df3683a2
...
@@ -513,7 +513,7 @@ class MovieLens(object):
...
@@ -513,7 +513,7 @@ class MovieLens(object):
else
:
else
:
raise
NotImplementedError
raise
NotImplementedError
TEXT
=
torchtext
.
data
.
Field
(
tokenize
=
'spacy'
)
TEXT
=
torchtext
.
data
.
Field
(
tokenize
=
'spacy'
,
tokenizer_language
=
'en_core_web_sm'
)
embedding
=
torchtext
.
vocab
.
GloVe
(
name
=
'840B'
,
dim
=
300
)
embedding
=
torchtext
.
vocab
.
GloVe
(
name
=
'840B'
,
dim
=
300
)
title_embedding
=
np
.
zeros
(
shape
=
(
self
.
movie_info
.
shape
[
0
],
300
),
dtype
=
np
.
float32
)
title_embedding
=
np
.
zeros
(
shape
=
(
self
.
movie_info
.
shape
[
0
],
300
),
dtype
=
np
.
float32
)
...
...
examples/pytorch/graphsage/train_cv_multi_gpu.py
View file @
df3683a2
...
@@ -332,12 +332,6 @@ def run(proc_id, n_gpus, args, devices, data):
...
@@ -332,12 +332,6 @@ def run(proc_id, n_gpus, args, devices, data):
# backward
# backward
optimizer
.
zero_grad
()
optimizer
.
zero_grad
()
loss
.
backward
()
loss
.
backward
()
if
n_gpus
>
1
:
for
param
in
model
.
parameters
():
if
param
.
requires_grad
and
param
.
grad
is
not
None
:
th
.
distributed
.
all_reduce
(
param
.
grad
.
data
,
op
=
th
.
distributed
.
ReduceOp
.
SUM
)
param
.
grad
.
data
/=
n_gpus
optimizer
.
step
()
optimizer
.
step
()
if
proc_id
==
0
:
if
proc_id
==
0
:
iter_tput
.
append
(
len
(
seeds
)
*
n_gpus
/
(
time
.
time
()
-
tic_step
))
iter_tput
.
append
(
len
(
seeds
)
*
n_gpus
/
(
time
.
time
()
-
tic_step
))
...
...
examples/pytorch/graphsage/train_sampling_multi_gpu.py
View file @
df3683a2
...
@@ -207,13 +207,6 @@ def run(proc_id, n_gpus, args, devices, data):
...
@@ -207,13 +207,6 @@ def run(proc_id, n_gpus, args, devices, data):
loss
=
loss_fcn
(
batch_pred
,
batch_labels
)
loss
=
loss_fcn
(
batch_pred
,
batch_labels
)
optimizer
.
zero_grad
()
optimizer
.
zero_grad
()
loss
.
backward
()
loss
.
backward
()
if
n_gpus
>
1
:
for
param
in
model
.
parameters
():
if
param
.
requires_grad
and
param
.
grad
is
not
None
:
th
.
distributed
.
all_reduce
(
param
.
grad
.
data
,
op
=
th
.
distributed
.
ReduceOp
.
SUM
)
param
.
grad
.
data
/=
n_gpus
optimizer
.
step
()
optimizer
.
step
()
if
proc_id
==
0
:
if
proc_id
==
0
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment