7 Commits
Author SHA1 Message Date
Lu Fan(SonnyCalcr) 649747f8cd feat(server): 神经网络整句效果优先模型改为按需下载 (#838)
效果优先模型(sentence-model-desktop.safetensors,约 25 MB)不再随安装包分发,
改为和八股文模型一样在设置页下载后才能使用。

- engine:SentenceAssociationOptions 新增 neural_desktop_model 路径,留空即模型缺席、
  静默不重排;词典不再从资源目录固定加载效果档。load_file 按 UTF-8 打开路径,
  数据目录在非 ASCII 用户目录下也能读到模型
- server:新增 settings/neural_model,下载到 <数据目录>\models\neural-desktop\,
  下载与导入都按 neural-model/lock.json 的字节数和 SHA256 校验后原子落位;
  会话层只在开关打开时解析模型路径
- ui-html:设置页增加下载 / 导入 / 删除 / 浏览器下载,模型未就绪时开关置灰
- installer:不再打包效果档模型;旧版装进数据目录根下的那份在覆盖安装与卸载时清掉

原有配置项 sentence_neural_desktop 保持不变,用户的开关状态升级后保留。
2026-10-11 18:08:33 +08:00
luojiyin 7e2d9990a5 perf(engine): use AVX2 for vocabulary projection
Pack active hidden rows before the tied vocabulary projection.

Reuse the existing int8 AVX2 kernel when the CPU supports it.
Keep the original scalar path for other CPUs and float weights.
The projection and complete scoring both run faster with locked models.
2026-10-04 16:16:30 +08:00
luo jiyin 9a22905fb7 perf(engine): add blocked AVX2 int8 linear kernel (#608)
Reuse each widened weight chunk across up to four activation rows.

Use a scalar path when the CPU lacks AVX2 or FMA.
The blocked kernel reduces scoring time for both locked models.
Keep a focused test for row blocks, input tails, and optional bias.
2026-10-04 00:06:38 +08:00
luojiyin 895d637300 perf(engine): reuse neural forward buffers
Reuse temporary vectors across Transformer blocks within one forward call.

The keyboard model uses 76 allocations per scoring call, down from 135.
The desktop model uses 76 allocations per scoring call, down from 157.
Scores match the original implementation for both models.
2026-10-03 21:35:12 +08:00
luojiyin 1b5e7a71e4 refactor(engine): name compact logit slots
Use slot for compact logits and row for Transformer positions.
2026-10-03 16:40:00 +08:00
luojiyin 1acc3d6745 perf(engine): skip unused neural scoring positions
Skip vocabulary projection for positions without targets.

Remove the final unused Transformer position from each candidate row.

Add coverage for empty candidates in mixed batches. Refs #593.
2026-10-03 16:40:00 +08:00
fanlusky e7f7addd4f feat(engine): 神经网络整句联想与词格 n-best 重排
- 新增 engine/neural:移植 chinese-ime-lm 的字符级 Transformer 推理,在词格解出的最多 12 条
  n-best 里重排挑选整句,desktop / keyboard 两档模型各出一条首选,后台 worker 异步打分
- 词格支持 n-best 输出与重排(quanpin/lattice_rerank),全拼、双拼共用
- 新增 SentenceAssociationOptions,经 QueryRequest 传给各 provider;四个来源默认全关
- 资源契约登记两个 safetensors 与 NOTICE;模型二进制不进仓库,由
  scripts/fetch-neural-model.ps1 按 neural-model/lock.json 下载并校验 SHA256
- 新增 neural_sentence 测试
2026-09-24 14:03:39 +08:00