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

[transformers] Prompt masking #2192

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
Open

[transformers] Prompt masking #2192

wants to merge 13 commits into from

Conversation

horheynm
Copy link
Member

@horheynm horheynm commented Mar 20, 2024

Applying character masks to a prompts in the format [foo]some text here\n[bar]response here, to mask characters owned by[bar]

bfineran
bfineran previously approved these changes Mar 20, 2024
Copy link
Contributor

@Satrat Satrat left a comment

Choose a reason for hiding this comment

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

Calculation of the mask looks good but pretty sure its being applied backwards. Lets add a test case to test the whole pipeline so we catch this error(ie text -> tokenization -> text and confirm the labels are masked out only on the prompts.

Also, can you update the internal_docs repo with instructions on how to use this new feature on a custom dataset: https://github.com/neuralmagic/internal-docs/blob/main/teams/ml-engineering/sparseml/text_generation/custom_datasets.md

tests/sparseml/transformers/utils/test_helpers.py Outdated Show resolved Hide resolved
src/sparseml/transformers/finetune/data/custom.py Outdated Show resolved Hide resolved
src/sparseml/transformers/utils/helpers.py Show resolved Hide resolved
src/sparseml/transformers/utils/helpers.py Outdated Show resolved Hide resolved
Copy link
Contributor

@Satrat Satrat left a comment

Choose a reason for hiding this comment

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

Overall LGTM, just want to see a few more test cases (see comments)

src/sparseml/transformers/utils/helpers.py Outdated Show resolved Hide resolved
Satrat
Satrat previously approved these changes Apr 5, 2024
bfineran
bfineran previously approved these changes Apr 8, 2024
@bfineran bfineran dismissed stale reviews from Satrat and themself via 4b0ad66 April 15, 2024 15:11
@bfineran bfineran changed the title Prompt mask [transformers] Prompt masking Apr 15, 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.

None yet

3 participants