Unverified Commit 6336eea4 authored by Nathan Barry's avatar Nathan Barry Committed by GitHub
Browse files

fix: Remove constant gpt-2 token_id upper bound check (#3760)


Co-authored-by: default avatarRyan McCormick <rmccormick@nvidia.com>
parent f7244d1c
......@@ -85,8 +85,6 @@ pub const MAX_TOOLS: usize = 128;
// Metadata validation constants removed - we are no longer restricting the metadata field char limits
/// Maximum allowed length for function names
pub const MAX_FUNCTION_NAME_LENGTH: usize = 64;
/// Maximum allowed value for Prompt IntegerArray elements
pub const MAX_PROMPT_TOKEN_ID: u32 = 50256;
/// Minimum allowed value for `repetition_penalty`
pub const MIN_REPETITION_PENALTY: f32 = 0.0;
/// Maximum allowed value for `repetition_penalty`
......@@ -440,16 +438,6 @@ pub fn validate_prompt(prompt: &dynamo_async_openai::types::Prompt) -> Result<()
if arr.is_empty() {
anyhow::bail!("Prompt integer array cannot be empty");
}
for (i, &token_id) in arr.iter().enumerate() {
if token_id > MAX_PROMPT_TOKEN_ID {
anyhow::bail!(
"Token ID at index {} must be between 0 and {}, got {}",
i,
MAX_PROMPT_TOKEN_ID,
token_id
);
}
}
}
dynamo_async_openai::types::Prompt::ArrayOfIntegerArray(arr) => {
if arr.is_empty() {
......@@ -459,17 +447,6 @@ pub fn validate_prompt(prompt: &dynamo_async_openai::types::Prompt) -> Result<()
if inner_arr.is_empty() {
anyhow::bail!("Prompt integer array at index {} cannot be empty", i);
}
for (j, &token_id) in inner_arr.iter().enumerate() {
if token_id > MAX_PROMPT_TOKEN_ID {
anyhow::bail!(
"Token ID at index [{}][{}] must be between 0 and {}, got {}",
i,
j,
MAX_PROMPT_TOKEN_ID,
token_id
);
}
}
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment