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
Megatron-LM
Commits
1c4c360f
Commit
1c4c360f
authored
May 14, 2021
by
Jared Casper
Browse files
Ensure numpy random seed is within range.
parent
002cde6b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
1 deletion
+2
-1
megatron/data/bert_dataset.py
megatron/data/bert_dataset.py
+2
-1
No files found.
megatron/data/bert_dataset.py
View file @
1c4c360f
...
...
@@ -77,7 +77,8 @@ class BertDataset(torch.utils.data.Dataset):
sample
=
[
self
.
indexed_dataset
[
i
]
for
i
in
range
(
start_idx
,
end_idx
)]
# Note that this rng state should be numpy and not python since
# python randint is inclusive whereas the numpy one is exclusive.
np_rng
=
np
.
random
.
RandomState
(
seed
=
(
self
.
seed
+
idx
))
# We % 2**32 since numpy requres the seed to be between 0 and 2**32 - 1
np_rng
=
np
.
random
.
RandomState
(
seed
=
((
self
.
seed
+
idx
)
%
2
**
32
))
return
build_training_sample
(
sample
,
seq_length
,
self
.
max_seq_length
,
# needed for padding
self
.
vocab_id_list
,
...
...
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