Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
AMBS
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
esde
machine-learning
AMBS
Commits
aa6d9dd6
Commit
aa6d9dd6
authored
Feb 3, 2021
by
Michael Langguth
Browse files
Options
Downloads
Patches
Plain Diff
Bugfix in time tracking (for training on multiple GPUs).
parent
12073fe4
No related branches found
No related tags found
No related merge requests found
Pipeline
#58788
passed
Feb 3, 2021
Stage: build
Stage: test
Stage: deploy
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
video_prediction_tools/main_scripts/main_train_models.py
+15
-16
15 additions, 16 deletions
video_prediction_tools/main_scripts/main_train_models.py
with
15 additions
and
16 deletions
video_prediction_tools/main_scripts/main_train_models.py
+
15
−
16
View file @
aa6d9dd6
...
@@ -289,22 +289,21 @@ class TrainModel(object):
...
@@ -289,22 +289,21 @@ class TrainModel(object):
with
open
(
cnode_file
,
"
w
"
)
as
fjs
:
with
open
(
cnode_file
,
"
w
"
)
as
fjs
:
json
.
dump
({
"
worker{0}
"
.
format
(
str
(
hvd
.
local_rank
())):
host
},
fjs
)
json
.
dump
({
"
worker{0}
"
.
format
(
str
(
hvd
.
local_rank
())):
host
},
fjs
)
@staticmethod
def
save_timing_to_pkl
(
self
,
training_time
,
time_per_iteration
):
def
save_timing_to_pkl
(
total_time
,
training_time
,
time_per_iteration
,
output_dir
):
"""
"""
Saves tracked time per iteration step, training time and total time to pickle-file
Saves tracked time per iteration step, training time and total time to pickle-file
:param total_time: tracked total time
:param training_time: tracked training time
:param training_time: tracked training time
:param time_per_iteration: tracked iteration step time (list)
:param time_per_iteration: tracked iteration step time (list)
:param output_dir: path to directory where the pickle-files will be stored
:return: -
:return: -
"""
"""
with
open
(
os
.
path
.
join
(
output_dir
,
"
timing_total_time.pkl
"
),
"
wb
"
)
as
f
:
with
open
(
os
.
path
.
join
(
self
.
output_dir
,
"
timing_total_time.pkl
"
),
"
wb
"
)
as
f
:
pkl
.
dump
(
t
otal
_time
,
f
)
pkl
.
dump
(
t
ime
.
time
()
-
self
.
start
_time
,
f
)
with
open
(
os
.
path
.
join
(
output_dir
,
"
timing_training_time.pkl
"
),
"
wb
"
)
as
f
:
with
open
(
os
.
path
.
join
(
self
.
output_dir
,
"
timing_training_time.pkl
"
),
"
wb
"
)
as
f
:
pkl
.
dump
(
training_time
,
f
)
pkl
.
dump
(
training_time
,
f
)
with
open
(
os
.
path
.
join
(
output_dir
,
"
timing_per_iteration_time.pkl
"
),
"
wb
"
)
as
f
:
with
open
(
os
.
path
.
join
(
self
.
output_dir
,
"
timing_per_iteration_time.pkl
"
),
"
wb
"
)
as
f
:
pkl
.
dump
(
time_per_iteration
,
f
)
pkl
.
dump
(
time_per_iteration
,
f
)
with
open
(
os
.
path
.
join
(
self
.
output_dir
,
"
total_steps.pkl
"
),
"
wb
"
)
as
f
:
pkl
.
dump
(
self
.
total_steps
,
f
)
def
train_model
(
self
):
def
train_model
(
self
):
"""
"""
...
@@ -354,15 +353,15 @@ class TrainModel(object):
...
@@ -354,15 +353,15 @@ class TrainModel(object):
TrainModel
.
save_results_to_pkl
(
train_losses
,
val_losses
,
self
.
output_dir
)
TrainModel
.
save_results_to_pkl
(
train_losses
,
val_losses
,
self
.
output_dir
)
TrainModel
.
plot_train
(
train_losses
,
val_losses
,
step
,
self
.
output_dir
)
TrainModel
.
plot_train
(
train_losses
,
val_losses
,
step
,
self
.
output_dir
)
if
hvd
.
rank
()
==
0
:
# track time (save to pickle-files)
# track time (save to pickle-files)
train_time
=
time
.
time
()
-
run_start_time
#Total train time over all the iterations
train_time
=
time
.
time
()
-
run_start_time
#Total train time over all the iterations
total_run_time
=
time
.
time
()
-
self
.
start_time
TrainModel
.
save_timing_to_pkl
(
total_run_time
,
train_time
,
time_per_iteration
,
self
.
output_dir
)
TrainModel
.
save_timing_to_pkl
(
self
,
train_time
,
time_per_iteration
)
# create result dictionary and save it
# create result dictionary and save it
results_dict
=
{
"
train_time
"
:
train_time
,
#
results_dict = {"train_time": train_time,
"
total_steps
"
:
self
.
total_steps
}
#
"total_steps": self.total_steps}
TrainModel
.
save_results_to_dict
(
results_dict
,
self
.
output_dir
)
#
TrainModel.save_results_to_dict(results_dict, self.output_dir)
# print some diagnostics
# print some diagnostics
print
(
"
train_losses:
"
,
train_losses
)
print
(
"
train_losses:
"
,
train_losses
)
print
(
"
val_losses:
"
,
val_losses
)
print
(
"
val_losses:
"
,
val_losses
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
sign in
to comment