From 1d49ebf6a784458105dede65a4f8440049623ad3 Mon Sep 17 00:00:00 2001 From: AsbjornOlling Date: Tue, 25 Feb 2025 12:22:03 +0100 Subject: [PATCH 1/2] use CString::new instead of Cstring::from_Str to init chat template --- llama-cpp-2/src/model.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/llama-cpp-2/src/model.rs b/llama-cpp-2/src/model.rs index 6425dc79..9c83a795 100644 --- a/llama-cpp-2/src/model.rs +++ b/llama-cpp-2/src/model.rs @@ -4,7 +4,7 @@ use std::num::NonZeroU16; use std::os::raw::c_int; use std::path::Path; use std::ptr::NonNull; -use std::str::{FromStr, Utf8Error}; +use std::str::Utf8Error; use crate::context::params::LlamaContextParams; use crate::context::LlamaContext; @@ -47,7 +47,7 @@ impl LlamaChatTemplate { /// Create a new template from a string. This can either be the name of a llama.cpp [chat template](https://github.com/ggerganov/llama.cpp/blob/8a8c4ceb6050bd9392609114ca56ae6d26f5b8f5/src/llama-chat.cpp#L27-L61) /// like "chatml" or "llama3" or an actual Jinja template for llama.cpp to interpret. pub fn new(template: &str) -> Result { - Ok(Self(CString::from_str(template)?)) + Ok(Self(CString::new(template)?)) } /// Accesses the template as a c string reference. From ef3a8a37f59245bb65e98702ba6f3bde717b1396 Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Tue, 25 Feb 2025 19:56:04 +0000 Subject: [PATCH 2/2] Bump version to 0.1.102 [skip ci] --- Cargo.lock | 8 ++++---- examples/embeddings/Cargo.toml | 2 +- examples/simple/Cargo.toml | 2 +- llama-cpp-2/Cargo.toml | 2 +- llama-cpp-sys-2/Cargo.toml | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 37fcddd5..447bf77f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -277,7 +277,7 @@ checksum = "3dca9240753cf90908d7e4aac30f630662b02aebaa1b58a3cadabdb23385b58b" [[package]] name = "embeddings" -version = "0.1.101" +version = "0.1.102" dependencies = [ "anyhow", "clap", @@ -662,7 +662,7 @@ checksum = "643cb0b8d4fcc284004d5fd0d67ccf61dfffadb7f75e1e71bc420f4688a3a704" [[package]] name = "llama-cpp-2" -version = "0.1.101" +version = "0.1.102" dependencies = [ "encoding_rs", "enumflags2", @@ -674,7 +674,7 @@ dependencies = [ [[package]] name = "llama-cpp-sys-2" -version = "0.1.101" +version = "0.1.102" dependencies = [ "bindgen", "cc", @@ -1115,7 +1115,7 @@ checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" [[package]] name = "simple" -version = "0.1.101" +version = "0.1.102" dependencies = [ "anyhow", "clap", diff --git a/examples/embeddings/Cargo.toml b/examples/embeddings/Cargo.toml index f1067b8d..c96551ec 100644 --- a/examples/embeddings/Cargo.toml +++ b/examples/embeddings/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "embeddings" -version = "0.1.101" +version = "0.1.102" edition = "2021" [dependencies] diff --git a/examples/simple/Cargo.toml b/examples/simple/Cargo.toml index b3173a21..cb5d4e07 100644 --- a/examples/simple/Cargo.toml +++ b/examples/simple/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "simple" -version = "0.1.101" +version = "0.1.102" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/llama-cpp-2/Cargo.toml b/llama-cpp-2/Cargo.toml index 8235ca03..d85ca5af 100644 --- a/llama-cpp-2/Cargo.toml +++ b/llama-cpp-2/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "llama-cpp-2" description = "llama.cpp bindings for Rust" -version = "0.1.101" +version = "0.1.102" edition = "2021" license = "MIT OR Apache-2.0" repository = "https://github.com/utilityai/llama-cpp-rs" diff --git a/llama-cpp-sys-2/Cargo.toml b/llama-cpp-sys-2/Cargo.toml index d37a143a..0d07eefd 100644 --- a/llama-cpp-sys-2/Cargo.toml +++ b/llama-cpp-sys-2/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "llama-cpp-sys-2" description = "Low Level Bindings to llama.cpp" -version = "0.1.101" +version = "0.1.102" edition = "2021" license = "MIT OR Apache-2.0" repository = "https://github.com/utilityai/llama-cpp-rs"