Initial K3 snapshot: 0.5B KDA/MLA/MoE train path

Standalone tree split from LLMRL/projects/kda. Includes Triton dt_bias
backward fix, train_k3 --preset 0.5b, SFT, Docker runtime, and tests.
This commit is contained in:
dela
2026-08-25 14:43:17 +08:00
commit 584f7e9e73
140 changed files with 21592 additions and 0 deletions
+43
View File
@@ -0,0 +1,43 @@
[project]
name = "kda"
version = "0.0.1"
description = "Hand-written KDA implementation from naive recurrent to fused Triton + training + inference"
requires-python = ">=3.10"
# kda 是独立 uv 项目 (自带 uv.lock + .venv), 自声明运行依赖, 不依赖仓库根环境
dependencies = [
"torch>=2.9.0", # uv 解析最新满足版 (含 CUDA 构建); 与根环境 2.9.0+cu128 仅下限一致
"einops>=0.7.0", # kda/ops/reference/chunkwise.py 的 rearrange
"packaging>=23.0", # vendored FLA utils version checks
"sentencepiece>=0.2.0", # toy SentencePiece
"datasets>=3.0.0", # 中文 wiki 语料加载
"transformers>=4.51.0", # Qwen3 tokenizer for 0.5b preset
"swanlab>=0.9.7",
]
# 训练机 / Docker 镜像: uv sync --extra train
[project.optional-dependencies]
train = [
"swanlab>=0.6.0",
"sacrebleu>=2.4.0",
"langdetect>=1.0.9",
]
# uv run / uv sync 默认安装 dev group
[dependency-groups]
dev = [
"pytest>=7.0",
"torchlens>=2.34", # 计算图展开集成测试; 未装时测试模块自动 skip
"tensorlens>=0.0.3", # Flask viewer 集成测试; 未装时测试模块自动 skip
]
[tool.uv]
# 公共入口: `from kda import CausalLM, KDAConfig, K3Config, chunk_kda`
package = true
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[tool.hatch.build.targets.wheel]
packages = ["kda"]