Skip to content

Commit

Permalink
feat(tabby): Added --chat-device arg for serve subcommand (#1685)
Browse files Browse the repository at this point in the history
* feat(tabby): Added --chat-device arg for serve subcommand

* chore(changelog): Added info about --chat-device flag
  • Loading branch information
SpeedCrash100 authored Mar 16, 2024
1 parent f216d77 commit 6f3db0a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# v0.10.0 [UNRELEASED]

## Features
* Added the --chat-device flag to override a device used to run chat model.

## Fixes and Improvements

Expand Down
12 changes: 11 additions & 1 deletion crates/tabby/src/serve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@ pub struct ServeArgs {
#[clap(long, default_value_t=Device::Cpu)]
device: Device,

/// Device to run chat model [default equals --device arg]
#[clap(long, requires("chat_model"))]
chat_device: Option<Device>,

/// Parallelism for model serving - increasing this number will have a significant impact on the
/// memory requirement e.g., GPU vRAM.
#[clap(long, default_value_t = 1)]
Expand Down Expand Up @@ -187,7 +191,13 @@ async fn api_router(

let chat_state = if let Some(chat_model) = &args.chat_model {
Some(Arc::new(
create_chat_service(logger.clone(), chat_model, &args.device, args.parallelism).await,
create_chat_service(
logger.clone(),
chat_model,
args.chat_device.as_ref().unwrap_or(&args.device),
args.parallelism,
)
.await,
))
} else {
None
Expand Down

0 comments on commit 6f3db0a

Please sign in to comment.