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
8df64670
Unverified
Commit
8df64670
authored
Nov 28, 2023
by
Rhett Ying
Committed by
GitHub
Nov 28, 2023
Browse files
[examples] create dataloader before train epoch (#6636)
parent
659b9289
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
11 deletions
+12
-11
examples/sampling/graphbolt/rgcn/hetero_rgcn.py
examples/sampling/graphbolt/rgcn/hetero_rgcn.py
+12
-11
No files found.
examples/sampling/graphbolt/rgcn/hetero_rgcn.py
View file @
8df64670
...
@@ -537,14 +537,6 @@ def run(
...
@@ -537,14 +537,6 @@ def run(
print
(
"start to run..."
)
print
(
"start to run..."
)
category
=
"paper"
category
=
"paper"
# Typically, the best Validation performance is obtained after
# the 1st or 2nd epoch. This is why the max epoch is set to 3.
for
epoch
in
range
(
3
):
num_train
=
len
(
train_set
)
model
.
train
()
total_loss
=
0
data_loader
=
create_dataloader
(
data_loader
=
create_dataloader
(
name
,
name
,
g
,
g
,
...
@@ -556,6 +548,15 @@ def run(
...
@@ -556,6 +548,15 @@ def run(
shuffle
=
True
,
shuffle
=
True
,
num_workers
=
num_workers
,
num_workers
=
num_workers
,
)
)
# Typically, the best Validation performance is obtained after
# the 1st or 2nd epoch. This is why the max epoch is set to 3.
for
epoch
in
range
(
3
):
num_train
=
len
(
train_set
)
model
.
train
()
total_loss
=
0
for
data
in
tqdm
(
data_loader
,
desc
=
f
"Training~Epoch
{
epoch
:
02
d
}
"
):
for
data
in
tqdm
(
data_loader
,
desc
=
f
"Training~Epoch
{
epoch
:
02
d
}
"
):
# Convert MiniBatch to DGL Blocks.
# Convert MiniBatch to DGL Blocks.
blocks
=
[
block
.
to
(
device
)
for
block
in
data
.
blocks
]
blocks
=
[
block
.
to
(
device
)
for
block
in
data
.
blocks
]
...
...
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