Skip to content
Draft
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
8 changes: 4 additions & 4 deletions core/src/infer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -550,8 +550,8 @@ async fn backend_task(backend: Backend, mut embed_receiver: mpsc::Receiver<NextB
ModelType::Classifier => {
let results = backend.predict(batch.1).await;

// Handle sending responses in another thread to avoid starving the backend
std::thread::spawn(move || match results {
// Handle sending responses in a blocking task to avoid starving the backend
tokio::task::spawn_blocking(move || match results {
Ok((mut predictions, inference_duration)) => {
batch.0.into_iter().enumerate().for_each(|(i, m)| {
let infer_metadata = InferMetadata {
Expand Down Expand Up @@ -581,8 +581,8 @@ async fn backend_task(backend: Backend, mut embed_receiver: mpsc::Receiver<NextB
ModelType::Embedding(_) => {
let results = backend.embed(batch.1).await;

// Handle sending responses in another thread to avoid starving the backend
std::thread::spawn(move || match results {
// Handle sending responses in a blocking task to avoid starving the backend
tokio::task::spawn_blocking(move || match results {
Ok((mut embeddings, inference_duration)) => {
batch.0.into_iter().enumerate().for_each(|(i, m)| {
let metadata = InferMetadata {
Expand Down
Loading