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

fix: fail when required args not passed when prompt_tuning_init==TEXT #1519

Merged
merged 3 commits into from
Mar 5, 2024

Conversation

kmehant
Copy link
Contributor

@kmehant kmehant commented Mar 1, 2024

When prompt_tuning_init==TEXT is set, there are some args needed to be provided. For instance, tokenizer_name_or_path should be set to some tokenizer name or path, failing which would result in errors such as

HTTPError: 401 Client Error: Unauthorized for url: https://huggingface.co/None/resolve/main/tokenizer_config.json

tokenizer_name_or_path is taken as None. Such errors can be handled and reported meaningfully post config initialization and this PR makes that contribution.

@BenjaminBossan
Copy link
Member

Thanks for adding this quality of life feature. Two points:

  • Could you please break the long lines? We want to keep a 120 char limit.
  • Would you mind adding tests to check that the error is raised? We can help with that if needed.

@kmehant kmehant force-pushed the check-args-post-init branch from 129b8cc to f172b0d Compare March 1, 2024 10:15
@kmehant
Copy link
Contributor Author

kmehant commented Mar 1, 2024

@BenjaminBossan

Would you mind adding tests to check that the error is raised? We can help with that if needed.

Sure @BenjaminBossan, I tried looking for tests for prompt tuning implementation, but I could not find them, can you point me to that?

@BenjaminBossan
Copy link
Member

I tried looking for tests for prompt tuning implementation, but I could not find them, can you point me to that?

The tests are a bit scattered around, as we group by model architecture and not by method. But a good fit would be to add them to tests/test_initialization.py.

@kmehant kmehant force-pushed the check-args-post-init branch from f172b0d to 282fc35 Compare March 1, 2024 11:02
@kmehant
Copy link
Contributor Author

kmehant commented Mar 1, 2024

@BenjaminBossan Have added the tests and made required changes.

Screenshot 2024-03-01 at 4 35 15 PM

@BenjaminBossan
Copy link
Member

Thanks a lot for adding the test, could you please run make style and push the changes?

@kmehant kmehant force-pushed the check-args-post-init branch from 282fc35 to 0ea3102 Compare March 4, 2024 05:27
@kmehant
Copy link
Contributor Author

kmehant commented Mar 4, 2024

#1519 (comment)

@BenjaminBossan I have run make style and pushed the changes thanks.

@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
Member

@BenjaminBossan BenjaminBossan left a comment

Choose a reason for hiding this comment

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

Thanks for the update. I found some very small things still, after that we should be good to go.

src/peft/tuners/prompt_tuning/config.py Outdated Show resolved Hide resolved
src/peft/tuners/prompt_tuning/config.py Outdated Show resolved Hide resolved
src/peft/tuners/prompt_tuning/config.py Outdated Show resolved Hide resolved
kmehant and others added 3 commits March 5, 2024 17:12
Signed-off-by: Mehant Kammakomati <mehant.kammakomati2@ibm.com>
Co-authored-by: Benjamin Bossan <BenjaminBossan@users.noreply.github.com>
Signed-off-by: Mehant Kammakomati <mehant.kammakomati2@ibm.com>
@kmehant kmehant force-pushed the check-args-post-init branch from d4c19c5 to 5851a06 Compare March 5, 2024 11:46
@kmehant kmehant requested a review from BenjaminBossan March 5, 2024 11:46
Copy link
Member

@BenjaminBossan BenjaminBossan left a comment

Choose a reason for hiding this comment

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

Thanks a lot for adding these early checks.

@BenjaminBossan BenjaminBossan merged commit e597388 into huggingface:main Mar 5, 2024
14 checks passed
BenjaminBossan pushed a commit to BenjaminBossan/peft that referenced this pull request Mar 14, 2024
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