Skip to content

Commit 0882883

Browse files
magdyksalehtgaddair
authored andcommitted
fix block size in health check (#742)
1 parent b38bfb0 commit 0882883

File tree

2 files changed

+27
-12
lines changed

2 files changed

+27
-12
lines changed

router/src/health.rs

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use lorax_client::{
2-
Batch, NextTokenChooserParameters, Request, ShardInfo, ShardedClient,
3-
StoppingCriteriaParameters,
2+
input_chunk, Batch, InputChunk, NextTokenChooserParameters, Request, ShardInfo, ShardedClient,
3+
StoppingCriteriaParameters, TokenizedInputs,
44
};
55
use std::sync::atomic::{AtomicBool, Ordering};
66
use std::sync::Arc;
@@ -40,7 +40,12 @@ impl Health {
4040
let generation_liveness_request = Request {
4141
id: LIVENESS_ID,
4242
inputs: "liveness".to_string(),
43-
tokenized_inputs: None,
43+
tokenized_inputs: Some(TokenizedInputs {
44+
ids: vec![75],
45+
input_chunks: vec![InputChunk {
46+
chunk: Some(input_chunk::Chunk::Text("liveness".to_string())),
47+
}],
48+
}),
4449
truncate: 10,
4550
prefill_logprobs: false,
4651
parameters: Some(NextTokenChooserParameters {
@@ -66,7 +71,7 @@ impl Health {
6671
adapter_index: 0,
6772
// Block 0 is reserved for health checks
6873
blocks: vec![0],
69-
slots: (0..16).collect(),
74+
slots: (0..self.shard_info.block_size).collect(),
7075
cache_len: 0,
7176
chunk_len: None,
7277
};
@@ -84,15 +89,20 @@ impl Health {
8489
pub(crate) async fn check_classification(&mut self) -> bool {
8590
let classify_request = Request {
8691
id: LIVENESS_ID,
87-
inputs: "San Francisco".to_string(),
88-
tokenized_inputs: None,
92+
inputs: "liveness".to_string(),
93+
tokenized_inputs: Some(TokenizedInputs {
94+
ids: vec![75],
95+
input_chunks: vec![InputChunk {
96+
chunk: Some(input_chunk::Chunk::Text("liveness".to_string())),
97+
}],
98+
}),
8999
truncate: 10,
90100
prefill_logprobs: false,
91101
parameters: None,
92102
stopping_parameters: None,
93103
adapter_index: 0,
94104
blocks: vec![0],
95-
slots: (0..16).collect(),
105+
slots: (0..self.shard_info.block_size).collect(),
96106
cache_len: 0,
97107
chunk_len: None,
98108
};
@@ -109,15 +119,20 @@ impl Health {
109119
pub(crate) async fn check_embeddings(&mut self) -> bool {
110120
let embed_request = Request {
111121
id: LIVENESS_ID,
112-
inputs: "San Francisco".to_string(),
113-
tokenized_inputs: None,
122+
inputs: "liveness".to_string(),
123+
tokenized_inputs: Some(TokenizedInputs {
124+
ids: vec![75],
125+
input_chunks: vec![InputChunk {
126+
chunk: Some(input_chunk::Chunk::Text("liveness".to_string())),
127+
}],
128+
}),
114129
truncate: 10,
115130
prefill_logprobs: false,
116131
parameters: None,
117132
stopping_parameters: None,
118133
adapter_index: 0,
119134
blocks: vec![0],
120-
slots: (0..16).collect(),
135+
slots: (0..self.shard_info.block_size).collect(),
121136
cache_len: 0,
122137
chunk_len: None,
123138
};

rust-toolchain.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[toolchain]
2-
channel = "1.79.0"
3-
components = ["rustfmt", "clippy"]
2+
channel = "1.83.0"
3+
components = ["rustfmt", "clippy"]

0 commit comments

Comments
 (0)