File size: 8,324 Bytes
f203641 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 |
# Getting Started with OktoEngine
**Your first 5 minutes with OktoEngine** - A quick guide to get you up and running.
---
## Prerequisites
- OktoEngine installed (download from [GitHub Releases](https://github.com/oktoseek/oktoengine/releases))
- Basic understanding of AI/ML concepts
- A dataset ready for training (optional for first run)
---
## Step 1: Install OktoEngine
### Download Pre-built Binary
1. Visit [GitHub Releases](https://github.com/oktoseek/oktoengine/releases)
2. Download the binary for your platform:
- **Windows:** `okto-windows.exe`
- **Linux:** `okto-linux`
- **macOS:** `okto-macos`
3. Make it executable (Linux/Mac):
```bash
chmod +x okto-linux
```
4. Add to PATH (optional but recommended)
### Verify Installation
```bash
okto --version
```
Should output: `okto 0.1.0`
---
## Step 2: Check Your System
Before starting, check if your system is ready:
```bash
okto doctor
```
This will show:
- β
Platform information
- β
RAM and CPU
- β
GPU detection
- β
CUDA availability
- β
Runtime environment
- β
Dependencies status
**If dependencies are missing:**
```bash
okto doctor --install
```
Automatically installs missing dependencies.
---
## Step 3: Create Your First Project
Initialize a new OktoScript project:
```bash
okto init my-first-model
cd my-first-model
```
This creates:
```
my-first-model/
βββ scripts/
β βββ train.okt # Your training configuration
βββ dataset/
β βββ train.jsonl # Training data (sample)
β βββ val.jsonl # Validation data (sample)
βββ export/ # Where models will be exported
```
---
## Step 4: Prepare Your Dataset
Edit `dataset/train.jsonl` with your training data:
**dataset/train.jsonl:**
```json
{"input":"Hello","output":"Hi! How can I help you?"}
{"input":"What's the weather?","output":"I don't have access to weather data."}
{"input":"Thank you","output":"You're welcome!"}
```
**Minimum requirements:**
- At least 10 examples for basic training
- Consistent format (JSONL recommended)
- Valid JSON on each line
**Supported formats:**
- JSONL (recommended)
- CSV
- TXT
- Parquet
---
## Step 5: Configure Your Training
Edit `scripts/train.okt`:
```okt
PROJECT "MyFirstModel"
DESCRIPTION "My first AI model with OktoEngine"
ENV {
accelerator: "gpu"
min_memory: "8GB"
precision: "fp16"
install_missing: true
}
DATASET {
train: "dataset/train.jsonl"
validation: "dataset/val.jsonl"
}
MODEL {
base: "gpt2"
}
TRAIN {
epochs: 5
batch_size: 32
device: "auto"
}
EXPORT {
format: ["okm"]
path: "export/"
}
```
**Key settings:**
- `PROJECT` - Your model name
- `MODEL.base` - Base model (gpt2, distilgpt2, etc.)
- `TRAIN.epochs` - Number of training epochs
- `TRAIN.batch_size` - Batch size
- `TRAIN.device` - "auto" detects GPU/CPU automatically
- `EXPORT.format` - Output format
---
## Step 6: Validate Your Configuration
Before training, validate your configuration:
```bash
okto validate
```
**What it checks:**
- β
Syntax is correct
- β
All required fields are present
- β
Dataset files exist
- β
Model paths are valid
- β
Values are within allowed ranges
**Example output:**
```
π OktoEngine v0.1
π Validating OktoScript file: "scripts/train.okt"
π File: "scripts/train.okt"
π Size: 382 bytes
π Lines: 31
β File parsed successfully
π Validation Results:
β
Validation passed! No errors or warnings.
π Summary:
Project: MyFirstModel
ENV: Configured
Dataset: dataset/train.jsonl
Model: gpt2
Training: 5 epochs, batch size 32
Export: ["okm"]
```
**If validation fails:**
- Check error messages
- Fix syntax errors
- Verify file paths
- Run `okto validate --debug` for detailed logs
---
## Step 7: Train Your Model
Start training:
```bash
okto train
```
**What happens:**
1. β
Configuration is parsed and validated
2. β
System environment is checked
3. β
Dependencies are verified
4. β
Dataset is loaded
5. β
Model is initialized (downloads from HuggingFace if needed)
6. β
Training loop starts
7. β
Progress is shown in real-time
8. β
Model is saved to `runs/MyFirstModel/`
9. β
Exported models saved to `export/`
**Example output:**
```
π OktoEngine v0.1
π Reading: "scripts/train.okt"
π Environment Check:
β Runtime: Python 3.14.0
β GPU: NVIDIA GeForce RTX 4070
β RAM: 63GB (40GB available)
β Platform: windows
π¦ Checking dependencies...
β All dependencies available
π Starting training pipeline...
Epoch 1/5: 100%|ββββββββββββ| 500/500 [02:15<00:00, 3.70it/s]
Loss: 2.345 β 1.892
Learning Rate: 5e-5
GPU Memory: 8.2GB / 12GB
Epoch 2/5: 100%|ββββββββββββ| 500/500 [02:14<00:00, 3.72it/s]
Loss: 1.892 β 1.654
...
β
Training completed successfully!
π Output: runs/MyFirstModel/
```
**Training time:**
- Small models (100M params): 5-15 minutes
- Medium models (1B params): 30-60 minutes
- Large models (7B params): Several hours
---
## Step 8: Check Your Results
After training completes:
**Check training output:**
```bash
ls runs/MyFirstModel/
```
**Files created:**
- `checkpoint-*/` - Training checkpoints
- `training_logs.json` - Detailed training logs
- `metrics.json` - Training metrics
- `tokenizer.json` - Tokenizer configuration
**Check exported models:**
```bash
ls export/
```
**Exported files:**
- `model.okm` - OktoSeek Model format
---
## Step 9: Evaluate Your Model (Optional)
Evaluate your trained model:
```bash
okto eval
```
**Output:**
```
π OktoEngine v0.1
π Evaluating model...
π Evaluation Results:
Accuracy: 0.892
Loss: 1.234
Perplexity: 2.456
F1-Score: 0.876
β
Evaluation completed!
```
---
## Common First Steps
### Using GPU
If you have a GPU, OktoEngine will automatically detect and use it. To ensure GPU usage:
```okt
ENV {
accelerator: "gpu"
precision: "fp16"
}
TRAIN {
device: "auto" # or "cuda" for explicit GPU
}
```
### Adding More Epochs
```okt
TRAIN {
epochs: 10 # Increase from 5
batch_size: 32
}
```
### Exporting to Multiple Formats
```okt
EXPORT {
format: ["okm", "onnx", "gguf"]
path: "export/"
}
```
### Using Debug Mode
For detailed logs during training:
```bash
okto train --debug
```
Shows:
- Parsing details
- Execution flow
- Error diagnostics
- Performance metrics
---
## Troubleshooting
### Training Fails
**Check system:**
```bash
okto doctor
```
**Check configuration:**
```bash
okto validate --debug
```
**Common issues:**
- **Out of memory:** Reduce `batch_size` in TRAIN block
- **Model not found:** Check `MODEL.base` is a valid HuggingFace model
- **Dataset not found:** Verify paths in DATASET block
- **Dependencies missing:** Run `okto doctor --install`
### Validation Fails
**Enable debug mode:**
```bash
okto validate --debug
```
**Common errors:**
- Syntax errors - Check OktoScript syntax
- Missing fields - Add required blocks
- Invalid paths - Verify file paths exist
- Invalid values - Check value ranges
### System Issues
**Check system:**
```bash
okto doctor
```
**Install dependencies:**
```bash
okto doctor --install
```
---
## Next Steps
- π Read the [Complete CLI Reference](./CLI_REFERENCE.md)
- π― Check out [Examples](../examples/) for advanced use cases
- π Learn about [Debug Mode](./DEBUG_GUIDE.md)
- π‘ Explore [FAQ](./FAQ.md) for common questions
---
## Quick Reference
| Task | Command |
|------|---------|
| Initialize project | `okto init <name>` |
| Validate | `okto validate` |
| Check system | `okto doctor` |
| Train | `okto train` |
| Evaluate | `okto eval` |
| Export | `okto export --format okm` |
| Debug mode | `okto train --debug` |
| Upgrade | `okto upgrade` |
---
**Need help?** Check the [FAQ](./FAQ.md) or open an issue on [GitHub](https://github.com/oktoseek/oktoengine/issues).
|