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

Add cli arg --speculation-max-batch-size #686

Merged
merged 2 commits into from
Nov 19, 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
13 changes: 13 additions & 0 deletions launcher/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,10 @@ struct Args {
#[clap(long, env)]
speculative_tokens: Option<usize>,

// The maximum batch size past which speculative decoding is disabled.
#[clap(default_value = "32", long, env)]
speculation_max_batch_size: usize,

/// The list of adapter ids to preload during initialization (to avoid cold start times).
#[clap(long, env)]
preloaded_adapter_ids: Vec<String>,
Expand Down Expand Up @@ -638,6 +642,7 @@ fn shard_manager(
quantize: Option<Quantization>,
compile: bool,
speculative_tokens: Option<usize>,
speculation_max_batch_size: usize,
preloaded_adapter_ids: Vec<String>,
preloaded_adapter_source: Option<String>,
predibase_api_token: Option<String>,
Expand Down Expand Up @@ -802,6 +807,12 @@ fn shard_manager(
envs.push(("CHUNKED_PREFILL".into(), chunked_prefill.to_string().into()));
}

// Speculative decoding max batch size
envs.push((
"LORAX_SPECULATION_MAX_BATCH_SIZE".into(),
speculation_max_batch_size.to_string().into(),
));

// Backend
if backend == Backend::FlashInfer {
envs.push(("FLASH_INFER".into(), "1".into()));
Expand Down Expand Up @@ -1244,6 +1255,7 @@ fn spawn_shards(
let quantize = args.quantize;
let compile = args.compile;
let speculative_tokens = args.speculative_tokens;
let speculation_max_batch_size = args.speculation_max_batch_size;
let preloaded_adapter_ids = args.preloaded_adapter_ids.clone();
let preloaded_adapter_source = args.preloaded_adapter_source.clone();
let predibase_api_token = args.predibase_api_token.clone();
Expand Down Expand Up @@ -1271,6 +1283,7 @@ fn spawn_shards(
quantize,
compile,
speculative_tokens,
speculation_max_batch_size,
preloaded_adapter_ids,
preloaded_adapter_source,
predibase_api_token,
Expand Down
Loading