mirror of
https://github.com/block/goose.git
synced 2026-06-02 06:19:33 +02:00
Gate MLX variants on feature flag
Mark MLX Hugging Face variants unsupported unless the binary was built with the mlx feature. This keeps non-MLX macOS builds from advertising models that the runtime cannot load.
This commit is contained in:
@@ -1336,7 +1336,8 @@ fn mlx_variants_from_model_info(repo_id: &str, info: &ModelInfo) -> Vec<HfModelV
|
||||
.count()
|
||||
> 1,
|
||||
supported: mlx_model_type(&info.config).is_some_and(is_mlx_runtime_supported_model_type)
|
||||
&& cfg!(target_os = "macos"),
|
||||
&& cfg!(target_os = "macos")
|
||||
&& cfg!(feature = "mlx"),
|
||||
unsupported_reason: mlx_unsupported_reason(&info.config),
|
||||
}]
|
||||
}
|
||||
@@ -1366,6 +1367,9 @@ fn mlx_unsupported_reason(config: &Option<serde_json::Value>) -> Option<String>
|
||||
if !cfg!(target_os = "macos") {
|
||||
return Some("MLX requires macOS".to_string());
|
||||
}
|
||||
if !cfg!(feature = "mlx") {
|
||||
return Some("MLX support was not compiled in".to_string());
|
||||
}
|
||||
|
||||
let model_type = mlx_model_type(config)?;
|
||||
if is_mlx_runtime_supported_model_type(model_type) {
|
||||
@@ -1464,7 +1468,10 @@ fn mlx_variant_label(variant_id: &str) -> String {
|
||||
}
|
||||
}
|
||||
|
||||
fn snapshot_root_for_file(path: &std::path::Path, repo_filename: &str) -> Option<std::path::PathBuf> {
|
||||
fn snapshot_root_for_file(
|
||||
path: &std::path::Path,
|
||||
repo_filename: &str,
|
||||
) -> Option<std::path::PathBuf> {
|
||||
let mut root = path.to_path_buf();
|
||||
for _ in 0..repo_filename.split('/').count() {
|
||||
root.pop();
|
||||
|
||||
Reference in New Issue
Block a user