Skip to content

Commit

Permalink
Merge branch 'main' into embeddings-plus-updated-llama.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
williamhogman authored Dec 17, 2023
2 parents 5333d50 + cb03333 commit 0e29158
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
8 changes: 8 additions & 0 deletions crates/llm-chain-llama-sys/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,11 @@ To update the llama.cpp submodule, run the following command:
```console
$ git submodule update --remote --merge llama.cpp
```
Then to save the generated bindings run the build and set the environment
variable `LLAMA_SAVE_BINDINGS` to `true`:

```console
$ env LLAMA_SAVE_BINDINGS=true cargo build --release
```

And then check-in the generated bindings in `src/bindings.rs`.
12 changes: 9 additions & 3 deletions crates/llm-chain-llama-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,15 @@ fn main() {
let out_path = PathBuf::from(env::var("OUT_DIR").unwrap());
b.write_to_file(out_path.join("bindings.rs"))
.expect("Couldn't write bindings!");
let out_path = PathBuf::from("src");
b.write_to_file(out_path.join("bindings.rs"))
.expect("Couldn't write binding to src directorys!");

let save_bindings = env::var("LLAMA_SAVE_BINDINGS")
.map(|value| value == "true")
.unwrap_or(false);
if save_bindings {
let out_path = PathBuf::from("src");
b.write_to_file(out_path.join("bindings.rs"))
.expect("Couldn't write binding to src directorys!");
}
}
Err(e) => {
println!("cargo:warning=Unable to generate bindings: {}", e);
Expand Down

0 comments on commit 0e29158

Please sign in to comment.