mirror of
https://github.com/openmlsys/openmlsys-zh.git
synced 2026-03-20 20:17:03 +08:00
refactor: restructure project and update documentation for second edition (#500)
* feat: remove bilingual button on the front page * misc: clean repo * test: fix test suite for v1/v2 restructure and removed language switch * refactor: restructure chapters for the second edition * refactor: restructure project * refactor: remove unused scripts * refactor: move conftest.py to tests directory * refactor: update README with new chapter structure and logo path * fix: update image paths in README and README_EN for consistency * refactor: update directory structure and script references in documentation
This commit is contained in:
16
.gitignore
vendored
16
.gitignore
vendored
@@ -33,19 +33,3 @@ zh_chapters/img
|
||||
zh_chapters/references
|
||||
zh_chapters/static
|
||||
zh_chapters/mlsys.bib
|
||||
v1/en_chapters/img
|
||||
v1/en_chapters/references
|
||||
v1/en_chapters/static
|
||||
v1/en_chapters/mlsys.bib
|
||||
v1/zh_chapters/img
|
||||
v1/zh_chapters/references
|
||||
v1/zh_chapters/static
|
||||
v1/zh_chapters/mlsys.bib
|
||||
v2/en_chapters/img
|
||||
v2/en_chapters/references
|
||||
v2/en_chapters/static
|
||||
v2/en_chapters/mlsys.bib
|
||||
v2/zh_chapters/img
|
||||
v2/zh_chapters/references
|
||||
v2/zh_chapters/static
|
||||
v2/zh_chapters/mlsys.bib
|
||||
|
||||
46
README.md
46
README.md
@@ -1,5 +1,5 @@
|
||||
<p align="center">
|
||||
<img src="static/logo-with-text.png" alt="OpenMLSys Logo" width="400"/>
|
||||
<img src="info/logo-with-text.png" alt="OpenMLSys Logo" width="400"/>
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
@@ -46,35 +46,19 @@
|
||||
|
||||
## 内容介绍
|
||||
|
||||
本书分为基础篇、进阶篇和扩展篇三个部分:
|
||||
|
||||
### 基础篇
|
||||
本书(第二版)共分9章:
|
||||
|
||||
| 章节 | 内容 |
|
||||
|------|------|
|
||||
| [编程接口](chapter_programming_interface/) | 框架接口设计哲学、机器学习工作流、深度学习模型定义、C/C++ 框架开发 |
|
||||
| [计算图](chapter_computational_graph/) | 计算图基本构成、生成方法、调度策略、自动微分 |
|
||||
|
||||
### 进阶篇
|
||||
|
||||
| 章节 | 内容 |
|
||||
|------|------|
|
||||
| [编译器前端和中间表示](chapter_frontend_and_ir/) | 类型推导、中间表示(IR)、自动微分、常见优化 Pass |
|
||||
| [编译器后端和运行时](chapter_backend_and_runtime/) | 计算图优化、算子选择、内存分配、计算调度与执行 |
|
||||
| [硬件加速器](chapter_accelerator/) | GPU/Ascend 架构原理、高性能编程接口(CUDA/CANN) |
|
||||
| [数据处理框架](chapter_data_processing/) | 易用性、高效性、保序性、分布式数据处理 |
|
||||
| [模型部署](chapter_model_deployment/) | 模型转换、模型压缩、模型推理、安全保护 |
|
||||
| [分布式训练](chapter_distributed_training/) | 数据并行、模型并行、流水线并行、集合通讯、参数服务器 |
|
||||
|
||||
### 扩展篇
|
||||
|
||||
| 章节 | 内容 |
|
||||
|------|------|
|
||||
| [深度学习推荐系统](chapter_recommender_system/) | 推荐系统原理、大规模工业场景架构设计 |
|
||||
| [联邦学习系统](chapter_federated_learning/) | 联邦学习方法、隐私保护、系统实现 |
|
||||
| [强化学习系统](chapter_reinforcement_learning/) | 单智能体/多智能体强化学习系统 |
|
||||
| [可解释性 AI 系统](chapter_explainable_AI/) | 可解释 AI 方法与落地实践 |
|
||||
| [机器人学习系统](chapter_rl_sys/) | 机器人感知、规划、控制与系统安全 |
|
||||
| [第1章 导论](v2/zh_chapters/01_chapter_introduction/) | 机器学习系统架构和技术栈概述 |
|
||||
| [第2章 编程接口与计算图](v2/zh_chapters/02_chapter_programming_and_graph/) | 张量抽象、自动微分、图表示与执行 |
|
||||
| [第3章 AI加速器与编程](v2/zh_chapters/03_chapter_accelerator/) | GPU 架构与 CUDA/Triton/CUTLASS 编程模型 |
|
||||
| [第4章 AI编译器与运行时系统](v2/zh_chapters/04_chapter_compiler_and_runtime/) | IR 设计、图优化、算子生成与运行时执行 |
|
||||
| [第5章 数据处理系统](v2/zh_chapters/05_chapter_data_processing/) | 数据加载、数据管道和分布式数据处理 |
|
||||
| [第6章 训练系统](v2/zh_chapters/06_chapter_training_systems/) | 单节点与分布式训练、并行策略与训练优化 |
|
||||
| [第7章 模型服务](v2/zh_chapters/07_chapter_model_serving/) | 推理优化、在线服务与模型管理 |
|
||||
| [第8章 强化学习系统](v2/zh_chapters/08_chapter_rl_systems/) | 强化学习管道、环境交互与 RL 系统设计 |
|
||||
| [第9章 大规模GPU集群管理](v2/zh_chapters/09_chapter_gpu_cluster/) | GPU 调度、资源管理与大规模训练基础设施 |
|
||||
|
||||
## 更新日志
|
||||
|
||||
@@ -91,6 +75,7 @@
|
||||
|
||||
- curl
|
||||
- git
|
||||
- Python 3
|
||||
|
||||
### 安装步骤
|
||||
|
||||
@@ -109,11 +94,12 @@ cargo install mdbook
|
||||
### 编译HTML
|
||||
|
||||
```bash
|
||||
sh build_mdbook_zh.sh
|
||||
# 生成结果位于 .mdbook-zh/book
|
||||
sh build_mdbook_v2.sh
|
||||
# 英文版生成结果位于 .mdbook-v2/book
|
||||
# 中文版生成结果位于 .mdbook-v2-zh/book
|
||||
```
|
||||
|
||||
更多细节请参考 [构建指南](info/info.md)。
|
||||
更多细节请参考 [构建指南](v2/info/info.md)。
|
||||
|
||||
## 贡献指南
|
||||
|
||||
|
||||
52
README_EN.md
52
README_EN.md
@@ -1,5 +1,5 @@
|
||||
<p align="center">
|
||||
<img src="static/logo-with-text.png" alt="OpenMLSys Logo" width="400"/>
|
||||
<img src="info/logo-with-text.png" alt="OpenMLSys Logo" width="400"/>
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
@@ -48,35 +48,19 @@ An open-source book explaining the design principles and implementation experien
|
||||
|
||||
## Content Overview
|
||||
|
||||
The book is organized into three parts: Fundamentals, Advanced Topics, and Extensions.
|
||||
|
||||
### Part I: Fundamentals
|
||||
The book (2nd edition) consists of 9 chapters:
|
||||
|
||||
| Chapter | Content |
|
||||
|---------|---------|
|
||||
| [Programming Interface](chapter_programming_interface/) | Framework API design, ML workflows, deep learning model definition, C/C++ framework development |
|
||||
| [Computational Graph](chapter_computational_graph/) | Graph components, generation methods, scheduling strategies, automatic differentiation |
|
||||
|
||||
### Part II: Advanced Topics
|
||||
|
||||
| Chapter | Content |
|
||||
|---------|---------|
|
||||
| [Compiler Frontend & IR](chapter_frontend_and_ir/) | Type inference, intermediate representation (IR), automatic differentiation, common optimization passes |
|
||||
| [Compiler Backend & Runtime](chapter_backend_and_runtime/) | Graph optimization, operator selection, memory allocation, compute scheduling and execution |
|
||||
| [Hardware Accelerators](chapter_accelerator/) | GPU/Ascend architecture, high-performance programming interfaces (CUDA/CANN) |
|
||||
| [Data Processing](chapter_data_processing/) | Usability, efficiency, order preservation, distributed data processing |
|
||||
| [Model Deployment](chapter_model_deployment/) | Model conversion, compression, inference, and security |
|
||||
| [Distributed Training](chapter_distributed_training/) | Data parallelism, model parallelism, pipeline parallelism, collective communication, parameter servers |
|
||||
|
||||
### Part III: Extensions
|
||||
|
||||
| Chapter | Content |
|
||||
|---------|---------|
|
||||
| [Recommender Systems](chapter_recommender_system/) | Recommendation principles, large-scale industrial architecture |
|
||||
| [Federated Learning](chapter_federated_learning/) | Federated learning methods, privacy protection, system implementation |
|
||||
| [Reinforcement Learning Systems](chapter_reinforcement_learning/) | Single-agent and multi-agent RL systems |
|
||||
| [Explainable AI Systems](chapter_explainable_AI/) | XAI methods and production practices |
|
||||
| [Robot Learning Systems](chapter_rl_sys/) | Robot perception, planning, control, and system safety |
|
||||
| [Chapter 1: Introduction](v2/en_chapters/01_chapter_introduction/) | Overview of ML system architecture and technology stack |
|
||||
| [Chapter 2: Programming Interfaces and Computational Graphs](v2/en_chapters/02_chapter_programming_and_graph/) | Tensor abstraction, automatic differentiation, graph representation and execution |
|
||||
| [Chapter 3: AI Accelerators and Programming](v2/en_chapters/03_chapter_accelerator/) | GPU architecture and CUDA/Triton/CUTLASS programming models |
|
||||
| [Chapter 4: AI Compilers and Runtime Systems](v2/en_chapters/04_chapter_compiler_and_runtime/) | IR design, graph optimization, kernel generation, and runtime execution |
|
||||
| [Chapter 5: Data Processing Systems](v2/en_chapters/05_chapter_data_processing/) | Data loading, data pipelines, and distributed data processing |
|
||||
| [Chapter 6: Training Systems](v2/en_chapters/06_chapter_training_systems/) | Single-node and distributed training, parallelism strategies, and training optimization |
|
||||
| [Chapter 7: Model Serving](v2/en_chapters/07_chapter_model_serving/) | Inference optimization, online serving, and model management |
|
||||
| [Chapter 8: RL Systems](v2/en_chapters/08_chapter_rl_systems/) | Reinforcement learning pipelines, environment interaction, and RL system design |
|
||||
| [Chapter 9: Large-scale GPU Cluster Management](v2/en_chapters/09_chapter_gpu_cluster/) | GPU scheduling, resource management, and large-scale training infrastructure |
|
||||
|
||||
## Changelog
|
||||
|
||||
@@ -93,6 +77,7 @@ The book is organized into three parts: Fundamentals, Advanced Topics, and Exten
|
||||
|
||||
- curl
|
||||
- git
|
||||
- Python 3
|
||||
|
||||
### Installation
|
||||
|
||||
@@ -111,11 +96,12 @@ cargo install mdbook
|
||||
### Build HTML
|
||||
|
||||
```bash
|
||||
sh build_mdbook.sh
|
||||
# Output is in .mdbook/book
|
||||
sh build_mdbook_v2.sh
|
||||
# English output: .mdbook-v2/book
|
||||
# Chinese output: .mdbook-v2-zh/book
|
||||
```
|
||||
|
||||
For more details, see the [Build Guide](info/info.md).
|
||||
For more details, see the [Build Guide](v2/info/info.md).
|
||||
|
||||
## Contributing
|
||||
|
||||
@@ -127,7 +113,11 @@ Before contributing, please read:
|
||||
|
||||
## Community
|
||||
|
||||
Join our WeChat group by scanning the QR code in [info/mlsys_group.png](info/mlsys_group.png).
|
||||
<p align="center">
|
||||
<img src="info/mlsys_group.png" alt="微信群二维码" width="200"/>
|
||||
<br/>
|
||||
Join our WeChat group by scanning the QR code
|
||||
</p>
|
||||
|
||||
## Citation
|
||||
|
||||
|
||||
19
book.toml
19
book.toml
@@ -1,19 +0,0 @@
|
||||
[book]
|
||||
authors = ["OpenMLSys Contributors"]
|
||||
language = "en"
|
||||
src = "en_chapters"
|
||||
title = "Machine Learning Systems: Design and Implementation"
|
||||
|
||||
[build]
|
||||
build-dir = ".mdbook/book"
|
||||
create-missing = false
|
||||
|
||||
[preprocessor.openmlsys]
|
||||
command = "python3 tools/mdbook_preprocessor.py"
|
||||
|
||||
[output.html]
|
||||
mathjax-support = true
|
||||
git-repository-url = "https://github.com/openmlsys/openmlsys-zh"
|
||||
preferred-dark-theme = "navy"
|
||||
additional-css = ["theme/dark-mode-images.css", "theme/version-selector.css"]
|
||||
additional-js = ["theme/version-selector.js"]
|
||||
@@ -1,2 +0,0 @@
|
||||
d2lbook build html
|
||||
python3 tools/format_tables.py
|
||||
@@ -1,23 +0,0 @@
|
||||
#!/bin/bash
|
||||
# Build the English (en) version of the book from en_chapters/.
|
||||
# Output: en_chapters/_build/html/
|
||||
#
|
||||
# Resources (img/, references/, static/, mlsys.bib) live at the repo root and
|
||||
# are symlinked into en_chapters/ so d2lbook can find them at relative paths.
|
||||
|
||||
set -e
|
||||
|
||||
ROOT="$(cd "$(dirname "$0")" && pwd)"
|
||||
|
||||
# ── Create resource symlinks ──────────────────────────────────────────────────
|
||||
python3 "$ROOT/tools/ensure_book_resources.py" --chapter-dir "$ROOT/en_chapters"
|
||||
|
||||
# ── Build ─────────────────────────────────────────────────────────────────────
|
||||
cd "$ROOT/en_chapters"
|
||||
|
||||
rm -rf _build/rst _build/html
|
||||
d2lbook build rst
|
||||
cp static/frontpage.html _build/rst/
|
||||
d2lbook build html
|
||||
cp -r static/image/* _build/html/_images/ 2>/dev/null || true
|
||||
python3 "$ROOT/tools/format_tables.py"
|
||||
@@ -1,23 +0,0 @@
|
||||
#!/bin/bash
|
||||
# Build the Chinese (zh) version of the book from zh_chapters/.
|
||||
# Output: zh_chapters/_build/html/
|
||||
#
|
||||
# Resources (img/, references/, static/, mlsys.bib) live at the repo root and
|
||||
# are symlinked into zh_chapters/ so d2lbook can find them at relative paths.
|
||||
|
||||
set -e
|
||||
|
||||
ROOT="$(cd "$(dirname "$0")" && pwd)"
|
||||
|
||||
# ── Create resource symlinks ──────────────────────────────────────────────────
|
||||
python3 "$ROOT/tools/ensure_book_resources.py" --chapter-dir "$ROOT/zh_chapters"
|
||||
|
||||
# ── Build ─────────────────────────────────────────────────────────────────────
|
||||
cd "$ROOT/zh_chapters"
|
||||
|
||||
rm -rf _build/rst _build/html
|
||||
d2lbook build rst
|
||||
cp static/frontpage.html _build/rst/
|
||||
d2lbook build html
|
||||
cp -r static/image/* _build/html/_images/ 2>/dev/null || true
|
||||
python3 "$ROOT/tools/format_tables.py"
|
||||
@@ -1,23 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
PYTHON_BIN="$(command -v python3 || command -v python || true)"
|
||||
|
||||
if [[ -z "${PYTHON_BIN}" ]]; then
|
||||
echo "Python is required to prepare the mdBook staging tree." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! command -v mdbook >/dev/null 2>&1; then
|
||||
echo "mdbook is not installed. Install it first, for example with: cargo install mdbook" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
"${PYTHON_BIN}" "${ROOT}/tools/ensure_book_resources.py" --chapter-dir "${ROOT}/en_chapters"
|
||||
"${PYTHON_BIN}" "${ROOT}/tools/prepare_mdbook.py" \
|
||||
--source "${ROOT}/en_chapters" \
|
||||
--summary-output "${ROOT}/en_chapters/SUMMARY.md" \
|
||||
--placeholder-prefix "[TODO: src = zh_chapters/"
|
||||
|
||||
mdbook build "${ROOT}"
|
||||
@@ -1,25 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
PYTHON_BIN="$(command -v python3 || command -v python || true)"
|
||||
|
||||
if [[ -z "${PYTHON_BIN}" ]]; then
|
||||
echo "Python is required to prepare the mdBook staging tree." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! command -v mdbook >/dev/null 2>&1; then
|
||||
echo "mdbook is not installed. Install it first, for example with: cargo install mdbook" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# ── Create resource links ─────────────────────────────────────────────────────
|
||||
"${PYTHON_BIN}" "${ROOT}/tools/ensure_book_resources.py" --chapter-dir "${ROOT}/zh_chapters"
|
||||
|
||||
# ── Build ─────────────────────────────────────────────────────────────────────
|
||||
"${PYTHON_BIN}" "${ROOT}/tools/prepare_mdbook_zh.py" \
|
||||
--source "${ROOT}/zh_chapters" \
|
||||
--summary-output "${ROOT}/zh_chapters/SUMMARY.md"
|
||||
|
||||
mdbook build "${ROOT}/books/zh"
|
||||
@@ -1,4 +0,0 @@
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
sys.path.insert(0, str(Path(__file__).resolve().parent))
|
||||
@@ -1,49 +0,0 @@
|
||||
# 编辑和作者
|
||||
|
||||
## 章节编辑
|
||||
|
||||
本书由超过30位人工智能系统领域的学术专家和开发人员共同完成。以下为各个章节编辑:
|
||||
|
||||
项目README: [@luomai](https://github.com/luomai)
|
||||
|
||||
序言:[@luomai](https://github.com/luomai)
|
||||
|
||||
导论:[@luomai](https://github.com/luomai)
|
||||
|
||||
编程接口:[@Laicheng0830](https://github.com/Laicheng0830)
|
||||
|
||||
计算图:[@hanjr92](https://github.com/hanjr92)
|
||||
|
||||
进阶篇序言:[@ganzhiliang](https://github.com/ganzhiliang)
|
||||
|
||||
编译器前端和IR: [@LiangZhibo](https://github.com/LiangZhibo)
|
||||
|
||||
编译器后端和运行时: [@chujinjin101](https://github.com/chujinjin101)
|
||||
|
||||
硬件加速器:[@anyrenwei](https://github.com/anyrenwei)
|
||||
|
||||
数据处理框架: [@eedalong](https://github.com/eedalong)
|
||||
|
||||
模型部署: [@AssassinG](https://github.com/AssassinGQ)
|
||||
|
||||
分布式训练系统: [@luomai](https://github.com/luomai)
|
||||
|
||||
拓展篇序言:[@luomai](https://github.com/luomai)
|
||||
|
||||
深度学习推荐系统:[@future-xy](https://github.com/future-xy)
|
||||
|
||||
联邦学习系统:[@chengtianwu](https://github.com/chengtianwu)
|
||||
|
||||
强化学习系统:[@quantumiracle](https://github.com/quantumiracle)
|
||||
|
||||
可解释性AI系统:[@HaoyangLee](https://github.com/HaoyangLee)
|
||||
|
||||
机器人系统:[@Jack](https://github.com/Jiankai-Sun)
|
||||
|
||||
附录:机器学习介绍:[@Hao](https://github.com/zsdonghao)
|
||||
|
||||
## 加入我们
|
||||
|
||||
我们创建了OpenMLSys微信群来讨论书籍的写作和拓展。如果希望加入我们,可以扫以下二维码(加的时候请介绍自己,并说明希望参与书籍的哪方面工作):
|
||||
|
||||

|
||||
BIN
info/logo-with-text.png
Normal file
BIN
info/logo-with-text.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 62 KiB |
@@ -1,35 +0,0 @@
|
||||
# 参考文献引用方式
|
||||
下面为参考文献的引用,需要注意引用时前面需要有一个空格:
|
||||
1. 单篇参考文献
|
||||
这篇文章参考了论文 :cite:`cnn2015`
|
||||
2. 多篇参考文献可以用逗号分开
|
||||
这篇文章参考了论文 :cite:`cnn2015,rnn2015`
|
||||
3. 此时在对应bib中应该有如下参考文献
|
||||
@inproceedings{cnn2015,
|
||||
title = {CNN},
|
||||
author = {xxx},
|
||||
year = {2015},
|
||||
keywords = {xxx}
|
||||
}
|
||||
@inproceedings{rnn2015,
|
||||
title = {RNN},
|
||||
author = {xxx},
|
||||
year = {2015},
|
||||
keywords = {xxx}
|
||||
}
|
||||
|
||||
# 参考文献置于章节末尾方式
|
||||
1.将章节所引用的全部参考文献生成一个chapter.pip,放置于references文件夹下。
|
||||
如机器人系统章节将该章节参考文献全部放在rlsys.bib,并将其放在reference文件夹下。
|
||||
|
||||
```
|
||||
参考文献目录
|
||||
|
||||
/references/rlsys.bib`
|
||||
```
|
||||
2.将对应章节参考文献引用添加至文章末尾处,如机器人系统章节在summary最后加上
|
||||
```
|
||||
## 参考文献
|
||||
|
||||
:bibliography:`../references/rlsys.bib`
|
||||
```
|
||||
4
tests/conftest.py
Normal file
4
tests/conftest.py
Normal file
@@ -0,0 +1,4 @@
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
sys.path.insert(0, str(Path(__file__).resolve().parent.parent))
|
||||
@@ -1,16 +0,0 @@
|
||||
/* 暗色模式下仅为正文图片添加浅灰色背景,提高透明背景图片的可读性 */
|
||||
.navy .content main img,
|
||||
.coal .content main img,
|
||||
.ayu .content main img {
|
||||
background-color: #e8e8e8;
|
||||
border-radius: 4px;
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
/* 首页 frontpage 图片保持透明,不添加正文图像底色。 */
|
||||
.navy .openmlsys-frontpage img,
|
||||
.coal .openmlsys-frontpage img,
|
||||
.ayu .openmlsys-frontpage img {
|
||||
background-color: transparent !important;
|
||||
padding: 0 !important;
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
<script type="text/x-mathjax-config">
|
||||
MathJax.Hub.Config({
|
||||
"HTML-CSS": {
|
||||
availableFonts: ["TeX"],
|
||||
preferredFont: "TeX",
|
||||
webFont: "TeX"
|
||||
},
|
||||
SVG: {
|
||||
font: "TeX"
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@@ -1,48 +0,0 @@
|
||||
/* Version and Language selectors — inline in .right-buttons */
|
||||
.openmlsys-nav-selectors {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
margin-right: 4px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
/* Shared style for all selector links/buttons */
|
||||
.openmlsys-selector-link {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
min-width: 32px;
|
||||
height: 28px;
|
||||
padding: 0 8px;
|
||||
border-radius: 4px;
|
||||
border: 1px solid transparent;
|
||||
color: var(--icons, #747474);
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
text-decoration: none;
|
||||
cursor: pointer;
|
||||
line-height: 1;
|
||||
transition: color 0.1s, background 0.1s;
|
||||
}
|
||||
|
||||
.openmlsys-selector-link:hover {
|
||||
color: var(--icons-hover, #333);
|
||||
background: var(--theme-hover, rgba(0, 0, 0, 0.05));
|
||||
}
|
||||
|
||||
/* Active/current indicator */
|
||||
.openmlsys-selector-link.active {
|
||||
color: var(--links, #4183c4);
|
||||
border-color: var(--links, #4183c4);
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
/* Separator between version and language groups */
|
||||
.openmlsys-selector-sep {
|
||||
width: 1px;
|
||||
height: 18px;
|
||||
background: var(--icons, #747474);
|
||||
opacity: 0.3;
|
||||
margin: 0 2px;
|
||||
}
|
||||
@@ -1,75 +0,0 @@
|
||||
// Version and Language selector for OpenMLSys mdbook
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
var path = window.location.pathname;
|
||||
|
||||
// Detect current version and language from URL
|
||||
var currentVersion = "v2";
|
||||
var currentLang = "en";
|
||||
|
||||
if (path.match(/\/v1(\/|$)/)) {
|
||||
currentVersion = "v1";
|
||||
}
|
||||
if (path.match(/\/cn(\/|$)/)) {
|
||||
currentLang = "zh";
|
||||
}
|
||||
|
||||
// Build base paths — always navigate to root of target version
|
||||
function basePath(version, lang) {
|
||||
// Determine site root: everything before /v1/, /cn/, or first path segment after /docs/
|
||||
var root = "/";
|
||||
var docsMatch = path.match(/^(\/docs\/)/);
|
||||
if (docsMatch) root = docsMatch[1];
|
||||
|
||||
var p = root;
|
||||
if (version === "v1") p += "v1/";
|
||||
if (lang === "zh") p += "cn/";
|
||||
return p;
|
||||
}
|
||||
|
||||
var container = document.createElement("span");
|
||||
container.className = "openmlsys-nav-selectors";
|
||||
|
||||
// --- Version links: V1 | V2 ---
|
||||
var versions = [
|
||||
{ label: "V1", value: "v1" },
|
||||
{ label: "V2", value: "v2" },
|
||||
];
|
||||
|
||||
versions.forEach(function (v) {
|
||||
var a = document.createElement("a");
|
||||
a.className = "openmlsys-selector-link";
|
||||
a.textContent = v.label;
|
||||
a.href = basePath(v.value, currentLang);
|
||||
if (v.value === currentVersion) a.classList.add("active");
|
||||
container.appendChild(a);
|
||||
});
|
||||
|
||||
// Separator
|
||||
var sep = document.createElement("span");
|
||||
sep.className = "openmlsys-selector-sep";
|
||||
container.appendChild(sep);
|
||||
|
||||
// --- Language toggle: single button that switches to the other language ---
|
||||
var otherLang = currentLang === "zh" ? "en" : "zh";
|
||||
var langLink = document.createElement("a");
|
||||
langLink.className = "openmlsys-selector-link";
|
||||
langLink.textContent = currentLang === "zh" ? "EN" : "ZH";
|
||||
langLink.href = basePath(currentVersion, otherLang);
|
||||
container.appendChild(langLink);
|
||||
|
||||
// Insert into .right-buttons, before existing icons
|
||||
function insertSelector() {
|
||||
var rightButtons = document.querySelector(".right-buttons");
|
||||
if (rightButtons) {
|
||||
rightButtons.insertBefore(container, rightButtons.firstChild);
|
||||
}
|
||||
}
|
||||
|
||||
if (document.readyState === "loading") {
|
||||
document.addEventListener("DOMContentLoaded", insertSelector);
|
||||
} else {
|
||||
insertSelector();
|
||||
}
|
||||
})();
|
||||
1
v1/en_chapters/img
Symbolic link
1
v1/en_chapters/img
Symbolic link
@@ -0,0 +1 @@
|
||||
../img
|
||||
1
v1/en_chapters/mlsys.bib
Symbolic link
1
v1/en_chapters/mlsys.bib
Symbolic link
@@ -0,0 +1 @@
|
||||
../mlsys.bib
|
||||
1
v1/en_chapters/references
Symbolic link
1
v1/en_chapters/references
Symbolic link
@@ -0,0 +1 @@
|
||||
../references
|
||||
1
v1/en_chapters/static
Symbolic link
1
v1/en_chapters/static
Symbolic link
@@ -0,0 +1 @@
|
||||
../static
|
||||
@@ -5,6 +5,7 @@
|
||||

|
||||
:width:`300px`
|
||||
:label:`simpledag`
|
||||
|
||||
### 张量和算子
|
||||
|
||||
在数学中定义张量是基于标量与向量的推广。在机器学习领域内将多维数据称为张量,使用秩来表示张量的轴数或维度。如 :numref:`tensor`所示,标量为零秩张量,包含单个数值,没有轴;向量为一秩张量,拥有一个轴;拥有RGB三个通道的彩色图像即为三秩张量,包含三个轴。
|
||||
|
||||
1
v1/zh_chapters/img
Symbolic link
1
v1/zh_chapters/img
Symbolic link
@@ -0,0 +1 @@
|
||||
../img
|
||||
1
v1/zh_chapters/mlsys.bib
Symbolic link
1
v1/zh_chapters/mlsys.bib
Symbolic link
@@ -0,0 +1 @@
|
||||
../mlsys.bib
|
||||
1
v1/zh_chapters/references
Symbolic link
1
v1/zh_chapters/references
Symbolic link
@@ -0,0 +1 @@
|
||||
../references
|
||||
1
v1/zh_chapters/static
Symbolic link
1
v1/zh_chapters/static
Symbolic link
@@ -0,0 +1 @@
|
||||
../static
|
||||
@@ -1,3 +1,22 @@
|
||||
# Summary
|
||||
|
||||
[Machine Learning Systems: Design and Implementation, 2nd Edition](index.md)
|
||||
[前言](00_chapter_preface/index.md)
|
||||
|
||||
# Basic
|
||||
|
||||
- [Chapter 1: Introduction](01_chapter_introduction/index.md)
|
||||
- [Chapter 2: Programming Interfaces and Computational Graphs](02_chapter_programming_and_graph/index.md)
|
||||
- [Chapter 3: AI Accelerators and Programming](03_chapter_accelerator/index.md)
|
||||
|
||||
# System
|
||||
|
||||
- [Chapter 4: AI Compilers and Runtime Systems](04_chapter_compiler_and_runtime/index.md)
|
||||
- [Chapter 5: Data Processing Systems](05_chapter_data_processing/index.md)
|
||||
- [Chapter 6: Training Systems](06_chapter_training_systems/index.md)
|
||||
|
||||
# Applications and More
|
||||
|
||||
- [Chapter 7: Model Serving](07_chapter_model_serving/index.md)
|
||||
- [Chapter 8: RL Systems](08_chapter_rl_systems/index.md)
|
||||
- [Chapter 9: Large-scale GPU Cluster Management](09_chapter_gpu_cluster/index.md)
|
||||
|
||||
1
v2/en_chapters/img
Symbolic link
1
v2/en_chapters/img
Symbolic link
@@ -0,0 +1 @@
|
||||
../../v1/img
|
||||
@@ -3,3 +3,24 @@
|
||||
This book provides a comprehensive introduction to the design and implementation of modern machine learning systems. It covers the full technology stack, from programming interfaces and AI accelerators to distributed training, model serving, and large-scale GPU cluster management.
|
||||
|
||||
The 2nd edition has been significantly restructured and expanded to reflect the rapid evolution of the ML systems landscape, including new chapters on AI compilers, RL systems, and GPU cluster management.
|
||||
|
||||
```toc
|
||||
:maxdepth: 2
|
||||
|
||||
[前言](00_chapter_preface/index)
|
||||
|
||||
# Basic
|
||||
01_chapter_introduction/index
|
||||
02_chapter_programming_and_graph/index
|
||||
03_chapter_accelerator/index
|
||||
|
||||
# System
|
||||
04_chapter_compiler_and_runtime/index
|
||||
05_chapter_data_processing/index
|
||||
06_chapter_training_systems/index
|
||||
|
||||
# Applications and More
|
||||
07_chapter_model_serving/index
|
||||
08_chapter_rl_systems/index
|
||||
09_chapter_gpu_cluster/index
|
||||
```
|
||||
|
||||
1
v2/en_chapters/mlsys.bib
Symbolic link
1
v2/en_chapters/mlsys.bib
Symbolic link
@@ -0,0 +1 @@
|
||||
../../v1/mlsys.bib
|
||||
1
v2/en_chapters/references
Symbolic link
1
v2/en_chapters/references
Symbolic link
@@ -0,0 +1 @@
|
||||
../../v1/references
|
||||
1
v2/en_chapters/static
Symbolic link
1
v2/en_chapters/static
Symbolic link
@@ -0,0 +1 @@
|
||||
../../v1/static
|
||||
@@ -10,12 +10,14 @@
|
||||
openmlsys/
|
||||
├── v2/ # Version 2 (active version, accepting contributions)
|
||||
│ ├── zh_chapters/ # Chinese chapter source files
|
||||
│ │ ├── chapter_xxx/ # Per-chapter directory, containing index.md and section .md files
|
||||
│ │ ├── 00_chapter_preface/ # Per-chapter directory (numeric prefix + name)
|
||||
│ │ ├── 01_chapter_introduction/
|
||||
│ │ ├── ...
|
||||
│ │ ├── index.md # Book homepage
|
||||
│ │ └── SUMMARY.md # Auto-generated by script — do not edit manually
|
||||
│ ├── en_chapters/ # English chapter source files (same structure as zh_chapters)
|
||||
│ ├── books/zh/ # Chinese mdBook configuration (used for build)
|
||||
│ ├── docs/ # Documentation (location of this file)
|
||||
│ ├── info/ # Documentation (location of this file)
|
||||
│ └── book.toml # English mdBook configuration
|
||||
├── v1/ # Version 1 (archived)
|
||||
├── img/ # Shared image assets for the entire book
|
||||
@@ -39,7 +41,7 @@ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
|
||||
# 2. Install mdBook
|
||||
cargo install mdbook
|
||||
|
||||
# 3. Clone the repository
|
||||
# 3. Clone the repository (Python 3 must also be installed)
|
||||
git clone https://github.com/openmlsys/openmlsys.git
|
||||
cd openmlsys
|
||||
```
|
||||
@@ -54,7 +56,7 @@ cd openmlsys
|
||||
bash build_mdbook_v2.sh
|
||||
```
|
||||
|
||||
Build output is placed in `.mdbook-v2/book/cn/` (Chinese) and `.mdbook-v2/book/` (English).
|
||||
Build output is placed in `.mdbook-v2-zh/book` (Chinese) and `.mdbook-v2/book` (English).
|
||||
|
||||
### Live Preview
|
||||
|
||||
|
||||
@@ -10,12 +10,14 @@
|
||||
openmlsys/
|
||||
├── v2/ # 第二版(当前活跃版本,接受贡献)
|
||||
│ ├── zh_chapters/ # 中文章节源文件
|
||||
│ │ ├── chapter_xxx/ # 各章目录,包含 index.md 及各节 .md 文件
|
||||
│ │ ├── 00_chapter_preface/ # 各章目录(数字前缀 + 名称)
|
||||
│ │ ├── 01_chapter_introduction/
|
||||
│ │ ├── ...
|
||||
│ │ ├── index.md # 全书首页
|
||||
│ │ └── SUMMARY.md # 由脚本自动生成,勿手动编辑
|
||||
│ ├── en_chapters/ # 英文章节源文件(结构与中文章节一致)
|
||||
│ ├── books/zh/ # 中文 mdBook 配置(供构建使用)
|
||||
│ ├── docs/ # 文档(本文件所在位置)
|
||||
│ ├── info/ # 文档(本文件所在位置)
|
||||
│ └── book.toml # 英文版 mdBook 配置
|
||||
├── v1/ # 第一版(已归档)
|
||||
├── img/ # 全书共享图片资源
|
||||
@@ -39,7 +41,7 @@ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
|
||||
# 2. 安装 mdBook
|
||||
cargo install mdbook
|
||||
|
||||
# 3. 克隆仓库
|
||||
# 3. 克隆仓库(需预先安装 Python 3)
|
||||
git clone https://github.com/openmlsys/openmlsys.git
|
||||
cd openmlsys
|
||||
```
|
||||
@@ -54,7 +56,7 @@ cd openmlsys
|
||||
bash build_mdbook_v2.sh
|
||||
```
|
||||
|
||||
构建产物输出至 `.mdbook-v2/book/cn/`(中文)和 `.mdbook-v2/book/`(英文)。
|
||||
构建产物输出至 `.mdbook-v2-zh/book`(中文)和 `.mdbook-v2/book`(英文)。
|
||||
|
||||
### 实时预览
|
||||
|
||||
|
||||
@@ -12,14 +12,13 @@ cargo install mdbook
|
||||
git clone https://github.com/openmlsys/openmlsys-zh.git
|
||||
cd openmlsys-zh
|
||||
```
|
||||
使用mdbook工具编译HTML。 请尽量使用build_mdbook.sh脚本进行编译,保证首页正确合并到书籍中去。
|
||||
使用mdbook工具编译HTML。 请尽量使用build_mdbook_v2.sh脚本进行编译,保证首页正确合并到书籍中去。
|
||||
```bash
|
||||
sh build_mdbook.sh
|
||||
# 中文版本
|
||||
sh build_mdbook_zh.sh
|
||||
sh build_mdbook_v1.sh
|
||||
sh build_mdbook_v2.sh
|
||||
```
|
||||
|
||||
生成的html会在`.mdbook/book`或者`.mdbook-zh/book`下。此时我们可以使用`tools/assemble_docs_publish_tree.py`组装最终的双语发布版本,然后将其拷贝至openmlsys.github.io的docs发布。
|
||||
生成的html会在`.mdbook-v2/book`或者`.mdbook-v2-zh/book`下。此时我们可以使用`tools/assemble_docs_publish_tree.py`组装最终的双语发布版本,然后将其拷贝至openmlsys.github.io的docs发布。
|
||||
|
||||
具体工作流可以参考`.github/workflows/update_docs.yml`
|
||||
|
||||
30
v2/info/refenence_guide.md
Normal file
30
v2/info/refenence_guide.md
Normal file
@@ -0,0 +1,30 @@
|
||||
# 参考文献引用方式
|
||||
|
||||
所有参考文献统一维护在 `mlsys.bib` 中。
|
||||
|
||||
## 添加文献条目
|
||||
|
||||
在 `mlsys.bib` 中添加 BibTeX 格式的条目,添加前请先检索是否已存在同名 key:
|
||||
|
||||
```bibtex
|
||||
@inproceedings{cnn2015,
|
||||
title = {CNN},
|
||||
author = {xxx},
|
||||
year = {2015},
|
||||
keywords = {xxx}
|
||||
}
|
||||
```
|
||||
|
||||
## 正文引用
|
||||
|
||||
引用时前面需要有一个空格:
|
||||
|
||||
1. 单篇参考文献
|
||||
```
|
||||
这篇文章参考了论文 :cite:`cnn2015`
|
||||
```
|
||||
|
||||
2. 多篇参考文献用逗号分隔
|
||||
```
|
||||
这篇文章参考了论文 :cite:`cnn2015,rnn2015`
|
||||
```
|
||||
@@ -19,7 +19,7 @@ This document defines the formatting and style requirements for v2 chapter conte
|
||||
|
||||
## File Structure
|
||||
|
||||
- Each chapter corresponds to a `v2/en_chapters/chapter_<name>/` directory
|
||||
- Each chapter corresponds to a `v2/en_chapters/<nn>_chapter_<name>/` directory (e.g., `02_chapter_programming_and_graph/`)
|
||||
- The chapter entry file is `index.md`; section content goes in separate `.md` files in the same directory
|
||||
- Declare the section structure in `index.md` using a `toc` block (used to auto-generate `SUMMARY.md`):
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
## 文件结构
|
||||
|
||||
- 每章对应 `v2/zh_chapters/chapter_<名称>/` 目录
|
||||
- 每章对应 `v2/zh_chapters/<nn>_chapter_<名称>/` 目录(如 `02_chapter_programming_and_graph/`)
|
||||
- 章节入口为 `index.md`,各节内容放在同目录下的独立 `.md` 文件中
|
||||
- 在 `index.md` 中使用 `toc` 块声明本章的节结构(脚本据此自动生成 `SUMMARY.md`):
|
||||
|
||||
|
||||
@@ -1,3 +1,22 @@
|
||||
# Summary
|
||||
|
||||
[机器学习系统:设计和实现(第二版)](index.md)
|
||||
[前言](00_chapter_preface/index.md)
|
||||
|
||||
# 基础篇
|
||||
|
||||
- [第1章 导论](01_chapter_introduction/index.md)
|
||||
- [第2章 编程接口与计算图](02_chapter_programming_and_graph/index.md)
|
||||
- [第3章 AI加速器与编程](03_chapter_accelerator/index.md)
|
||||
|
||||
# 系统篇
|
||||
|
||||
- [第4章 AI编译器与运行时系统](04_chapter_compiler_and_runtime/index.md)
|
||||
- [第5章 数据处理系统](05_chapter_data_processing/index.md)
|
||||
- [第6章 训练系统](06_chapter_training_systems/index.md)
|
||||
|
||||
# 应用与扩展篇
|
||||
|
||||
- [第7章 模型服务](07_chapter_model_serving/index.md)
|
||||
- [第8章 强化学习系统](08_chapter_rl_systems/index.md)
|
||||
- [第9章 大规模GPU集群管理](09_chapter_gpu_cluster/index.md)
|
||||
|
||||
1
v2/zh_chapters/img
Symbolic link
1
v2/zh_chapters/img
Symbolic link
@@ -0,0 +1 @@
|
||||
../../v1/img
|
||||
@@ -1,3 +1,24 @@
|
||||
# 机器学习系统:设计和实现(第二版)
|
||||
|
||||
本书系统性地介绍机器学习系统的设计原理与实现方法,涵盖从编程接口、AI加速器、编译器到分布式训练、模型服务和大规模集群管理等核心主题。第二版在第一版基础上进行了全面更新和重构,反映了机器学习系统领域的最新进展。
|
||||
|
||||
```toc
|
||||
:maxdepth: 2
|
||||
|
||||
[前言](00_chapter_preface/index)
|
||||
|
||||
# 基础篇
|
||||
01_chapter_introduction/index
|
||||
02_chapter_programming_and_graph/index
|
||||
03_chapter_accelerator/index
|
||||
|
||||
# 系统篇
|
||||
04_chapter_compiler_and_runtime/index
|
||||
05_chapter_data_processing/index
|
||||
06_chapter_training_systems/index
|
||||
|
||||
# 应用与扩展篇
|
||||
07_chapter_model_serving/index
|
||||
08_chapter_rl_systems/index
|
||||
09_chapter_gpu_cluster/index
|
||||
```
|
||||
|
||||
1
v2/zh_chapters/mlsys.bib
Symbolic link
1
v2/zh_chapters/mlsys.bib
Symbolic link
@@ -0,0 +1 @@
|
||||
../../v1/mlsys.bib
|
||||
1
v2/zh_chapters/references
Symbolic link
1
v2/zh_chapters/references
Symbolic link
@@ -0,0 +1 @@
|
||||
../../v1/references
|
||||
1
v2/zh_chapters/static
Symbolic link
1
v2/zh_chapters/static
Symbolic link
@@ -0,0 +1 @@
|
||||
../../v1/static
|
||||
Reference in New Issue
Block a user