WatermarkingConfig

  • Version: 4.45.2

  • From: src/transformers/generation/configuration_utils.py

Class that holds arguments for watermark generation and should be passed into `GenerationConfig` during `generate`.
See [this paper](https://arxiv.org/abs/2306.04634) for more details on the arguments.

Accepts the following keys:
    - greenlist_ratio (`float`):
        Used for watermarking. The ratio of "green" tokens used to the vocabulary size. Defaults to 0.25.
    - bias (`float`):
        Used with watermarking. The bias added to the selected "green" tokens' logits. Defaults to 2.0.
    - hashing_key (`int`):
        Hashing key used for watermarking. Defaults to 15485863 (the millionth prime).
    - seeding_scheme (`str`):
        Algorithm to use for watermarking. Accepts values:
            - "lefthash" (default): "green" tokens selection depend on the last token (Algorithm 2 from the paper)
            - "selfhash": "green" tokens selection depends on the current token itself (Algorithm 3 from the paper)
                The downside of this scheme is that it considers all possible next tokens and can be slower than "lefthash".
    - context_width(`int`):
        The context length of previous tokens to use in seeding. Higher context length makes watermarking more robust.