You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
+"Top-p sampling, also known as nucleus sampling, is another text generation method that selects the next token from a subset of tokens that together have a cumulative probability of at least p. This method provides a balance between diversity and quality by considering both the probabilities of tokens and the number of tokens to sample from. A higher value for top_p (e.g., 0.95) will lead to more diverse text, while a lower value (e.g., 0.5) will generate more focused and conservative text.",
522
522
)
523
523
524
+
min_p_field=Field(
525
+
default=0.05,
526
+
ge=0.0,
527
+
le=1.0,
528
+
description="Sets a minimum base probability threshold for token selection.\n\n"
529
+
+"The Min-P sampling method was designed as an alternative to Top-P, and aims to ensure a balance of quality and variety. The parameter min_p represents the minimum probability for a token to be considered, relative to the probability of the most likely token. For example, with min_p=0.05 and the most likely token having a probability of 0.9, logits with a value less than 0.045 are filtered out.",
530
+
)
531
+
524
532
stop_field=Field(
525
533
default=None,
526
534
description="A list of tokens at which to stop generation. If None, no stop tokens are used.",
@@ -593,6 +601,7 @@ class CreateCompletionRequest(BaseModel):
593
601
max_tokens: int=max_tokens_field
594
602
temperature: float=temperature_field
595
603
top_p: float=top_p_field
604
+
min_p: float=min_p_field
596
605
echo: bool=Field(
597
606
default=False,
598
607
description="Whether to echo the prompt in the generated text. Useful for chatbots.",
@@ -788,6 +797,7 @@ class CreateChatCompletionRequest(BaseModel):
0 commit comments