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
OpenPCDet
Commits
08652f94
"git@developer.sourcefind.cn:OpenDAS/openpcdet.git" did not exist on "d2829c9682410dc896544f3b6a9dad9e0aeeab89"
Commit
08652f94
authored
Aug 17, 2022
by
Shaoshuai Shi
Browse files
merge with master to support latest timer
parents
97a4e42e
dd2edf9d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
tools/train_utils/train_utils.py
tools/train_utils/train_utils.py
+5
-5
No files found.
tools/train_utils/train_utils.py
View file @
08652f94
...
@@ -24,8 +24,8 @@ def train_one_epoch(model, optimizer, train_loader, model_func, lr_scheduler, ac
...
@@ -24,8 +24,8 @@ def train_one_epoch(model, optimizer, train_loader, model_func, lr_scheduler, ac
batch_time
=
common_utils
.
AverageMeter
()
batch_time
=
common_utils
.
AverageMeter
()
forward_time
=
common_utils
.
AverageMeter
()
forward_time
=
common_utils
.
AverageMeter
()
end
=
time
.
time
()
for
cur_it
in
range
(
start_it
,
total_it_each_epoch
):
for
cur_it
in
range
(
start_it
,
total_it_each_epoch
):
end
=
time
.
time
()
try
:
try
:
batch
=
next
(
dataloader_iter
)
batch
=
next
(
dataloader_iter
)
except
StopIteration
:
except
StopIteration
:
...
@@ -51,16 +51,16 @@ def train_one_epoch(model, optimizer, train_loader, model_func, lr_scheduler, ac
...
@@ -51,16 +51,16 @@ def train_one_epoch(model, optimizer, train_loader, model_func, lr_scheduler, ac
loss
,
tb_dict
,
disp_dict
=
model_func
(
model
,
batch
)
loss
,
tb_dict
,
disp_dict
=
model_func
(
model
,
batch
)
forward_timer
=
time
.
time
()
cur_forward_time
=
forward_timer
-
data_timer
loss
.
backward
()
loss
.
backward
()
clip_grad_norm_
(
model
.
parameters
(),
optim_cfg
.
GRAD_NORM_CLIP
)
clip_grad_norm_
(
model
.
parameters
(),
optim_cfg
.
GRAD_NORM_CLIP
)
optimizer
.
step
()
optimizer
.
step
()
accumulated_iter
+=
1
accumulated_iter
+=
1
cur_forward_time
=
time
.
time
()
-
data_timer
cur_batch_time
=
time
.
time
()
-
end
cur_batch_time
=
time
.
time
()
-
end
end
=
time
.
time
()
# average reduce
# average reduce
avg_data_time
=
commu_utils
.
average_reduce_value
(
cur_data_time
)
avg_data_time
=
commu_utils
.
average_reduce_value
(
cur_data_time
)
avg_forward_time
=
commu_utils
.
average_reduce_value
(
cur_forward_time
)
avg_forward_time
=
commu_utils
.
average_reduce_value
(
cur_forward_time
)
...
...
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