-
Notifications
You must be signed in to change notification settings - Fork 639
FEAT: Added VLSU Multimodal Dataset #1309
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
base: main
Are you sure you want to change the base?
Conversation
| group_id = uuid.uuid4() | ||
|
|
||
| # Create text prompt if text_grade is unsafe or borderline | ||
| if text_grade in self.unsafe_grades: |
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.
If I understand this dataset correctly, each line in the dataset has both a text part and an image part. So I would just say if the harm is sufficient, make sure both have the same group id and add them
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.
The text and image parts individually might have a different safety grade than the combined prompt - for instance, text and image individually might be harmful individually, but their combined prompt can be a safe prompt. I thought it could be useful to create individual text and image prompts to use them in cases where the combined prompt would be skipped.
I could create the unsafe text/image prompts specifically when the combined prompt is safe and they'd be skipped otherwise. Or if you think its better to remove them completely, I can just keep the combined prompts too
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.
I think they should always be added (or not) together, because we likely always want to send them together as part of a single Message.
I don't care quite as much about how we decide which ones to add as much as they be added together so we can handle them consistently :)
| continue | ||
|
|
||
| # Handle UUID | ||
| if uuid_str: |
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.
We should always generate a new uuid. Otherwise there will be weirdness. It's unique to pyrit for when we pull these from the database
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.
right I overlooked that, makes sense!
rlundeen2
left a comment
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.
This is good! Thank you! I think once comments are addressed and CI passes it should be ready to merge.
Description
Added VLSU multimodal dataset. This dataset contains multimodal prompts (text+images) which have safety gradings and categories for the text, images and both combined. This functionality creates text prompts, image prompts and multimodal prompts from the same.
Closes #1285.
Files Changed:
pyrit/datasets/seed_datasets/remote/vlsu_multimodal_dataset.py(new)pyrit/datasets/seed_datasets/remote/__init__.py(updated exports)pyrit/datasets/__init__.py(updated exports)tests/unit/datasets/test_vlsu_multimodal_dataset.py(new)pyrit/models/seed.py(added optionalprompt_textoption in the image prompt)Features:
-- Text-only prompts: When text_grade is unsafe/borderline
-- Image-only prompts: When image_grade is unsafe/borderline
-- Combined prompts: When combined_grade is unsafe/borderline (captures emergent harm)
Tests and Documentation
Some essential unit tests added in
tests/unit/datasets/test_vlsu_multimodal_dataset.py-- Test dataset name property
-- Test initialization with categories
-- Test invalid categories raise ValueError
-- Test text-only prompt creation (unsafe text grade)
-- Test image-only prompt creation (unsafe image grade)
-- Test combined prompt creation (unsafe combined grade)
-- Test all prompts created when all grades unsafe
-- Test borderline grades trigger prompt creation
-- Test no prompts when all grades safe (expects error)
-- Test category filtering
-- Test handling of failed image downloads
pre-commit run --all-filespasses