Skip to content

Commit 98b6983

Browse files
authored
Refactor codebase, enhance documentation, and add new features (#26)
## Summary <img width="2185" height="829" alt="run_20260430_192930" src="https://github.com/user-attachments/assets/420ebbb4-cadf-4408-bc69-fc32ad081c6f" /> ## Model Configuration | Parameter | Value | |---|---| | Layers | 6 | | Heads | 6 | | Embedding dim | 100 | | Block size | 190 | | Batch size | 64 | | Dropout | 0.2 | | Learning rate | 3e-4 | | Total parameters | **10,837,257** | ## Training Details | Field | Value | |---|---| | Steps | 8,000 | | Eval every | 200 steps | | Optimizer seed | 1337 | | Train tokens | 14,080,249 | | Val tokens | 1,564,473 | | Precision | bf16 | | MFU | 60.0% | ## Results | Metric | Value | |---|---| | Best val loss | **2.3918** | | Final train loss | 2.2825 | | Total loss drop | 8.57 | | Peak throughput | 19,602 tok/s | | Mean throughput | 18,756 tok/s | | Peak grad norm | 2.2504 | | Mean grad norm | 1.6894 | | Training time | **82m 43s** | | Checkpoint | `best_model.pt` |
2 parents 62a0b3d + 06afff3 commit 98b6983

103 files changed

Lines changed: 376161 additions & 587 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
---
2+
name: Bug report
3+
about: Report a reproducible problem in training, inference, API, or UI
4+
title: "[Bug]: "
5+
labels: bug
6+
assignees: ""
7+
---
8+
9+
## Summary
10+
11+
A short description of the bug.
12+
13+
## Area
14+
15+
- [ ] C++ core
16+
- [ ] Backend API
17+
- [ ] Frontend UI
18+
- [ ] PyTorch engine
19+
- [ ] iGPU path
20+
- [ ] Docs
21+
22+
## Steps To Reproduce
23+
24+
1. Go to "..."
25+
2. Run "..."
26+
3. See error
27+
28+
## Expected Behavior
29+
30+
What should have happened instead?
31+
32+
## Actual Behavior
33+
34+
What happened?
35+
36+
## Logs Or Screenshots
37+
38+
Paste relevant output, stack traces, or screenshots here.
39+
40+
## Environment
41+
42+
- OS:
43+
- Compiler / Python / Node version:
44+
- GPU / CPU:

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
blank_issues_enabled: false
2+
contact_links:
3+
- name: Questions and general discussion
4+
url: https://github.com/Eamon2009/Quadtrix.cpp/discussions
5+
about: Use discussions for ideas, questions, and open-ended conversation.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for this project
4+
title: "[Feature]: "
5+
labels: enhancement
6+
assignees: ""
7+
8+
---
9+
10+
## Problem
11+
12+
What limitation or workflow pain are you running into?
13+
14+
## Proposed Solution
15+
16+
Describe the change you would like to see.
17+
18+
## Alternatives Considered
19+
20+
What other approaches did you consider?
21+
22+
## Additional Context
23+
24+
Add mockups, examples, references, or related issues here.

.github/dependabot.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "github-actions"
4+
directory: "/"
5+
schedule:
6+
interval: "weekly"
7+
8+
- package-ecosystem: "npm"
9+
directory: "/frontend"
10+
schedule:
11+
interval: "weekly"
12+
13+
- package-ecosystem: "pip"
14+
directory: "/backend"
15+
schedule:
16+
interval: "weekly"

.github/pull_request_template.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
## Summary
2+
3+
Describe the change and the user-facing impact.
4+
5+
## Checks
6+
7+
- [ ] C++ build still works
8+
- [ ] Backend changes were smoke-tested locally
9+
- [ ] Frontend build still passes
10+
- [ ] Docs or screenshots were updated if needed
11+
12+
## Notes
13+
14+
Anything reviewers should pay attention to, including follow-up work or known limitations.

.github/workflows/ci.yml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- exp
7+
- master
8+
pull_request:
9+
10+
permissions:
11+
contents: read
12+
13+
jobs:
14+
cpp-build:
15+
name: C++ build
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- name: Check out repository
20+
uses: actions/checkout@v4
21+
22+
- name: Install compiler
23+
run: sudo apt-get update && sudo apt-get install -y g++
24+
25+
- name: Build Quadtrix
26+
run: g++ -std=c++17 -O2 -I. -Iinclude -o quadtrix main.cpp
27+
28+
backend-smoke:
29+
name: Backend smoke checks
30+
runs-on: ubuntu-latest
31+
32+
steps:
33+
- name: Check out repository
34+
uses: actions/checkout@v4
35+
36+
- name: Set up Python
37+
uses: actions/setup-python@v5
38+
with:
39+
python-version: "3.11"
40+
41+
- name: Install backend runtime dependencies
42+
run: |
43+
python -m pip install --upgrade pip
44+
pip install fastapi "uvicorn[standard]" pydantic pydantic-settings httpx redis
45+
46+
- name: Compile Python sources
47+
run: python -m compileall backend engine iGPU
48+
49+
- name: Import FastAPI application
50+
working-directory: backend
51+
run: |
52+
python -c "from main import app; print(app.title)"
53+
54+
frontend-build:
55+
name: Frontend build
56+
runs-on: ubuntu-latest
57+
58+
steps:
59+
- name: Check out repository
60+
uses: actions/checkout@v4
61+
62+
- name: Set up Node.js
63+
uses: actions/setup-node@v4
64+
with:
65+
node-version: "20"
66+
cache: "npm"
67+
cache-dependency-path: frontend/package-lock.json
68+
69+
- name: Install frontend dependencies
70+
working-directory: frontend
71+
run: npm ci
72+
73+
- name: Build frontend
74+
working-directory: frontend
75+
run: npm run build

.github/workflows/release.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
build-release:
13+
name: Build release artifacts
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Check out repository
18+
uses: actions/checkout@v4
19+
20+
- name: Set up Python
21+
uses: actions/setup-python@v5
22+
with:
23+
python-version: "3.11"
24+
25+
- name: Set up Node.js
26+
uses: actions/setup-node@v4
27+
with:
28+
node-version: "20"
29+
cache: "npm"
30+
cache-dependency-path: frontend/package-lock.json
31+
32+
- name: Build C++ binary
33+
run: g++ -std=c++17 -O2 -I. -Iinclude -o quadtrix main.cpp
34+
35+
- name: Compile Python sources
36+
run: python -m compileall backend engine iGPU
37+
38+
- name: Build frontend
39+
working-directory: frontend
40+
run: |
41+
npm ci
42+
npm run build
43+
44+
- name: Package release files
45+
run: |
46+
tar \
47+
--exclude='*.pt' \
48+
--exclude='engine/logs' \
49+
--exclude='__pycache__' \
50+
-czf quadtrix-linux.tar.gz \
51+
quadtrix README.md LICENSE run.md backend engine iGPU include src data config frontend/dist
52+
53+
- name: Create GitHub release
54+
uses: softprops/action-gh-release@v2
55+
with:
56+
files: quadtrix-linux.tar.gz
57+
generate_release_notes: true

.gitignore

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,10 @@ libtorch-win-shared-with-deps-2.11.0+cpu (2)
77
frontend/node_modules/
88
frontend/dist/
99
.venv
10+
.npm-cache/
1011
build
11-
CMakeCache.txt
12+
CMakeCache.txt
13+
engine/fine-tune/input.txt
14+
*best_model.pt
15+
*.pt
16+
*exe

.npmignore

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
__pycache__/
2+
*.pyc
3+
*.pyo
4+
*.pt
5+
*.bin
6+
*.exe
7+
.git/
8+
.github/
9+
.npm-cache/
10+
.venv/
11+
.vscode/
12+
build/
13+
frontend/node_modules/
14+
frontend/src/
15+
frontend/public/
16+
frontend/package-lock.json
17+
frontend/package.json
18+
frontend/postcss.config.js
19+
frontend/tailwind.config.ts
20+
frontend/tsconfig.json
21+
frontend/vite.config.ts
22+
engine/logs/
23+
engine/fine-tune/
24+
engine/fineweb_30mb.txt
25+
engine/data/input.txt

.vscode/c++.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"_UNICODE"
1414
],
1515
"windowsSdkVersion": "10.0.19041.0",
16-
"compilerPath": "C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.34.31933/bin/Hostx64/x64/cl.exe",
16+
"compilerPath": "",
1717
"cStandard": "c17",
1818
"cppStandard": "c++17",
1919
"intelliSenseMode": "windows-msvc-x64",

0 commit comments

Comments
 (0)