Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

llama: update llama.cpp to latest version #244

Merged
merged 11 commits into from
Dec 15, 2023
2 changes: 2 additions & 0 deletions .github/workflows/cicd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,12 @@ jobs:

build_and_test:
strategy:
fail-fast: false
Juzov marked this conversation as resolved.
Show resolved Hide resolved
matrix:
os: [ubuntu-latest, macos-13, windows-latest]
rust-version: [stable]
runs-on: ${{ matrix.os }}
timeout-minutes: 30
Juzov marked this conversation as resolved.
Show resolved Hide resolved
steps:
- name: Checkout repository
uses: actions/checkout@v3
Expand Down
164 changes: 149 additions & 15 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion crates/llm-chain-hnsw/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ repository = "https://github.com/sobelio/llm-chain/"

[dependencies]
async-trait.workspace = true
hnsw_rs = "0.1.19"
hnsw_rs = "0.2"
llm-chain = { path = "../llm-chain", version = "0.13.0", default-features = false }
serde.workspace = true
serde_json.workspace = true
Expand Down
17 changes: 10 additions & 7 deletions crates/llm-chain-hnsw/examples/dump_load.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use hnsw_rs::{hnswio::*, prelude::*};
use std::path::PathBuf;
use std::sync::Arc;

use llm_chain::{
Expand All @@ -16,7 +18,7 @@ async fn main() {
let hnsw_index_fn = "hnsw_index".to_string();
let mut embeddings = llm_chain_openai::embeddings::Embeddings::default();
let document_store = Arc::new(Mutex::new(InMemoryDocumentStore::<EmptyMetadata>::new()));
let mut hnsw_vs = HnswVectorStore::new(
let hnsw_vs = HnswVectorStore::new(
HnswArgs::default(),
Arc::new(embeddings),
document_store.clone(),
Expand Down Expand Up @@ -56,12 +58,13 @@ async fn main() {
// Load
println!("Loading hnsw index from file");
embeddings = llm_chain_openai::embeddings::Embeddings::default();
hnsw_vs = HnswVectorStore::load_from_file(
hnsw_index_fn,
Arc::new(embeddings),
document_store.clone(),
)
.unwrap();

let mut hnswio = HnswIo::new(PathBuf::from("."), hnsw_index_fn);
let hnsw_loaded = hnswio.load_hnsw::<f32, DistCosine>().unwrap();
let hnsw_vs =
HnswVectorStore::load_from_file(hnsw_loaded, Arc::new(embeddings), document_store.clone())
.unwrap();

println!("Loaded!");

let response = hnsw_vs
Expand Down
Loading
Loading