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
60078cf3
Commit
60078cf3
authored
Aug 17, 2021
by
mshoeybi
Browse files
minor changes from github issues
parent
f69f699f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
4 deletions
+4
-4
megatron/data/dataset_utils.py
megatron/data/dataset_utils.py
+2
-2
megatron/training.py
megatron/training.py
+2
-2
No files found.
megatron/data/dataset_utils.py
View file @
60078cf3
...
@@ -674,7 +674,7 @@ def get_samples_mapping(indexed_dataset,
...
@@ -674,7 +674,7 @@ def get_samples_mapping(indexed_dataset,
# Build samples mapping
# Build samples mapping
verbose
=
torch
.
distributed
.
get_rank
()
==
0
verbose
=
torch
.
distributed
.
get_rank
()
==
0
start_time
=
time
.
time
()
start_time
=
time
.
time
()
print_rank_0
(
' > building sa
p
mles index mapping for {} ...'
.
format
(
print_rank_0
(
' > building sam
p
les index mapping for {} ...'
.
format
(
name
))
name
))
# First compile and then import.
# First compile and then import.
from
megatron.data
import
helpers
from
megatron.data
import
helpers
...
@@ -688,7 +688,7 @@ def get_samples_mapping(indexed_dataset,
...
@@ -688,7 +688,7 @@ def get_samples_mapping(indexed_dataset,
seed
,
seed
,
verbose
,
verbose
,
2
if
binary_head
else
1
)
2
if
binary_head
else
1
)
print_rank_0
(
' > done building sa
p
mles index maping'
)
print_rank_0
(
' > done building sam
p
les index maping'
)
np
.
save
(
indexmap_filename
,
samples_mapping
,
allow_pickle
=
True
)
np
.
save
(
indexmap_filename
,
samples_mapping
,
allow_pickle
=
True
)
print_rank_0
(
' > saved the index mapping in {}'
.
format
(
print_rank_0
(
' > saved the index mapping in {}'
.
format
(
indexmap_filename
))
indexmap_filename
))
...
...
megatron/training.py
View file @
60078cf3
...
@@ -541,7 +541,7 @@ def training_log(loss_dict, total_loss_dict, learning_rate, iteration,
...
@@ -541,7 +541,7 @@ def training_log(loss_dict, total_loss_dict, learning_rate, iteration,
if
iteration
%
args
.
log_interval
==
0
:
if
iteration
%
args
.
log_interval
==
0
:
elapsed_time
=
timers
(
'interval-time'
).
elapsed
()
elapsed_time
=
timers
(
'interval-time'
).
elapsed
()
elapsed_time_per_iteration
=
elapsed_time
/
total_iterations
elapsed_time_per_iteration
=
elapsed_time
/
total_iterations
if
writer
and
torch
.
distributed
.
get_rank
()
==
0
:
if
writer
:
if
args
.
log_timers_to_tensorboard
:
if
args
.
log_timers_to_tensorboard
:
writer
.
add_scalar
(
'iteration-time'
,
writer
.
add_scalar
(
'iteration-time'
,
elapsed_time_per_iteration
,
iteration
)
elapsed_time_per_iteration
,
iteration
)
...
@@ -748,7 +748,7 @@ def evaluate_and_print_results(prefix, forward_step_func,
...
@@ -748,7 +748,7 @@ def evaluate_and_print_results(prefix, forward_step_func,
string
+=
'{} value: {:.6E} | '
.
format
(
key
,
total_loss_dict
[
key
].
item
())
string
+=
'{} value: {:.6E} | '
.
format
(
key
,
total_loss_dict
[
key
].
item
())
ppl
=
math
.
exp
(
min
(
20
,
total_loss_dict
[
key
].
item
()))
ppl
=
math
.
exp
(
min
(
20
,
total_loss_dict
[
key
].
item
()))
string
+=
'{} PPL: {:.6E} | '
.
format
(
key
,
ppl
)
string
+=
'{} PPL: {:.6E} | '
.
format
(
key
,
ppl
)
if
writer
and
is_last_rank
()
:
if
writer
:
writer
.
add_scalar
(
'{} validation'
.
format
(
key
),
writer
.
add_scalar
(
'{} validation'
.
format
(
key
),
total_loss_dict
[
key
].
item
(),
total_loss_dict
[
key
].
item
(),
iteration
)
iteration
)
...
...
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