README.md 4.26 KB
Newer Older
yongshk's avatar
yongshk committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# Hygon-hub
海光测试镜像仓库。

## 贡献指南
为了提升协作效率,本项目使用 [pre-commit](https://pre-commit.com/) 框架在每次提交前自动执行代码格式化与检查。具体使用方式请参考 [CONTRIBUTING.md](./CONTRIBUTING.md)

## 镜像层级依赖关系

本项目的 Docker 镜像采用分层构建策略,各镜像之间存在依赖关系。下图展示了镜像的构建层级和目录位置:

```mermaid
flowchart TD
    A["<b>🏭 Hygon PyTorch Base</b><br/><code>harbor.sourcefind.cn:5443/dcu/admin/base/pytorch</code><br/><br/>"]

    B["<b>📦 PyTorch Common Base</b><br/><code>common/base/pytorch/</code><br/><br/>"]

    C["<b>🚗 Autodrive</b><br/><code>common/base/autodrive/</code><br/><br/>"]
    D["<b>💬 Megatron-LM</b><br/><code>common/base/megatron/</code><br/><br/>"]
    E["<b>🎨 DiffSynth-Studio</b><br/><code>common/base/diffsynth-studio/</code><br/><br/>"]

    F["<b>Qwen3</b><br/><code>models/Qwen2-3/</code><br/><br/>"]
    G["<b>Wan2.2, FLUX.2, ...</b><br/><code>models/xxx/</code><br/><br/>"]
    H["<b>BEVFormer, ...</b><br/><code>models/BEVFormer/</code><br/><br/>"]

    A --> B
    B --> C & D & E
    C --> H
    D --> F
    E --> G

    style A fill:#e1f5fe,stroke:#01579b,stroke-width:2px
    style B fill:#fff3e0,stroke:#e65100,stroke-width:2px
    style C fill:#f3e5f5,stroke:#7b1fa2,stroke-width:2px
    style D fill:#f3e5f5,stroke:#7b1fa2,stroke-width:2px
    style E fill:#f3e5f5,stroke:#7b1fa2,stroke-width:2px
    style F fill:#e8f5e9,stroke:#2e7d32,stroke-width:2px
    style G fill:#e8f5e9,stroke:#2e7d32,stroke-width:2px
    style H fill:#e8f5e9,stroke:#2e7d32,stroke-width:2px
```

### 镜像层级说明

| 层级 | 名称 | 说明 | 构建目录 |
|------|------|------|----------|
| L0 | 海光官方镜像 | 由海光提供的 PyTorch DCU 基础镜像 | - |
| L1 | PyTorch 公共镜像 | 包含 SSH、网络、环境变量等通用配置 | `common/base/pytorch/` |
| L2 | 框架公共镜像 | 面向特定领域的框架镜像(自动驾驶/LLM/生成模型) | `common/base/<framework>/` |
| L3 | 模型镜像 | 特定模型的训练镜像 | `models/<model>/` |

### 构建顺序

构建镜像时需要按照依赖顺序进行:

54
55
1. **L1**: 先构建 `common/base/pytorch/dockerfile`,生成 `pytorch2.7.1_dtk26.04_v2.0_Hygon`
2. **L2**: 再构建框架镜像(如 `common/base/autodrive/dockerfile`),生成 `mmcv1.6_dtk26.04_v2.0_Hygon`
yongshk's avatar
yongshk committed
56
57
3. **L3**: 最后构建具体模型镜像(如 `models/BEVFormer/dockerfile`

58
59
> 构建时直接使用 Dockerfile 中配置的内部源或随模型目录携带的必要 wheel,不再需要启动本地包服务。

yongshk's avatar
yongshk committed
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
> ⚠️ **注意**: 构建下层镜像前,请确保其依赖的上层镜像已经构建完成并正确推送到镜像仓库。


## 项目目录结构

```
TrainingPerfBench/
├── common/                          # 公共文件
│   ├── base/                        # 基础框架镜像目录
│   │   ├── diffsynth-studio/        # DiffSynthStudio 目录
│   │   │   ├── DiffSynth-Studio/    # DiffSynthStudio 项目源码
│   │   │   ├── dockerfile           # DiffSynthStudio 基础镜像 dockerfile
│   │   │   └── README.md            # 镜像构建命令
│   │   │
│   │   ├── megatron/                # Megatron-LM 目录
│   │   │   ├── Megatron-LM/         # Megatron-LM 项目源码
│   │   │   ├── dockerfile           # Megatron-LM 基础镜像 dockerfile
│   │   │   └── README.md            # 镜像构建命令
│   │   └── ...
│   │
│   └── utils/                       # 通用工具脚本
│       ├── download_utils.sh
│       └── run_cmd.sh

├── models/                          # 模型特定训练镜像
│   ├── Qwen2-3/                     # Qwen 2/3 训练
│   │   ├── dockerfile
│   │   ├── train_qwen.sh
│   │   ├── download_datasets.sh
│   │   └── README.md                # 镜像构建命令
│   │
│   ├── Qwen2.5VL/                   # Qwen 2.5 多模态视觉语言模型
│   ├── Wan2/                        # Wan2 模型
│   └── ...

├── .dockerignore
├── .gitignore
├── .gitmodules
└── README.md

```