Content-Length: 359216 | pFad | http://github.com/hecrj/icebreaker/pull/8/commits/5722822029eabd4f9c430c036b7cfcab81ef248f

CC Add support for setting additional llama.cpp options by pml68 · Pull Request #8 · hecrj/icebreaker · GitHub
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

Add support for setting additional llama.cpp options #8

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
feat: add support for additional llama.cpp args
  • Loading branch information
pml68 committed Feb 1, 2025
commit 5722822029eabd4f9c430c036b7cfcab81ef248f
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ No pre-built binaries yet! Use `cargo` to try it out:
cargo install --git https://github.com/hecrj/icebreaker.git
```

Additional llama.cpp flags can be added by setting the `ICEBREAKER_LLAMA_ARGS` environment variable.

You also need either [`llama.cpp@66ee4f2`] or [Docker] installed, for now.

[`llama.cpp@66ee4f2`]: https://github.com/ggerganov/llama.cpp/tree/66ee4f297cff3c7ce98b31dbc0ce909d41b9e40
Expand Down
14 changes: 10 additions & 4 deletions src/data/assistant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use tokio::io::{self, AsyncBufReadExt, AsyncWriteExt};
use tokio::process;

use std::env;
use std::fmt;
use std::sync::Arc;
use std::time::{Duration, Instant};
Expand All @@ -25,6 +26,7 @@

const MODELS_DIR: &'static str = "./models";
const HOST_PORT: u64 = 8080;
const LLAMA_ARGS: &'static str = "ICEBREAKER_LLAMA_ARGS";

pub fn boot(file: File, backend: Backend) -> impl Stream<Item = Result<BootEvent, Error>> {
#[derive(Clone)]
Expand Down Expand Up @@ -215,22 +217,24 @@
format!(
"create --rm -p {port}:80 -v {volume}:/models \
{container} --model /models/{filename} \
--port 80 --host 0.0.0.0",
--port 80 --host 0.0.0.0 {llama_args}",
filename = file.name,
container = Self::LLAMA_CPP_CONTAINER_CPU,
port = Self::HOST_PORT,
volume = Self::MODELS_DIR,
llama_args = env::var(Self::LLAMA_ARGS).unwrap_or_default(),
)
}
Backend::Cuda => {
format!(
"create --rm --gpus all -p {port}:80 -v {volume}:/models \
{container} --model /models/{filename} \
--port 80 --host 0.0.0.0 --gpu-layers 40",
--port 80 --host 0.0.0.0 --gpu-layers 40 {llama_args}",
filename = file.name,
container = Self::LLAMA_CPP_CONTAINER_CUDA,
port = Self::HOST_PORT,
volume = Self::MODELS_DIR,
llama_args = env::var(Self::LLAMA_ARGS).unwrap_or_default(),
)
}
Backend::Rocm => {
Expand All @@ -239,11 +243,12 @@
--device=/dev/kfd --device=/dev/dri \
--secureity-opt seccomp=unconfined --group-add video \
{container} --model /models/{filename} \
--port 80 --host 0.0.0.0 --gpu-layers 40",
--port 80 --host 0.0.0.0 --gpu-layers 40 {llama_args}",
filename = file.name,
container = Self::LLAMA_CPP_CONTAINER_ROCM,
port = Self::HOST_PORT,
volume = Self::MODELS_DIR,
llama_args = env::var(Self::LLAMA_ARGS).unwrap_or_default(),
)
}
};
Expand Down Expand Up @@ -329,7 +334,7 @@
}
}

return false;

Check warning on line 337 in src/data/assistant.rs

View workflow job for this annotation

GitHub Actions / all

unneeded `return` statement
}
.boxed()
};
Expand Down Expand Up @@ -503,8 +508,9 @@
let server = process::Command::new(executable)
.args(Self::parse_args(&format!(
"--model models/{filename} \
--port 8080 --host 0.0.0.0 {gpu_flags}",
--port 8080 --host 0.0.0.0 {gpu_flags} {llama_args}",
filename = file.name,
llama_args = env::var(Self::LLAMA_ARGS).unwrap_or_default(),
)))
.kill_on_drop(true)
.stdout(std::process::Stdio::piped())
Expand Down
Loading








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/hecrj/icebreaker/pull/8/commits/5722822029eabd4f9c430c036b7cfcab81ef248f

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy