Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
wsxiaoys committed Oct 27, 2023
1 parent 52de209 commit e6bc9e4
Showing 1 changed file with 9 additions and 20 deletions.
29 changes: 9 additions & 20 deletions crates/tabby/src/serve/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,11 @@ impl Device {
fn ggml_use_gpu(&self) -> bool {
*self == Device::Cuda
}

#[cfg(not(any(all(target_os = "macos", target_arch = "aarch64"), feature = "cuda")))]
fn ggml_use_gpu(&self) -> bool {
false
}
}

#[derive(Args)]
Expand All @@ -114,17 +119,10 @@ pub struct ServeArgs {
#[clap(long, default_value_t=Device::Cpu)]
device: Device,

/// GPU indices to run models, only applicable for CUDA.
#[clap(long, default_values_t=[0])]
device_indices: Vec<i32>,

/// DEPRECATED: Do not use.
#[deprecated(since = "0.5.0")]
#[clap(long, hide(true))]
num_replicas_per_device: Option<usize>,

/// DEPRECATED: Do not use.
#[clap(long, hide(true))]
compute_type: Option<String>,
device_indices: Vec<i32>,
}

pub async fn main(config: &Config, args: &ServeArgs) {
Expand Down Expand Up @@ -251,17 +249,8 @@ fn api_router(args: &ServeArgs, config: &Config) -> Router {
}

fn valid_args(args: &ServeArgs) {
if args.num_replicas_per_device.is_some() {
warn!("--num-replicas-per-device is deprecated and will be removed in future release.");
}

if args.device == Device::Cpu && (args.device_indices.len() != 1 || args.device_indices[0] != 0)
{
fatal!("CPU device only supports device indices = [0]");
}

if args.compute_type.is_some() {
warn!("--compute-type is deprecated and will be removed in future release.");
if !args.device_indices.is_empty() {
warn!("--device-indices is deprecated and will be removed in future release.");
}
}

Expand Down

0 comments on commit e6bc9e4

Please sign in to comment.