Skip to content

Commit 5549a3c

Browse files
committed
Prototype Lang TL
1 parent 84ed87a commit 5549a3c

28 files changed

+353
-80
lines changed

README.md

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,12 @@
1818
<!-- HTML_BLOCK:... -->
1919

2020
> *MyGPU: Lightweight GPU Management Utility: a compact `nvidia-smi` wrapper with an elegant web dashboard.*
21+
2122
<!-- HTML_BLOCK: no change to url; output entire as it is... -->
22-
![License](https://img.shields.io/badge/license-MIT-blue.svg)
23-
![Python](https://img.shields.io/badge/python-3.10%2B-blue)
24-
![Version](https://img.shields.io/badge/version-1.2.3-blue)
25-
![Platform](https://img.shields.io/badge/platform-Windows10/11-lightgrey)
23+
![License](https://img.shields.io/badge/license-MIT-orange.svg)
24+
![Python](https://img.shields.io/badge/python-3.10%2B-pink)
25+
![Version](https://img.shields.io/badge/version-1.2.3-green)
26+
![Platform](https://img.shields.io/badge/platform-Windows10/11-blue)
2627
![cuda 12.x](https://img.shields.io/badge/CUDA-12.x-0f9d58?logo=nvidia)
2728

2829
## Gallery
@@ -51,11 +52,14 @@
5152

5253
</details>
5354
<details>
54-
<summary>CLI</summary>
55+
<summary>
56+
CLI
57+
</summary>
5558
<div style="display:flex; overflow-x:auto; gap:10px; padding:12px 0; scroll-snap-type:x mandatory; -webkit-overflow-scrolling:touch;">
5659

5760
<div style="flex:0 0 100%; scroll-snap-align:center; aspect-ratio:1624/675; display:flex; align-items:center; justify-content:center;">
58-
<img src="monitor/api/static/cli1.png" style="width:100%; height:100%; object-fit:contain;" />
61+
62+
<img src="monitor/api/static/cli1.png" style="width:100%; height:100%; object-fit:contain;" />
5963
</div>
6064
<div style="flex:0 0 100%; scroll-snap-align:center; aspect-ratio:1624/675; display:flex; align-items:center; justify-content:center;">
6165
<img src="monitor/api/static/cli2.png" style="width:100%; height:100%; object-fit:contain;" />
@@ -176,4 +180,4 @@ python health_monitor.py cli
176180

177181
## License
178182

179-
MIT License. See [LICENSE](LICENSE) for details.
183+
See [LICENSE](LICENSE) for details.

locales/README.de.md

Lines changed: 53 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121

2222
<!-- HTML_BLOCK:... -->
2323

24-
> *MyGPU: Lightweight GPU Management Utility: a compact `nvidia-smi` wrapper with an elegant web dashboard.*
24+
> *MyGPU: Leichtgewichtiges GPU-Verwaltungstool: ein kompakter Wrapper für `nvidia-smi` mit einem eleganten Web-Dashboard.*
25+
2526
<!-- HTML_BLOCK: no change to url; output entire as it is... -->
2627
![License](https://img.shields.io/badge/license-MIT-blue.svg)
2728
![Python](https://img.shields.io/badge/python-3.10%2B-blue)
@@ -37,30 +38,33 @@
3738
Web-Dashboard
3839
</summary>
3940

40-
<div style="display:flex; overflow-x:auto; gap:10px; padding:12px 0; scroll-snap-type:x mandatory; -webkit-overflow-scrolling:touch;">
41-
<!-- Verwende das erste Bild mit dem Seitenverhältnis 1624x675 als Rahmen für die Folie; Bilder passen sich mit object-fit:contain automatisch an -->
42-
<div style="flex:0 0 100%; scroll-snap-align:center; aspect-ratio:1624/675; display:flex; align-items:center; justify-content:center;">
43-
<img src="../monitor/api/static/web1.png" style="width:100%; height:100%; object-fit:contain;" />
41+
<div class="galerie">
42+
<!-- Bilder werden in einem flexiblen Container mit Scroll-Snap-Funktionalität angezeigt -->
43+
<div class="slide" style="flex: 0 0 calc(25% - 10px); scroll-snap-align: center; aspect-ratio: 1624/675; display: flex; align-items: center; justify-content: center;">
44+
<img src="../monitor/api/static/web1.png" alt="Web-Dashboard Bild 1" style="width: 100%; height: 100%; object-fit: contain;" />
4445
</div>
45-
<div style="flex:0 0 100%; scroll-snap-align:center; aspect-ratio:1624/675; display:flex; align-items:center; justify-content:center;">
46-
<img src="../monitor/api/static/web2.png" style="width:100%; height:100%; object-fit:contain;" />
46+
<div class="slide" style="flex: 0 0 calc(25% - 10px); scroll-snap-align: center; aspect-ratio: 1624/675; display: flex; align-items: center; justify-content: center;">
47+
<img src="../monitor/api/static/web2.png" alt="Web-Dashboard Bild 2" style="width: 100%; height: 100%; object-fit: contain;" />
4748
</div>
48-
<div style="flex:0 0 100%; scroll-snap-align:center; aspect-ratio:1624/675; display:flex; align-items:center; justify-content:center;">
49-
<img src="../monitor/api/static/web3.png" style="width:100%; height:100%; object-fit:contain;" />
49+
<div class="slide" style="flex: 0 0 calc(25% - 10px); scroll-snap-align: center; aspect-ratio: 1624/675; display: flex; align-items: center; justify-content: center;">
50+
<img src="../monitor/api/static/web3.png" alt="Web-Dashboard Bild 3" style="width: 100%; height: 100%; object-fit: contain;" />
5051
</div>
51-
<div style="flex:0 0 100%; scroll-snap-align:center; aspect-ratio:1624/675; display:flex; align-items:center; justify-content:center;">
52-
<img src="../monitor/api/static/web4.png" style="width:100%; height:100%; object-fit:contain;" />
52+
<div class="slide" style="flex: 0 0 calc(25% - 10px); scroll-snap-align: center; aspect-ratio: 1624/675; display: flex; align-items: center; justify-content: center;">
53+
<img src="../monitor/api/static/web4.png" alt="Web-Dashboard Bild 4" style="width: 100%; height: 100%; object-fit: contain;" />
5354
</div>
5455
</div>
5556

5657
</details>
5758

5859
<details>
59-
<summary>CLI</summary>
60+
<summary>
61+
CLI
62+
</summary>
6063
<div style="display:flex; overflow-x:auto; gap:10px; padding:12px 0; scroll-snap-type:x mandatory; -webkit-overflow-scrolling:touch;">
6164

6265
<div style="flex:0 0 100%; scroll-snap-align:center; aspect-ratio:1624/675; display:flex; align-items:center; justify-content:center;">
63-
<img src="../monitor/api/static/cli1.png" style="width:100%; height:100%; object-fit:contain;" />
66+
67+
<img src="../monitor/api/static/cli1.png" style="width:100%; height:100%; object-fit:contain;" />
6468
</div>
6569
<div style="flex:0 0 100%; scroll-snap-align:center; aspect-ratio:1624/675; display:flex; align-items:center; justify-content:center;">
6670
<img src="../monitor/api/static/cli2.png" style="width:100%; height:100%; object-fit:contain;" />
@@ -76,63 +80,63 @@
7680
</div>
7781
</details>
7882

79-
### Warum dies nutzen?
83+
### Warum sollte man dies nutzen?
8084

81-
- **Leichtgewichtig**: Minimale Ressourcenanforderungen.
85+
- **Leichtgewichtig**: Minimale Ressourcenbelastung.
8286
- **Flexibel**: Als CLI-Tool oder als umfassendes Web-Dashboard ausführbar.
83-
- **admin-zentriert**: Enthält Funktionen wie **VRAM-Erzwingung** (Automatische Beendigung von Prozessen, die die Grenzen überschreiten) und **Watchlists**.
84-
- **Entwicklerfreundlich**: Integrierte Leistungsanalyse- und Stress-Test-Tools (GEMM, Teilchenphysik) zur Überprüfung der Systemstabilität.
87+
- **admin-zentriert**: Enthält Funktionen wie **VRAM-Durchsetzung** (automatische Beendigung von Prozessen, die die Grenzen überschreiten) und **Watchlists**.
88+
- **entwicklerfreundlich**: Integrierte Benchmarking- und Stress-Test-Tools (GEMM, Teilchenphysik) zur Überprüfung der Systemstabilität.
8589

8690
## Funktionen
8791

8892
- **Echtzeitüberwachung**:
89-
- Detaillierte GPU-Metriken (Auslastung, VRAM, Stromverbrauch, Temperatur).
93+
- Detaillierte GPU-Metriken (Nutzung, VRAM, Stromverbrauch, Temperatur).
9094
- Systemmetriken (CPU, RAM usw.).
9195

9296
- **Verwaltung und Durchsetzung**:
9397
- **VRAM-Begrenzung**: Setze harte Obergrenzen für den VRAM-Verbrauch pro GPU.
94-
- **Automatische Beendigung**: Beende automatisch Prozesse, die VRAM-Richtlinien verletzen (nur für Administratoren).
95-
- **Watchlisten**: Überwache spezifische PIDs oder Prozessnamen.
98+
- **Automatische Beendigung**: Automatische Beendigung von Prozessen, die gegen VRAM-Richtlinien verstoßen (nur Administrator).
99+
- **Watchlists**: Überwache spezifische PIDs oder Prozessnamen.
96100

97-
- **Leistungsanalyse und Simulation**:
98-
- **Stresstests**: Konfigurierbare GEMM-Lasten, um thermische Drosselung und Stabilität zu testen.
99-
- **Visualisierung**: Interaktive 3D-Partikelphysik-Simulation zur Visualisierung der GPU-Belastung.
101+
- **Benchmarking und Simulation**:
102+
- **Stresstests**: Konfigurierbare GEMM-Lasttests zur Prüfung der thermischen Drosselung und Stabilität.
103+
- **Visualisierungssimulation**: Interaktive 3D-Partikelphysiksimulation zur Visualisierung der GPU-Belastung.
100104

101-
## Roadmap und zukünftige Arbeiten
105+
## Roadmap & Zukunftsplanung
102106

103-
Beiträge sind willkommen! Die Hauptpunkte, die in Zukunft angegangen werden sollen, sind:
107+
Deine Beiträge sind willkommen! Die wichtigsten zukünftigen Schwerpunkte umfassen:
104108

105109
- **Mehrfach-GPU-Unterstützung**: Verbesserte Handhabung von Mehrkarten-Einrichtungen und NVLink-Topologien.
106110
- **Containerisierung**: Offizielle Docker-Unterstützung für einfache Bereitstellung in Container-Umgebungen.
107-
- **Remote-Zugriff**: Integration von SSH-Tunneln und sicherem Remote-Management.
108-
- **Plattformübergreifend**:
109-
- [ ] Linux-Unterstützung (Ubuntu/Debian-Fokus).
110-
- [ ] macOS-Unterstützung (Apple Silicon im Blick).
111+
- **Fernzugriff**: Integration von SSH-Tunneling und sicherem Fernmanagement.
112+
- **Cross-Platform**:
113+
- [ ] Linux-Unterstützung (Ubuntu/Debian Fokus).
114+
- [ ] macOS-Unterstützung (Apple Silicon Überwachung).
111115
- **Hardwareunabhängig**:
112-
- [ ] AMD ROCm-Unterstützung.
113-
- [ ] Intel Arc-Unterstützung.
116+
- [ ] AMD ROCm Unterstützung.
117+
- [ ] Intel Arc Unterstützung.
114118
- ~~**Mehrsprachige Dokumentation**: Unterstützung der beliebtesten GitHub-Sprachen.~~
115119

116-
Siehe [CONTRIBUTING.md](../CONTRIBUTING.md) für Informationen, wie du dich einbringen kannst.
120+
Sieh [CONTRIBUTING.md](../CONTRIBUTING.md) für Hinweise, wie du dich einbringen kannst.
117121

118122
## Anforderungen
119123

120124
- **Betriebssystem**: Windows 10/11
121-
- **Python**: 3.10+
125+
- **Python**: Version 3.10 oder höher
122126
- **Hardware**: NVIDIA-GPU mit installierten Treibern.
123-
- **CUDA**: Toolkit 12.x (Streng erforderlich für Leistungsanalyse/Simulationsfunktionen).
124-
- *Hinweis: Wird CUDA 12.x nicht erkannt, werden die GPU-spezifischen Leistungsanalysefunktionen deaktiviert.*
127+
- **CUDA**: Toolkit 12.x (Für die Benutzerung der Benchmarking-/Simulationsfunktionen zwingend erforderlich).
128+
- *Hinweis: Wird CUDA 12.x nicht erkannt, werden die GPU-spezifischen Benchmarking-Funktionen deaktiviert.*
125129

126130
## Installation
127131

128-
Das Tool unterstützt eine modulare Installation, um deinen Anforderungen gerecht zu werden:
132+
Das Tool unterstützt eine modulare Installation, um sich an deine Anforderungen anzupassen:
129133

130134
### 1. Minimal (CLI Nur)
131135

132-
Ideal für Headless-Server oder Hintergrundüberwachung.
136+
Am besten für Headless-Server oder Hintergrundüberwachung geeignet.
133137

134-
- Befehlszeileninterface.
135-
- Grundlegende System- und GPU-Metriken.
138+
- Befehlszeilen-Schnittstelle.
139+
- Grundlegende System-/GPU-Metriken.
136140

137141
### 2. Standard (CLI + Web-Benutzeroberfläche)
138142

@@ -143,14 +147,14 @@ Am besten für die meisten Benutzer geeignet.
143147
- Echtzeit-Diagramme.
144148
- Ohne Simulation oder Leistungsanalyse.
145149

146-
### 3. Vollständig (Standard + Visualisierung)
150+
### 3. Vollständige Konfiguration (Standard + Visualisierung)
147151

148152
Am besten für Entwicklung und Stresstests geeignet.
149153

150-
- Enthält Simulation.
151-
- PyTorch/CuPy-Abhängigkeiten für Leistungsanalysen.
154+
- Enthält Simulationen.
155+
- Abhängigkeiten von PyTorch/CuPy für Leistungsanalysen.
152156

153-
### Schnelle Einführung
157+
### Schnellstart
154158

155159
1. **Lade** die neueste Version herunter oder klone das Repository.
156160
2. **Führe die Einrichtung aus**:
@@ -162,14 +166,16 @@ Am besten für Entwicklung und Stresstests geeignet.
162166
## 3. **Starten**:
163167

164168
```powershell
165-
# Starten Sie die Web-Benutzeroberfläche (Standard/Vollständig)
169+
# Web-Dashboard starten (Standard/Vollständig)
166170
python health_monitor.py web
167171
168-
# Starten Sie die CLI-Schnittstelle
172+
# CLI starten
169173
python health_monitor.py cli
170174
```
171175

172-
## Lizenz
176+
---
177+
178+
## License
173179

174-
**MIT-Lizenz. Details finden Sie unter [LICENSE](../LICENSE).**
180+
Siehe die [Lizenz](../LICENSE) für Details.
175181

old/print_chunks.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import json
2+
from translate_seg import get_smart_chunks, merge_small_chunks
3+
4+
if __name__ == '__main__':
5+
with open('README.md', 'r', encoding='utf-8') as f:
6+
content = f.read()
7+
8+
chunks = merge_small_chunks(get_smart_chunks(content))
9+
10+
for i, (ctype, ctext) in enumerate(chunks, start=1):
11+
excerpt = ctext.replace('\n', '\\n')
12+
if len(excerpt) > 300:
13+
excerpt = excerpt[:300] + '...'
14+
print(f"--- CHUNK {i} ({ctype}) ---")
15+
print(excerpt)
16+
print()

old/translate_seg.py

Lines changed: 86 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ def get_smart_chunks(text):
5757

5858
p = part.strip()
5959

60+
if p.startswith('>') or p.startswith('*') or p.endswith('*') or p.startswith('> *') or p.startswith(' *'):
61+
chunks.append(("prose", p))
62+
continue
63+
6064
if (
6165
p.startswith(('<div', '<details', '```')) or
6266
p.startswith('<!--') or p.endswith('-->') or
@@ -67,7 +71,12 @@ def get_smart_chunks(text):
6771
else:
6872
chunks.append(("prose", p))
6973

70-
return chunks
74+
# Ensure any struct chunks containing blockquotes are split
75+
try:
76+
return split_struct_blockquotes(chunks)
77+
except NameError:
78+
return chunks
79+
7180

7281

7382
def merge_small_chunks(chunks, min_chars=400):
@@ -89,6 +98,73 @@ def merge_small_chunks(chunks, min_chars=400):
8998
i += 1
9099
return merged
91100

101+
def _classify_text_as_struct_or_prose(text):
102+
t = text.strip()
103+
if (
104+
t.startswith(('<div', '<details', '```')) or
105+
t.startswith('<!--') or t.endswith('-->') or
106+
re.match(r'!\[.*?\]\(.*?\)', t) or
107+
re.match(r'\[.*?\]\(.*?\)', t)
108+
):
109+
return 'struct'
110+
return 'prose'
111+
112+
113+
def split_struct_blockquotes(chunks):
114+
"""Split any `struct` chunk that contains a markdown blockquote into
115+
a `struct` part before the quote, a `prose` blockquote part, and an
116+
optional tail (struct/prose) after. This handles cases where placeholders
117+
like <!-- HTML_BLOCK --> are adjacent to a quoted one-line description.
118+
"""
119+
out = []
120+
for ctype, ctext in chunks:
121+
if ctype != 'struct' or not re.search(r'^\s*>', ctext, flags=re.MULTILINE):
122+
out.append((ctype, ctext))
123+
continue
124+
125+
# Work with original lines to preserve spacing
126+
lines = ctext.splitlines(True)
127+
128+
# find first line that starts with '>' (block quote)
129+
start = None
130+
for idx, line in enumerate(lines):
131+
if line.lstrip().startswith('>'):
132+
start = idx
133+
break
134+
135+
if start is None:
136+
out.append((ctype, ctext))
137+
continue
138+
139+
# find end of contiguous blockquote region, include adjacent blank lines
140+
end = start
141+
while end + 1 < len(lines):
142+
nxt = lines[end + 1]
143+
if nxt.lstrip().startswith('>'):
144+
end += 1
145+
continue
146+
# include a single blank line immediately after blockquote
147+
if nxt.strip() == '':
148+
# only include if followed by another blockquote line
149+
if end + 2 < len(lines) and lines[end + 2].lstrip().startswith('>'):
150+
end += 1
151+
continue
152+
# otherwise, treat blank as separator and stop
153+
break
154+
break
155+
156+
before = ''.join(lines[:start]).strip()
157+
block = ''.join(lines[start:end+1]).strip()
158+
after = ''.join(lines[end+1:]).strip()
159+
160+
if before:
161+
out.append(('struct', before))
162+
out.append(('prose', block))
163+
if after:
164+
out.append((_classify_text_as_struct_or_prose(after), after))
165+
166+
return out
167+
92168

93169
def fix_relative_paths(text):
94170
# Matches Markdown links [text](path)
@@ -180,7 +256,8 @@ def fix_relative_paths(text):
180256
"- The input is a single section header. Translate it 1:1.\n"
181257
"- DO NOT generate any content, lists, or descriptions under the header.\n"
182258
"- Preserve the '#' symbols exactly.\n"
183-
"- Output ONLY the translated header."
259+
"- Output ONLY the translated header.\n"
260+
"- Preserve original formatting, punctuation, whitespace, and markdown/code symbols exactly; do NOT normalize, reflow, or 'fix' the input."
184261
)
185262

186263
SYSTEM_PROSE = (
@@ -191,7 +268,9 @@ def fix_relative_paths(text):
191268
"- Translate human text inside HTML tags (e.g., <summary>Source</summary> -> <summary>Translation</summary>).\n"
192269
"- NEVER modify HTML tags, attributes (href, src), or CSS styles.\n"
193270
"- Keep technical terms (GPU, VRAM, CLI, Docker, GEMM, PIDs, NVLink) in English.\n"
194-
"- Preserve all Markdown symbols (#, **, `, -, [link](url)) exactly."
271+
"- Preserve all Markdown symbols (#, > *, **, `, -, [link](url)) exactly.\n"
272+
"- Do NOT modify formatting, whitespace, punctuation, code fences, list markers, or emphasis markers; translate only the human-visible text and leave surrounding symbols unchanged.\n"
273+
"- Preserve original formatting, punctuation, whitespace, and markdown/code symbols exactly; do NOT normalize, reflow, or 'fix' the input."
195274
)
196275

197276
# 4. Main
@@ -200,7 +279,10 @@ def main():
200279
with open("README.md", "r", encoding="utf-8") as f:
201280
content = f.read()
202281

203-
chunks = merge_small_chunks(get_smart_chunks(content))
282+
# Compute raw chunks, then split any struct chunks that contain blockquotes
283+
chunks = get_smart_chunks(content)
284+
chunks = split_struct_blockquotes(chunks)
285+
chunks = merge_small_chunks(chunks)
204286

205287
final_output = []
206288

scripts/ar.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,8 @@ TERMINOLOGY:
77
- Throttling: خنق الأداء (Khang al-ada')
88
- Enforcement: فرض القيود (Fard al-quyouda)
99
- Agnostic: مستقل عن الأجهزة
10-
- Lightweight: خفيف الوزن
10+
- Lightweight: خفيف الوزن
11+
12+
Preserve all Markdown symbols (#, > *, **, `, -, [link](url)) exactly.
13+
Do NOT modify formatting, whitespace, punctuation, code fences, list markers, or emphasis markers; translate only the human-visible text and leave surrounding symbols unchanged.
14+
Preserve original formatting, punctuation, whitespace, and markdown/code symbols exactly; do NOT normalize, reflow, or 'fix' the input.

scripts/cs.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,8 @@ ROLE: Czech Software Developer.
22
TERMINOLOGY:
33
- Throttling: Tepelné omezování (Throttling)
44
- Enforcement: Vynucení limitů
5-
- Agnostic: Hardwarově nezávislý
5+
- Agnostic: Hardwarově nezávislý
6+
7+
Preserve all Markdown symbols (#, > *, **, `, -, [link](url)) exactly.
8+
Do NOT modify formatting, whitespace, punctuation, code fences, list markers, or emphasis markers; translate only the human-visible text and leave surrounding symbols unchanged.
9+
Preserve original formatting, punctuation, whitespace, and markdown/code symbols exactly; do NOT normalize, reflow, or 'fix' the input.

0 commit comments

Comments
 (0)