Skip to content

armgit / uzu

Public Imported from GitHub
0

A high-performance inference engine for AI models

Explicit AsyncBatchSize parameter

Aleksei Savine2d91bef4b69
diff --git a/crates/uzu/src/session/config/decoding_config.rs b/crates/uzu/src/session/config/decoding_config.rs
index 05a752456..4add97589 100644
--- a/crates/uzu/src/session/config/decoding_config.rs
+++ b/crates/uzu/src/session/config/decoding_config.rs
@@ -13,8 +13,8 @@ pub struct DecodingConfig {
pub prefill_step_size: PrefillStepSize,
pub speculator_config: SpeculatorConfig,
pub sampling_seed: SamplingSeed,
- pub allow_pre_encode: bool,
pub async_batch_size: AsyncBatchSize,
+ pub allow_pre_encode: bool,
}
impl DecodingConfig {
@@ -24,6 +24,7 @@ impl DecodingConfig {
prefill_step_size: PrefillStepSize,
speculator_config: SpeculatorConfig,
sampling_seed: SamplingSeed,
+ async_batch_size: AsyncBatchSize,
allow_pre_encode: bool,
) -> Self {
Self {
@@ -32,8 +33,8 @@ impl DecodingConfig {
prefill_step_size,
speculator_config,
sampling_seed,
+ async_batch_size,
allow_pre_encode,
- async_batch_size: AsyncBatchSize::default(),
}
}
@@ -50,8 +51,8 @@ impl Default for DecodingConfig {
prefill_step_size: PrefillStepSize::default(),
speculator_config: SpeculatorConfig::default(),
sampling_seed: SamplingSeed::default(),
- allow_pre_encode: true,
async_batch_size: AsyncBatchSize::default(),
+ allow_pre_encode: true,
}
}
}
@@ -107,22 +108,22 @@ impl DecodingConfig {
}
}
- pub fn with_allow_pre_encode(
+ pub fn with_async_batch_size(
&self,
- allow_pre_encode: bool,
+ async_batch_size: AsyncBatchSize,
) -> Self {
Self {
- allow_pre_encode,
+ async_batch_size,
..self.clone()
}
}
- pub fn with_async_batch_size(
+ pub fn with_allow_pre_encode(
&self,
- async_batch_size: AsyncBatchSize,
+ allow_pre_encode: bool,
) -> Self {
Self {
- async_batch_size,
+ allow_pre_encode,
..self.clone()
}
}
diff --git a/crates/uzu/src/tracer/tracer.rs b/crates/uzu/src/tracer/tracer.rs
index 1b1f01ec8..3d6bc88a4 100644
--- a/crates/uzu/src/tracer/tracer.rs
+++ b/crates/uzu/src/tracer/tracer.rs
@@ -29,8 +29,8 @@ use crate::{
session::{
config::{DecodingConfig, SpeculatorConfig},
parameter::{
- ConfigResolvableValue, ContextLength, ContextMode, PrefillStepSize,
- SamplingSeed,
+ AsyncBatchSize, ConfigResolvableValue, ContextLength, ContextMode,
+ PrefillStepSize, SamplingSeed,
},
},
};
@@ -153,6 +153,7 @@ impl Tracer {
PrefillStepSize::Custom(prefill_step_size),
SpeculatorConfig::default(),
SamplingSeed::default(),
+ AsyncBatchSize::default(),
false,
);
let mut generator_context =
@@ -183,6 +184,7 @@ impl Tracer {
PrefillStepSize::Custom(prefill_step_size),
SpeculatorConfig::default(),
sampling_seed,
+ AsyncBatchSize::default(),
false,
);
let mut generator_context =
diff --git a/crates/uzu/tests/context_mode_test.rs b/crates/uzu/tests/context_mode_test.rs
index b8b63029f..39d21ac86 100644
--- a/crates/uzu/tests/context_mode_test.rs
+++ b/crates/uzu/tests/context_mode_test.rs
@@ -5,8 +5,8 @@ use uzu::session::{
Session,
config::{DecodingConfig, RunConfig, SpeculatorConfig},
parameter::{
- ContextLength, ContextMode, PrefillStepSize, SamplingMethod,
- SamplingPolicy, SamplingSeed,
+ AsyncBatchSize, ContextLength, ContextMode, PrefillStepSize,
+ SamplingMethod, SamplingPolicy, SamplingSeed,
},
types::{Input, Message, Output},
};
@@ -22,6 +22,7 @@ fn build_decoding_config() -> DecodingConfig {
PrefillStepSize::default(),
SpeculatorConfig::default(),
SamplingSeed::Custom(42),
+ AsyncBatchSize::default(),
true,
)
}