Skip to content
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
3 changes: 1 addition & 2 deletions backends/candle/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -511,9 +511,8 @@ impl CandleBackend {
}
};

// Load Dense layers from the provided Dense paths
let mut dense_layers = Vec::new();
if let Some(dense_paths) = &dense_paths {
if let Some(dense_paths) = dense_paths {
if !dense_paths.is_empty() {
tracing::info!("Loading Dense module/s from path/s: {dense_paths:?}");

Expand Down
33 changes: 32 additions & 1 deletion backends/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,38 @@ async fn init_backend(
tracing::info!("Dense modules downloaded in {:?}", start.elapsed());
Some(dense_paths)
} else {
None
// For local models, try to parse modules.json and handle dense_path logic
let modules_json_path = model_path.join("modules.json");
if modules_json_path.exists() {
match parse_dense_paths_from_modules(&modules_json_path).await {
Ok(module_paths) => match module_paths.len() {
0 => Some(vec![]),
1 => {
let path_to_use = if let Some(ref user_path) = dense_path {
if user_path != &module_paths[0] {
tracing::info!("`{}` found in `modules.json`, but using provided `--dense-path={user_path}` instead", module_paths[0]);
}
user_path.clone()
} else {
module_paths[0].clone()
};
Some(vec![path_to_use])
}
_ => {
if dense_path.is_some() {
tracing::warn!("A value for `--dense-path` was provided, but since there's more than one subsequent Dense module, then the provided value will be ignored.");
}
Some(module_paths)
}
},
Err(err) => {
tracing::warn!("Failed to parse local modules.json: {err}");
None
}
}
} else {
None
}
};

let backend = CandleBackend::new(
Expand Down
Loading