ViperEkura
|
0ba8c70ce1
|
fix: 修复 MLA 多个 bug 并缩小测试模型参数
- MLA kv_b_proj 输出维度和 q_rope 切分偏移修复
- 打通 MLA 配置从 ModelConfig 到 DecoderBlock 的传递路径
- rope_theta 配置不再被忽略,MLA 使用 qk_rope_head_dim
- tie_weight 使用 is True 避免 None 隐式生效
- norm_eps/rope base 类型标注修正
- 测试模型参数缩小 (dim=8, head_dim=4)
- 新增 6 种架构配置 × 2 场景的前向传播测试
|
2026-05-16 14:57:43 +08:00 |
ViperEkura
|
e3382f6bb5
|
fix: 修复推理引擎 batch decode 中多项正确性与并发问题
- scheduler: decode 分组由幂次分桶改为精确 next_pos,消除 KV cache 位置错乱
- task: activate() 加锁操作 active_tasks,消除数据竞争
- engine: wait_completion 加超时,防止分配失败时永久死锁
- sample: TopKStrategy 向量化为 per-sample threshold,尊重各 task 的 top_k
- cache: Storage.write/gather 中 -1 页改用 mask 处理,防数据污染
- executor: prefill 逐 task 循环改为单次 tensor 调用
|
2026-05-14 21:31:39 +08:00 |
ViperEkura
|
205b40bd28
|
refactor: 重构 cache 和 inference 参数体系,分离存储与分配
- 合并 GenerationRequest/GenerationParams,统一 max_tokens 参数名
- PagePool/PrefixCache 分离为 Allocator + PrefixCache + PagePool
- 拆分 KV 存储为独立 Storage 类,PagedCache → KVCache,CacheView → KvcacheView
- Allocator.inc_ref 移除 LRU 防止竞争,Storage.write 增加负页防御
- Allocator/PrefixCache/TaskTable 加 threading.Lock 保证线程安全
- server.py uvicorn.run 改为传 app 对象修复导入错误
- benchmark.py 适配 KVCache 新 API
|
2026-05-14 20:05:08 +08:00 |
ViperEkura
|
2196c34c52
|
refactor: 重构 inference 模块架构,引入设计模式并分组文件
- 新增 protocol.py 协议层,Template Method 模式消除流/非流分支 45% 重复
- SSEBuilder 统一 SSE 构造,StopChecker 独立 stop_sequence 检测
- AnthropicHandler 追踪已产出文本,修复 stop 时重复 delta
- server.py 路由从约 100 行缩减至 3 行
- 拆分为 core/(cache/executor/scheduler/task)和 api/(protocol/server)
- 外部保持二级导入路径(from astrai.inference import Name)
- 删除所有分隔线注释,代码按语义自然分组
|
2026-05-14 17:42:37 +08:00 |
ViperEkura
|
6d6ef99e66
|
perf: 消除 PagedCache.write 中的 position_ids GPU 同步,解码提速 15%
- CacheView.write 用 total_len - k.size(1) 推导 start_pos,替代 position_ids[0,0].item()
- 移除 GQA/MLA/DecoderBlock 中不再使用的 position_ids 参数
- PagedCache.write 参数 position_ids:Tensor → start_pos:int
|
2026-05-14 15:37:48 +08:00 |
ViperEkura
|
c0effc9f5b
|
refactor: 位置编码改用 position_ids [B,S],简化 attention mask 构建
- RotaryEmbedding/CacheView 接受 position_ids 替代 start_pos
- process_attention_mask 用 position_ids >= arange 做逐位置 causal
- 训练/无 KV cache 时 position_ids=None 内部自动处理
- 移除 executor/benchmark 中冗余的 input_mask 构造
|
2026-05-14 13:26:31 +08:00 |
ViperEkura
|
df0845e916
|
chore: 解耦 Executor/Scheduler/TaskManager,修复 stop 页泄漏,移除 ServerState 全局单例
|
2026-05-12 13:47:55 +08:00 |
ViperEkura
|
7440e9c809
|
style: 重命名 test_scheduler_concurrency 为 test_scheduler
|
2026-05-12 12:24:36 +08:00 |
ViperEkura
|
7d4029c2a4
|
test: inference 模块补全单元测试,cache/sample/engine/task
- test_cache: page_hash, PagePool, PrefixCache, TaskTable, PagedCache write/gather
- test_sample: TemperatureStrategy, TopKStrategy, TopPStrategy, SamplingPipeline, sample()
- test_engine: _Result 线程安全, generate stream/non-stream batch/single
- test_task: Task 生命周期, TaskManager 队列操作
- 4 新文件, +771 行, 116 total tests
|
2026-05-12 12:17:57 +08:00 |
ViperEkura
|
0ca6c9e6eb
|
test: 增加 13 个边界条件测试,不需要 base_test_env 的函数移除该参数
- Fetcher 空/边界/跨段测试
- Storage 未加载 fetch 异常
- detect_format 无效路径/不支持格式
- create_storage 无效类型
- JSON pre-tokenized 无 tokenizer
- load_json 跳过 config.json
- Dataset 未加载/数据过短
- 所有 import 提到文件顶部
|
2026-05-12 11:47:30 +08:00 |
ViperEkura
|
5203b7f53e
|
perf: 测试优化,model 改为 session 共享,scheduler 用 Event 替代 sleep
- 拆出 session-scoped test_tokenizer + test_model,14 次创建 → 1 次
- 删除无用 test_env fixture
- 固定模型维度,消除随机性
- 添加 pytest markers 配置
|
2026-05-12 11:35:18 +08:00 |
ViperEkura
|
5889179c54
|
refactor: 抽取 BaseStorage 存储抽象,支持 JSON 原始文本数据加载
- 新增 astrai/dataset/storage.py:BaseStorage/H5Storage/JSONStorage + Fetchers + 序列化函数
- BaseDataset.load() 接入存储抽象,自动检测 HDF5/JSON 格式
- JSON 支持原始文本 + tokenizer callable 加载时 tokenize
- 新增 BaseDataset.count / keys 属性进行长度观测
- serialization.py 精简为只保留 Checkpoint 类
- 函数放前、类放后,删除分隔注释
|
2026-05-12 11:17:24 +08:00 |
ViperEkura
|
3583c46b66
|
feat: 推理引擎前缀缓存(KV cache 复用)
- cache.py: 新增模块级 page_hash() 多项式滚动哈希函数;PagedCache 新增
record_page/lookup_prefix/inc_ref,free() 自动清理哈希映射
- scheduler.py: Task 新增 _prefix_cached_tokens;_refill_active_batch 先查
缓存命中页(inc_ref)再分配剩余页;合并 _execute_prefill 为单一方法,
按 (prompt_len, start_pos) 分组批量执行全量/部分 prefill;
_record_page_hashes 注册完整页哈希;修复 device/dtype 默认值从硬编码
改为 None(自动检测模型设备)
- test: mock model 补充 dtype/device 适配自动检测
|
2026-05-09 23:53:57 +08:00 |
ViperEkura
|
283bcaf2ff
|
fix: 修复 CLI 参数缺失/重复、device_ids 越界、generate 参数名不一致、scheduler 时序、非流式截断等 bug
- train.py: 补上 --batch_size、--grpo_clip_eps,删除 3 处重复 --group_size
- generate.py: --model_dir 改为 --param_path 对齐 README
- automodel.py: from_pretrained 新增 strict 参数(默认 True)
- parallel/setup.py: 修复 device_ids 索引越界
- train_callback.py: scheduler.step() 移至 on_step_end
- test_train_strategy.py: 测试中补 optimizer.step()
- engine.py: 非流式改为循环等待所有任务完成,补 remove_task 清理
- scheduler.py: Task 添加 _pages_freed 标志,杜绝双重释放
- trainer.py: accumulation_steps=0 时 clamp 为 1
- tokenizer.py: save_pretrained 添加 _tokenizer is None 检查
- benchmark.py: 修复 ModelConfig 过时 import 路径
- inference/__init__.py: 修复 stale docstring
|
2026-05-09 14:36:42 +08:00 |
ViperEkura
|
d73f52a2f8
|
feat: 新增 Anthropic 兼容 /v1/messages API,移除旧版 /generate 端点
- 新增 /v1/messages 端点,兼容 Anthropic Messages API 格式
- 支持流式 SSE(message_start → content_block_delta → message_stop)
- 支持 system 顶层提示词与 stop_sequences 停止序列
- 新增 AnthropicMessage / MessagesRequest Pydantic 模型
- 移除旧版 /generate 端点及相关测试用例
- 更新 README.md / README-zh-CN.md / introduction.md 文档
|
2026-05-09 11:47:22 +08:00 |
ViperEkura
|
f81e2b4a73
|
feat: OpenAI 兼容的 chat completion API(流式+非流式+usage)
|
2026-05-08 21:54:55 +08:00 |
ViperEkura
|
30cc2d67a4
|
refactor: 分页 KV cache 替换固定 slot,删除 PrefixCache 及相关死代码
- 用 PagedCache + CacheView 替换固定 slot 式 KV cache,attention 层只通过 page_table 间接索引
- 删除 PrefixCache(radix tree)及 scheduler 中所有 prefix cache 命中/插入/释放逻辑
- 删除无用函数:pin、version、free_count、_mark_seq_mask 及 seq_mask 分配
- 修复 write 在多页 prefill 时 offset 为负导致 chunk 计算错误
- _make_page_table_tensor 改用 list 拼接一次 tensor,去掉逐元素赋值
- 清理 model 接口参数:kv_cache, slot_indices → paged_cache(CacheView)
- 精简 docstring 为单行,删除冗余 section 注释和旧代码
- 修复 test_scheduler_concurrency.py 缺少 import pytest
|
2026-05-08 20:44:05 +08:00 |
ViperEkura
|
44d7a4e959
|
refactor: 设计模式优化 inference 模块导入结构
- 新建 cache.py:SlotAllocator 对象池 + PrefixCacheManager
- 新建 sampling.py:Temperature/TopK/TopP 可组合策略
- TaskStatus 改用 Enum,GenerationParams 值对象模式
- _STOP 移至 cache.py,解除 engine→scheduler 轻量耦合
- 更新测试导入路径,ruff 格式检查通过
|
2026-05-08 16:57:57 +08:00 |
ViperEkura
|
a6f5ff3b37
|
fix: 修复 remove_task 未释放 KV cache slot 导致第二轮对话死锁
- remove_task() 现在释放 KV cache slot 和 prefix cache 引用
- _refill_active_batch 中 alloc 失败时将剩余 task 推回 waiting_queue
- 主循环增加 try/except 异常兜底,发送 _STOP 给所有 task
- 重构:server.py 全局变量改为 ServerState 类;automodel.py
使用 Registry 替代裸 dict;合并 TrainContextBuilder 的 with_*
方法到 build()
|
2026-05-08 14:53:04 +08:00 |
ViperEkura
|
520de3ebe8
|
refactor: 重构推理引擎控制逻辑,修复连续批处理核心缺陷
- 修复 decode 阶段新任务覆盖已有任务的严重缺陷
- 修复线程安全问题(热路径无锁竞争)
- 修复前缀缓存引用计数管理不当导致缓存被驱逐
- 修复 pad_id 缺失导致全量 prefill 崩溃
- 修复 RoPE 位置错乱(不同位置任务共用 start_pos)
- 新增 slot 版本追踪实现前缀缓存零拷贝复用
- 新增异步流式生成接口避免阻塞事件循环
- 添加完整英文文档字符串
|
2026-05-06 16:04:06 +08:00 |
ViperEkura
|
a2ae742988
|
chore: 增加并发测试
|
2026-04-09 18:10:28 +08:00 |
ViperEkura
|
ace8f6ee68
|
chore: 优化未使用的模块
|
2026-04-06 09:54:17 +08:00 |
ViperEkura
|
39766aa1dc
|
chore: 修改类名,优化导入顺序
|
2026-04-05 22:27:57 +08:00 |
ViperEkura
|
fc278d17ab
|
feat: 实现模型动态注册机制
|
2026-04-05 19:38:12 +08:00 |
ViperEkura
|
2b26f03bd3
|
refactor: 拆分engine.py 文件
|
2026-04-05 00:07:21 +08:00 |
ViperEkura
|
861d33b1a1
|
refactor: 更新inference 部分的实现
|
2026-04-04 23:49:18 +08:00 |
ViperEkura
|
c94a246c71
|
chore: 重命名目录
|
2026-04-04 17:03:22 +08:00 |
ViperEkura
|
9c31d78a22
|
chore: 将data 模块命名为dataset
|
2026-04-04 16:16:27 +08:00 |
ViperEkura
|
bd9741dc5f
|
refactor: 从data 模块分离tokenizer
|
2026-04-04 16:12:58 +08:00 |
ViperEkura
|
b531232a9b
|
style: 修改为显式导入
|
2026-04-04 16:02:49 +08:00 |
ViperEkura
|
e97536758f
|
refactor: 优化工厂模式结构
|
2026-04-04 11:33:58 +08:00 |
ViperEkura
|
0852b852f8
|
refactor: 优化参数传递,清理导入样式
|
2026-04-03 22:06:32 +08:00 |
ViperEkura
|
3a7d98a950
|
fix: 修复测试部分导入问题
|
2026-04-03 15:01:39 +08:00 |
ViperEkura
|
475de51c7d
|
feat: 增加server, 并且修改测试单元
|
2026-04-02 15:05:07 +08:00 |
ViperEkura
|
2e009cf59a
|
chore: 更新项目名称
|
2026-03-31 09:34:11 +08:00 |
ViperEkura
|
426af2d75f
|
style: 使用ruff 工具优化代码风格
|
2026-03-30 23:32:28 +08:00 |
ViperEkura
|
345fd2f091
|
fix: 修复参数传递问题
|
2026-03-30 22:22:36 +08:00 |
ViperEkura
|
c01791ff54
|
feat: 增加推理部分工厂模式
|
2026-03-30 00:55:15 +08:00 |
ViperEkura
|
3e8f2eba81
|
fix: 修复路径问题
|
2026-03-20 21:14:02 +08:00 |
ViperEkura
|
50f76cd7c7
|
refactor: 重构数据模块中的数据集类命名和文件结构
|
2026-03-19 22:37:32 +08:00 |
ViperEkura
|
5713b55500
|
refactor: 修改 StepMonitorCallback, 分离职责
|
2026-03-04 19:45:39 +08:00 |
ViperEkura
|
8a8d6369bc
|
fix: 修复 dataset 和 checkpoint 的 bug
|
2026-03-02 11:12:21 +08:00 |
ViperEkura
|
6089a12cef
|
fix: 修复参数传递问题并更新测试单元
|
2026-02-28 19:01:16 +08:00 |
ViperEkura
|
582d4ae9a7
|
refactor(data): 修改文件加载方案
|
2026-02-22 21:14:10 +08:00 |
ViperEkura
|
7dfa5cc0ac
|
refactor(data): 重构MmapFileHandler类并改进数据加载机制
|
2026-01-11 19:37:28 +08:00 |
ViperEkura
|
9dab96c31f
|
test(checkpoint): 添加多进程检查点测试功能
|
2026-01-08 22:04:39 +08:00 |
ViperEkura
|
4da70785b5
|
refactor(tests): 重构测试文件目录结构
|
2026-01-08 21:34:52 +08:00 |
ViperEkura
|
d407962ffa
|
fix(trainer): 更新检查点保存和加载逻辑
|
2026-01-08 19:04:08 +08:00 |
ViperEkura
|
eba99e1f5e
|
feat(model): 添加QK归一化和门控注意力支持
|
2026-01-05 16:14:44 +08:00 |
ViperEkura
|
573f041c51
|
feat(trainer): 支持分布式训练配置与检查点加载优化
|
2025-12-19 19:34:39 +08:00 |