Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enh: Add ignore_eos_token param to completions and chat completions endpoints #344

Merged
merged 1 commit into from
Mar 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions router/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,7 @@ struct ChatCompletionRequest {
response_format: Option<ResponseFormat>,
repetition_penalty: Option<f32>,
top_k: Option<i32>,
ignore_eos_token: Option<bool>,
}

#[derive(Clone, Debug, Deserialize, ToSchema)]
Expand All @@ -505,6 +506,7 @@ struct CompletionRequest {
// TODO(travis): add other LoRAX params here
repetition_penalty: Option<f32>,
top_k: Option<i32>,
ignore_eos_token: Option<bool>,
}

#[derive(Serialize, ToSchema)]
Expand Down Expand Up @@ -623,7 +625,7 @@ impl From<CompletionRequest> for CompatGenerateRequest {
.max_tokens
.map(|x| x as u32)
.unwrap_or(default_max_new_tokens()),
ignore_eos_token: false,
ignore_eos_token: req.ignore_eos_token.unwrap_or(false),
return_full_text: req.echo,
stop: req.stop,
truncate: None,
Expand Down Expand Up @@ -660,7 +662,7 @@ impl From<ChatCompletionRequest> for CompatGenerateRequest {
.max_tokens
.map(|x| x as u32)
.unwrap_or(default_max_new_tokens()),
ignore_eos_token: false,
ignore_eos_token: req.ignore_eos_token.unwrap_or(false),
return_full_text: None,
stop: req.stop,
truncate: None,
Expand Down
Loading