Skip to content

Commit

Permalink
update: test_get_optimizer_parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
kozistr committed Oct 24, 2024
1 parent f5aca19 commit e83c789
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,13 @@ def test_get_optimizer_parameters():
wd_ban_list: List[str] = ['bias', 'LayerNorm.bias', 'LayerNorm.weight', 'LayerNorm']

before_parameters = list(model.named_parameters())

_ = get_optimizer_parameters(before_parameters, weight_decay=1e-3, wd_ban_list=wd_ban_list)
after_parameters = get_optimizer_parameters(model, weight_decay=1e-3, wd_ban_list=wd_ban_list)

for before, after in zip(before_parameters, after_parameters):
layer_name: str = before[0]
if layer_name.find('bias') != -1 or layer_name in wd_ban_list:
if layer_name.find('bias') != -1 or layer_name.find('LayerNorm') != -1:
assert after['weight_decay'] == 0.0


Expand Down

0 comments on commit e83c789

Please sign in to comment.