-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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: Warn when a user provided model name in the config renamed #2004
ENH: Warn when a user provided model name in the config renamed #2004
Conversation
Resolves huggingface#2001 In PEFT, users can provide a custom base_model_name_or_path argument to the PEFT config. However, this value is overridden by the model's name_or_path attribute. This can be surprising for users. Therefore, there is now a warning about this. To see why that can be relevant, check the original issue. It eludes me why this argument can be passed by users only to be overridden by PEFT. This was implemented by Younes before I joined the project.
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!
I slightly prefer catching warnings with a with context more, but that is just preferential.
tests/test_initialization.py
Outdated
|
||
def test_warning_name_transformers_model(self, recwarn): | ||
# The base_model_name_or_path provided by the user is overridden. | ||
model = AutoModelForCausalLM.from_pretrained("facebook/opt-125m") |
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 test with a smaller model? Plenty available here: https://huggingface.co/hf-internal-testing
tests/test_initialization.py
Outdated
assert any(msg in str(warning.message) for warning in recwarn.list) | ||
|
||
def test_warning_name_custom_model(self, custom_module, recwarn): | ||
get_peft_model(custom_module, LoraConfig(target_modules=["lin"], base_model_name_or_path="custom_name")) |
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.
"custom_name" could be assigned to a variable and reused for easier understanding.
- use smaller base model - assign custom name to variable
Thanks @sayakpaul. The last commit should address your comments.
You mean something like |
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.
LGTM!
Resolves #2001
In PEFT, users can provide a custom
base_model_name_or_path
argument to the PEFT config. However, this value is overridden by the model'sname_or_path
attribute. This can be surprising for users. Therefore, there is now a warning about this.To see why that can be relevant, check the original issue.
It eludes me why this argument can be passed by users only to be overridden by PEFT. This was implemented by Younes before I joined the project.