Skip to content

FIX: Handle seed prompts with metadata=None in SeedGroup - #3509

Open
ni (nniiovoo) wants to merge 1 commit into
microsoft:mainfrom
nniiovoo:fix/seed-group-none-metadata
Open

ni (nniiovoo) wants to merge 1 commit into
microsoft:mainfrom
nniiovoo:fix/seed-group-none-metadata

Conversation

@nniiovoo

Copy link
Copy Markdown
Contributor

Description

SeedPrompt.metadata can be None, but SeedGroup._prompts_to_messages passed it to MessagePiece(prompt_metadata=...), which requires a dict. So a seed group with such a prompt failed in next_message, user_messages, prepended_conversation and AttackParameters.from_seed_group_async. The PKU-SafeRLHF loader produces these seeds for every prompt without a harm category.

This passes prompt.metadata or {}, so those prompts get empty metadata like a prompt with no metadata set.

Fixes #3508

Tests and Documentation

Added test_seed_prompts_without_metadata_convert_to_messages, which covers history, the next message and user messages. It fails on main and passes with the fix. The models, executor, datasets and memory unit tests and pre-commit pass. No doc changes.

SeedPrompt.metadata can be None (the PKU-SafeRLHF loader sets it for
prompts without a harm category), but _prompts_to_messages passed it to
MessagePiece(prompt_metadata=...), which requires a dict. Building
next_message, user_messages or prepended_conversation then raised a
ValidationError.

Use an empty dict when the seed has no metadata.

Signed-off-by: NNIIOVO <haimingni44@gmail.com>

This branch has not been deployed

No deployments
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.

BUG: SeedGroup fails on seed prompts with metadata=None

1 participant