Skip to content

Commit

Permalink
chore: fix embedding default model (#2327)
Browse files Browse the repository at this point in the history
  • Loading branch information
wsxiaoys authored Jun 2, 2024
1 parent 074dec1 commit 5599084
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 14 deletions.
10 changes: 9 additions & 1 deletion crates/tabby/src/serve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use clap::Args;
use hyper::StatusCode;
use tabby_common::{
api::{self, code::CodeSearch, event::EventLogger},
config::{Config, ConfigAccess, ModelConfig, StaticConfigAccess},
config::{Config, ConfigAccess, LocalModelConfig, ModelConfig, StaticConfigAccess},
usage,
};
use tabby_inference::Embedding;
Expand Down Expand Up @@ -398,5 +398,13 @@ fn merge_args(config: &Config, args: &ServeArgs) -> Config {
));
}

if config.model.embedding.is_none() {
config.model.embedding = Some(ModelConfig::Local(LocalModelConfig {
model_id: "Nomic-Embed-Text".to_string(),
parallelism: 4,
num_gpu_layers: 9999,
}))
}

config
}
14 changes: 1 addition & 13 deletions crates/tabby/src/services/embedding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,5 @@ use tabby_inference::Embedding;
use super::model;

pub async fn create(config: Option<&ModelConfig>) -> Arc<dyn Embedding> {
if let Some(config) = config {
model::load_embedding(config).await
} else {
model::load_embedding(&default_config()).await
}
}

fn default_config() -> ModelConfig {
ModelConfig::Local(LocalModelConfig {
model_id: "Nomic-Embed-Text".to_string(),
parallelism: 4,
num_gpu_layers: 9999,
})
model::load_embedding(config.expect("Embedding model is not specified")).await
}

0 comments on commit 5599084

Please sign in to comment.