Implementing support for laguna arch

This commit is contained in:
Owen Qwen
2026-07-29 11:46:09 -05:00
parent 0bcb7ca59a
commit 68f5d104a8
8 changed files with 234 additions and 189 deletions
+6 -7
View File
@@ -1359,8 +1359,8 @@ bool llama_model_base::load_tensors(llama_model_loader & ml) {
#if !defined(__APPLE__)
throw std::runtime_error("longhaul is only supported on macOS");
#endif
if (arch != LLM_ARCH_QWEN35MOE) {
throw std::runtime_error("longhaul currently requires a qwen35moe model");
if (arch != LLM_ARCH_QWEN35MOE && arch != LLM_ARCH_LAGUNA) {
throw std::runtime_error("longhaul currently requires a qwen35moe or laguna model");
}
if (hparams.n_layer_nextn != 0) {
throw std::runtime_error("longhaul does not support MTP tensors");
@@ -1368,9 +1368,6 @@ bool llama_model_base::load_tensors(llama_model_loader & ml) {
if (params.check_tensors || params.no_alloc || params.vocab_only) {
throw std::runtime_error("longhaul does not support check-tensors, no-alloc, or vocab-only loading");
}
if (ml.files.size() != 1) {
throw std::runtime_error("longhaul currently requires a single-file GGUF");
}
for (int il = 0; il < n_layer_all; ++il) {
ggml_backend_dev_t dev = pimpl->dev_layer[il].dev;
if (ggml_backend_dev_type(dev) != GGML_BACKEND_DEVICE_TYPE_GPU ||
@@ -1380,8 +1377,10 @@ bool llama_model_base::load_tensors(llama_model_loader & ml) {
}
ml.configure_longhaul(params.longhaul_cache_bytes, n_expert, n_layer_all);
if (ml.longhaul_slots < (size_t) n_expert_used) {
throw std::runtime_error(format("longhaul cache has %zu slots per layer, but the model uses %lld experts",
ml.longhaul_slots, (long long) n_expert_used));
LLAMA_LOG_WARN("%s: longhaul cache has %zu slots for %lld selected experts; "
"each MoE layer will run in %zu stages\n",
__func__, ml.longhaul_slots, (long long) n_expert_used,
((size_t) n_expert_used + ml.longhaul_slots - 1) / ml.longhaul_slots);
}
}