[watermark] compatibility validation (#56801)
Signed-off-by: Raphael Rialland <raphael.rialland@mistral.ai> Signed-off-by: Simon Veitner <sveitner@redhat.com> Co-authored-by: Simon Veitner <sveitner@redhat.com>
This commit is contained in:
co-authored by
Simon Veitner
parent
88f3c601b3
commit
c32495d58f
@@ -242,6 +242,12 @@ class AnthropicMessagesRequest(BaseModel):
|
||||
"to 256 bit)."
|
||||
),
|
||||
)
|
||||
watermarking: bool | None = Field(
|
||||
default=None,
|
||||
description=(
|
||||
"Whether to apply the engine's configured watermark to this request."
|
||||
),
|
||||
)
|
||||
kv_transfer_params: dict[str, Any] | None = Field(
|
||||
default=None,
|
||||
description="KVTransfer parameters used for disaggregated serving.",
|
||||
|
||||
@@ -613,6 +613,7 @@ class AnthropicServingMessages(OpenAIServingChat):
|
||||
temperature=anthropic_request.temperature,
|
||||
top_p=anthropic_request.top_p,
|
||||
top_k=anthropic_request.top_k,
|
||||
watermarking=anthropic_request.watermarking,
|
||||
cache_salt=anthropic_request.cache_salt,
|
||||
kv_transfer_params=anthropic_request.kv_transfer_params,
|
||||
ec_transfer_params=anthropic_request.ec_transfer_params,
|
||||
|
||||
@@ -175,6 +175,12 @@ class CohereChatV2Request(BaseModel):
|
||||
# vLLM-specific extensions (not in Cohere spec). These mirror what the
|
||||
# Anthropic and OpenAI surfaces already expose so V2 callers can reach
|
||||
# the same engine knobs when needed.
|
||||
watermarking: bool | None = Field(
|
||||
default=None,
|
||||
description=(
|
||||
"Whether to apply the engine's configured watermark to this request."
|
||||
),
|
||||
)
|
||||
kv_transfer_params: dict[str, Any] | None = Field(
|
||||
default=None,
|
||||
description="KVTransfer parameters used for disaggregated serving.",
|
||||
|
||||
@@ -557,6 +557,7 @@ class CohereServingChatV2(OpenAIServingChat):
|
||||
temperature=request.temperature,
|
||||
top_p=request.p,
|
||||
top_k=request.k,
|
||||
watermarking=request.watermarking,
|
||||
seed=request.seed,
|
||||
frequency_penalty=request.frequency_penalty,
|
||||
presence_penalty=request.presence_penalty,
|
||||
|
||||
@@ -82,7 +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)
|
||||
self.llm_engine.input_processor.resolve_watermarking(params)
|
||||
|
||||
tokenizer = self.renderer.get_tokenizer()
|
||||
eos_token_id = tokenizer.eos_token_id
|
||||
@@ -120,6 +120,7 @@ class BeamSearchOfflineMixin(OfflineInferenceMixin):
|
||||
logprobs=2 * beam_width,
|
||||
max_tokens=1,
|
||||
temperature=temperature,
|
||||
watermarking=False,
|
||||
detokenize=False,
|
||||
skip_clone=True, # Internal beam search, safe to skip clone
|
||||
)
|
||||
@@ -457,6 +458,7 @@ class BeamSearchOfflineMixin(OfflineInferenceMixin):
|
||||
logprobs=base_params.logprobs,
|
||||
max_tokens=1,
|
||||
temperature=base_params.temperature,
|
||||
watermarking=base_params.watermarking,
|
||||
detokenize=False,
|
||||
allowed_token_ids=(
|
||||
allowed_ids
|
||||
|
||||
@@ -40,6 +40,7 @@ class BeamSearchOnlineMixin(ABC):
|
||||
temperature = params.temperature
|
||||
length_penalty = params.length_penalty
|
||||
include_stop_str_in_output = params.include_stop_str_in_output
|
||||
self.engine_client.input_processor.resolve_watermarking(params)
|
||||
|
||||
tokenizer = self.renderer.get_tokenizer()
|
||||
eos_token_id = tokenizer.eos_token_id
|
||||
@@ -62,6 +63,7 @@ class BeamSearchOnlineMixin(ABC):
|
||||
logprobs=logprobs_num,
|
||||
max_tokens=1,
|
||||
temperature=temperature,
|
||||
watermarking=False,
|
||||
detokenize=False,
|
||||
)
|
||||
all_beams = [
|
||||
|
||||
@@ -261,6 +261,7 @@ class ServingGenerativeScoring(BaseServing):
|
||||
logprobs=len(request.label_token_ids),
|
||||
logprob_token_ids=request.label_token_ids,
|
||||
n=1,
|
||||
watermarking=False,
|
||||
)
|
||||
|
||||
# Get trace headers
|
||||
|
||||
@@ -268,7 +268,7 @@ class ChatCompletionRequest(OpenAIBaseModel):
|
||||
top_k: int | None = None
|
||||
min_p: float | None = None
|
||||
repetition_penalty: float | None = None
|
||||
watermarking: bool = True
|
||||
watermarking: bool | None = None
|
||||
length_penalty: float = 1.0
|
||||
stop_token_ids: list[int] | None = []
|
||||
include_stop_str_in_output: bool = False
|
||||
@@ -647,6 +647,7 @@ class ChatCompletionRequest(OpenAIBaseModel):
|
||||
max_tokens=max_tokens,
|
||||
ignore_eos=self.ignore_eos,
|
||||
temperature=temperature,
|
||||
watermarking=self.watermarking,
|
||||
length_penalty=self.length_penalty,
|
||||
include_stop_str_in_output=self.include_stop_str_in_output,
|
||||
skip_special_tokens=self.skip_special_tokens,
|
||||
@@ -1100,6 +1101,7 @@ class BatchChatCompletionRequest(OpenAIBaseModel):
|
||||
top_k: int | None = None
|
||||
min_p: float | None = None
|
||||
repetition_penalty: float | None = None
|
||||
watermarking: bool | None = None
|
||||
length_penalty: float | None = 1.0
|
||||
early_stopping: bool = False
|
||||
structured_outputs: StructuredOutputsParams | None = None
|
||||
|
||||
@@ -75,7 +75,7 @@ class CompletionRequest(OpenAIBaseModel):
|
||||
top_k: int | None = None
|
||||
min_p: float | None = None
|
||||
repetition_penalty: float | None = None
|
||||
watermarking: bool = True
|
||||
watermarking: bool | None = None
|
||||
length_penalty: float = 1.0
|
||||
stop_token_ids: list[int] | None = []
|
||||
include_stop_str_in_output: bool = False
|
||||
@@ -303,6 +303,7 @@ class CompletionRequest(OpenAIBaseModel):
|
||||
max_tokens=max_tokens,
|
||||
ignore_eos=self.ignore_eos,
|
||||
temperature=temperature,
|
||||
watermarking=self.watermarking,
|
||||
length_penalty=self.length_penalty,
|
||||
include_stop_str_in_output=self.include_stop_str_in_output,
|
||||
skip_special_tokens=self.skip_special_tokens,
|
||||
|
||||
@@ -245,7 +245,7 @@ class ResponsesRequest(OpenAIBaseModel):
|
||||
)
|
||||
|
||||
# --8<-- [start:responses-extra-params]
|
||||
watermarking: bool = True
|
||||
watermarking: bool | None = None
|
||||
request_id: str = Field(
|
||||
default_factory=lambda: f"resp_{random_uuid()}",
|
||||
description=(
|
||||
|
||||
@@ -229,6 +229,7 @@ class SpeechToTextBaseServing(GenerateBaseServing):
|
||||
max_tokens=1,
|
||||
temperature=0.0,
|
||||
allowed_token_ids=allowed_token_ids,
|
||||
watermarking=False,
|
||||
)
|
||||
|
||||
result_generator = self.engine_client.generate(
|
||||
|
||||
@@ -151,6 +151,9 @@ class TranscriptionRequest(OpenAIBaseModel):
|
||||
to automatically increase the temperature until certain thresholds are hit.
|
||||
"""
|
||||
|
||||
watermarking: bool | None = None
|
||||
"""Whether to apply the engine's configured watermark to this request."""
|
||||
|
||||
top_p: float | None = None
|
||||
"""Enables nucleus (top-p) sampling, where tokens are selected from the
|
||||
smallest possible set whose cumulative probability exceeds `p`.
|
||||
@@ -226,6 +229,7 @@ class TranscriptionRequest(OpenAIBaseModel):
|
||||
beam_width=n,
|
||||
max_tokens=max_tokens,
|
||||
temperature=temperature,
|
||||
watermarking=self.watermarking,
|
||||
length_penalty=self.length_penalty,
|
||||
include_stop_str_in_output=self.include_stop_str_in_output,
|
||||
)
|
||||
@@ -264,6 +268,7 @@ class TranscriptionRequest(OpenAIBaseModel):
|
||||
|
||||
return SamplingParams.from_optional(
|
||||
temperature=temperature,
|
||||
watermarking=self.watermarking,
|
||||
max_tokens=max_tokens,
|
||||
seed=self.seed,
|
||||
top_p=top_p,
|
||||
|
||||
@@ -102,6 +102,9 @@ class TranslationRequest(OpenAIBaseModel):
|
||||
to automatically increase the temperature until certain thresholds are hit.
|
||||
"""
|
||||
|
||||
watermarking: bool | None = None
|
||||
"""Whether to apply the engine's configured watermark to this request."""
|
||||
|
||||
top_p: float | None = None
|
||||
"""Enables nucleus (top-p) sampling, where tokens are selected from the
|
||||
smallest possible set whose cumulative probability exceeds `p`.
|
||||
@@ -215,6 +218,7 @@ class TranslationRequest(OpenAIBaseModel):
|
||||
beam_width=n,
|
||||
max_tokens=max_tokens,
|
||||
temperature=temperature,
|
||||
watermarking=self.watermarking,
|
||||
length_penalty=self.length_penalty,
|
||||
include_stop_str_in_output=self.include_stop_str_in_output,
|
||||
)
|
||||
@@ -251,6 +255,7 @@ class TranslationRequest(OpenAIBaseModel):
|
||||
|
||||
return SamplingParams.from_optional(
|
||||
temperature=temperature,
|
||||
watermarking=self.watermarking,
|
||||
max_tokens=max_tokens,
|
||||
seed=self.seed,
|
||||
top_p=top_p,
|
||||
|
||||
Reference in New Issue
Block a user