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
259062c2
Commit
259062c2
authored
Mar 30, 2020
by
Mohammad
Browse files
removed unused values in samplers
parent
32e1ddb0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
13 deletions
+0
-13
megatron/data/samplers.py
megatron/data/samplers.py
+0
-13
No files found.
megatron/data/samplers.py
View file @
259062c2
...
...
@@ -15,8 +15,6 @@
"""Batch samplers that work with either random or sequential data samplers."""
import
numpy
as
np
import
torch
from
torch.utils
import
data
...
...
@@ -100,7 +98,6 @@ class DistributedBatchSampler(data.sampler.BatchSampler):
def
__iter__
(
self
):
batch
=
[]
last_batch
=
None
i
=
0
for
idx
in
self
.
data_iterator
(
self
.
sampler
,
wrap_around
=
False
):
batch
.
append
(
idx
)
...
...
@@ -110,7 +107,6 @@ class DistributedBatchSampler(data.sampler.BatchSampler):
yield
tbatch
self
.
start_iter
=
0
i
+=
1
last_batch
=
np
.
array
(
list
(
tbatch
))
batch
=
[]
batch_len
=
len
(
batch
)
if
batch_len
>
0
and
not
self
.
drop_last
:
...
...
@@ -118,15 +114,6 @@ class DistributedBatchSampler(data.sampler.BatchSampler):
self
.
sampler
.
wrap_around
-=
(
self
.
batch_size
)
self
.
wrap_around
+=
(
len
(
batch
))
self
.
wrap_around
%=
self
.
batch_size
if
isinstance
(
self
.
sampler
,
TransposedSampler
):
for
i
,
idx
in
enumerate
(
self
.
data_iterator
(
self
.
sampler
,
wrap_around
=
True
)):
if
i
==
0
:
continue
batch
.
append
(
idx
)
new_batch_len
=
len
(
batch
)
if
len
(
batch
)
==
self
.
batch_size
:
break
yield
self
.
_batch
(
batch
)
if
self
.
wrap_last
:
self
.
sampler
.
wrap_around
+=
self
.
batch_size
...
...
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