Skip to content

Commit 78892df

Browse files
mudlerlocalai-org-maint-bot
authored andcommitted
fix(buun-llama-cpp): drop logit_bias_eog arg from params_from_json_cmpl
Previous substitution kept the call as 5 args, but buun predates the upstream refactor that also *added* the logit_bias_eog parameter to params_from_json_cmpl — buun's signature is still the 4-arg form (const llama_vocab*, const common_params&, int, const json&) and it still derives logit_bias_eog internally from the common_params. Replace the substitution with a line-delete. Guard matches both the original call (ctx_server.get_meta().logit_bias_eog) and the previously substituted form (params_base.sampling.logit_bias_eog) so the script stays safe across re-runs and whatever state the tree was left in. Assisted-by: Claude:Opus-4.7 [Read] [Edit] [Bash] Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
1 parent 69342c3 commit 78892df

1 file changed

Lines changed: 17 additions & 11 deletions

File tree

backend/cpp/buun-llama-cpp/patch-grpc-server.sh

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -125,19 +125,25 @@ else
125125
echo "==> DFlash option-handler patch OK"
126126
fi
127127

128-
if grep -q 'ctx_server\.get_meta()\.logit_bias_eog' "$SRC"; then
129-
echo "==> patching $SRC to source logit_bias_eog from params_base.sampling (buun predates server_context_meta::logit_bias_eog accessor)"
130-
# Upstream llama.cpp exposes logit_bias_eog through server_context_meta
131-
# after buun's 2026-04-05 fork-point. Buun still carries the underlying
132-
# data on common_params_sampling::logit_bias_eog (the struct field the
133-
# meta accessor eventually returns). Rewriting the call site to read
134-
# params_base.sampling.logit_bias_eog works against both trees — upstream
135-
# still populates that same vector the newer accessor returns.
136-
sed 's/ctx_server\.get_meta()\.logit_bias_eog/params_base.sampling.logit_bias_eog/g' "$SRC" > "$SRC.tmp"
128+
if grep -qE 'ctx_server\.get_meta\(\)\.logit_bias_eog|params_base\.sampling\.logit_bias_eog,' "$SRC"; then
129+
echo "==> patching $SRC to drop the logit_bias_eog arg from params_from_json_cmpl() callsites (buun still uses the pre-refactor 4-arg signature)"
130+
# Upstream llama.cpp refactored params_from_json_cmpl to take a precomputed
131+
# logit_bias_eog vector after buun's 2026-04-05 fork-point — simultaneously
132+
# adding server_context_meta::logit_bias_eog as the supplier. Buun carries
133+
# neither change: its params_from_json_cmpl is still 4-arg, and internally
134+
# derives logit_bias_eog from the common_params it's passed. So we just
135+
# delete the argument line entirely — the remaining 4 args match buun's
136+
# signature and the resulting behavior matches upstream bit-for-bit
137+
# (upstream's 5th arg is the same data buun derives internally).
138+
#
139+
# Guard is broad so this works whether the line has been run through this
140+
# block before (leaving params_base.sampling.logit_bias_eog,) or not
141+
# (leaving the original ctx_server.get_meta().logit_bias_eog,).
142+
sed -E '/^[[:space:]]+(ctx_server\.get_meta\(\)\.logit_bias_eog|params_base\.sampling\.logit_bias_eog),$/d' "$SRC" > "$SRC.tmp"
137143
mv "$SRC.tmp" "$SRC"
138-
echo "==> logit_bias_eog substitution OK"
144+
echo "==> logit_bias_eog arg drop OK"
139145
else
140-
echo "==> $SRC has no ctx_server.get_meta().logit_bias_eog call, skipping logit_bias_eog patch"
146+
echo "==> $SRC has no logit_bias_eog arg line, skipping"
141147
fi
142148

143149
if grep -q 'get_media_marker()' "$SRC"; then

0 commit comments

Comments
 (0)