Skip to content

Commit 8ae497f

Browse files
committed
Merge upstream llama.cpp through 5aa3a64
Preserve Bee-specific DFlash and server wiring while adopting upstream VRAM reductions for output rows and FA masks.
2 parents e0663be + 5aa3a64 commit 8ae497f

59 files changed

Lines changed: 5918 additions & 2005 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.devops/nix/package.nix

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
glibc,
44
config,
55
stdenv,
6+
stdenvNoCC,
67
runCommand,
78
cmake,
89
ninja,
@@ -19,6 +20,8 @@
1920
openssl,
2021
shaderc,
2122
spirv-headers,
23+
nodejs,
24+
importNpmLock,
2225
useBlas ?
2326
builtins.all (x: !x) [
2427
useCuda
@@ -130,7 +133,31 @@ effectiveStdenv.mkDerivation (finalAttrs: {
130133
src = lib.cleanSource ../../.;
131134
};
132135

133-
postPatch = ''
136+
# Builds the webui locally, taking care not to require updating any sha256 hash.
137+
webui = stdenvNoCC.mkDerivation {
138+
pname = "webui";
139+
version = llamaVersion;
140+
src = lib.cleanSource ../../tools/ui;
141+
142+
nativeBuildInputs = [
143+
nodejs
144+
importNpmLock.linkNodeModulesHook
145+
];
146+
147+
# no sha256 required when using buildNodeModules
148+
npmDeps = importNpmLock.buildNodeModules {
149+
npmRoot = ../../tools/ui;
150+
inherit nodejs;
151+
};
152+
153+
installPhase = ''
154+
LLAMA_UI_OUT_DIR=$out npm run build --offline
155+
'';
156+
};
157+
158+
postPatch = lib.optionalString useWebUi ''
159+
cp -r ${finalAttrs.webui} tools/ui/dist
160+
chmod -R u+w tools/ui/dist
134161
'';
135162

136163
# With PR#6015 https://github.com/ggml-org/llama.cpp/pull/6015,

SECURITY.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212

1313
## Reporting a vulnerability
1414

15+
> [!IMPORTANT]
16+
> The private security disclosure program is disabled until further notice. Please submit patches with fixes directly to the repo as public PRs. Emails will be ignored.
17+
1518
If you have discovered a security vulnerability in this project that falls inside the [covered topics](#covered-topics), please report it privately. **Do not disclose it as a public issue.** This gives us time to work with you to fix the issue before public exposure, reducing the chance that the exploit will be used before a patch is released.
1619

1720
Please disclose it as a private [security advisory](https://github.com/Anbeeld/beellama.cpp/security/advisories/new).
@@ -31,7 +34,7 @@ Before submitting your report, ensure you meet the following requirements:
3134

3235
Maintainers reserve the right to close the report if these requirements are not fulfilled.
3336

34-
## Covered Topics
37+
### Covered Topics
3538

3639
Only vulnerabilities that fall within these parts of the project are considered valid. For problems falling outside of this list, please report them as issues.
3740

common/common.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1569,6 +1569,7 @@ struct llama_context_params common_context_params_to_llama(const common_params &
15691569
cparams.n_ctx = params.n_ctx;
15701570
cparams.n_seq_max = params.n_parallel;
15711571
cparams.n_rs_seq = params.speculative.need_n_rs_seq();
1572+
cparams.n_outputs_max = std::max(params.n_outputs_max, 0);
15721573
cparams.n_batch = params.n_batch;
15731574
cparams.n_ubatch = params.n_ubatch;
15741575
cparams.n_threads = params.cpuparams.n_threads;

common/common.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -578,6 +578,7 @@ struct common_params {
578578
int32_t n_chunks = -1; // max number of chunks to process (-1 = unlimited)
579579
int32_t n_parallel = 1; // number of parallel sequences to decode
580580
int32_t n_sequences = 1; // number of sequences to decode
581+
int32_t n_outputs_max = 0; // max outputs in a batch (0 = n_batch)
581582
int32_t grp_attn_n = 1; // group-attention factor
582583
int32_t grp_attn_w = 512; // group-attention width
583584
int32_t n_print = -1; // print token count every n tokens (-1 = disabled)

common/reasoning-budget.cpp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,3 +285,24 @@ size_t common_reasoning_budget_forced_token_count(const struct llama_sampler * s
285285
const auto * ctx = (const common_reasoning_budget_ctx *) smpl->ctx;
286286
return ctx->forced_tokens.size();
287287
}
288+
289+
bool common_reasoning_budget_force(struct llama_sampler * smpl) {
290+
if (!smpl) {
291+
return false;
292+
}
293+
294+
auto * ctx = (common_reasoning_budget_ctx *) smpl->ctx;
295+
296+
// only a sampler that is actively counting down the budget may be forced;
297+
// any other state (idle, already forcing/waiting, or done) is left untouched
298+
if (ctx->state != REASONING_BUDGET_COUNTING) {
299+
return false;
300+
}
301+
302+
ctx->state = REASONING_BUDGET_FORCING;
303+
ctx->force_pos = 0;
304+
ctx->end_matcher.reset();
305+
LOG_INF("reasoning-budget: forced into forcing state (manual transition)\n");
306+
307+
return true;
308+
}

common/reasoning-budget.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,7 @@ bool common_reasoning_budget_force_end(struct llama_sampler * smpl);
4747
llama_token common_reasoning_budget_next_forced_token(const struct llama_sampler * smpl);
4848

4949
size_t common_reasoning_budget_forced_token_count(const struct llama_sampler * smpl);
50+
51+
// Manually transition the reasoning budget sampler into the FORCING state.
52+
// Returns true if the transition occurred.
53+
bool common_reasoning_budget_force(struct llama_sampler * smpl);

common/sampling.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -943,6 +943,14 @@ uint32_t common_sampler_get_seed(const struct common_sampler * gsmpl) {
943943
return llama_sampler_get_seed(gsmpl->chain);
944944
}
945945

946+
bool common_sampler_reasoning_budget_force(struct common_sampler * gsmpl) {
947+
if (!gsmpl) {
948+
return false;
949+
}
950+
951+
return common_reasoning_budget_force(gsmpl->rbudget);
952+
}
953+
946954
// helpers
947955

948956
llama_token_data_array * common_sampler_get_candidates(struct common_sampler * gsmpl, bool do_sort) {

common/sampling.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,9 @@ std::vector<llama_token> common_sampler_sample_and_accept_n(
130130

131131
uint32_t common_sampler_get_seed(const struct common_sampler * gsmpl);
132132

133+
// force the reasoning budget sampler (if any) to begin forcing its end sequence now.
134+
bool common_sampler_reasoning_budget_force(struct common_sampler * gsmpl);
135+
133136
// helpers
134137

135138
// access the internal list of current candidate tokens

conversion/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
"Ernie4_5_ForCausalLM": "ernie",
6060
"Ernie4_5_MoeForCausalLM": "ernie",
6161
"EuroBertModel": "bert",
62+
"Exaone4_5_ForConditionalGeneration": "exaone",
6263
"Exaone4ForCausalLM": "exaone",
6364
"ExaoneForCausalLM": "exaone",
6465
"ExaoneMoEForCausalLM": "exaone",
@@ -241,6 +242,7 @@
241242
"DeepseekOCR2ForCausalLM": "deepseek",
242243
"DeepseekOCRForCausalLM": "deepseek",
243244
"DotsOCRForCausalLM": "dotsocr",
245+
"Exaone4_5_ForConditionalGeneration": "exaone",
244246
"Gemma3ForConditionalGeneration": "gemma",
245247
"Gemma3nForConditionalGeneration": "gemma",
246248
"Gemma4ForConditionalGeneration": "gemma",

conversion/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2593,7 +2593,7 @@ def get_model_architecture(hparams: dict[str, Any], model_type: ModelType) -> st
25932593
# Step3-VL keeps text config under text_config but uses a custom top-level architecture.
25942594
# For text conversion we route to a dedicated text-only class.
25952595
# TODO: refactor this later to avoid adding exception here
2596-
if model_type == ModelType.TEXT and arch in ("StepVLForConditionalGeneration", "Sarashina2VisionForCausalLM"):
2596+
if model_type == ModelType.TEXT and arch in ("StepVLForConditionalGeneration", "Sarashina2VisionForCausalLM", "Exaone4_5_ForConditionalGeneration"):
25972597
return arch
25982598

25992599
# if "architectures" is found in the sub-config, use that instead

0 commit comments

Comments
 (0)