-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs: highlight difference between num_parameters() and get_nb_trainable_parameters() in PEFT #1531
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding the docstrings. I made some comments where I think it can be improved. Please check them out.
src/peft/peft_model.py
Outdated
@@ -515,7 +515,12 @@ def get_nb_trainable_parameters(self) -> tuple[int, int]: | |||
|
|||
def print_trainable_parameters(self) -> None: | |||
""" | |||
Prints the number of trainable parameters in the model. | |||
Prints the number of trainable parameters in the model. Note: print_trainable_parameters() uses |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please add 1 empty line after the first sentence (before "Note")?
src/peft/peft_model.py
Outdated
@@ -515,7 +515,12 @@ def get_nb_trainable_parameters(self) -> tuple[int, int]: | |||
|
|||
def print_trainable_parameters(self) -> None: | |||
""" | |||
Prints the number of trainable parameters in the model. | |||
Prints the number of trainable parameters in the model. Note: print_trainable_parameters() uses | |||
get_nb_trainable_parameters() which is different from num_parameters(only_trainable=True). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's mention that num_parameters
is a method from transformers.
src/peft/peft_model.py
Outdated
Prints the number of trainable parameters in the model. | ||
Prints the number of trainable parameters in the model. Note: print_trainable_parameters() uses | ||
get_nb_trainable_parameters() which is different from num_parameters(only_trainable=True). | ||
get_nb_trainable_parameters() returns (trainable parameters, all paramters) of the Peft Model which includes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
paramters -> parameters
src/peft/peft_model.py
Outdated
get_nb_trainable_parameters() returns (trainable parameters, all paramters) of the Peft Model which includes | ||
modified backbone transformer model. For techniques like LoRA, the backbone transformer model is modified in | ||
place with LoRA modules. However, for prompt tuning, the backbone transformer model is unmodified. | ||
num_parameters(only_trainable=True) returns number of trainable parameters of the backbone transformer model. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to make it totally clear, let's add here that this can result in a different number :)
…ble_parameters() in PEFT Signed-off-by: Mehant Kammakomati <[email protected]>
a883d87
to
1151fdc
Compare
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding this informative docstring!
Signed-off-by: Mehant Kammakomati <[email protected]>
related to #1526