Skip to content

Commit 786b586

Browse files
committed
#4 zh done
1 parent 81f5bda commit 786b586

File tree

2 files changed

+96
-71
lines changed

2 files changed

+96
-71
lines changed

locales/README.zh.md

Lines changed: 49 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@
3131
## 画廊
3232

3333
<details>
34-
<summary>Web Dashboard</summary>
34+
<summary>网络仪表板</summary>
3535
<div style="display:flex; overflow-x:auto; gap:10px; padding:12px 0; scroll-snap-type:x mandatory; -webkit-overflow-scrolling:touch;">
36-
<!-- Use first image aspect ratio 1624x675 for slide frame; images fit inside using object-fit:contain -->
36+
<!-- 使用第一张图片的 1624x675 宽高作为滑块框架;图片使用 `object-fit:contain` 填充框架 -->
3737
<div style="flex:0 0 100%; scroll-snap-align:center; aspect-ratio:1624/675; display:flex; align-items:center; justify-content:center;">
3838
<img src="../monitor/api/static/web1.png" style="width:100%; height:100%; object-fit:contain;" />
3939
</div>
@@ -47,7 +47,6 @@
4747
<img src="../monitor/api/static/web4.png" style="width:100%; height:100%; object-fit:contain;" />
4848
</div>
4949
</div>
50-
5150
</details>
5251

5352
<details>
@@ -71,103 +70,100 @@
7170
</div>
7271
</details>
7372

74-
### 为什么使用这个工具?
75-
76-
- **轻量级**:最小化资源占用。
77-
- **灵活**:作为 CLI 工具运行,或提供全功能的 Web 仪表板。
78-
- **管理员优先**:包括 VRAM 强制执行(自动杀死超出限制的进程)和监控列表等功能。
79-
- **开发人员友好**:内置基准测试和压力测试工具(GEMM、粒子物理),以验证系统稳定性。
73+
### 为什么使用它?
8074

81-
---
75+
- **轻量级**:资源占用最小。
76+
- **灵活**:作为 CLI 工具或全功能 Web 仪表板运行。
77+
- **以管理员为中心的**:包含 **VRAM 强制执行**(超出限制时自动终止进程)和 **监控列表**等功能。
78+
- **开发人员友好**:内置基准测试和压力测试工具(GEMM、粒子物理),用于验证系统稳定性。
8279

8380
## 功能
8481

8582
- **实时监控**
86-
- GPU 详细指标(利用率、VRAM、功耗、温度)。
83+
- GPU 详细指标(利用率、显存、功耗、温度)。
8784
- 系统指标(CPU、内存等)。
8885

89-
- **管理员与强制执行**
90-
- **VRAM 限制**:为每个 GPU 设置 VRAM 使用量的硬限额
91-
- **自动终止**:(仅管理员可用)自动终止违反 VRAM 策略的进程
92-
- **监控列表**:监控特定 PID 或过程名称
86+
- **管理与执行**
87+
- **显存限制**:为每个 GPU 设置硬性显存使用上限
88+
- **自动终止**:(仅管理员)自动终止违反显存策略的进程
89+
- **监控列表**:监控特定 PID 或过程名
9390

9491
- **基准测试与模拟**
95-
- **压力测试**:配置可变的 GEMM 加载项,以测试热量限制和稳定性。
96-
- **视觉模拟**:交互式 3D 粒子物理模拟,以可视化 GPU 加载。
97-
98-
---
92+
- **压力测试**:配置可配置 GEMM 工作负载以测试热量限制和稳定性。
93+
- **视觉模拟**:交互式三维粒子物理模拟,以可视化 GPU 加载。
9994

10095
## 路线图与未来工作
10196

102-
欢迎贡献!主要需要涵盖的未来要点如下
97+
欢迎贡献!主要未来工作重点包括
10398

104-
- **多 GPU 支持**增强多卡设置和 NVLink 拓扑处理
105-
- **容器化**官方 Docker 支持,方便在容器环境中部署。
106-
- **远程访问**SSH 隧道集成和安全远程管理
99+
- **多GPU支持**增强对多卡设置和NVLink拓扑的处理
100+
- **容器化**官方Docker支持,方便在容器环境中部署。
101+
- **远程访问**集成SSH隧道和安全远程管理
107102
- **跨平台**
108-
- [ ] Linux 支持(Ubuntu/Debian 重点)。
109-
- [ ] macOS 支持(Apple Silicon 监控)。
110-
- **硬件无归属**
111-
- [ ] AMD ROCm 支持。
112-
- [ ] Intel Arc 支持。
113-
- ~~**多语言文档**:支持 GitHub 上最受欢迎的编程语言。~~
114-
115-
请参阅 [CONTRIBUTING.md](../CONTRIBUTING.md) 了解如何参与。
103+
- [ ] Linux支持(Ubuntu/Debian重点关注)。
104+
- [ ] macOS支持(Apple Silicon监控)。
105+
- **硬件无感知**
106+
- [ ] AMD ROCm支持。
107+
- [ ] Intel Arc支持。
108+
- ~~**多语言文档**:支持GitHub上最受欢迎的语言。~~
116109

117-
---
110+
请参阅[CONTRIBUTING.md](../CONTRIBUTING.md)了解如何参与。
118111

119112
## 要求
120113

121114
- **操作系统**:Windows 10/11
122-
- **Python**:3.10+
123-
- **硬件**:NVIDIA GPU 与安装的驱动程序。
124-
- **CUDA**:12.x 工具包(严格需要基准测试/模拟功能)。
125-
- *注意:如果未检测到 CUDA 12.x,GPU 特定基准功能将禁用*
126-
127-
---
115+
- **Python**:3.10及以上版本
116+
- **硬件**:配备NVIDIA GPU,并安装驱动程序。
117+
- **CUDA**:Toolkit 12.x(用于性能测试/模拟功能的严格要求)。
118+
- *注意*:如果未检测到CUDA 12.x,GPU特定性能测试功能将被禁用。
128119

129120
## 安装
130121

131-
该工具支持模块化安装以适应您的需求
122+
该工具支持模块化安装,以适应您的需求
132123

133-
### 1. 最小(仅 CLI
124+
### 1. 最小化(仅命令行界面
134125

135-
适合无头服务器或后台监控的最佳选择
126+
适合无头服务器或后台监控
136127

137128
- 命令行界面。
138-
- 基本系统/GPU 指标
129+
- 基本系统/GPU指标
139130

140-
### 2. 标准(CLI + Web UI
131+
### 2. 标准版(命令行界面 + Web 界面
141132

142133
适合大多数用户。
143134

144-
- 包括 Web 仪表板。
135+
- 包含 Web 仪表板。
145136
- REST API 端点。
146137
- 实时图表。
147-
- 但无模拟或基准测试。
138+
- 但无模拟或基准测试功能。
139+
140+
### 3. 全功能(标准 + 可视化)
141+
142+
最适合开发和压力测试。
148143

149-
### 3. 完整(标准 + 可视化)
144+
- 包含模拟。
145+
- PyTorch/CuPy 依赖项用于基准测试。
150146

151-
适合开发和压力测试的最佳选择。
147+
### 快速入门
152148

153-
- 包括模拟
154-
- PyTorch/CuPy 依赖的基准测试。
149+
1. **下载**最新版本或克隆仓库
150+
2. **运行设置**
155151

156152
```powershell
157153
.\setup.ps1
158154
```
159155

160-
3. **发布**
156+
**启动**
161157

162158
```powershell
163-
# Start the web dashboard (Standard/Full)
159+
# 启动网络仪表板(标准/完整)
164160
python health_monitor.py web
165161
166-
# Start the CLI
162+
# 启动命令行界面 (CLI)
167163
python health_monitor.py cli
168164
```
169165

170166
## 许可证
171167

172-
MIT 许可证。详细信息请见 [LICENSE](../LICENSE)
168+
MIT许可证。详细信息请见[LICENSE](../LICENSE)
173169

translate_seg.py

Lines changed: 47 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -51,35 +51,62 @@ def get_smart_chunks(text):
5151

5252

5353
def merge_small_chunks(chunks, min_chars=400):
54+
"""
55+
Prevents 'naked headers' by ensuring short prose blocks are
56+
bundled with the following structural or prose content.
57+
"""
5458
merged = []
55-
buffer = ""
56-
57-
for ctype, ctext in chunks:
58-
if ctype == "prose":
59-
buffer += "\n\n" + ctext.strip()
59+
i = 0
60+
while i < len(chunks):
61+
ctype, ctext = chunks[i]
62+
63+
# Lookahead Logic: If current is a header or very short prose
64+
# and there is a subsequent block available
65+
if ctype == "prose" and (ctext.startswith('#') or len(ctext) < 50) and i + 1 < len(chunks):
66+
next_ctype, next_ctext = chunks[i+1]
67+
68+
# Bundle them together to provide context to the LLM
69+
# We treat the merged block as 'prose' so the LLM processes the internal tags
70+
combined_text = ctext + "\n\n" + next_ctext
71+
merged.append(("prose", combined_text))
72+
i += 2 # Skip the next block since it's now bundled
6073
else:
61-
if buffer:
62-
merged.append(("prose", buffer.strip()))
63-
buffer = ""
6474
merged.append((ctype, ctext))
75+
i += 1
76+
77+
return merged
6578

66-
if buffer:
67-
merged.append(("prose", buffer.strip()))
6879

69-
return merged
80+
def fix_relative_paths(text):
81+
# Matches Markdown links [text](path)
82+
# Ignores http, /, #, and already existing ../
83+
text = re.sub(r'(\[.*?\]\()(?!(?:http|/|#|\.\./))', r'\1../', text)
84+
85+
# Matches HTML attributes src="path" or href="path"
86+
text = re.sub(r'((?:src|href)=["\'])(?!(?:http|/|#|\.\./))', r'\1../', text)
87+
88+
return text
89+
90+
# The regex used to capture complex "tree" structures (div/details) as single chunks
91+
pattern = r'(' \
92+
r'```[\s\S]*?```|' \
93+
r'<(div|details|section|table)\b[^>]*>[\s\S]*?<\/\2>|' \
94+
r'^#{1,6} .*' \
95+
r')'
7096

7197

7298
FORBIDDEN = ["This section", "In this", "means", "explains", "以下", "说明"]
7399

74100
# 3. Prompt
75101

76102
SYSTEM_PROSE = (
77-
f"You are a literal translation engine. Translate into {target_lang_name}.\n"
78-
"Rules:\n"
79-
"- Output ONLY the translation.\n"
80-
"- Do NOT explain or add content.\n"
81-
"- Preserve formatting and symbols.\n"
82-
"- If input is not meaningful language, return it unchanged.\n"
103+
f"You are a robotic technical translation engine for {target_lang_name}.\n"
104+
"STRICT RULES:\n"
105+
"- Translate human text inside tags (e.g., <summary>Text</summary> -> <summary>翻译</summary>).\n"
106+
"- NEVER translate HTML tag names or attributes (keep <div>, <summary>, <strong> as is).\n"
107+
"- Preserve Markdown syntax (#, **, `) exactly.\n"
108+
"- Keep technical terms (GPU, VRAM, CLI, Docker, GEMM) in English.\n"
109+
"- Output ONLY the translated result. No explanations or intro."
83110
)
84111

85112
# 4. Main
@@ -147,8 +174,10 @@ def main():
147174

148175
full_text = "".join(final_output)
149176

150-
# Fix only markdown relative links, not HTML
177+
# Fix markdown links: [text](path)
151178
full_text = re.sub(r'(\[.*?\]\()(?!(?:http|/|#|\.\./))', r'\1../', full_text)
179+
180+
# Fix HTML attributes: src="path" or href="path"
152181
full_text = re.sub(r'((?:src|href)=["\'])(?!(?:http|/|#|\.\./))', r'\1../', full_text)
153182

154183
os.makedirs("locales", exist_ok=True)

0 commit comments

Comments
 (0)