Skip to content
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

ENH: Add attribute to show targeted module names #1330

Conversation

BenjaminBossan
Copy link
Member

This is just a tiny convenience feature to help users understand which modules are being targeted by the adapter. This can be useful to quickly check if a complex regex works for target_modules.

Note: This should work for all adapters that use BaseTuner, so not only LoRA but also IA³, LoHa, etc. Only the first two were tested but that should be enough.

Usage:

config = LoraConfig(target_modules=<COMPLICATED-REGEX>)
model = get_peft_mode(base_model, config)
print(model.targeted_module_names)

This is just a tiny convenience feature to help users understand
which modules are being targeted by the adapter. This can be useful
to quickly check if a complex regex works for `target_modules`.

Note: This should work for all adapters that use BaseTuner, so not only
LoRA but also IA³, LoHa, etc. Only the first two were tested but that
should be enough.
@HuggingFaceDocBuilderDev

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.

Copy link
Contributor

@pacman100 pacman100 left a comment

Choose a reason for hiding this comment

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

Thank you @BenjaminBossan for adding this feature to see all the targeted module names, LGTM!

@BenjaminBossan BenjaminBossan merged commit eb2c12d into huggingface:main Jan 10, 2024
14 checks passed
@BenjaminBossan BenjaminBossan deleted the enh-add-attribute-targeted_module_names branch January 10, 2024 10:38
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