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
Fairseq
Commits
5ef59abd
Commit
5ef59abd
authored
Oct 26, 2017
by
Myle Ott
Browse files
Fix seed so that data is properly shuffled between epochs
parent
ae6f6d56
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
3 deletions
+4
-3
train.py
train.py
+4
-3
No files found.
train.py
View file @
5ef59abd
...
...
@@ -125,12 +125,13 @@ def get_perplexity(loss):
def
train
(
args
,
epoch
,
batch_offset
,
trainer
,
dataset
,
max_positions
,
num_gpus
):
"""Train the model for one epoch."""
torch
.
manual_seed
(
args
.
seed
+
epoch
)
trainer
.
set_seed
(
args
.
seed
+
epoch
)
seed
=
args
.
seed
+
epoch
torch
.
manual_seed
(
seed
)
trainer
.
set_seed
(
seed
)
itr
=
dataset
.
dataloader
(
args
.
train_subset
,
num_workers
=
args
.
workers
,
max_tokens
=
args
.
max_tokens
,
seed
=
args
.
seed
,
epoch
=
epoch
,
max_positions
=
max_positions
,
seed
=
seed
,
epoch
=
epoch
,
max_positions
=
max_positions
,
sample_without_replacement
=
args
.
sample_without_replacement
,
skip_invalid_size_inputs_valid_test
=
args
.
skip_invalid_size_inputs_valid_test
,
sort_by_source_size
=
(
epoch
<=
args
.
curriculum
))
...
...
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