garak.buffs.paraphrase

Buff that paraphrases a prompt.

class Fast(config_root=<module 'garak._config' from '/home/docs/checkouts/readthedocs.org/user_builds/garak/checkouts/latest/docs/source/../../garak/_config.py'>)Source

Bases: Buff, HFCompatible

CPU-friendly paraphrase buff based on Humarin’s T5 paraphraser

Configurable parameters:

DEFAULT_PARAMS contents:

  • para_model_name = 'garak-llm/chatgpt_paraphraser_on_T5_base'

  • hf_args = {'device': 'cpu', 'torch_dtype': 'float32', 'custom_generate': 'transformers-community/group-beam-search', 'trust_remote_code': True}

Default values are listed

See also Configuring garak for how to set these values.

Other attributes:

doc_uri = 'https://huggingface.co/humarin/chatgpt_paraphraser_on_T5_base'
lang = 'en'
transform(attempt: Attempt) Iterable[Attempt]Source

attempt copying is handled elsewhere. isn’t that nice

class PegasusT5(config_root=<module 'garak._config' from '/home/docs/checkouts/readthedocs.org/user_builds/garak/checkouts/latest/docs/source/../../garak/_config.py'>)Source

Bases: Buff, HFCompatible

Paraphrasing buff using Pegasus model

Configurable parameters:

DEFAULT_PARAMS contents:

  • para_model_name = 'garak-llm/pegasus_paraphrase'

  • hf_args = {'device': 'cpu', 'trust_remote_code': False}

  • max_length = 60

  • temperature = 1.5

Default values are listed

See also Configuring garak for how to set these values.

Other attributes:

doc_uri = 'https://huggingface.co/tuner007/pegasus_paraphrase'
lang = 'en'
transform(attempt: Attempt) Iterable[Attempt]Source

attempt copying is handled elsewhere. isn’t that nice