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
dcnv3
Commits
cfd24625
Commit
cfd24625
authored
Jan 17, 2025
by
zhe chen
Browse files
Fix keyward to keyword
parent
0404891e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
5 deletions
+5
-5
classification/models/intern_image.py
classification/models/intern_image.py
+2
-2
classification/optimizer.py
classification/optimizer.py
+3
-3
No files found.
classification/models/intern_image.py
View file @
cfd24625
...
@@ -691,7 +691,7 @@ class InternImage(nn.Module):
...
@@ -691,7 +691,7 @@ class InternImage(nn.Module):
m
.
_reset_parameters
()
m
.
_reset_parameters
()
@
torch
.
jit
.
ignore
@
torch
.
jit
.
ignore
def
lr_decay_keyw
a
rds
(
self
,
decay_ratio
=
0.87
):
def
lr_decay_keyw
o
rds
(
self
,
decay_ratio
=
0.87
):
lr_ratios
=
{}
lr_ratios
=
{}
# blocks
# blocks
...
@@ -701,7 +701,7 @@ class InternImage(nn.Module):
...
@@ -701,7 +701,7 @@ class InternImage(nn.Module):
for
j
in
range
(
self
.
depths
[
layer_num
]):
for
j
in
range
(
self
.
depths
[
layer_num
]):
block_num
=
self
.
depths
[
layer_num
]
-
j
-
1
block_num
=
self
.
depths
[
layer_num
]
-
j
-
1
tag
=
'levels.{}.blocks.{}.'
.
format
(
layer_num
,
block_num
)
tag
=
'levels.{}.blocks.{}.'
.
format
(
layer_num
,
block_num
)
decay
=
1.0
*
(
decay_ratio
**
idx
)
decay
=
1.0
*
(
decay_ratio
**
idx
)
lr_ratios
[
tag
]
=
decay
lr_ratios
[
tag
]
=
decay
idx
+=
1
idx
+=
1
# patch_embed (before stage-1)
# patch_embed (before stage-1)
...
...
classification/optimizer.py
View file @
cfd24625
...
@@ -129,11 +129,11 @@ def set_weight_decay_and_lr(
...
@@ -129,11 +129,11 @@ def set_weight_decay_and_lr(
if
lr_layer_decay
:
if
lr_layer_decay
:
print
(
'layer-wise lr decay is used !'
)
print
(
'layer-wise lr decay is used !'
)
assert
hasattr
(
model
,
'lr_decay_keyw
a
rds'
)
assert
hasattr
(
model
,
'lr_decay_keyw
o
rds'
)
lr_ratio_keyw
a
rds
=
model
.
lr_decay_keyw
a
rds
(
lr_layer_decay_ratio
)
lr_ratio_keyw
o
rds
=
model
.
lr_decay_keyw
o
rds
(
lr_layer_decay_ratio
)
# 2. check lr
# 2. check lr
ratio
=
check_keywords_in_dict
(
name
,
lr_ratio_keyw
a
rds
)
ratio
=
check_keywords_in_dict
(
name
,
lr_ratio_keyw
o
rds
)
if
ratio
is
not
None
:
if
ratio
is
not
None
:
lr
=
ratio
*
base_lr
lr
=
ratio
*
base_lr
else
:
else
:
...
...
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