Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
D
DAN
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Container Registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Automatic Text Recognition
DAN
Commits
568e5880
Verified
Commit
568e5880
authored
1 year ago
by
Mélodie Boillet
Browse files
Options
Downloads
Patches
Plain Diff
Save dropout scheduler step_num
parent
b0bca1a7
No related branches found
Branches containing commit
No related tags found
1 merge request
!292
Save dropout scheduler step_num
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
dan/ocr/manager/training.py
+3
-0
3 additions, 0 deletions
dan/ocr/manager/training.py
dan/ocr/schedulers.py
+3
-0
3 additions, 0 deletions
dan/ocr/schedulers.py
with
6 additions
and
0 deletions
dan/ocr/manager/training.py
+
3
−
0
View file @
568e5880
...
@@ -224,6 +224,8 @@ class GenericTrainingManager:
...
@@ -224,6 +224,8 @@ class GenericTrainingManager:
self
.
best
=
checkpoint
[
"
best
"
]
self
.
best
=
checkpoint
[
"
best
"
]
if
"
scaler_state_dict
"
in
checkpoint
:
if
"
scaler_state_dict
"
in
checkpoint
:
self
.
scaler
.
load_state_dict
(
checkpoint
[
"
scaler_state_dict
"
])
self
.
scaler
.
load_state_dict
(
checkpoint
[
"
scaler_state_dict
"
])
if
"
dropout_scheduler_step
"
in
checkpoint
:
self
.
dropout_scheduler
.
resume
(
checkpoint
[
"
dropout_scheduler_step
"
])
# Load model weights from past training
# Load model weights from past training
for
model_name
in
self
.
models
:
for
model_name
in
self
.
models
:
# Transform to DDP/from DDP model
# Transform to DDP/from DDP model
...
@@ -412,6 +414,7 @@ class GenericTrainingManager:
...
@@ -412,6 +414,7 @@ class GenericTrainingManager:
"
scaler_state_dict
"
:
self
.
scaler
.
state_dict
(),
"
scaler_state_dict
"
:
self
.
scaler
.
state_dict
(),
"
best
"
:
self
.
best
,
"
best
"
:
self
.
best
,
"
charset
"
:
self
.
dataset
.
charset
,
"
charset
"
:
self
.
dataset
.
charset
,
"
dropout_scheduler_step
"
:
self
.
dropout_scheduler
.
step_num
,
}
}
for
model_name
in
self
.
optimizers
:
for
model_name
in
self
.
optimizers
:
...
...
This diff is collapsed.
Click to expand it.
dan/ocr/schedulers.py
+
3
−
0
View file @
568e5880
...
@@ -17,6 +17,9 @@ class DropoutScheduler:
...
@@ -17,6 +17,9 @@ class DropoutScheduler:
def
step
(
self
,
num
):
def
step
(
self
,
num
):
self
.
step_num
+=
num
self
.
step_num
+=
num
def
resume
(
self
,
step_num
):
self
.
step_num
=
step_num
def
init_teta_list
(
self
,
models
):
def
init_teta_list
(
self
,
models
):
for
model_name
in
models
:
for
model_name
in
models
:
self
.
init_teta_list_module
(
models
[
model_name
])
self
.
init_teta_list_module
(
models
[
model_name
])
...
...
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
register
or
sign in
to comment