Crates.io | rs-llama-cpp |
lib.rs | rs-llama-cpp |
version | 0.1.67 |
source | src |
created_at | 2023-06-11 15:00:46.819266 |
updated_at | 2023-08-09 01:03:56.547736 |
description | Automated Rust bindings generation for LLaMA.cpp |
homepage | https://github.com/fardjad/rs-llama-cpp |
repository | https://github.com/fardjad/rs-llama-cpp |
max_upload_size | |
id | 887430 |
size | 5,216,107 |
Automated Rust bindings generation for LLaMA.cpp
LLaMA.cpp is under heavy development with contributions pouring in from numerous individuals every day. Currently, its C API is very low-level and given how fast the project is evolving, keeping up with the changes and porting the examples into a higher-level API prove to be difficult. As a trade-off, this project prioritizes automation over flexibility by automatically generating Rust bindings for the main example of LLaMA.cpp.
The main design goal of this project is to minimize the effort of updating LLaMA.cpp by automating as many steps as possible. However, this approach does have some limitations:
std::unordered_map
and std::vector
.stderr
and stdout
. This is not configurable at the momentuse rs_llama_cpp::{gpt_params_c, run_inference, str_to_mut_i8};
fn main() {
let params: gpt_params_c = {
gpt_params_c {
model: str_to_mut_i8("/path/to/model.bin"),
prompt: str_to_mut_i8("Hello "),
..Default::default()
}
};
run_inference(params, |token| {
println!("Token: {}", token);
if token.ends_with("\n") {
return false; // stop inference
}
return true; // continue inference
});
}