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: Multitask prompt tuning with other tuning init #1144

Conversation

BenjaminBossan
Copy link
Member

@BenjaminBossan BenjaminBossan commented Nov 17, 2023

This is WIP, do not merge.

I attempted to fix #1082. While adding tests for the bug, I discovered that I could not make prompt_tuning_init != RANDOM to work. Maybe I'm using it wrong, but I'm not sure what to change.

Tests are now passing, this is ready for review @pacman100 @younesbelkada

This is WIP.

I attempted to fix huggingface#1082. While adding tests for the bug, I discovered
that I could not make prompt_tuning_init != RANDOM to work. Maybe I'm
using it wrong, but I'm not sure what to change.
@BenjaminBossan
Copy link
Member Author

ping @mayank31398

@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint.

Copy link

This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

@github-actions github-actions bot closed this Dec 25, 2023
@BenjaminBossan
Copy link
Member Author

Another friendly ping @mayank31398

@mayank31398
Copy link
Contributor

oops, hey @BenjaminBossan
will take a look over the weekend

@BenjaminBossan BenjaminBossan reopened this Jan 9, 2024
@mayank31398
Copy link
Contributor

FAILED tests/test_multitask_prompt_tuning.py::MultiTaskPromptTuningTester::test_generate_text_1_AVERAGE_SOURCE_TASKS - ValueError: task_ids cannot be None
FAILED tests/test_multitask_prompt_tuning.py::MultiTaskPromptTuningTester::test_generate_text_2_EXACT_SOURCE_TASK - ValueError: task_ids cannot be None
FAILED tests/test_multitask_prompt_tuning.py::MultiTaskPromptTuningTester::test_generate_text_3_ONLY_SOURCE_SHARED - ValueError: task_ids cannot be None

is this not expected?
these methods require task_ids parameter for forward pass or generate function

@BenjaminBossan
Copy link
Member Author

these methods require task_ids parameter for forward pass or generate function

Yes, but the point is how do I pass them correctly? I tried this and it doesn't work:

https://github.com/huggingface/peft/pull/1144/files#diff-46602edfe9ad4dd646762de8e946d4e66a92d70968702a38bddd7a56f078abc7R284

Probably I'm using it wrong but I'm not sure how :)

Copy link

github-actions bot commented Feb 3, 2024

This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

@BenjaminBossan
Copy link
Member Author

Gentle ping @mayank31398

@mayank31398
Copy link
Contributor

Screenshot 2024-02-06 at 12 14 47 PM
@BenjaminBossan It seems to be working fine for me.
Ignore the failing test for bf16 (I am on a Mac and that doesn't support bf16).

@mayank31398
Copy link
Contributor

I merge main branch into the branch and then ran it. The test seems to pass for me

@mayank31398
Copy link
Contributor

@BenjaminBossan
Copy link
Member Author

I merge main branch into the branch and then ran it. The test seems to pass for me

Strange. I also merged the main branch and as you can see, CI is still red. The failing tests are:

FAILED tests/test_multitask_prompt_tuning.py::MultiTaskPromptTuningTester::test_generate_text_3_ONLY_SOURCE_SHARED - ValueError: task_ids cannot be None
FAILED tests/test_multitask_prompt_tuning.py::MultiTaskPromptTuningTester::test_generate_text_0_TEXT - OSError: None is not a local folder and is not a valid model identifier listed on 'https://huggingface.co/models'
If this is a private repository, make sure to pass a token having permission to this repo either by logging in with `huggingface-cli login` or by passing `token=<your_token>`
FAILED tests/test_multitask_prompt_tuning.py::MultiTaskPromptTuningTester::test_generate_text_1_AVERAGE_SOURCE_TASKS - ValueError: task_ids cannot be None
FAILED tests/test_multitask_prompt_tuning.py::MultiTaskPromptTuningTester::test_generate_text_2_EXACT_SOURCE_TASK - ValueError: task_ids cannot be None

@mayank31398
Copy link
Contributor

@BenjaminBossan ok, I did a fresh conda env install and now I am able to replicate your issue
For some reason, it was not picking my source install.
Fixing this right now :)

@mayank31398
Copy link
Contributor

@BenjaminBossan fixed. Opened PR against your branch: BenjaminBossan#8

@BenjaminBossan
Copy link
Member Author

Thanks @mayank31398, this has fixed the failing tests!

@BenjaminBossan BenjaminBossan marked this pull request as ready for review February 9, 2024 10:56
@mayank31398
Copy link
Contributor

@BenjaminBossan @pacman100 can we merge this soon? 🤗

@BenjaminBossan
Copy link
Member Author

Still waiting for a review :D

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 and @mayank31398 for fixing Multitask prompt tuning to work with non-random init configs!

@BenjaminBossan BenjaminBossan merged commit 043d5c0 into huggingface:main Feb 19, 2024
14 checks passed
@BenjaminBossan BenjaminBossan deleted the fix-multitask-prompt-tuning-other-inits branch February 19, 2024 12:53
BenjaminBossan added a commit to BenjaminBossan/peft that referenced this pull request Mar 14, 2024
Resolves huggingface#1082.

Also, adding tests for prompt_tuning_init != RANDOM.

---------

Co-authored-by: Mayank Mishra <32954280+mayank31398@users.noreply.github.com>
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.

'Embedding' object has no attribute 'device' for MPT
4 participants