detector_benchmark.generation.article_generator¶
Classes¶
Helper class that provides a standard way to create an ABC using |
Module Contents¶
- class detector_benchmark.generation.article_generator.ArticleGenerator(gen_model: detector_benchmark.generation.generator.LLMGenerator, gen_config: detector_benchmark.utils.configs.ModelConfig, gen_prompt_config: detector_benchmark.utils.configs.PromptConfig, max_sample_len: int, watermarking_scheme: detector_benchmark.watermark.auto_watermark.AutoWatermark = None)¶
Bases:
abc.ABC
Helper class that provides a standard way to create an ABC using inheritance.
- gen_model¶
- gen_prompt_config¶
- gen_model_config¶
- max_sample_len¶
- watermarking_scheme¶
- attack_name = ''¶
- watermarking_scheme_name = ''¶
- gen_name¶
- generate_text(prefixes, batch_size=1) list[str] ¶
Takes a list of input contexts and generates text using the model.
Parameters:¶
- prefixes: list
A list of input contexts for text generation.
- batch_size: int
The batch size to use for generation.
Returns:¶
- fake_articles: list
A list of generated text.
- set_attack_name(attack_name: str) None ¶
Public setter for the attack name.
Parameters:¶
- attack_name: str
The name of the attack.
- set_watermarking_scheme_name(watermarking_scheme_name: str) None ¶
Public setter for the watermarking scheme name.
Parameters:¶
- watermarking_scheme_name: str
The name of the watermarking scheme.
- abstract generate_adversarial_text(prefixes: list, batch_size: int = 1) list[str] ¶
This is the adversarial version of text generation. All attack should generate text at some point. Either generate text in a specific way or modify the generated text.
Parameters:¶
- prefixes: list
A list of input contexts for text generation.
- batch_size: int
The batch size to use for generation.