Skip to content

DOC: fix adapter_names parameter name in set_requires_grad docstrings - #3271

Merged
githubnemo merged 1 commit into
huggingface:mainfrom
kratos0718:fix/set-requires-grad-docstring
Jun 23, 2026
Merged

githubnemo merged 1 commit into
huggingface:mainfrom
kratos0718:fix/set-requires-grad-docstring

Conversation

@kratos0718

Copy link
Copy Markdown
Contributor

What does this fix?

The set_requires_grad function and methods across 4 files document the parameter as adapter_name (singular) but the actual parameter name in every function signature is adapter_names (plural, accepts str | Sequence[str]).

Also fixes an incorrect model description in the standalone set_requires_grad in tuners_utils.py — it was copy-pasted from delete_adapter and said "The model from which the adapter should be deleted" instead of correctly describing the gradient update operation.

Files changed

  • src/peft/peft_model.py — PeftModel.set_requires_grad
  • src/peft/tuners/tuners_utils.py — BaseTuner.set_requires_grad, BaseTunerLayer.set_requires_grad, standalone set_requires_grad
  • src/peft/utils/other.py — AuxiliaryTrainingWrapper.set_requires_grad

The `set_requires_grad` function and methods across 4 files documented
the parameter as `adapter_name` (singular) but the actual parameter name
is `adapter_names` (plural, accepts str or Sequence[str]).

Also fixes an incorrect description for the `model` parameter in the
standalone `set_requires_grad` function in tuners_utils.py, which was
copy-pasted from `delete_adapter` and said "The model from which the
adapter should be deleted" instead of describing the gradient update.

Affected locations:
- src/peft/peft_model.py (PeftModel.set_requires_grad)
- src/peft/tuners/tuners_utils.py (BaseTuner.set_requires_grad,
  BaseTunerLayer.set_requires_grad, standalone set_requires_grad)
- src/peft/utils/other.py (AuxiliaryTrainingWrapper.set_requires_grad)
@kratos0718

Copy link
Copy Markdown
Contributor Author

Hi! Just submitted this fix — all checks should pass shortly. Happy to make any adjustments based on feedback. Thanks for reviewing!

@githubnemo githubnemo left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, once the CI is through we can merge this :)

@HuggingFaceDocBuilderDev

Copy link
Copy Markdown

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@githubnemo

Copy link
Copy Markdown
Collaborator

Failing tests are unrelated.

@githubnemo
githubnemo merged commit 8c95d10 into huggingface:main Jun 23, 2026
2 of 10 checks passed
BenjaminBossan pushed a commit to BenjaminBossan/peft that referenced this pull request Jun 24, 2026
…huggingface#3271)

The `set_requires_grad` function and methods across 4 files documented
the parameter as `adapter_name` (singular) but the actual parameter name
is `adapter_names` (plural, accepts str or Sequence[str]).

Also fixes an incorrect description for the `model` parameter in the
standalone `set_requires_grad` function in tuners_utils.py, which was
copy-pasted from `delete_adapter` and said "The model from which the
adapter should be deleted" instead of describing the gradient update.

Affected locations:
- src/peft/peft_model.py (PeftModel.set_requires_grad)
- src/peft/tuners/tuners_utils.py (BaseTuner.set_requires_grad,
  BaseTunerLayer.set_requires_grad, standalone set_requires_grad)
- src/peft/utils/other.py (AuxiliaryTrainingWrapper.set_requires_grad)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants