aimlite 0.1.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.
- aimlite-0.1.0/.gitignore +20 -0
- aimlite-0.1.0/.python-version +1 -0
- aimlite-0.1.0/PKG-INFO +230 -0
- aimlite-0.1.0/README.md +222 -0
- aimlite-0.1.0/api_docs/.gitignore +24 -0
- aimlite-0.1.0/api_docs/.oxlintrc.json +8 -0
- aimlite-0.1.0/api_docs/README.md +32 -0
- aimlite-0.1.0/api_docs/index.html +18 -0
- aimlite-0.1.0/api_docs/package-lock.json +1970 -0
- aimlite-0.1.0/api_docs/package.json +30 -0
- aimlite-0.1.0/api_docs/public/favicon.svg +1 -0
- aimlite-0.1.0/api_docs/public/icons.svg +24 -0
- aimlite-0.1.0/api_docs/src/App.css +184 -0
- aimlite-0.1.0/api_docs/src/App.tsx +156 -0
- aimlite-0.1.0/api_docs/src/assets/hero.png +0 -0
- aimlite-0.1.0/api_docs/src/assets/react.svg +1 -0
- aimlite-0.1.0/api_docs/src/assets/vite.svg +1 -0
- aimlite-0.1.0/api_docs/src/components/CodePlayground.tsx +192 -0
- aimlite-0.1.0/api_docs/src/components/EndpointDoc.tsx +352 -0
- aimlite-0.1.0/api_docs/src/components/GuideStepCard.tsx +176 -0
- aimlite-0.1.0/api_docs/src/components/Navbar.tsx +106 -0
- aimlite-0.1.0/api_docs/src/components/SearchModal.tsx +192 -0
- aimlite-0.1.0/api_docs/src/components/Sidebar.tsx +114 -0
- aimlite-0.1.0/api_docs/src/index.css +114 -0
- aimlite-0.1.0/api_docs/src/main.tsx +10 -0
- aimlite-0.1.0/api_docs/tsconfig.app.json +26 -0
- aimlite-0.1.0/api_docs/tsconfig.json +7 -0
- aimlite-0.1.0/api_docs/tsconfig.node.json +23 -0
- aimlite-0.1.0/api_docs/vite.config.ts +11 -0
- aimlite-0.1.0/build/README.md +45 -0
- aimlite-0.1.0/build/aimlite +0 -0
- aimlite-0.1.0/build/build_cli.py +63 -0
- aimlite-0.1.0/build/build_cli.sh +8 -0
- aimlite-0.1.0/docs/MLKit CLI /342/200/224 Zero-Path Execution Specification.pdf +0 -0
- aimlite-0.1.0/docs/MLKit Core /342/200/224 Header Interface & Contract Specification.pdf +0 -0
- aimlite-0.1.0/docs/MLKit /342/200/224 Generated Project Architecture Specification.pdf +0 -0
- aimlite-0.1.0/docs/examples/churn_scratch/README.md +78 -0
- aimlite-0.1.0/docs/examples/churn_scratch/data.py +122 -0
- aimlite-0.1.0/docs/examples/churn_scratch/evaluator.py +45 -0
- aimlite-0.1.0/docs/examples/churn_scratch/inference.py +52 -0
- aimlite-0.1.0/docs/examples/churn_scratch/model.py +139 -0
- aimlite-0.1.0/docs/examples/churn_scratch/trainer.py +64 -0
- aimlite-0.1.0/docs/examples/instruction_adapter/README.md +62 -0
- aimlite-0.1.0/docs/examples/instruction_adapter/data.py +83 -0
- aimlite-0.1.0/docs/examples/instruction_adapter/inference.py +38 -0
- aimlite-0.1.0/docs/examples/instruction_adapter/model.py +116 -0
- aimlite-0.1.0/docs/examples/instruction_adapter/trainer.py +51 -0
- aimlite-0.1.0/docs/examples/knowledge_rag/README.md +66 -0
- aimlite-0.1.0/docs/examples/knowledge_rag/data.py +100 -0
- aimlite-0.1.0/docs/examples/knowledge_rag/inference.py +42 -0
- aimlite-0.1.0/docs/examples/knowledge_rag/model.py +112 -0
- aimlite-0.1.0/docs/examples/knowledge_rag/trainer.py +50 -0
- aimlite-0.1.0/pyproject.toml +25 -0
- aimlite-0.1.0/src/aimlite/__init__.py +75 -0
- aimlite-0.1.0/src/aimlite/adapters.py +209 -0
- aimlite-0.1.0/src/aimlite/config.py +184 -0
- aimlite-0.1.0/src/aimlite/data.py +444 -0
- aimlite-0.1.0/src/aimlite/lifecycle.py +214 -0
- aimlite-0.1.0/src/aimlite/models.py +166 -0
- aimlite-0.1.0/src/aimlite/py.typed +1 -0
- aimlite-0.1.0/src/aimlite/rag.py +391 -0
- aimlite-0.1.0/src/aimlite/registry.py +107 -0
- aimlite-0.1.0/src/aimlite/templates/app_template/__init__.py +1 -0
- aimlite-0.1.0/src/aimlite/templates/app_template/data.py +33 -0
- aimlite-0.1.0/src/aimlite/templates/app_template/evaluator.py +15 -0
- aimlite-0.1.0/src/aimlite/templates/app_template/inference.py +33 -0
- aimlite-0.1.0/src/aimlite/templates/app_template/model.py +20 -0
- aimlite-0.1.0/src/aimlite/templates/app_template/trainer.py +18 -0
- aimlite-0.1.0/src/aimlite/templates/swagger.html +66 -0
- aimlite-0.1.0/src/cli/__init__.py +1 -0
- aimlite-0.1.0/src/cli/commands/__init__.py +70 -0
- aimlite-0.1.0/src/cli/commands/data.py +182 -0
- aimlite-0.1.0/src/cli/commands/doctor.py +86 -0
- aimlite-0.1.0/src/cli/commands/evaluate.py +171 -0
- aimlite-0.1.0/src/cli/commands/init.py +351 -0
- aimlite-0.1.0/src/cli/commands/install.py +164 -0
- aimlite-0.1.0/src/cli/commands/serve.py +144 -0
- aimlite-0.1.0/src/cli/commands/train.py +290 -0
- aimlite-0.1.0/src/cli/discovery.py +374 -0
- aimlite-0.1.0/src/cli/main.py +158 -0
- aimlite-0.1.0/src/cli/server.py +470 -0
- aimlite-0.1.0/src/cli/test.py +28 -0
- aimlite-0.1.0/src/cli/ui.py +94 -0
- aimlite-0.1.0/test/main.py +17 -0
- aimlite-0.1.0/test/test_cli.py +673 -0
- aimlite-0.1.0/test/test_examples.py +119 -0
- aimlite-0.1.0/test/test_headers.py +434 -0
- aimlite-0.1.0/uv.lock +8 -0
aimlite-0.1.0/.gitignore
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Python-generated files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[oc]
|
|
4
|
+
dist/
|
|
5
|
+
wheels/
|
|
6
|
+
*.egg-info
|
|
7
|
+
.pytest_cache/
|
|
8
|
+
|
|
9
|
+
# Virtual environments
|
|
10
|
+
.venv
|
|
11
|
+
node_modules/
|
|
12
|
+
|
|
13
|
+
# Build and training artifacts
|
|
14
|
+
artifacts/
|
|
15
|
+
checkpoints/
|
|
16
|
+
experiments/
|
|
17
|
+
models/
|
|
18
|
+
data/
|
|
19
|
+
*.pkl
|
|
20
|
+
.aimlite/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.14
|
aimlite-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: aimlite
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: The Django for AI & Machine Learning — zero-configuration, zero-path execution.
|
|
5
|
+
Author-email: Mickyas Tesfaye <alazartesfaye42@gmail.com>, Beamlak Tadesse <atocodes@gmail.com>
|
|
6
|
+
Requires-Python: >=3.10
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
|
|
9
|
+
# AIMLite
|
|
10
|
+
|
|
11
|
+
**The Django for AI & Machine Learning** — an opinionated, convention-over-configuration Python framework with zero-path CLI execution.
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## PyPI Installation
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
pip install aimlite
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Or with [`uv`](https://docs.astral.sh/uv/):
|
|
22
|
+
```bash
|
|
23
|
+
uv add aimlite
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
```python
|
|
27
|
+
from aimlite import Model, Dataset, BaseTrainer, BaseConfig, BaseEvaluator, BaseInference
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## Authors & Collaborators
|
|
33
|
+
|
|
34
|
+
- **Mickyas Tesfaye** ([alazartesfaye42@gmail.com](mailto:alazartesfaye42@gmail.com))
|
|
35
|
+
- **Beamlak Tadesse** ([atocodes@gmail.com](mailto:atocodes@gmail.com))
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## Why AIMLite?
|
|
40
|
+
|
|
41
|
+
Traditional AI and machine learning projects suffer from repetitive boilerplate: scattered scripts, brittle path configurations, unstandardized train/test splits, hardcoded checkpoint paths, and ad-hoc serving code.
|
|
42
|
+
|
|
43
|
+
AIMLite provides a standardized, convention-based structure inspired by modern web frameworks like Django and Vite:
|
|
44
|
+
- **Zero-Path Execution**: Run `aimlite` anywhere inside your project directory. AIMLite resolves modules, sets up paths, and locates your data and models automatically.
|
|
45
|
+
- **Automated Virtual Environment Management**: Automatically detects and uses project `.venv` (powered by `uv` or `pip`).
|
|
46
|
+
- **First-Class IDE Typing Headers**: Generates PEP 561 headers and `.aimlite/workspace.json` on project initialization, giving VS Code, Cursor, and PyCharm immediate auto-completion, parameter hints, and docstrings with zero global installs.
|
|
47
|
+
- **Per-Model Artifacts & Lifecycle**: Supports multiple model classes per project with standardized naming (`models/<model_name>.pkl` and `experiments/<model_name>_snapshot.json`).
|
|
48
|
+
- **Built-in Inference Serving**: Production-ready HTTP server with `POST /predict`, `GET /health`, `GET /docs`, custom user-defined endpoints, and optional static frontend hosting.
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## Quickstart
|
|
53
|
+
|
|
54
|
+
Requires Python **>= 3.10** (tested on 3.14) and [`uv`](https://docs.astral.sh/uv/) (or `pip`).
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
git clone https://github.com/Alazar42/aimlite.git
|
|
58
|
+
cd aimlite
|
|
59
|
+
uv sync
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Essential Commands
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
uv run aimlite --help # Run AIMLite CLI
|
|
66
|
+
uv run test # Run core test suite (41 tests)
|
|
67
|
+
uv run pytest # Full pytest runner
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## Project Structure Conventions
|
|
73
|
+
|
|
74
|
+
When you run `aimlite init <project_name>` (or `aimlite init .`), AIMLite scaffolds a standardized convention layout:
|
|
75
|
+
|
|
76
|
+
```text
|
|
77
|
+
my_project/
|
|
78
|
+
├── .aimlite/
|
|
79
|
+
│ └── workspace.json # IDE workspace configuration
|
|
80
|
+
├── .venv/ # Project-isolated virtual environment
|
|
81
|
+
├── data/ # Raw datasets (.csv, .json, .txt, .md)
|
|
82
|
+
├── models/ # Model architectures and saved weights (*.pkl)
|
|
83
|
+
├── experiments/ # Training run logs and metric snapshots (*.json)
|
|
84
|
+
├── data.py # Dataset definitions extending Dataset
|
|
85
|
+
├── model.py # Model classes extending Model / RAGModel / AdapterModel
|
|
86
|
+
├── trainer.py # Training lifecycle hooks extending BaseTrainer
|
|
87
|
+
├── evaluator.py # Metric benchmarks extending BaseEvaluator
|
|
88
|
+
├── inference.py # Inference pipeline extending BaseInference
|
|
89
|
+
└── aimlite.json # Project config, dependencies manifest, and paradigms
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
## The 3 AI Paradigms
|
|
95
|
+
|
|
96
|
+
AIMLite is architected around the 3 primary modern machine learning paradigms:
|
|
97
|
+
|
|
98
|
+
### Paradigm 1: Training from Scratch (Customer Churn Classifier)
|
|
99
|
+
|
|
100
|
+
Bespoke tabular architectures, full optimization loops, and custom weights.
|
|
101
|
+
|
|
102
|
+
- **Dataset**: Kaggle Telecom Churn Dataset ([Kaggle Source](https://www.kaggle.com/datasets/barun2104/telecom-churn))
|
|
103
|
+
- **Required Dependencies**:
|
|
104
|
+
```bash
|
|
105
|
+
aimlite install scikit-learn pandas
|
|
106
|
+
# or
|
|
107
|
+
pip install scikit-learn pandas
|
|
108
|
+
```
|
|
109
|
+
- **Example Files**: [`docs/examples/churn_scratch/`](docs/examples/churn_scratch/)
|
|
110
|
+
- `data.py`: `TelecomChurnDataset(Dataset)` ingesting `data/telecom_churn.csv` with automatic 80/10/10 train/val/test splits.
|
|
111
|
+
- `model.py`: `ChurnClassifier(Model)` wrapping scikit-learn's `RandomForestClassifier`.
|
|
112
|
+
- `trainer.py`: `ChurnTrainer(BaseTrainer)` fitting and saving weights to `models/churn_classifier.pkl`.
|
|
113
|
+
- `evaluator.py`: `ChurnEvaluator(BaseEvaluator)` calculating accuracy, precision, recall, and F1 score.
|
|
114
|
+
- `inference.py`: `ChurnInference(BaseInference)` scoring churn risk probability and returning retention decisions.
|
|
115
|
+
- **Workflow**:
|
|
116
|
+
```bash
|
|
117
|
+
# Initialize (new directory or in-place with .)
|
|
118
|
+
aimlite init churn_model && cd churn_model
|
|
119
|
+
# Place telecom_churn.csv in data/
|
|
120
|
+
aimlite data validate
|
|
121
|
+
aimlite train ChurnClassifier
|
|
122
|
+
aimlite evaluate ChurnClassifier
|
|
123
|
+
aimlite serve ChurnClassifier --port 8000
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
### Paradigm 2: RAG (Knowledge Base Question Answering)
|
|
129
|
+
|
|
130
|
+
Ground foundation models in enterprise documents with semantic vector search and zero hallucination.
|
|
131
|
+
|
|
132
|
+
- **Data Formats**: Markdown (`.md`) or text (`.txt`) documents placed in `data/`.
|
|
133
|
+
- **Required Dependencies**:
|
|
134
|
+
```bash
|
|
135
|
+
aimlite install sentence-transformers numpy
|
|
136
|
+
# or
|
|
137
|
+
pip install sentence-transformers numpy
|
|
138
|
+
```
|
|
139
|
+
- **Example Files**: [`docs/examples/knowledge_rag/`](docs/examples/knowledge_rag/)
|
|
140
|
+
- `data.py`: `KnowledgeDocsDataset(Dataset)` chunking documents with `TextSplitter`.
|
|
141
|
+
- `model.py`: `SupportDocRAG(RAGModel)` binding `MemoryVectorStore` and `VectorRetriever`.
|
|
142
|
+
- `trainer.py`: `IndexBuilderTrainer(BaseTrainer)` building and persisting the vector index to `models/rag_index.json`.
|
|
143
|
+
- `inference.py`: `RAGInference(BaseInference)` querying the retriever and synthesizing grounded answers with citations.
|
|
144
|
+
- **Workflow**:
|
|
145
|
+
```bash
|
|
146
|
+
aimlite init support_rag && cd support_rag
|
|
147
|
+
# Place knowledge documents in data/
|
|
148
|
+
aimlite train SupportDocRAG
|
|
149
|
+
aimlite serve SupportDocRAG --port 8000
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
---
|
|
153
|
+
|
|
154
|
+
### Paradigm 3: Fine-Tuning (LoRA & PEFT Adapters)
|
|
155
|
+
|
|
156
|
+
Parameter-efficient adaptation with lightweight delta checkpoints (~50KB to 50MB instead of 14GB+).
|
|
157
|
+
|
|
158
|
+
- **Data Formats**: Prompt-response instruction pairs in `data/instructions.json` or `data/instructions.jsonl`.
|
|
159
|
+
- **Required Dependencies**:
|
|
160
|
+
```bash
|
|
161
|
+
aimlite install torch peft
|
|
162
|
+
# or
|
|
163
|
+
pip install torch peft
|
|
164
|
+
```
|
|
165
|
+
- **Example Files**: [`docs/examples/instruction_adapter/`](docs/examples/instruction_adapter/)
|
|
166
|
+
- `data.py`: `InstructionDataset(Dataset)` formatting instruction prompt templates.
|
|
167
|
+
- `model.py`: `LoRAInstructionModel(AdapterModel)` configuring `AdapterConfig(r=8, alpha=16.0)` and freezing foundation weights.
|
|
168
|
+
- `trainer.py`: `AdapterInstructionTrainer(BaseTrainer)` optimizing low-rank delta matrices.
|
|
169
|
+
- `inference.py`: `AdapterInference(BaseInference)` executing fine-tuned generations via `POST /predict`.
|
|
170
|
+
- **Workflow**:
|
|
171
|
+
```bash
|
|
172
|
+
aimlite init lora_app && cd lora_app
|
|
173
|
+
# Place instructions.json in data/
|
|
174
|
+
aimlite train LoRAInstructionModel
|
|
175
|
+
aimlite serve LoRAInstructionModel --port 8000
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
---
|
|
179
|
+
|
|
180
|
+
## Zero-Path CLI Reference
|
|
181
|
+
|
|
182
|
+
AIMLite provides zero-path convention-over-configuration commands:
|
|
183
|
+
|
|
184
|
+
| Command | Description |
|
|
185
|
+
|---|---|
|
|
186
|
+
| `aimlite init [project_name \| .]` | Scaffolds a project in a new folder or directly in the current directory (`.`), setting up `.venv`, `.aimlite/workspace.json` IDE headers, starter files, and conventions. |
|
|
187
|
+
| `aimlite install [packages...]` | Without arguments, installs all dependencies listed in `aimlite.json`. With packages, installs them into `.venv` using `uv` (or `pip`) and adds them to `aimlite.json`. |
|
|
188
|
+
| `aimlite data validate` | Validates dataset schema, record count, column names, and partition readiness across all datasets in `data/`. |
|
|
189
|
+
| `aimlite train [ModelName]` | Automatically discovers registered models and executes training. Saves checkpoint to `models/<model_name>.pkl` and snapshots to `experiments/`. |
|
|
190
|
+
| `aimlite evaluate [ModelName]` | Loads the model's checkpoint and calculates benchmark metrics on test partitions. |
|
|
191
|
+
| `aimlite serve [ModelName] [--port 8000] [--frontend <dir>]` | Starts an HTTP inference server exposing `POST /predict`, `GET /health`, `GET /docs`, custom routes, and optional static frontend hosting. |
|
|
192
|
+
| `aimlite doctor` | Diagnoses runtime health, virtual environment, hardware accelerator availability (`cuda`, `mps`, `cpu`), and directory permissions. |
|
|
193
|
+
|
|
194
|
+
---
|
|
195
|
+
|
|
196
|
+
## Standalone Executable & Build System (`build/`)
|
|
197
|
+
|
|
198
|
+
The standalone binary is packaged using Python's native `zipapp` format into a single self-contained executable with zero runtime dependencies:
|
|
199
|
+
|
|
200
|
+
```bash
|
|
201
|
+
# Compile / rebuild the standalone binary:
|
|
202
|
+
python3 build/build_cli.py
|
|
203
|
+
|
|
204
|
+
# Run directly without python invocation:
|
|
205
|
+
./build/aimlite doctor
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
---
|
|
209
|
+
|
|
210
|
+
## Interactive API Documentation Portal (`api_docs/`)
|
|
211
|
+
|
|
212
|
+
The full documentation portal is built with React, Vite, and modern styling, featuring interactive paradigm step-by-step guides, code explanation walkthroughs, copy-to-clipboard code blocks, and an API test playground:
|
|
213
|
+
|
|
214
|
+
```bash
|
|
215
|
+
cd api_docs
|
|
216
|
+
npm install
|
|
217
|
+
npm run dev # Launch local docs dev server at http://localhost:5173
|
|
218
|
+
npm run build # Build production bundle into api_docs/dist/
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
---
|
|
222
|
+
|
|
223
|
+
## Testing
|
|
224
|
+
|
|
225
|
+
AIMLite includes a comprehensive 41-test suite validating CLI commands, header generation, data validation, model lifecycle, inference serving, and end-to-end paradigm workflows:
|
|
226
|
+
|
|
227
|
+
```bash
|
|
228
|
+
uv run test # Core test runner
|
|
229
|
+
uv run pytest # Full pytest runner (41/41 passing)
|
|
230
|
+
```
|
aimlite-0.1.0/README.md
ADDED
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
# AIMLite
|
|
2
|
+
|
|
3
|
+
**The Django for AI & Machine Learning** — an opinionated, convention-over-configuration Python framework with zero-path CLI execution.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## PyPI Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
pip install aimlite
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Or with [`uv`](https://docs.astral.sh/uv/):
|
|
14
|
+
```bash
|
|
15
|
+
uv add aimlite
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
```python
|
|
19
|
+
from aimlite import Model, Dataset, BaseTrainer, BaseConfig, BaseEvaluator, BaseInference
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## Authors & Collaborators
|
|
25
|
+
|
|
26
|
+
- **Mickyas Tesfaye** ([alazartesfaye42@gmail.com](mailto:alazartesfaye42@gmail.com))
|
|
27
|
+
- **Beamlak Tadesse** ([atocodes@gmail.com](mailto:atocodes@gmail.com))
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## Why AIMLite?
|
|
32
|
+
|
|
33
|
+
Traditional AI and machine learning projects suffer from repetitive boilerplate: scattered scripts, brittle path configurations, unstandardized train/test splits, hardcoded checkpoint paths, and ad-hoc serving code.
|
|
34
|
+
|
|
35
|
+
AIMLite provides a standardized, convention-based structure inspired by modern web frameworks like Django and Vite:
|
|
36
|
+
- **Zero-Path Execution**: Run `aimlite` anywhere inside your project directory. AIMLite resolves modules, sets up paths, and locates your data and models automatically.
|
|
37
|
+
- **Automated Virtual Environment Management**: Automatically detects and uses project `.venv` (powered by `uv` or `pip`).
|
|
38
|
+
- **First-Class IDE Typing Headers**: Generates PEP 561 headers and `.aimlite/workspace.json` on project initialization, giving VS Code, Cursor, and PyCharm immediate auto-completion, parameter hints, and docstrings with zero global installs.
|
|
39
|
+
- **Per-Model Artifacts & Lifecycle**: Supports multiple model classes per project with standardized naming (`models/<model_name>.pkl` and `experiments/<model_name>_snapshot.json`).
|
|
40
|
+
- **Built-in Inference Serving**: Production-ready HTTP server with `POST /predict`, `GET /health`, `GET /docs`, custom user-defined endpoints, and optional static frontend hosting.
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## Quickstart
|
|
45
|
+
|
|
46
|
+
Requires Python **>= 3.10** (tested on 3.14) and [`uv`](https://docs.astral.sh/uv/) (or `pip`).
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
git clone https://github.com/Alazar42/aimlite.git
|
|
50
|
+
cd aimlite
|
|
51
|
+
uv sync
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Essential Commands
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
uv run aimlite --help # Run AIMLite CLI
|
|
58
|
+
uv run test # Run core test suite (41 tests)
|
|
59
|
+
uv run pytest # Full pytest runner
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## Project Structure Conventions
|
|
65
|
+
|
|
66
|
+
When you run `aimlite init <project_name>` (or `aimlite init .`), AIMLite scaffolds a standardized convention layout:
|
|
67
|
+
|
|
68
|
+
```text
|
|
69
|
+
my_project/
|
|
70
|
+
├── .aimlite/
|
|
71
|
+
│ └── workspace.json # IDE workspace configuration
|
|
72
|
+
├── .venv/ # Project-isolated virtual environment
|
|
73
|
+
├── data/ # Raw datasets (.csv, .json, .txt, .md)
|
|
74
|
+
├── models/ # Model architectures and saved weights (*.pkl)
|
|
75
|
+
├── experiments/ # Training run logs and metric snapshots (*.json)
|
|
76
|
+
├── data.py # Dataset definitions extending Dataset
|
|
77
|
+
├── model.py # Model classes extending Model / RAGModel / AdapterModel
|
|
78
|
+
├── trainer.py # Training lifecycle hooks extending BaseTrainer
|
|
79
|
+
├── evaluator.py # Metric benchmarks extending BaseEvaluator
|
|
80
|
+
├── inference.py # Inference pipeline extending BaseInference
|
|
81
|
+
└── aimlite.json # Project config, dependencies manifest, and paradigms
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
## The 3 AI Paradigms
|
|
87
|
+
|
|
88
|
+
AIMLite is architected around the 3 primary modern machine learning paradigms:
|
|
89
|
+
|
|
90
|
+
### Paradigm 1: Training from Scratch (Customer Churn Classifier)
|
|
91
|
+
|
|
92
|
+
Bespoke tabular architectures, full optimization loops, and custom weights.
|
|
93
|
+
|
|
94
|
+
- **Dataset**: Kaggle Telecom Churn Dataset ([Kaggle Source](https://www.kaggle.com/datasets/barun2104/telecom-churn))
|
|
95
|
+
- **Required Dependencies**:
|
|
96
|
+
```bash
|
|
97
|
+
aimlite install scikit-learn pandas
|
|
98
|
+
# or
|
|
99
|
+
pip install scikit-learn pandas
|
|
100
|
+
```
|
|
101
|
+
- **Example Files**: [`docs/examples/churn_scratch/`](docs/examples/churn_scratch/)
|
|
102
|
+
- `data.py`: `TelecomChurnDataset(Dataset)` ingesting `data/telecom_churn.csv` with automatic 80/10/10 train/val/test splits.
|
|
103
|
+
- `model.py`: `ChurnClassifier(Model)` wrapping scikit-learn's `RandomForestClassifier`.
|
|
104
|
+
- `trainer.py`: `ChurnTrainer(BaseTrainer)` fitting and saving weights to `models/churn_classifier.pkl`.
|
|
105
|
+
- `evaluator.py`: `ChurnEvaluator(BaseEvaluator)` calculating accuracy, precision, recall, and F1 score.
|
|
106
|
+
- `inference.py`: `ChurnInference(BaseInference)` scoring churn risk probability and returning retention decisions.
|
|
107
|
+
- **Workflow**:
|
|
108
|
+
```bash
|
|
109
|
+
# Initialize (new directory or in-place with .)
|
|
110
|
+
aimlite init churn_model && cd churn_model
|
|
111
|
+
# Place telecom_churn.csv in data/
|
|
112
|
+
aimlite data validate
|
|
113
|
+
aimlite train ChurnClassifier
|
|
114
|
+
aimlite evaluate ChurnClassifier
|
|
115
|
+
aimlite serve ChurnClassifier --port 8000
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
### Paradigm 2: RAG (Knowledge Base Question Answering)
|
|
121
|
+
|
|
122
|
+
Ground foundation models in enterprise documents with semantic vector search and zero hallucination.
|
|
123
|
+
|
|
124
|
+
- **Data Formats**: Markdown (`.md`) or text (`.txt`) documents placed in `data/`.
|
|
125
|
+
- **Required Dependencies**:
|
|
126
|
+
```bash
|
|
127
|
+
aimlite install sentence-transformers numpy
|
|
128
|
+
# or
|
|
129
|
+
pip install sentence-transformers numpy
|
|
130
|
+
```
|
|
131
|
+
- **Example Files**: [`docs/examples/knowledge_rag/`](docs/examples/knowledge_rag/)
|
|
132
|
+
- `data.py`: `KnowledgeDocsDataset(Dataset)` chunking documents with `TextSplitter`.
|
|
133
|
+
- `model.py`: `SupportDocRAG(RAGModel)` binding `MemoryVectorStore` and `VectorRetriever`.
|
|
134
|
+
- `trainer.py`: `IndexBuilderTrainer(BaseTrainer)` building and persisting the vector index to `models/rag_index.json`.
|
|
135
|
+
- `inference.py`: `RAGInference(BaseInference)` querying the retriever and synthesizing grounded answers with citations.
|
|
136
|
+
- **Workflow**:
|
|
137
|
+
```bash
|
|
138
|
+
aimlite init support_rag && cd support_rag
|
|
139
|
+
# Place knowledge documents in data/
|
|
140
|
+
aimlite train SupportDocRAG
|
|
141
|
+
aimlite serve SupportDocRAG --port 8000
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
---
|
|
145
|
+
|
|
146
|
+
### Paradigm 3: Fine-Tuning (LoRA & PEFT Adapters)
|
|
147
|
+
|
|
148
|
+
Parameter-efficient adaptation with lightweight delta checkpoints (~50KB to 50MB instead of 14GB+).
|
|
149
|
+
|
|
150
|
+
- **Data Formats**: Prompt-response instruction pairs in `data/instructions.json` or `data/instructions.jsonl`.
|
|
151
|
+
- **Required Dependencies**:
|
|
152
|
+
```bash
|
|
153
|
+
aimlite install torch peft
|
|
154
|
+
# or
|
|
155
|
+
pip install torch peft
|
|
156
|
+
```
|
|
157
|
+
- **Example Files**: [`docs/examples/instruction_adapter/`](docs/examples/instruction_adapter/)
|
|
158
|
+
- `data.py`: `InstructionDataset(Dataset)` formatting instruction prompt templates.
|
|
159
|
+
- `model.py`: `LoRAInstructionModel(AdapterModel)` configuring `AdapterConfig(r=8, alpha=16.0)` and freezing foundation weights.
|
|
160
|
+
- `trainer.py`: `AdapterInstructionTrainer(BaseTrainer)` optimizing low-rank delta matrices.
|
|
161
|
+
- `inference.py`: `AdapterInference(BaseInference)` executing fine-tuned generations via `POST /predict`.
|
|
162
|
+
- **Workflow**:
|
|
163
|
+
```bash
|
|
164
|
+
aimlite init lora_app && cd lora_app
|
|
165
|
+
# Place instructions.json in data/
|
|
166
|
+
aimlite train LoRAInstructionModel
|
|
167
|
+
aimlite serve LoRAInstructionModel --port 8000
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
---
|
|
171
|
+
|
|
172
|
+
## Zero-Path CLI Reference
|
|
173
|
+
|
|
174
|
+
AIMLite provides zero-path convention-over-configuration commands:
|
|
175
|
+
|
|
176
|
+
| Command | Description |
|
|
177
|
+
|---|---|
|
|
178
|
+
| `aimlite init [project_name \| .]` | Scaffolds a project in a new folder or directly in the current directory (`.`), setting up `.venv`, `.aimlite/workspace.json` IDE headers, starter files, and conventions. |
|
|
179
|
+
| `aimlite install [packages...]` | Without arguments, installs all dependencies listed in `aimlite.json`. With packages, installs them into `.venv` using `uv` (or `pip`) and adds them to `aimlite.json`. |
|
|
180
|
+
| `aimlite data validate` | Validates dataset schema, record count, column names, and partition readiness across all datasets in `data/`. |
|
|
181
|
+
| `aimlite train [ModelName]` | Automatically discovers registered models and executes training. Saves checkpoint to `models/<model_name>.pkl` and snapshots to `experiments/`. |
|
|
182
|
+
| `aimlite evaluate [ModelName]` | Loads the model's checkpoint and calculates benchmark metrics on test partitions. |
|
|
183
|
+
| `aimlite serve [ModelName] [--port 8000] [--frontend <dir>]` | Starts an HTTP inference server exposing `POST /predict`, `GET /health`, `GET /docs`, custom routes, and optional static frontend hosting. |
|
|
184
|
+
| `aimlite doctor` | Diagnoses runtime health, virtual environment, hardware accelerator availability (`cuda`, `mps`, `cpu`), and directory permissions. |
|
|
185
|
+
|
|
186
|
+
---
|
|
187
|
+
|
|
188
|
+
## Standalone Executable & Build System (`build/`)
|
|
189
|
+
|
|
190
|
+
The standalone binary is packaged using Python's native `zipapp` format into a single self-contained executable with zero runtime dependencies:
|
|
191
|
+
|
|
192
|
+
```bash
|
|
193
|
+
# Compile / rebuild the standalone binary:
|
|
194
|
+
python3 build/build_cli.py
|
|
195
|
+
|
|
196
|
+
# Run directly without python invocation:
|
|
197
|
+
./build/aimlite doctor
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
---
|
|
201
|
+
|
|
202
|
+
## Interactive API Documentation Portal (`api_docs/`)
|
|
203
|
+
|
|
204
|
+
The full documentation portal is built with React, Vite, and modern styling, featuring interactive paradigm step-by-step guides, code explanation walkthroughs, copy-to-clipboard code blocks, and an API test playground:
|
|
205
|
+
|
|
206
|
+
```bash
|
|
207
|
+
cd api_docs
|
|
208
|
+
npm install
|
|
209
|
+
npm run dev # Launch local docs dev server at http://localhost:5173
|
|
210
|
+
npm run build # Build production bundle into api_docs/dist/
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
---
|
|
214
|
+
|
|
215
|
+
## Testing
|
|
216
|
+
|
|
217
|
+
AIMLite includes a comprehensive 41-test suite validating CLI commands, header generation, data validation, model lifecycle, inference serving, and end-to-end paradigm workflows:
|
|
218
|
+
|
|
219
|
+
```bash
|
|
220
|
+
uv run test # Core test runner
|
|
221
|
+
uv run pytest # Full pytest runner (41/41 passing)
|
|
222
|
+
```
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Logs
|
|
2
|
+
logs
|
|
3
|
+
*.log
|
|
4
|
+
npm-debug.log*
|
|
5
|
+
yarn-debug.log*
|
|
6
|
+
yarn-error.log*
|
|
7
|
+
pnpm-debug.log*
|
|
8
|
+
lerna-debug.log*
|
|
9
|
+
|
|
10
|
+
node_modules
|
|
11
|
+
dist
|
|
12
|
+
dist-ssr
|
|
13
|
+
*.local
|
|
14
|
+
|
|
15
|
+
# Editor directories and files
|
|
16
|
+
.vscode/*
|
|
17
|
+
!.vscode/extensions.json
|
|
18
|
+
.idea
|
|
19
|
+
.DS_Store
|
|
20
|
+
*.suo
|
|
21
|
+
*.ntvs*
|
|
22
|
+
*.njsproj
|
|
23
|
+
*.sln
|
|
24
|
+
*.sw?
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# React + TypeScript + Vite
|
|
2
|
+
|
|
3
|
+
This template provides a minimal setup to get React working in Vite with HMR and some Oxlint rules.
|
|
4
|
+
|
|
5
|
+
Currently, two official plugins are available:
|
|
6
|
+
|
|
7
|
+
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Oxc](https://oxc.rs)
|
|
8
|
+
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/)
|
|
9
|
+
|
|
10
|
+
## React Compiler
|
|
11
|
+
|
|
12
|
+
The React Compiler is not enabled on this template because of its impact on dev & build performances. To add it, see [this documentation](https://react.dev/learn/react-compiler/installation).
|
|
13
|
+
|
|
14
|
+
## Expanding the Oxlint configuration
|
|
15
|
+
|
|
16
|
+
If you are developing a production application, we recommend enabling type-aware lint rules by installing `oxlint-tsgolint` and editing `.oxlintrc.json`:
|
|
17
|
+
|
|
18
|
+
```json
|
|
19
|
+
{
|
|
20
|
+
"$schema": "./node_modules/oxlint/configuration_schema.json",
|
|
21
|
+
"plugins": ["react", "typescript", "oxc"],
|
|
22
|
+
"options": {
|
|
23
|
+
"typeAware": true
|
|
24
|
+
},
|
|
25
|
+
"rules": {
|
|
26
|
+
"react/rules-of-hooks": "error",
|
|
27
|
+
"react/only-export-components": ["warn", { "allowConstantExport": true }]
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
See the [Oxlint rules documentation](https://oxc.rs/docs/guide/usage/linter/rules) for the full list of rules and categories.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<link rel="icon" type="image/svg+xml" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2300f2fe' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polygon points='13 2 3 14 12 14 11 22 21 10 12 10 13 2'/></svg>" />
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
+
<title>AIMLite — The Django for Machine Learning & AI | Interactive API & Architecture Docs</title>
|
|
8
|
+
<meta name="description" content="Official interactive documentation and API explorer for AIMLite: Zero-Path Execution, BYOF framework contracts, automatic .venv package management, and zero-boilerplate ML serving." />
|
|
9
|
+
<!-- Modern Typography -->
|
|
10
|
+
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
11
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
12
|
+
<link href="https://fonts.googleapis.com/css2?family=Fira+Code:wght@400;500;600&family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800&display=swap" rel="stylesheet">
|
|
13
|
+
</head>
|
|
14
|
+
<body>
|
|
15
|
+
<div id="root"></div>
|
|
16
|
+
<script type="module" src="/src/main.tsx"></script>
|
|
17
|
+
</body>
|
|
18
|
+
</html>
|