From 104a968d018e6f9845f142a1165b98ac6f71601c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrien=20Gallou=C3=ABt?= Date: Sat, 1 Feb 2025 20:27:31 +0000 Subject: [PATCH] Remove warmup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Adrien Gallouët --- backends/llamacpp/src/backend.rs | 34 -------------------------------- 1 file changed, 34 deletions(-) diff --git a/backends/llamacpp/src/backend.rs b/backends/llamacpp/src/backend.rs index e2fe84e8..5b44c4e6 100644 --- a/backends/llamacpp/src/backend.rs +++ b/backends/llamacpp/src/backend.rs @@ -238,38 +238,6 @@ impl Llamacpp { self.batch.n_tokens += 1; n } - - // useless ? - fn warmup(&self) { - let mut buf: Vec = Vec::new(); - - let bos = unsafe { - bindings::llama_vocab_bos(self.vocab) - }; - if bos != bindings::LLAMA_TOKEN_NULL { - buf.push(bos); - } - let eos = unsafe { - bindings::llama_vocab_eos(self.vocab) - }; - if eos != bindings::LLAMA_TOKEN_NULL { - buf.push(eos); - } - if buf.is_empty() { - warn!("Warmup failed: no bos/eos..."); - return; - } - let batch = unsafe { - bindings::llama_batch_get_one(buf.as_ptr() as _, buf.len() as _) - }; - if unsafe { bindings::llama_decode(self.ctx, batch) } != 0 { - error!("Warmup failed: llama_decode() returned an error"); - } - unsafe { - bindings::llama_kv_cache_clear(self.ctx); - bindings::llama_synchronize(self.ctx); - } - } } impl Drop for Llamacpp { @@ -456,8 +424,6 @@ impl LlamacppBackend { Ok(v) => { let _ = ok_tx.send(Ok(())); v }, Err(e) => { let _ = ok_tx.send(Err(e)); return; }, }; - llamacpp.warmup(); - let vocab = tokenizer.get_added_vocabulary(); // health() returns true