ggml now comes from third_party/llama.cpp, the commit upstream pins, instead of a FetchContent clone at configure time; the configure stops with the submodule command if the checkout is missing. patches/*.patch are applied to the submodule at configure time, idempotently (checked in reverse first); the one patch is the Qwen3-Coder any-argument-order parser fix carried from UnbiasedStrata 1. A second add_subdirectory builds llama.cpp's llama, common, cpp-httplib and mtmd for the coming C++ front end with every download switch off. Makefile: make build configures once and builds strata, strata-poly, strata_kq, llama-common and mtmd into build/bin for CUDA archs 61;75;86;89 (SM60 flag added for 61), finds nvcc on PATH or in /usr/local/cuda/bin, and probes for the newest GCC nvcc accepts, passing it as the C, C++ and CUDA host compiler so one libstdc++ is linked (a GCC 14 / GCC 13 mix failed to link strata on __cxa_call_terminate). PLAN.md and UPSTREAM.md added. Verified: a fresh clone and 'git submodule update --init' on a networked box checks out the shallow pin in 37 s. On VM 220 (Debian 13, GCC 13/14, CUDA 12.4, no outbound internet) 'unshare -rn make build JOBS=6' inside a network namespace with no interfaces built strata, strata-poly and libstrata_kq.so for 61;75;86;89 in 24 min with zero network errors in the log; strata --version prints 0.1.45.
27 lines
1.8 KiB
Diff
27 lines
1.8 KiB
Diff
diff --git a/common/parsers/qwen3-coder.cpp b/common/parsers/qwen3-coder.cpp
|
|
index 208f551..2d7c80f 100644
|
|
--- a/common/parsers/qwen3-coder.cpp
|
|
+++ b/common/parsers/qwen3-coder.cpp
|
|
@@ -139,12 +139,15 @@ common_chat_params common_chat_params_init_qwen3_coder(const common_chat_templat
|
|
(param.required ? required_args : optional_args).push_back(arg_rule);
|
|
});
|
|
|
|
- // Accept required arguments in any order, as Qwen does not always adhere to the
|
|
- // order provided.
|
|
- auto args = p.permute("tool-" + name + "-args", required_args);
|
|
- if (!optional_args.empty()) {
|
|
- args = args + p.zero_or_more(p.choice(optional_args));
|
|
- }
|
|
+ // Accept the arguments in any order, required and optional interleaved. The upstream rule
|
|
+ // took the required ones first and the optional ones after; Qwen3.8 Flash-Next often writes
|
|
+ // the optional ones first (limit, offset, path), and because the tool-call group below is
|
|
+ // optional and the grammar has no end anchor, such a call was dropped without any error:
|
|
+ // the client got finish_reason=stop and an empty answer. Whether every required argument
|
|
+ // is present is for the tool to report; a dropped call reports nothing.
|
|
+ std::vector<common_peg_parser> all_args = required_args;
|
|
+ all_args.insert(all_args.end(), optional_args.begin(), optional_args.end());
|
|
+ auto args = all_args.empty() ? p.eps() : p.zero_or_more(p.choice(all_args));
|
|
|
|
auto func = p.tool(p.tool_open("<function=" + p.tool_name(p.literal(name)) + ">\n") +
|
|
p.tool_args(args) +
|