Skip to content

Commit

Permalink
cloud build for cpp-rllm
Browse files Browse the repository at this point in the history
  • Loading branch information
mmoskal committed Jan 22, 2024
1 parent 2ef82c1 commit db8b65d
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 3 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/cpp-rllm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: rLLM with llama.cpp

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

env:
CARGO_TERM_COLOR: always

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- name: Build cpp-rllm
run: cargo build --verbose --release --no-default-features
working-directory: cpp-rllm
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions cpp-rllm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,13 @@ edition = "2021"

[dependencies]
actix-web = "4.4.0"
llama_cpp_low = { path = "../llama-cpp-low" }
rllm = { path = "../rllm", default-features = false, features = ["llamacpp"] }

[[bin]]
name = "cpp-rllm"
path = "src/cpp-rllm.rs"

[features]
default = ["cuda"]
cuda = ["llama_cpp_low/cuda"]
5 changes: 5 additions & 0 deletions cpp-rllm/server.sh → cpp-rllm/cpp-server.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ if [ "$1" = bench ] ; then
shift
fi

if [ "$1" = cpu ] ; then
REL="--release --no-default-features"
shift
fi

case "$1" in
orca )
ARGS="-m https://huggingface.co/TheBloke/Orca-2-13B-GGUF/blob/main/orca-2-13b.Q8_0.gguf -t orca"
Expand Down
4 changes: 4 additions & 0 deletions llama-cpp-low/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,7 @@ num_cpus = "1.16.0"
[build-dependencies]
bindgen = "0.69.2"
cmake = "0.1.50"

[features]
default = []
cuda = []
4 changes: 2 additions & 2 deletions llama-cpp-low/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const SUBMODULE_DIR: &str = concat!(env!("CARGO_MANIFEST_DIR"), "/llama.cpp");

fn main() {
let ccache = true;
let cuda = true;
let cuda = std::env::var("CARGO_FEATURE_CUDA").unwrap_or(String::new());

let submodule_dir = &PathBuf::from(SUBMODULE_DIR);
let header_path = submodule_dir.join("llama.h");
Expand All @@ -29,7 +29,7 @@ fn main() {
.configure_arg("-DCMAKE_CUDA_COMPILER_LAUNCHER=ccache");
}

if cuda {
if cuda == "1" {
cmake.configure_arg("-DLLAMA_CUBLAS=ON");
println!("cargo:rustc-link-search=/usr/local/cuda/lib64");
println!("cargo:rustc-link-lib=cuda");
Expand Down
2 changes: 1 addition & 1 deletion rllm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,5 @@ rayon = "1.7.0"
#default = ["llamacpp"]
default = ["tch", "cuda"]
tch = ["dep:tch", "dep:torch-sys"]
cuda = ["tch", "dep:tch-cuda", "dep:cudarc"]
cuda = ["tch", "dep:tch-cuda", "dep:cudarc", "llama_cpp_low?/cuda"]
llamacpp = ["dep:llama_cpp_low"]

0 comments on commit db8b65d

Please sign in to comment.