diff --git a/Cargo.lock b/Cargo.lock index 1e0f2685..e2e7bf63 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -68,9 +68,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.97" +version = "1.0.98" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcfed56ad506cb2c684a14971b8861fdc3baaaae314b9e5f9bb532cbe3ba7a4f" +checksum = "e16d2d3311acee920a9eb8d33b8cbc1787ce4a264e85f964c2404b969bdcd487" [[package]] name = "base64" @@ -109,9 +109,9 @@ checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" [[package]] name = "cc" -version = "1.2.17" +version = "1.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fcb57c740ae1daf453ae85f16e37396f672b039e00d9d866e07ddb24e328e3a" +checksum = "8e3a13707ac958681c13b39b458c073d0d9bc8a22cb1b2f4c8e55eb72c13f362" dependencies = [ "jobserver", "libc", @@ -146,9 +146,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.34" +version = "4.5.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e958897981290da2a852763fe9cdb89cd36977a5d729023127095fa94d95e2ff" +checksum = "2df961d8c8a0d08aa9945718ccf584145eee3f3aa06cddbeac12933781102e04" dependencies = [ "clap_builder", "clap_derive", @@ -156,9 +156,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.34" +version = "4.5.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83b0f35019843db2160b5bb19ae09b4e6411ac33fc6a712003c33e03090e2489" +checksum = "132dbda40fb6753878316a489d5a1242a8ef2f0d9e47ba01c951ea8aa7d013a5" dependencies = [ "anstream", "anstyle", @@ -762,9 +762,9 @@ checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] name = "openssl" -version = "0.10.70" +version = "0.10.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61cfb4e166a8bb8c9b55c500bc2308550148ece889be90f609377e58140f42c6" +checksum = "fedfea7d58a1f73118430a55da6a286e7b044961736ce96a16a17068ea25e5da" dependencies = [ "bitflags", "cfg-if", @@ -794,9 +794,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-sys" -version = "0.9.105" +version = "0.9.107" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b22d5b84be05a8d6947c7cb71f7c849aa0f112acd4bf51c2a7c1c988ac0a9dc" +checksum = "8288979acd84749c744a9014b4382d42b8f7b2592847b5afb2ed29e5d16ede07" dependencies = [ "cc", "libc", diff --git a/Cargo.toml b/Cargo.toml index 1bc7de90..656fce3d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,9 +19,9 @@ hf-hub = { version = "0.3.2" } criterion = "0.5.1" pprof = "0.13.0" bindgen = "0.69.5" -cc = "1.2.17" -anyhow = "1.0.97" -clap = "4.5.34" +cc = "1.2.19" +anyhow = "1.0.98" +clap = "4.5.36" encoding_rs = "0.8.35" tracing-subscriber = { version = "0.3", features = ["json"] } diff --git a/llama-cpp-2/src/lib.rs b/llama-cpp-2/src/lib.rs index 1ffbca2b..f2ac5313 100644 --- a/llama-cpp-2/src/lib.rs +++ b/llama-cpp-2/src/lib.rs @@ -217,6 +217,8 @@ pub enum LlamaLoraAdapterRemoveError { /// get the time (in microseconds) according to llama.cpp /// ``` /// # use llama_cpp_2::llama_time_us; +/// # use llama_cpp_2::llama_backend::LlamaBackend; +/// let backend = LlamaBackend::init().unwrap(); /// let time = llama_time_us(); /// assert!(time > 0); /// ``` @@ -311,6 +313,8 @@ pub enum ApplyChatTemplateError { /// /// ``` /// # use std::time::Duration; +/// # use llama_cpp_2::llama_backend::LlamaBackend; +/// let backend = LlamaBackend::init().unwrap(); /// use llama_cpp_2::ggml_time_us; /// /// let start = ggml_time_us(); diff --git a/llama-cpp-2/src/sampling.rs b/llama-cpp-2/src/sampling.rs index a659ab73..96feb402 100644 --- a/llama-cpp-2/src/sampling.rs +++ b/llama-cpp-2/src/sampling.rs @@ -117,6 +117,8 @@ impl LlamaSampler { /// data_array::LlamaTokenDataArray /// }; /// use llama_cpp_2::sampling::LlamaSampler; + /// use llama_cpp_2::llama_backend::LlamaBackend; + /// let backend = LlamaBackend::init().unwrap(); /// /// let mut data_array = LlamaTokenDataArray::new(vec![ /// LlamaTokenData::new(LlamaToken(0), 0., 0.), diff --git a/llama-cpp-sys-2/Cargo.toml b/llama-cpp-sys-2/Cargo.toml index 6db13f98..4fd842ee 100644 --- a/llama-cpp-sys-2/Cargo.toml +++ b/llama-cpp-sys-2/Cargo.toml @@ -12,9 +12,9 @@ include = [ "build.rs", "/src", - "/llama.cpp/common/*.h", - "/llama.cpp/common/*.hpp", - "/llama.cpp/common/*.cpp", + "/llama.cpp/common/**/*.h", + "/llama.cpp/common/**/*.hpp", + "/llama.cpp/common/**/*.cpp", "/llama.cpp/ggml/include/*.h", "/llama.cpp/ggml/src/*.h", "/llama.cpp/ggml/src/*.c", @@ -88,4 +88,4 @@ vulkan = [] native = [] openmp = [] # Only has an impact on Android. -shared-stdcxx = [] \ No newline at end of file +shared-stdcxx = [] diff --git a/llama-cpp-sys-2/build.rs b/llama-cpp-sys-2/build.rs index e2a56b38..5b39722d 100644 --- a/llama-cpp-sys-2/build.rs +++ b/llama-cpp-sys-2/build.rs @@ -267,6 +267,7 @@ fn main() { config.define("LLAMA_BUILD_TESTS", "OFF"); config.define("LLAMA_BUILD_EXAMPLES", "OFF"); config.define("LLAMA_BUILD_SERVER", "OFF"); + config.define("LLAMA_CURL", "OFF"); config.define( "BUILD_SHARED_LIBS", diff --git a/llama-cpp-sys-2/llama.cpp b/llama-cpp-sys-2/llama.cpp index 2b65ae30..ceda28ef 160000 --- a/llama-cpp-sys-2/llama.cpp +++ b/llama-cpp-sys-2/llama.cpp @@ -1 +1 @@ -Subproject commit 2b65ae30299b9c67e25c51ee567e9a2ef22279ab +Subproject commit ceda28ef8e310a8dee60bf275077a3eedae8e36c diff --git a/test-build.Dockerfile b/test-build.Dockerfile index 8540d2f9..383e0973 100644 --- a/test-build.Dockerfile +++ b/test-build.Dockerfile @@ -1,16 +1,16 @@ ARG CUDA_VERSION=12.3.1 ARG UBUNTU_VERSION=22.04 -FROM nvcr.io/nvidia/cuda:${CUDA_VERSION}-devel-ubuntu${UBUNTU_VERSION} as base-cuda +FROM nvcr.io/nvidia/cuda:${CUDA_VERSION}-devel-ubuntu${UBUNTU_VERSION} AS base-cuda # Install requirements for rustup install + bindgen: https://rust-lang.github.io/rust-bindgen/requirements.html -RUN DEBIAN_FRONTEND=noninteractive apt update -y && apt install -y curl llvm-dev libclang-dev clang pkg-config libssl-dev +RUN DEBIAN_FRONTEND=noninteractive apt update -y && apt install -y curl llvm-dev libclang-dev clang pkg-config libssl-dev cmake git RUN curl https://sh.rustup.rs -sSf | bash -s -- -y ENV PATH=/root/.cargo/bin:$PATH COPY . . RUN cargo build --bin simple --features cuda -FROM nvcr.io/nvidia/cuda:${CUDA_VERSION}-runtime-ubuntu${UBUNTU_VERSION} as base-cuda-runtime +FROM nvcr.io/nvidia/cuda:${CUDA_VERSION}-runtime-ubuntu${UBUNTU_VERSION} AS base-cuda-runtime COPY --from=base-cuda /target/debug/simple /usr/local/bin/simple