Unverified Commit 9907d104 authored by Graham King's avatar Graham King Committed by GitHub
Browse files

fix: Allow building only llamacpp or only mistralrs engine. (#1328)

This allows building:
-  only `mistral.rs` engine: `--no-default-features --features mistralrs`  
- or only `llama.cpp` engine: `--no-default-features --features llamacpp`. 

Since llama.cpp became a default we'd only tested building both at once. The docs already said we supported that but there was some combo of Rust features that didn't build. This is the fix.
parent 51e2c8cb
...@@ -116,9 +116,9 @@ pub async fn run( ...@@ -116,9 +116,9 @@ pub async fn run(
let out_opt = out_opt.unwrap_or_else(|| { let out_opt = out_opt.unwrap_or_else(|| {
let default_engine = if card.is_gguf() { let default_engine = if card.is_gguf() {
Output::LlamaCpp gguf_default()
} else { } else {
Output::MistralRs safetensors_default()
}; };
tracing::info!( tracing::info!(
"Using default engine: {default_engine}. Use out=<engine> to specify one of {}", "Using default engine: {default_engine}. Use out=<engine> to specify one of {}",
...@@ -400,3 +400,22 @@ fn print_cuda(output: &Output) { ...@@ -400,3 +400,22 @@ fn print_cuda(output: &Output) {
#[cfg(not(any(feature = "mistralrs", feature = "llamacpp")))] #[cfg(not(any(feature = "mistralrs", feature = "llamacpp")))]
fn print_cuda(_output: &Output) {} fn print_cuda(_output: &Output) {}
fn gguf_default() -> Output {
#[cfg(feature = "llamacpp")]
return Output::LlamaCpp;
#[cfg(all(feature = "mistralrs", not(feature = "llamacpp")))]
return Output::MistralRs;
#[cfg(not(any(feature = "mistralrs", feature = "llamacpp")))]
return Output::EchoFull;
}
fn safetensors_default() -> Output {
#[cfg(feature = "mistralrs")]
return Output::MistralRs;
#[cfg(not(feature = "mistralrs"))]
return Output::EchoFull;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment