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
wangsen
paddle_dbnet
Commits
9ecfc348
Commit
9ecfc348
authored
Jan 05, 2022
by
WenmuZhou
Browse files
rm const decay
parent
d8571bdb
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
24 deletions
+8
-24
configs/vqa/re/layoutxlm.yml
configs/vqa/re/layoutxlm.yml
+1
-1
configs/vqa/ser/layoutlm.yml
configs/vqa/ser/layoutlm.yml
+1
-1
configs/vqa/ser/layoutxlm.yml
configs/vqa/ser/layoutxlm.yml
+1
-1
ppocr/optimizer/regularizer.py
ppocr/optimizer/regularizer.py
+5
-21
No files found.
configs/vqa/re/layoutxlm.yml
View file @
9ecfc348
...
...
@@ -36,7 +36,7 @@ Optimizer:
lr
:
learning_rate
:
0.00005
regularizer
:
name
:
Const
name
:
L2
factor
:
0.00000
PostProcess
:
...
...
configs/vqa/ser/layoutlm.yml
View file @
9ecfc348
...
...
@@ -38,7 +38,7 @@ Optimizer:
epochs
:
*epoch_num
warmup_epoch
:
2
regularizer
:
name
:
Const
name
:
L2
factor
:
0.00000
PostProcess
:
...
...
configs/vqa/ser/layoutxlm.yml
View file @
9ecfc348
...
...
@@ -38,7 +38,7 @@ Optimizer:
epochs
:
*epoch_num
warmup_epoch
:
2
regularizer
:
name
:
Const
name
:
L2
factor
:
0.00000
PostProcess
:
...
...
ppocr/optimizer/regularizer.py
View file @
9ecfc348
...
...
@@ -29,39 +29,23 @@ class L1Decay(object):
def
__init__
(
self
,
factor
=
0.0
):
super
(
L1Decay
,
self
).
__init__
()
self
.
regularization_
coeff
=
factor
self
.
coeff
=
factor
def
__call__
(
self
):
reg
=
paddle
.
regularizer
.
L1Decay
(
self
.
regularization_
coeff
)
reg
=
paddle
.
regularizer
.
L1Decay
(
self
.
coeff
)
return
reg
class
L2Decay
(
object
):
"""
L2 Weight Decay Regularization, which
encourages the weights to be sparse
.
L2 Weight Decay Regularization, which
helps to prevent the model over-fitting
.
Args:
factor(float): regularization coeff. Default:0.0.
"""
def
__init__
(
self
,
factor
=
0.0
):
super
(
L2Decay
,
self
).
__init__
()
self
.
regularization_
coeff
=
factor
self
.
coeff
=
factor
def
__call__
(
self
):
reg
=
paddle
.
regularizer
.
L2Decay
(
self
.
regularization_coeff
)
return
reg
class
ConstDecay
(
object
):
"""
Const L2 Weight Decay Regularization, which encourages the weights to be sparse.
Args:
factor(float): regularization coeff. Default:0.0.
"""
def
__init__
(
self
,
factor
=
0.0
):
super
(
ConstDecay
,
self
).
__init__
()
self
.
regularization_coeff
=
factor
def
__call__
(
self
):
return
self
.
regularization_coeff
return
self
.
coeff
\ No newline at end of file
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