-
Notifications
You must be signed in to change notification settings - Fork 578
FEAT Add JailbreakV_28k dataset from HF #1098
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
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 for getting started on this!
The integration test for datasets is missing, but I suspect it will require a custom one as the dataset is meant to be multimodal (see other comment).
"fetch_jbb_behaviors_dataset", | ||
"fetch_jbb_behaviors_by_harm_category", | ||
"fetch_jbb_behaviors_by_jbb_category", | ||
"fetch_jailbreakv_28k_dataset", |
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.
mind keeping these alphabetical? I realize we missed out on that before but no better time to fix it than now 🙂
The dataset license: mit | ||
authors: Weidi Luo, Siyuan Ma, Xiaogeng Liu, Chaowei Xiao, Xiaoyu Guo |
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 dataset license: mit | |
authors: Weidi Luo, Siyuan Ma, Xiaogeng Liu, Chaowei Xiao, Xiaoyu Guo | |
The dataset license: MIT | |
Authors: Weidi Luo, Siyuan Ma, Xiaogeng Liu, Chaowei Xiao, Xiaoyu Guo |
if image_abs_path: | ||
group_id = uuid.uuid4() | ||
text_seed_prompt = SeedPrompt( | ||
value=item.get(text_field, ""), | ||
harm_categories=[policy], | ||
prompt_group_id=group_id, | ||
data_type="text", | ||
**common_metadata, # type: ignore[arg-type] | ||
) | ||
image_seed_prompt = SeedPrompt( | ||
value=image_abs_path, | ||
harm_categories=[policy], | ||
prompt_group_id=group_id, | ||
data_type="image_path", | ||
**common_metadata, # type: ignore[arg-type] | ||
) | ||
seed_prompts.append(text_seed_prompt) | ||
seed_prompts.append(image_seed_prompt) | ||
else: | ||
missing_images += 1 |
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 image_abs_path: | |
group_id = uuid.uuid4() | |
text_seed_prompt = SeedPrompt( | |
value=item.get(text_field, ""), | |
harm_categories=[policy], | |
prompt_group_id=group_id, | |
data_type="text", | |
**common_metadata, # type: ignore[arg-type] | |
) | |
image_seed_prompt = SeedPrompt( | |
value=image_abs_path, | |
harm_categories=[policy], | |
prompt_group_id=group_id, | |
data_type="image_path", | |
**common_metadata, # type: ignore[arg-type] | |
) | |
seed_prompts.append(text_seed_prompt) | |
seed_prompts.append(image_seed_prompt) | |
else: | |
missing_images += 1 | |
if not image_abs_path: | |
missing_images += 1 | |
continue | |
group_id = uuid.uuid4() | |
text_seed_prompt = SeedPrompt( | |
value=item.get(text_field, ""), | |
harm_categories=[policy], | |
prompt_group_id=group_id, | |
data_type="text", | |
**common_metadata, # type: ignore[arg-type] | |
) | |
image_seed_prompt = SeedPrompt( | |
value=image_abs_path, | |
harm_categories=[policy], | |
prompt_group_id=group_id, | |
data_type="image_path", | |
**common_metadata, # type: ignore[arg-type] | |
) | |
seed_prompts.append(text_seed_prompt) | |
seed_prompts.append(image_seed_prompt) | |
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.e., move the second case to first and remove indentation
if not seed_prompts: | ||
raise ValueError( | ||
"JailBreakV-28K fetch produced 0 prompts. " | ||
"Likely caused by all items returned after filtering having invalid image paths." | ||
) |
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.
how many are currently missing? Should we have a cutoff (>0) at which point it should error out?
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.
Currently, the vast majority are missing, making this dataset not as useful as previously expected. I have started a discussion on HF about adding the full images folder which currently is only contained a zip file held in a separate cloud drive.
assert sum(p.data_type == "text" for p in jailbreakv_28k.prompts) == len(jailbreakv_28k.prompts) / 2 | ||
assert sum(p.data_type == "image_path" for p in jailbreakv_28k.prompts) == len(jailbreakv_28k.prompts) / 2 | ||
except Exception as e: | ||
pytest.skip(f"Integration test skipped due to: {e}") |
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.
skip? why not fail?
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.
Good point, I am not sure why I was simply going off of what I thought was the convention based on previously merged custom integration tests (jbb dataset integration)
Description
This PR adds support for the JailbreakV_28k dataset to PyRIT.
Addresses #1007
Changes Made:
Files Added/Modified:
Tests and Documentation