From f1285003f9bcdecb6c92898224215f451ce1b5f4 Mon Sep 17 00:00:00 2001 From: marcus Date: Wed, 3 Jan 2024 11:53:00 -0800 Subject: [PATCH] fixed example v2 --- llama-cpp-2/src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/llama-cpp-2/src/lib.rs b/llama-cpp-2/src/lib.rs index ba2ea843..2cc3f6e9 100644 --- a/llama-cpp-2/src/lib.rs +++ b/llama-cpp-2/src/lib.rs @@ -33,7 +33,7 @@ //! let mut pos: i32 = 0; //! //! // add the prompt to the batch -//! let last_index = i32::try_from(tokens.len()).unwrap() - 1; +//! let last_index = i32::try_from(tokens.len())? - 1; //! for token in tokens { //! batch.add(token, pos, &[0], pos == last_index); //! pos += 1; @@ -47,8 +47,8 @@ //! let token = context.sample_token_greedy(LlamaTokenDataArray::from_iter(context.candidates_ith(batch.n_tokens()), false)); //! response.push(token); //! batch.clear(); -//! pos += 1; //! batch.add(token, pos, &[0], true); +//! pos += 1; //! } //! //! let response_str = model.tokens_to_str(&response)?;