openwandb 0.3.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- openwandb-0.3.0/.gitignore +43 -0
- openwandb-0.3.0/LICENSE +21 -0
- openwandb-0.3.0/PKG-INFO +367 -0
- openwandb-0.3.0/README.md +332 -0
- openwandb-0.3.0/examples/example_mlp.py +321 -0
- openwandb-0.3.0/examples/example_train.py +118 -0
- openwandb-0.3.0/openwandb/__init__.py +3 -0
- openwandb-0.3.0/openwandb/__main__.py +4 -0
- openwandb-0.3.0/openwandb/auth.py +297 -0
- openwandb-0.3.0/openwandb/cli.py +121 -0
- openwandb-0.3.0/openwandb/config.py +49 -0
- openwandb-0.3.0/openwandb/database.py +870 -0
- openwandb-0.3.0/openwandb/file_stream.py +233 -0
- openwandb-0.3.0/openwandb/graphql_schema.py +539 -0
- openwandb-0.3.0/openwandb/server.py +839 -0
- openwandb-0.3.0/openwandb/static/style.css +422 -0
- openwandb-0.3.0/openwandb/storage.py +76 -0
- openwandb-0.3.0/openwandb/templates/compare.html +286 -0
- openwandb-0.3.0/openwandb/templates/index.html +194 -0
- openwandb-0.3.0/openwandb/templates/login.html +257 -0
- openwandb-0.3.0/openwandb/templates/project.html +339 -0
- openwandb-0.3.0/openwandb/templates/run.html +365 -0
- openwandb-0.3.0/openwandb/templates/settings.html +365 -0
- openwandb-0.3.0/openwandb/templates/team.html +262 -0
- openwandb-0.3.0/pyproject.toml +51 -0
- openwandb-0.3.0/requirements.txt +13 -0
- openwandb-0.3.0/run_server.py +57 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Data directory (auto-created, contains SQLite DB and uploaded files)
|
|
2
|
+
data/
|
|
3
|
+
|
|
4
|
+
# wandb SDK local cache
|
|
5
|
+
wandb/
|
|
6
|
+
|
|
7
|
+
# MNIST dataset cache
|
|
8
|
+
data_mnist/
|
|
9
|
+
|
|
10
|
+
# Python
|
|
11
|
+
__pycache__/
|
|
12
|
+
*.py[cod]
|
|
13
|
+
*$py.class
|
|
14
|
+
*.so
|
|
15
|
+
*.egg
|
|
16
|
+
*.egg-info/
|
|
17
|
+
dist/
|
|
18
|
+
build/
|
|
19
|
+
*.egg-info
|
|
20
|
+
|
|
21
|
+
# Virtual environments
|
|
22
|
+
.venv/
|
|
23
|
+
venv/
|
|
24
|
+
env/
|
|
25
|
+
ENV/
|
|
26
|
+
|
|
27
|
+
# IDE
|
|
28
|
+
.vscode/
|
|
29
|
+
.idea/
|
|
30
|
+
*.swp
|
|
31
|
+
*.swo
|
|
32
|
+
*~
|
|
33
|
+
|
|
34
|
+
# OS
|
|
35
|
+
.DS_Store
|
|
36
|
+
Thumbs.db
|
|
37
|
+
|
|
38
|
+
# Logs
|
|
39
|
+
*.log
|
|
40
|
+
|
|
41
|
+
# Environment variables
|
|
42
|
+
.env
|
|
43
|
+
.env.local
|
openwandb-0.3.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 OpenWandb Contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
openwandb-0.3.0/PKG-INFO
ADDED
|
@@ -0,0 +1,367 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: openwandb
|
|
3
|
+
Version: 0.3.0
|
|
4
|
+
Summary: Open-source WandB-compatible server with multi-tenant support
|
|
5
|
+
Project-URL: Homepage, https://github.com/CVPaul/OpenWandb
|
|
6
|
+
Project-URL: Repository, https://github.com/CVPaul/OpenWandb
|
|
7
|
+
Project-URL: Issues, https://github.com/CVPaul/OpenWandb/issues
|
|
8
|
+
Author: OpenWandb Contributors
|
|
9
|
+
License-Expression: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: experiment-tracking,machine-learning,mlops,wandb
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Framework :: FastAPI
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Intended Audience :: Science/Research
|
|
16
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
22
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
23
|
+
Requires-Python: >=3.10
|
|
24
|
+
Requires-Dist: aiosqlite>=0.19.0
|
|
25
|
+
Requires-Dist: bcrypt>=4.0.0
|
|
26
|
+
Requires-Dist: click>=8.0.0
|
|
27
|
+
Requires-Dist: fastapi>=0.104.0
|
|
28
|
+
Requires-Dist: jinja2>=3.1.0
|
|
29
|
+
Requires-Dist: pyjwt>=2.8.0
|
|
30
|
+
Requires-Dist: python-multipart>=0.0.6
|
|
31
|
+
Requires-Dist: pyyaml>=6.0
|
|
32
|
+
Requires-Dist: strawberry-graphql[fastapi]>=0.215.0
|
|
33
|
+
Requires-Dist: uvicorn[standard]>=0.24.0
|
|
34
|
+
Description-Content-Type: text/markdown
|
|
35
|
+
|
|
36
|
+
# OpenWandb
|
|
37
|
+
|
|
38
|
+
**开源的 WandB (Weights & Biases) 兼容服务器** — 完全替代 wandb 闭源服务端,支持私有部署。
|
|
39
|
+
|
|
40
|
+
用户只需设置 `WANDB_BASE_URL` 环境变量,即可将现有训练代码**无缝迁移**到自建服务器,无需修改任何训练脚本。
|
|
41
|
+
|
|
42
|
+
## 核心特性
|
|
43
|
+
|
|
44
|
+
- **完全兼容 wandb Python SDK** — 实现 GraphQL API + File Stream 协议
|
|
45
|
+
- **pip install 一键部署** — `pip install openwandb && openwandb serve`
|
|
46
|
+
- **CLI 管理工具** — `openwandb serve / init / version`
|
|
47
|
+
- **多租户隔离** — Team → Project → Run 三级权限继承
|
|
48
|
+
- **用户管理** — 注册/登录、JWT + API Key 双模认证
|
|
49
|
+
- **团队协作** — 创建团队、邀请成员、角色管理 (Owner/Admin/Member/Viewer)
|
|
50
|
+
- **分享功能** — 项目/运行级别的 Token 分享链接
|
|
51
|
+
- **Web 可视化仪表盘** — 深色主题 UI,ECharts 图表引擎
|
|
52
|
+
- **零配置** — SQLite 数据库 + 本地文件存储,无需 Docker/K8s
|
|
53
|
+
|
|
54
|
+
## 快速开始
|
|
55
|
+
|
|
56
|
+
### 方式一: pip install (推荐)
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
pip install openwandb
|
|
60
|
+
|
|
61
|
+
# 启动服务 (数据默认存储在 ~/.openwandb/)
|
|
62
|
+
openwandb serve
|
|
63
|
+
|
|
64
|
+
# 自定义端口和数据目录
|
|
65
|
+
openwandb serve --port 9090 --data-dir /data/openwandb
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### 方式二: 源码运行 (开发模式)
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
git clone https://github.com/CVPaul/OpenWandb.git
|
|
72
|
+
cd OpenWandb
|
|
73
|
+
|
|
74
|
+
# 开发模式安装
|
|
75
|
+
pip install -e .
|
|
76
|
+
openwandb serve
|
|
77
|
+
|
|
78
|
+
# 或直接运行 (数据存储在 ./data/)
|
|
79
|
+
python run_server.py
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
服务默认运行在 `http://localhost:8080`,默认管理员账号: `admin` / `admin123`
|
|
83
|
+
|
|
84
|
+
### 配置训练脚本
|
|
85
|
+
|
|
86
|
+
只需设置两个环境变量:
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
export WANDB_BASE_URL=http://localhost:8080
|
|
90
|
+
export WANDB_API_KEY=local0000000000000000000000000000000000000000
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
然后正常运行你的训练脚本即可!
|
|
94
|
+
|
|
95
|
+
```python
|
|
96
|
+
import wandb
|
|
97
|
+
|
|
98
|
+
wandb.init(project="my-project", config={"lr": 0.001})
|
|
99
|
+
|
|
100
|
+
for step in range(100):
|
|
101
|
+
loss = train_step()
|
|
102
|
+
wandb.log({"loss": loss, "accuracy": acc}, step=step)
|
|
103
|
+
|
|
104
|
+
wandb.finish()
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### 管理 API Key
|
|
108
|
+
|
|
109
|
+
1. 登录 Web UI → Settings → API Keys
|
|
110
|
+
2. 创建新的 API Key
|
|
111
|
+
3. 使用新 Key 替代默认 Key:
|
|
112
|
+
```bash
|
|
113
|
+
export WANDB_API_KEY=local-xxxxxxxxxxxxxxxxxxxx
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## CLI 命令
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
# 启动服务器
|
|
120
|
+
openwandb serve [OPTIONS]
|
|
121
|
+
--host TEXT 监听地址 (默认: 0.0.0.0)
|
|
122
|
+
--port/-p INT 端口 (默认: 8080)
|
|
123
|
+
--data-dir PATH 数据目录 (默认: ~/.openwandb)
|
|
124
|
+
--log-level TEXT 日志级别: debug/info/warning/error
|
|
125
|
+
--reload 开发模式热重载
|
|
126
|
+
|
|
127
|
+
# 初始化数据目录和数据库
|
|
128
|
+
openwandb init [--data-dir PATH]
|
|
129
|
+
|
|
130
|
+
# 显示版本
|
|
131
|
+
openwandb version
|
|
132
|
+
|
|
133
|
+
# 也支持 python -m 方式运行
|
|
134
|
+
python -m openwandb serve
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
## 多租户使用
|
|
138
|
+
|
|
139
|
+
### 创建团队
|
|
140
|
+
|
|
141
|
+
1. 登录 → Settings → Teams → Create New Team
|
|
142
|
+
2. 邀请成员加入团队
|
|
143
|
+
3. 设置成员角色 (Viewer / Member / Admin)
|
|
144
|
+
|
|
145
|
+
### 团队项目
|
|
146
|
+
|
|
147
|
+
通过 wandb SDK 的 `entity` 参数指定团队:
|
|
148
|
+
|
|
149
|
+
```python
|
|
150
|
+
wandb.init(project="my-project", entity="my-team")
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### 项目可见性
|
|
154
|
+
|
|
155
|
+
| 可见性 | 说明 |
|
|
156
|
+
|--------|------|
|
|
157
|
+
| **Private** | 仅创建者可见 |
|
|
158
|
+
| **Team** | 团队成员可见 (默认) |
|
|
159
|
+
| **Public** | 所有人可见 |
|
|
160
|
+
|
|
161
|
+
### 分享
|
|
162
|
+
|
|
163
|
+
在项目页或运行页点击 "Share" 按钮,生成公开链接。任何人可通过链接查看 (只读)。
|
|
164
|
+
|
|
165
|
+
## 运行示例
|
|
166
|
+
|
|
167
|
+
### 快速演示 (模拟数据, 无需 GPU)
|
|
168
|
+
|
|
169
|
+
```bash
|
|
170
|
+
# 终端 1: 启动服务器
|
|
171
|
+
openwandb serve
|
|
172
|
+
|
|
173
|
+
# 终端 2: 运行模拟训练
|
|
174
|
+
python examples/example_train.py
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
### MLP 真实训练 (MNIST 手写数字识别)
|
|
178
|
+
|
|
179
|
+
一个完整的 PyTorch 训练脚本,用 MLP 识别手写数字,全程用 wandb 记录:
|
|
180
|
+
|
|
181
|
+
```bash
|
|
182
|
+
# 安装 PyTorch (如果还没有)
|
|
183
|
+
pip install torch torchvision
|
|
184
|
+
|
|
185
|
+
# 终端 1: 启动服务器
|
|
186
|
+
openwandb serve
|
|
187
|
+
|
|
188
|
+
# 终端 2: 运行训练 (默认参数)
|
|
189
|
+
python examples/example_mlp.py
|
|
190
|
+
|
|
191
|
+
# 修改超参数再跑一次, 然后在 Web UI 中对比两次实验!
|
|
192
|
+
python examples/example_mlp.py --lr 0.01 --hidden 128 --optimizer sgd --epochs 10
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
脚本会自动下载 MNIST 数据集、训练模型、并将所有指标上传到 OpenWandb。
|
|
196
|
+
打开 `http://localhost:8080` → 进入 `mnist-mlp` 项目 → 查看曲线图、对比不同实验。
|
|
197
|
+
|
|
198
|
+
## Web 仪表盘
|
|
199
|
+
|
|
200
|
+
| 页面 | 功能 |
|
|
201
|
+
|------|------|
|
|
202
|
+
| **首页** | 项目列表、团队切换、搜索、统计概览 |
|
|
203
|
+
| **项目页** | 运行列表、状态过滤、排序、分享、可见性控制 |
|
|
204
|
+
| **运行详情** | 指标图表、配置查看、Summary、系统监控、分享 |
|
|
205
|
+
| **运行对比** | 多运行指标叠加图、超参数差异对比 |
|
|
206
|
+
| **登录/注册** | 用户登录、新用户注册 |
|
|
207
|
+
| **设置** | 个人信息、API Key 管理、团队列表 |
|
|
208
|
+
| **团队管理** | 成员列表、邀请、角色修改、团队项目 |
|
|
209
|
+
|
|
210
|
+
## API 端点
|
|
211
|
+
|
|
212
|
+
### wandb SDK 兼容端点
|
|
213
|
+
|
|
214
|
+
| 端点 | 说明 |
|
|
215
|
+
|------|------|
|
|
216
|
+
| `POST /graphql` | GraphQL API (wandb SDK 核心通信) |
|
|
217
|
+
| `POST /files/{entity}/{project}/{run}/file_stream` | 指标流上传 |
|
|
218
|
+
| `GET /files/{entity}/{project}/{run}/{filename}` | 文件下载 |
|
|
219
|
+
| `PUT /files/{entity}/{project}/{run}/{filename}` | 文件上传 |
|
|
220
|
+
|
|
221
|
+
### 认证 API
|
|
222
|
+
|
|
223
|
+
| 端点 | 说明 |
|
|
224
|
+
|------|------|
|
|
225
|
+
| `POST /api/v2/auth/register` | 用户注册 |
|
|
226
|
+
| `POST /api/v2/auth/login` | 用户登录 (返回 JWT) |
|
|
227
|
+
| `POST /api/v2/auth/logout` | 用户登出 |
|
|
228
|
+
| `GET /api/v2/auth/me` | 获取当前用户信息 |
|
|
229
|
+
|
|
230
|
+
### 团队管理 API
|
|
231
|
+
|
|
232
|
+
| 端点 | 说明 |
|
|
233
|
+
|------|------|
|
|
234
|
+
| `GET /api/v2/teams` | 我的团队列表 |
|
|
235
|
+
| `POST /api/v2/teams` | 创建团队 |
|
|
236
|
+
| `GET /api/v2/teams/{name}/members` | 成员列表 |
|
|
237
|
+
| `POST /api/v2/teams/{name}/members` | 邀请成员 |
|
|
238
|
+
| `PUT /api/v2/teams/{name}/members/{uid}` | 修改角色 |
|
|
239
|
+
| `DELETE /api/v2/teams/{name}/members/{uid}` | 移除成员 |
|
|
240
|
+
|
|
241
|
+
### API Key 管理
|
|
242
|
+
|
|
243
|
+
| 端点 | 说明 |
|
|
244
|
+
|------|------|
|
|
245
|
+
| `GET /api/v2/settings/api-keys` | 我的 API Key 列表 |
|
|
246
|
+
| `POST /api/v2/settings/api-keys` | 创建新 Key (返回明文) |
|
|
247
|
+
| `DELETE /api/v2/settings/api-keys/{id}` | 删除 Key |
|
|
248
|
+
|
|
249
|
+
### 分享 API
|
|
250
|
+
|
|
251
|
+
| 端点 | 说明 |
|
|
252
|
+
|------|------|
|
|
253
|
+
| `POST /api/v2/share` | 创建分享链接 |
|
|
254
|
+
| `GET /api/v2/share/{token}` | 通过 token 访问 |
|
|
255
|
+
| `DELETE /api/v2/share/{id}` | 撤销分享 |
|
|
256
|
+
| `GET /s/{token}` | 分享链接入口 (自动跳转) |
|
|
257
|
+
|
|
258
|
+
### 内部 REST API
|
|
259
|
+
|
|
260
|
+
| 端点 | 说明 |
|
|
261
|
+
|------|------|
|
|
262
|
+
| `GET /api/v2/projects` | 项目列表 (按权限过滤) |
|
|
263
|
+
| `GET /api/v2/projects/{entity}/{project}/runs` | 运行列表 |
|
|
264
|
+
| `GET /api/v2/runs/{run_id}/metrics` | 指标数据 |
|
|
265
|
+
| `GET /api/v2/runs/{run_id}/system_metrics` | 系统指标 |
|
|
266
|
+
| `PUT /api/v2/projects/{id}/visibility` | 修改可见性 |
|
|
267
|
+
|
|
268
|
+
## 配置
|
|
269
|
+
|
|
270
|
+
通过环境变量配置:
|
|
271
|
+
|
|
272
|
+
| 变量 | 默认值 | 说明 |
|
|
273
|
+
|------|--------|------|
|
|
274
|
+
| `OPENWANDB_DATA_DIR` | `~/.openwandb` | 数据存储目录 |
|
|
275
|
+
| `OPENWANDB_HOST` | `0.0.0.0` | 监听地址 |
|
|
276
|
+
| `OPENWANDB_PORT` | `8080` | 监听端口 |
|
|
277
|
+
| `OPENWANDB_JWT_SECRET` | 随机生成 | JWT 签名密钥 |
|
|
278
|
+
| `OPENWANDB_JWT_EXPIRE_HOURS` | `72` | JWT 过期时间 (小时) |
|
|
279
|
+
| `OPENWANDB_ADMIN_USER` | `admin` | 默认管理员用户名 |
|
|
280
|
+
| `OPENWANDB_ADMIN_PASS` | `admin123` | 默认管理员密码 |
|
|
281
|
+
| `OPENWANDB_DEFAULT_TEAM` | `default` | 默认团队名 |
|
|
282
|
+
| `OPENWANDB_ALLOW_REGISTRATION` | `true` | 是否允许注册 |
|
|
283
|
+
| `OPENWANDB_MAX_FILE_SIZE` | `500MB` | 最大文件上传大小 |
|
|
284
|
+
| `OPENWANDB_LOG_LEVEL` | `INFO` | 日志级别 |
|
|
285
|
+
|
|
286
|
+
## 权限模型
|
|
287
|
+
|
|
288
|
+
```
|
|
289
|
+
Team (组织/团队)
|
|
290
|
+
├── Owner — 完全控制 (删除团队、管理成员角色)
|
|
291
|
+
├── Admin — 管理成员 (邀请/移除成员)
|
|
292
|
+
├── Member — 读写 (创建项目、记录 runs)
|
|
293
|
+
└── Viewer — 只读 (查看项目和 runs)
|
|
294
|
+
|
|
295
|
+
Project
|
|
296
|
+
├── Private — 仅创建者
|
|
297
|
+
├── Team — 团队成员 (默认)
|
|
298
|
+
└── Public — 所有人
|
|
299
|
+
|
|
300
|
+
Run → 继承所属 Project 的权限
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
## 技术架构
|
|
304
|
+
|
|
305
|
+
```
|
|
306
|
+
┌──────────────────┐ ┌──────────────────────────┐
|
|
307
|
+
│ wandb Python SDK │ ──────> │ FastAPI Server │
|
|
308
|
+
│ (训练脚本中) │ HTTP │ │
|
|
309
|
+
└──────────────────┘ │ ┌── Auth Middleware ──┐ │
|
|
310
|
+
│ │ JWT + API Key │ │
|
|
311
|
+
┌──────────────────┐ │ └─────────────────────┘ │
|
|
312
|
+
│ Web Dashboard │ ──────> │ │
|
|
313
|
+
│ (浏览器) │ HTTP │ ┌── GraphQL ──────────┐ │
|
|
314
|
+
└──────────────────┘ │ │ upsertBucket (+ ACL) │ │
|
|
315
|
+
│ │ viewer │ │
|
|
316
|
+
│ └──────────────────────┘ │
|
|
317
|
+
│ ┌── REST API ──────────┐ │
|
|
318
|
+
│ │ Auth / Teams / Share │ │
|
|
319
|
+
│ │ Projects / Runs │ │
|
|
320
|
+
│ └──────────────────────┘ │
|
|
321
|
+
│ │ │
|
|
322
|
+
│ ┌────▼────┐ │
|
|
323
|
+
│ │ SQLite │ │
|
|
324
|
+
│ │ + ACL │ │
|
|
325
|
+
│ └─────────┘ │
|
|
326
|
+
└────────────────────────────┘
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
## 项目结构
|
|
330
|
+
|
|
331
|
+
```
|
|
332
|
+
open-wandb/
|
|
333
|
+
├── pyproject.toml # 包配置 (pip install)
|
|
334
|
+
├── run_server.py # 开发模式启动脚本
|
|
335
|
+
├── examples/
|
|
336
|
+
│ ├── example_train.py # 模拟训练示例
|
|
337
|
+
│ └── example_mlp.py # MNIST MLP 真实训练示例
|
|
338
|
+
├── openwandb/ # Python 包
|
|
339
|
+
│ ├── __init__.py # 版本号
|
|
340
|
+
│ ├── __main__.py # python -m openwandb
|
|
341
|
+
│ ├── cli.py # CLI 命令 (serve/init/version)
|
|
342
|
+
│ ├── config.py # 服务配置 (路径/环境变量)
|
|
343
|
+
│ ├── server.py # FastAPI 主入口 + 所有路由
|
|
344
|
+
│ ├── database.py # SQLite 数据库 + 多租户权限
|
|
345
|
+
│ ├── graphql_schema.py # GraphQL schema (wandb SDK 兼容)
|
|
346
|
+
│ ├── file_stream.py # file_stream 处理
|
|
347
|
+
│ ├── storage.py # 文件存储管理
|
|
348
|
+
│ ├── auth.py # JWT + API Key 双模认证
|
|
349
|
+
│ ├── templates/ # Web UI 模板 (7 页面)
|
|
350
|
+
│ └── static/style.css # 全局样式
|
|
351
|
+
├── LICENSE # MIT License
|
|
352
|
+
└── .gitignore
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
## 贡献
|
|
356
|
+
|
|
357
|
+
欢迎贡献代码!请遵循以下步骤:
|
|
358
|
+
|
|
359
|
+
1. Fork 本仓库
|
|
360
|
+
2. 创建特性分支: `git checkout -b feature/your-feature`
|
|
361
|
+
3. 提交更改: `git commit -m 'Add your feature'`
|
|
362
|
+
4. 推送到分支: `git push origin feature/your-feature`
|
|
363
|
+
5. 提交 Pull Request
|
|
364
|
+
|
|
365
|
+
## License
|
|
366
|
+
|
|
367
|
+
MIT
|