Skip to content

Commit 1bcbcc6

Browse files
committed
Fix
1 parent 6cede8d commit 1bcbcc6

File tree

7 files changed

+114
-77
lines changed

7 files changed

+114
-77
lines changed

.justfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ check:
3737
uv run pre-commit run -a
3838
# Run mypy
3939
uv run mypy .
40-
# Run deptry
41-
uv run deptry .
40+
# Run deptry with ignored issues
41+
uv run deptry . --ignore=DEP002,DEP003
4242

4343
# Add scripts
4444
add_scripts:

README.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,10 @@ A web dashboard for training machine learning models with PyTorch.
2929
### Built With
3030

3131
[![Python][Python-shield]][Python-url]
32-
[![GitHub Actions][github-actions-shield]][github-actions-url]
32+
[![Pytest][Pytest-shield]][Pytest-url]
33+
[![Codecov][Codecov-shield]][Codecov-url]
3334
[![Docker][Docker-shield]][Docker-url]
35+
[![GitHub Actions][github-actions-shield]][github-actions-url]
3436

3537
<!-- GETTING STARTED -->
3638

@@ -107,9 +109,13 @@ The source code for this project is distributed under the terms of the MIT Licen
107109
<!-- MARKDOWN SHIELD BAGDES & LINKS -->
108110
<!-- https://github.com/Ileriayo/markdown-badges -->
109111

110-
[Python-shield]: https://img.shields.io/badge/Python-%23008080.svg?style=for-the-badge&logo=python&logoColor=306998&labelColor=222222&color=306998
112+
[Python-shield]: https://img.shields.io/badge/Python-%23008080.svg?style=for-the-badge&logo=python&logoColor=FFDD54&labelColor=222222&color=306998
111113
[Python-url]: https://www.python.org/
112-
[github-actions-shield]: https://img.shields.io/badge/github%20actions-%232671E5.svg?style=for-the-badge&logo=githubactions&logoColor=2671E5&labelColor=222222&color=2671E5
113-
[github-actions-url]: https://github.com/features/actions
114+
[Pytest-shield]: https://img.shields.io/badge/pytest-%23008080.svg?style=for-the-badge&logo=pytest&logoColor=2F9FE3&labelColor=222222&color=2F9FE3
115+
[Pytest-url]: https://docs.pytest.org
114116
[Docker-shield]: https://img.shields.io/badge/docker-%232671E5.svg?style=for-the-badge&logo=docker&logoColor=1D63ED&labelColor=222222&color=1D63ED
115117
[Docker-url]: https://www.docker.com/
118+
[Codecov-shield]: https://img.shields.io/badge/codecov-%23008080.svg?style=for-the-badge&logo=codecov&logoColor=FF0077&labelColor=222222&color=FF0077
119+
[Codecov-url]: https://codecov.io/
120+
[github-actions-shield]: https://img.shields.io/badge/github%20actions-%232671E5.svg?style=for-the-badge&logo=githubactions&logoColor=2671E5&labelColor=222222&color=2671E5
121+
[github-actions-url]: https://github.com/features/actions

src/dashboard/pyproject.toml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,18 @@ name = "dashboard"
33
version = "0.0.0"
44
description = "Dashboard functionality"
55
authors = [
6-
{name="Miguel Villa Floran", email="miguel.villafloran@gmail.com"}
6+
{ name = "Miguel Villa Floran", email = "miguel.villafloran@gmail.com" },
77
]
88
requires-python = ">=3.10"
99
readme = "README.md"
1010
dependencies = [
11-
"utils",
12-
"typer>=0.12.5",
13-
"uvicorn>=0.34.0",
14-
"fastapi>=0.115.8",
15-
"jinja2>=3.1.5",
11+
"utils",
12+
"typer>=0.12.5",
13+
"uvicorn>=0.34.0",
14+
"fastapi>=0.115.8",
15+
"jinja2>=3.1.5",
16+
"pynvml>=11.5.0",
17+
"torch>=2.6.0",
1618
]
1719

1820
[project.scripts]

src/dashboard/src/dashboard/api.py

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
import os
2+
3+
from fastapi import FastAPI, Request
4+
from fastapi.responses import HTMLResponse
5+
from fastapi.templating import Jinja2Templates
6+
7+
api = FastAPI(
8+
title="Dashboard API",
9+
description="API for the dashboard application",
10+
version="1.0.0",
11+
)
12+
13+
# Set up templates directory
14+
templates = Jinja2Templates(
15+
directory=os.path.join(os.path.dirname(__file__), "templates")
16+
)
17+
18+
# Training metrics storage
19+
training_metrics = {
20+
"iteration": 0,
21+
"loss": 0.0,
22+
"perplexity": 0.0,
23+
"accuracy": 0.0,
24+
"learning_rate": 0.0,
25+
"gradient_norm": 0.0,
26+
"bits_memorized": 0.0,
27+
"bits_per_second": 0.0,
28+
"gpu_utilization": [0.0] * 1024, # For 1024 GPUs
29+
"skills": {
30+
"Translation": 20,
31+
"Summarization": 15,
32+
"Reasoning": 10,
33+
"Coding": 5,
34+
"Comprehension": 25,
35+
},
36+
}
37+
38+
39+
@api.get("/", response_class=HTMLResponse)
40+
async def root(request: Request):
41+
"""Serve the dashboard HTML"""
42+
return templates.TemplateResponse("dashboard.html", {"request": request})
43+
44+
45+
@api.post("/update_metrics")
46+
async def update_metrics(metrics: dict):
47+
"""Receive updated metrics from PyTorch training"""
48+
# Update our stored metrics
49+
training_metrics.update(metrics)
50+
return {"status": "success"}
51+
52+
53+
@api.get("/metrics")
54+
async def get_metrics():
55+
"""Return current training metrics"""
56+
return training_metrics

src/dashboard/src/dashboard/cli.py

Lines changed: 1 addition & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,15 @@
1-
import os
2-
31
import typer
42
import uvicorn
5-
from fastapi import FastAPI, Request
6-
from fastapi.responses import HTMLResponse
7-
from fastapi.templating import Jinja2Templates
83
from utils import get_token
94

105
app = typer.Typer()
11-
api = FastAPI(
12-
title="Dashboard API",
13-
description="API for the dashboard application",
14-
version="1.0.0",
15-
)
16-
17-
# Set up templates directory
18-
templates = Jinja2Templates(
19-
directory=os.path.join(os.path.dirname(__file__), "templates")
20-
)
21-
22-
# Training metrics storage
23-
training_metrics = {
24-
"iteration": 0,
25-
"loss": 0.0,
26-
"perplexity": 0.0,
27-
"accuracy": 0.0,
28-
"learning_rate": 0.0,
29-
"gradient_norm": 0.0,
30-
"bits_memorized": 0.0,
31-
"bits_per_second": 0.0,
32-
"gpu_utilization": [0.0] * 1024, # For 1024 GPUs
33-
"skills": {
34-
"Translation": 20,
35-
"Summarization": 15,
36-
"Reasoning": 10,
37-
"Coding": 5,
38-
"Comprehension": 25,
39-
},
40-
}
41-
42-
43-
@api.get("/", response_class=HTMLResponse)
44-
async def root(request: Request):
45-
"""Serve the dashboard HTML"""
46-
return templates.TemplateResponse("dashboard.html", {"request": request})
47-
48-
49-
@api.post("/update_metrics")
50-
async def update_metrics(metrics: dict):
51-
"""Receive updated metrics from PyTorch training"""
52-
# Update our stored metrics
53-
training_metrics.update(metrics)
54-
return {"status": "success"}
55-
56-
57-
@api.get("/metrics")
58-
async def get_metrics():
59-
"""Return current training metrics"""
60-
return training_metrics
616

627

638
@app.command()
649
def run():
6510
"""Start the FastAPI server"""
6611
uvicorn.run(
67-
"dashboard.cli:api",
12+
"dashboard.api:api",
6813
host=get_token("DASHBOARD_HOST"),
6914
port=int(get_token("DASHBOARD_PORT")),
7015
reload=True,

src/trainer/pyproject.toml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,20 @@ name = "trainer"
33
version = "0.0.0"
44
description = "Trainer functionality"
55
authors = [
6-
{name="Miguel Villa Floran", email="miguel.villafloran@gmail.com"}
6+
{ name = "Miguel Villa Floran", email = "miguel.villafloran@gmail.com" },
77
]
88
requires-python = ">=3.10"
99
readme = "README.md"
1010
dependencies = [
11-
"utils",
12-
"typer>=0.12.5",
13-
"jinja2>=3.1.5",
14-
"torch>=2.6.0",
15-
"requests>=2.32.3",
16-
"numpy>=2.2.3",
17-
"torchvision>=0.21.0",
18-
"types-requests>=2.32.0.20250306",
11+
"utils",
12+
"typer>=0.12.5",
13+
"jinja2>=3.1.5",
14+
"torch>=2.6.0",
15+
"requests>=2.32.3",
16+
"numpy>=2.2.3",
17+
"torchvision>=0.21.0",
18+
"types-requests>=2.32.0.20250306",
19+
"pynvml>=11.5.0",
1920
]
2021

2122
[project.scripts]

uv.lock

Lines changed: 27 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)