Lightning-AI / Lightning-AI/pytorch-lightning

Add param_group name for BaseFinetuningCallback

Open
#20,194 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

callback: finetuning feature
Dominant language
Python
Stars
31.4k
Forks
3.8k
Avg merge
6d 7h
Merged PRs (30d)
6

Description

Description & Motivation

Add option to pass param_group name when we use unfreeze_and_add_param_group method in finetuning callback for better LR logging.
As it said in documentation

optimizer has multiple parameter groups they will be named Adam/pg1, Adam/pg2

so when we add new param_group, it will be shown as adam/pg2

Pitch

Change from:
optimizer.add_param_group({"params": params, "lr": params_lr / denom_lr})
to
optimizer.add_param_group({"params": params, "lr": params_lr / denom_lr, "name": unfreeze_params_name})

Alternatives

No response

Additional context

No response

cc @lantiga @borda

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Search the finetuning callback implementation for the unfreeze_and_add_param_group method and inspect how it calls optimizer.add_param_group. Pass the unfreeze parameter-group name through to the optimizer so the newly added group uses that name in learning-rate logging. Verify that the resulting logs identify the group by its supplied name.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
machine-learning
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.