get_prompts
Returns text prompts for a specific dataset and guidance type.Parameters
Name of the dataset to get prompts for.Supported datasets:
color_mnist: Colored MNIST digitswaterbirds: Waterbirds datasetceleba: CelebA dataset
Type of guidance to use. Can be prefixed with
guide_ or ignore_.For color_mnist:guide_numberornumber: Guide attention to digit numbersguide_colororcolor: Guide attention to colorsignore_number: Ignore number variationsignore_color: Ignore color variations
guide_ prefix if not present.Returns
Dictionary mapping prompt categories to lists of text prompts.Keys:
normal: Prompts for normal/expected attributesanomaly: Prompts for anomalous attributeshalf: Prompts for normal + half of anomaly attributesexact: Prompts for normal + all anomaly attributesall: Prompts for normal + anomaly + auxiliary attributes
guide_* modes, each value is a list of prompt lists (one per word).
For ignore_* modes, each value is a flat list of prompts.Examples
Get prompts for ColorMNIST with number guidance
Get prompts for color guidance
Using ignore mode
Working with different datasets
get_labels
Extracts attend and ignore labels from attribute tensors based on guidance type.Parameters
Name of the dataset.Supported:
color_mnist, waterbirds, celebaAttribute tensor from the dataset with shape
[num_samples, num_attrs].
Boolean values where False = normal, True = anomaly.Type of guidance (e.g.,
"guide_number", "ignore_color").Returns
Name of the attribute to attend to (e.g.,
"number" or "color").Name of the attribute to ignore.
Boolean tensor of shape
[num_samples] with labels for the attended attribute.Boolean tensor of shape
[num_samples] with labels for the ignored attribute.Examples
Extract labels for number guidance
Analyze label distribution
get_words
Returns word lists for a specific dataset and guidance type (without templates).Parameters
Name of the dataset.Supported:
color_mnist, waterbirds, celebaType of guidance (e.g.,
"guide_number", "ignore_color").Returns
Dictionary mapping word categories to lists of words.Keys:
normal, anomaly, half, exact, allFor guide_* modes: values are lists of words.
For ignore_* modes: values are flattened lists.Examples
Get words for number guidance
Get words for color guidance
Compare words vs prompts
Prompt Structure
The prompt system uses templates to generate variations of each word:Guidance Modes
- guide_*: Returns structured prompts (list of lists) for each word
- ignore_*: Returns flattened prompts (single list) for token-level matching
