[feature] Watermarked generation and detection (Gumbel-max algorithm) (#54053)
Signed-off-by: Raphael Rialland <raphael.rialland@mistral.ai> Co-authored-by: OpenAI Codex <codex@openai.com> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
This commit is contained in:
co-authored by
OpenAI Codex
mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
parent
8c34a37232
commit
ea40bb9e90
@@ -82,6 +82,7 @@ class BeamSearchOfflineMixin(OfflineInferenceMixin):
|
||||
temperature = params.temperature
|
||||
ignore_eos = params.ignore_eos
|
||||
length_penalty = params.length_penalty
|
||||
self.llm_engine.vllm_config._check_watermarking_unsupported(beam_search=True)
|
||||
|
||||
tokenizer = self.renderer.get_tokenizer()
|
||||
eos_token_id = tokenizer.eos_token_id
|
||||
|
||||
@@ -267,6 +267,7 @@ class ChatCompletionRequest(OpenAIBaseModel):
|
||||
top_k: int | None = None
|
||||
min_p: float | None = None
|
||||
repetition_penalty: float | None = None
|
||||
watermarking: bool = True
|
||||
length_penalty: float = 1.0
|
||||
stop_token_ids: list[int] | None = []
|
||||
include_stop_str_in_output: bool = False
|
||||
@@ -724,6 +725,7 @@ class ChatCompletionRequest(OpenAIBaseModel):
|
||||
frequency_penalty=self.frequency_penalty,
|
||||
repetition_penalty=repetition_penalty,
|
||||
temperature=temperature,
|
||||
watermarking=self.watermarking,
|
||||
top_p=top_p,
|
||||
top_k=top_k,
|
||||
min_p=min_p,
|
||||
|
||||
@@ -75,6 +75,7 @@ class CompletionRequest(OpenAIBaseModel):
|
||||
top_k: int | None = None
|
||||
min_p: float | None = None
|
||||
repetition_penalty: float | None = None
|
||||
watermarking: bool = True
|
||||
length_penalty: float = 1.0
|
||||
stop_token_ids: list[int] | None = []
|
||||
include_stop_str_in_output: bool = False
|
||||
@@ -373,6 +374,7 @@ class CompletionRequest(OpenAIBaseModel):
|
||||
frequency_penalty=self.frequency_penalty,
|
||||
repetition_penalty=repetition_penalty,
|
||||
temperature=temperature,
|
||||
watermarking=self.watermarking,
|
||||
top_p=top_p,
|
||||
top_k=top_k,
|
||||
min_p=min_p,
|
||||
|
||||
@@ -213,6 +213,7 @@ class ResponsesRequest(OpenAIBaseModel):
|
||||
)
|
||||
|
||||
# --8<-- [start:responses-extra-params]
|
||||
watermarking: bool = True
|
||||
request_id: str = Field(
|
||||
default_factory=lambda: f"resp_{random_uuid()}",
|
||||
description=(
|
||||
@@ -436,6 +437,7 @@ class ResponsesRequest(OpenAIBaseModel):
|
||||
|
||||
return SamplingParams.from_optional(
|
||||
temperature=temperature,
|
||||
watermarking=self.watermarking,
|
||||
top_p=top_p,
|
||||
top_k=top_k,
|
||||
max_tokens=max_tokens,
|
||||
|
||||
@@ -268,7 +268,7 @@ def jsonify_non_default_args(
|
||||
|
||||
|
||||
# Fields whose values must never be logged verbatim.
|
||||
_SENSITIVE_ARG_FIELDS = frozenset({"api_key", "hf_token"})
|
||||
_SENSITIVE_ARG_FIELDS = frozenset({"api_key", "hf_token", "watermark_config"})
|
||||
|
||||
|
||||
def redact_sensitive_args(args: dict[str, Any]) -> dict[str, Any]:
|
||||
|
||||
Reference in New Issue
Block a user