feat(model): support LFM2-1.2B - #587
Open
Hyacinth25 wants to merge 2 commits into
Open
Hyacinth25 wants to merge 2 commits into
Hyacinth25 wants to merge 2 commits into
Conversation
Author
|
老师您好,LFM2-1.2B 适配已提交 PR,并完成 NVIDIA RTX 4090 的干净构建、Static/Paged 双缓存真实模型回归。 当前 GitHub 显示 2 个 workflow 等待维护者批准,麻烦协助批准并触发 CI。感谢! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概述
LiquidAI/LFM2-1.2B的模型注册、配置归一化及 Safetensors 权重名称映射。LFM2_REPORT.md中记录实现思路、复现命令、平台状态、结果和已知限制。动机
LFM2 将循环 ShortConv 与 GQA Attention 交错使用。现有全 Attention 模型模板只能维护 KV Cache,无法保存 Prefill 与增量 Decode 所需的 ShortConv 历史卷积状态。本 PR 在尽量复用 InfiniLM 既有 Attention、Linear、MLP 与缓存基础设施的前提下,补齐了这一模型结构和状态路由。
变更类型
feat:新功能 / 新模型test:新增或修正测试docs:文档支持平台与测试结果
max_cache_len=256,三条 Prompt,A/B/C/A/B/Cmax_cache_len=1024,三条 Prompt,A/B/C/A/B/CNVIDIA_TF32_OVERRIDE=0后最大 logits 绝对误差为5.96e-08,小于1e-5,argmax 一致。当前源码的纯 Python 合同测试:
新增的 4 个 LFM2 C++ 编译单元也已通过
g++ -std=c++17 -fsyntax-only。完整的实现、干净构建信息与复现步骤见
LFM2_REPORT.md。性能影响
这不是性能优化 PR,不声明优化前后收益。此前在 RTX 4090 上记录过一组 BF16 单机基线:208 token Prefill、63 次单 token Decode;计时仅包含 engine forward 和设备同步,不包含模型加载、Tokenizer、元数据构造或输出回传。
供审阅者关注的事项
batch_size=1。多个不同长度请求组成的 packed Prefill 会被拒绝,避免错误共享 ShortConv 历史状态。CI / ChatOps
CI 尚未触发。创建 PR 后会在 Actions 中手动运行 CI 工作流;如果无法手动触发,将请求维护者执行
/retest或/test。检查清单
已完成
feat(model): support LFM2-1.2B。feat/support-lfm2-1-2b,符合仓库命名规范。fprintf、std::cout、std::cerr或 tensor trace。git diff --check、Pythoncompileall、16 个 Python 合同测试及新增 C++ 单元的语法检查。LFM2_REPORT.md已记录 NVIDIA、CPU、昇腾的支持状态和已知限制。PR 创建后继续完成
clang-format与ruff的环境执行scripts/format.py --check,并修复任何报告的问题。/retest。