Upload 48 files
Browse filesInitial public release of OktoScript specification
- .gitattributes +12 -35
- .gitignore +31 -0
- CHANGELOG.md +44 -0
- CHANGELOG_V1.1.md +185 -0
- CONTRIBUTING.md +58 -0
- LICENSE +192 -0
- README.md +720 -3
- VALIDATION_RULES.md +502 -0
- assets/README.md +22 -0
- assets/okto_logo.png +3 -0
- assets/okto_logo2.png +3 -0
- assets/okto_logo3.png +3 -0
- assets/okto_logo4.png +3 -0
- assets/oktoscript_banner.png +3 -0
- docs/FAQ.md +865 -0
- docs/GETTING_STARTED.md +199 -0
- docs/grammar.md +2571 -0
- examples/README.md +169 -0
- examples/basic.okt +28 -0
- examples/behavior-chat.okt +78 -0
- examples/chatbot.okt +47 -0
- examples/complete-v1.2.okt +210 -0
- examples/computer_vision.okt +41 -0
- examples/control-nested.okt +99 -0
- examples/dataset-mixing.okt +61 -0
- examples/datasets/demo_train.jsonl +13 -0
- examples/deploy-api.okt +77 -0
- examples/explorer-automl.okt +50 -0
- examples/finetuning-llm.okt +99 -0
- examples/guard-safety.okt +70 -0
- examples/inference-advanced.okt +92 -0
- examples/lora-finetuning.okt +101 -0
- examples/model-adapter.okt +46 -0
- examples/monitor-full.okt +89 -0
- examples/pizzabot.okt +31 -0
- examples/pizzabot/dataset/test.jsonl +8 -0
- examples/pizzabot/dataset/train.jsonl +18 -0
- examples/pizzabot/dataset/val.jsonl +8 -0
- examples/pizzabot/okt.yaml +16 -0
- examples/pizzabot/runs/pizzabot-v1/metrics.json +14 -0
- examples/pizzabot/runs/pizzabot-v1/training_logs.json +24 -0
- examples/pizzabot/scripts/train.okt +89 -0
- examples/qa-embeddings.okt +85 -0
- examples/recommender.okt +46 -0
- examples/security-full.okt +78 -0
- examples/stability-training.okt +60 -0
- examples/vision-pipeline.okt +89 -0
- schemas/dataset.schema.json +34 -0
.gitattributes
CHANGED
|
@@ -1,35 +1,12 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
*.
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
| 14 |
-
*.npy filter=lfs diff=lfs merge=lfs -text
|
| 15 |
-
*.npz filter=lfs diff=lfs merge=lfs -text
|
| 16 |
-
*.onnx filter=lfs diff=lfs merge=lfs -text
|
| 17 |
-
*.ot filter=lfs diff=lfs merge=lfs -text
|
| 18 |
-
*.parquet filter=lfs diff=lfs merge=lfs -text
|
| 19 |
-
*.pb filter=lfs diff=lfs merge=lfs -text
|
| 20 |
-
*.pickle filter=lfs diff=lfs merge=lfs -text
|
| 21 |
-
*.pkl filter=lfs diff=lfs merge=lfs -text
|
| 22 |
-
*.pt filter=lfs diff=lfs merge=lfs -text
|
| 23 |
-
*.pth filter=lfs diff=lfs merge=lfs -text
|
| 24 |
-
*.rar filter=lfs diff=lfs merge=lfs -text
|
| 25 |
-
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
| 26 |
-
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
| 27 |
-
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
| 28 |
-
*.tar filter=lfs diff=lfs merge=lfs -text
|
| 29 |
-
*.tflite filter=lfs diff=lfs merge=lfs -text
|
| 30 |
-
*.tgz filter=lfs diff=lfs merge=lfs -text
|
| 31 |
-
*.wasm filter=lfs diff=lfs merge=lfs -text
|
| 32 |
-
*.xz filter=lfs diff=lfs merge=lfs -text
|
| 33 |
-
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
-
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
-
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
| 1 |
+
# OktoScript Language Detection
|
| 2 |
+
# This file tells GitHub to recognize .okt files as OktoScript language
|
| 3 |
+
|
| 4 |
+
*.okt linguist-language=OktoScript
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
assets/okto_logo.png filter=lfs diff=lfs merge=lfs -text
|
| 9 |
+
assets/okto_logo2.png filter=lfs diff=lfs merge=lfs -text
|
| 10 |
+
assets/okto_logo3.png filter=lfs diff=lfs merge=lfs -text
|
| 11 |
+
assets/okto_logo4.png filter=lfs diff=lfs merge=lfs -text
|
| 12 |
+
assets/oktoscript_banner.png filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.gitignore
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# OktoScript - Files to ignore
|
| 2 |
+
|
| 3 |
+
# Internal documentation (not for public GitHub)
|
| 4 |
+
ENV_BLOCK_SUMMARY.md
|
| 5 |
+
ARQUIVOS_ATUALIZADOS_*.txt
|
| 6 |
+
MUDANCAS_*.txt
|
| 7 |
+
|
| 8 |
+
# Build artifacts
|
| 9 |
+
__pycache__/
|
| 10 |
+
*.pyc
|
| 11 |
+
*.pyo
|
| 12 |
+
*.pyd
|
| 13 |
+
.Python
|
| 14 |
+
|
| 15 |
+
# IDE
|
| 16 |
+
.vscode/
|
| 17 |
+
.idea/
|
| 18 |
+
*.swp
|
| 19 |
+
*.swo
|
| 20 |
+
*~
|
| 21 |
+
|
| 22 |
+
# OS
|
| 23 |
+
.DS_Store
|
| 24 |
+
Thumbs.db
|
| 25 |
+
|
| 26 |
+
# Logs
|
| 27 |
+
*.log
|
| 28 |
+
|
| 29 |
+
# Temporary files
|
| 30 |
+
*.tmp
|
| 31 |
+
*.temp
|
CHANGELOG.md
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Changelog
|
| 2 |
+
|
| 3 |
+
All notable changes to OktoScript will be documented in this file.
|
| 4 |
+
|
| 5 |
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
| 6 |
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
| 7 |
+
|
| 8 |
+
**OktoScript** is developed and maintained by **OktoSeek AI**.
|
| 9 |
+
|
| 10 |
+
## [1.0.0] - 2025-11-22
|
| 11 |
+
|
| 12 |
+
### Added
|
| 13 |
+
- Initial release of OktoScript by OktoSeek AI
|
| 14 |
+
- Complete grammar specification (v1.0)
|
| 15 |
+
- PROJECT, DESCRIPTION, VERSION, TAGS, AUTHOR blocks
|
| 16 |
+
- DATASET block with support for multiple formats
|
| 17 |
+
- MODEL block with architecture and precision options
|
| 18 |
+
- TRAIN block with optimizer and scheduler support
|
| 19 |
+
- METRICS block with built-in and custom metrics
|
| 20 |
+
- VALIDATION block for training validation
|
| 21 |
+
- INFERENCE block for inference configuration
|
| 22 |
+
- EXPORT block with multiple format support (gguf, onnx, okm, safetensors, tflite)
|
| 23 |
+
- DEPLOY block for deployment configuration
|
| 24 |
+
- SECURITY block for model encryption and watermarking
|
| 25 |
+
- LOGGING block for training logs
|
| 26 |
+
- Complete PizzaBot example project
|
| 27 |
+
- JSON Schema for dataset validation
|
| 28 |
+
- Professional README with documentation
|
| 29 |
+
- Apache 2.0 License
|
| 30 |
+
|
| 31 |
+
### Documentation
|
| 32 |
+
- Grammar specification in EBNF format
|
| 33 |
+
- Complete README with examples
|
| 34 |
+
- Example project documentation
|
| 35 |
+
- Contributing guidelines
|
| 36 |
+
- Project structure documentation
|
| 37 |
+
|
| 38 |
+
---
|
| 39 |
+
|
| 40 |
+
[1.0.0]: https://github.com/oktoseek/oktoscript/releases/tag/v1.0.0
|
| 41 |
+
|
| 42 |
+
---
|
| 43 |
+
|
| 44 |
+
**OktoScript** is a product of **OktoSeek AI**.
|
CHANGELOG_V1.1.md
ADDED
|
@@ -0,0 +1,185 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# OktoScript v1.1 Changelog
|
| 2 |
+
|
| 3 |
+
**Release Date:** November 2025
|
| 4 |
+
**Status:** 100% Backward Compatible with v1.0
|
| 5 |
+
|
| 6 |
+
---
|
| 7 |
+
|
| 8 |
+
## 🎉 New Features
|
| 9 |
+
|
| 10 |
+
### 1. LoRA Fine-Tuning Support
|
| 11 |
+
|
| 12 |
+
Added `FT_LORA` block for efficient fine-tuning using Low-Rank Adaptation adapters.
|
| 13 |
+
|
| 14 |
+
**Benefits:**
|
| 15 |
+
- ✅ Reduced memory footprint (up to 90% less VRAM)
|
| 16 |
+
- ✅ Faster training times
|
| 17 |
+
- ✅ Smaller model files (only adapter weights)
|
| 18 |
+
- ✅ Easy to combine multiple LoRA adapters
|
| 19 |
+
|
| 20 |
+
**Example:**
|
| 21 |
+
```okt
|
| 22 |
+
# okto_version: "1.1"
|
| 23 |
+
FT_LORA {
|
| 24 |
+
base_model: "oktoseek/base-llm-7b"
|
| 25 |
+
lora_rank: 8
|
| 26 |
+
lora_alpha: 32
|
| 27 |
+
epochs: 5
|
| 28 |
+
batch_size: 4
|
| 29 |
+
learning_rate: 0.00003
|
| 30 |
+
device: "cuda"
|
| 31 |
+
target_modules: ["q_proj", "v_proj"]
|
| 32 |
+
}
|
| 33 |
+
```
|
| 34 |
+
|
| 35 |
+
**See:** [`examples/lora-finetuning.okt`](./examples/lora-finetuning.okt)
|
| 36 |
+
|
| 37 |
+
---
|
| 38 |
+
|
| 39 |
+
### 2. Dataset Mixing and Sampling
|
| 40 |
+
|
| 41 |
+
Enhanced `DATASET` block with support for mixing multiple datasets with weighted sampling.
|
| 42 |
+
|
| 43 |
+
**New Fields:**
|
| 44 |
+
- `mix_datasets`: Array of `{path, weight}` objects
|
| 45 |
+
- `dataset_percent`: Limit dataset usage (1-100)
|
| 46 |
+
- `sampling`: `"weighted"` or `"random"`
|
| 47 |
+
- `shuffle`: Shuffle datasets before mixing
|
| 48 |
+
|
| 49 |
+
**Example:**
|
| 50 |
+
```okt
|
| 51 |
+
DATASET {
|
| 52 |
+
mix_datasets: [
|
| 53 |
+
{ path: "dataset/base.jsonl", weight: 70 },
|
| 54 |
+
{ path: "dataset/extra.jsonl", weight: 30 }
|
| 55 |
+
]
|
| 56 |
+
dataset_percent: 80
|
| 57 |
+
sampling: "weighted"
|
| 58 |
+
shuffle: true
|
| 59 |
+
}
|
| 60 |
+
```
|
| 61 |
+
|
| 62 |
+
**Benefits:**
|
| 63 |
+
- ✅ Combine multiple datasets intelligently
|
| 64 |
+
- ✅ Control dataset proportions
|
| 65 |
+
- ✅ Limit dataset size for faster iteration
|
| 66 |
+
- ✅ Weighted or random sampling strategies
|
| 67 |
+
|
| 68 |
+
**See:** [`examples/dataset-mixing.okt`](./examples/dataset-mixing.okt)
|
| 69 |
+
|
| 70 |
+
---
|
| 71 |
+
|
| 72 |
+
### 3. Advanced System Monitoring
|
| 73 |
+
|
| 74 |
+
Added `MONITOR` block for comprehensive system and training telemetry.
|
| 75 |
+
|
| 76 |
+
**Features:**
|
| 77 |
+
- System metrics (GPU, CPU, RAM, temperature)
|
| 78 |
+
- Training speed metrics (tokens/s, samples/s)
|
| 79 |
+
- Real-time dashboard (optional)
|
| 80 |
+
- Configurable refresh intervals
|
| 81 |
+
- Export to JSON
|
| 82 |
+
|
| 83 |
+
**Example:**
|
| 84 |
+
```okt
|
| 85 |
+
MONITOR {
|
| 86 |
+
level: "full"
|
| 87 |
+
log_metrics: ["loss", "accuracy", "perplexity"]
|
| 88 |
+
log_system: ["gpu_memory_used", "cpu_usage", "temperature"]
|
| 89 |
+
log_speed: ["tokens_per_second", "samples_per_second"]
|
| 90 |
+
refresh_interval: 2s
|
| 91 |
+
export_to: "runs/logs/system.json"
|
| 92 |
+
dashboard: true
|
| 93 |
+
}
|
| 94 |
+
```
|
| 95 |
+
|
| 96 |
+
**Benefits:**
|
| 97 |
+
- ✅ Monitor system resources during training
|
| 98 |
+
- ✅ Detect bottlenecks and optimize
|
| 99 |
+
- ✅ Track training speed
|
| 100 |
+
- ✅ Real-time visualization
|
| 101 |
+
|
| 102 |
+
---
|
| 103 |
+
|
| 104 |
+
### 4. Version Declaration
|
| 105 |
+
|
| 106 |
+
Added optional version declaration at the top of `.okt` files.
|
| 107 |
+
|
| 108 |
+
**Syntax:**
|
| 109 |
+
```okt
|
| 110 |
+
# okto_version: "1.1"
|
| 111 |
+
PROJECT "MyModel"
|
| 112 |
+
...
|
| 113 |
+
```
|
| 114 |
+
|
| 115 |
+
**Rules:**
|
| 116 |
+
- Optional (defaults to v1.0 if missing)
|
| 117 |
+
- Must be first line (comments allowed before)
|
| 118 |
+
- Format: `# okto_version: "1.1"` or `# okto_version: "1.0"`
|
| 119 |
+
- Enables v1.1 features when set to "1.1"
|
| 120 |
+
|
| 121 |
+
---
|
| 122 |
+
|
| 123 |
+
## 📁 New Optional Folders
|
| 124 |
+
|
| 125 |
+
v1.1 introduces optional folders for new features:
|
| 126 |
+
|
| 127 |
+
```
|
| 128 |
+
/runs/
|
| 129 |
+
└── my-model/
|
| 130 |
+
├── logs/
|
| 131 |
+
│ └── system.json # MONITOR output
|
| 132 |
+
└── lora/ # LoRA adapters
|
| 133 |
+
└── adapter.safetensors
|
| 134 |
+
```
|
| 135 |
+
|
| 136 |
+
**Note:** These folders are created automatically when using v1.1 features. Existing v1.0 structure remains unchanged.
|
| 137 |
+
|
| 138 |
+
---
|
| 139 |
+
|
| 140 |
+
## 🔄 Backward Compatibility
|
| 141 |
+
|
| 142 |
+
**100% Compatible with v1.0:**
|
| 143 |
+
|
| 144 |
+
- ✅ All v1.0 files work without modification
|
| 145 |
+
- ✅ v1.0 syntax remains valid
|
| 146 |
+
- ✅ No breaking changes
|
| 147 |
+
- ✅ Default version is v1.0 (if version not specified)
|
| 148 |
+
|
| 149 |
+
**Migration:**
|
| 150 |
+
- No migration required
|
| 151 |
+
- Simply add `# okto_version: "1.1"` to use new features
|
| 152 |
+
- Existing v1.0 files continue to work
|
| 153 |
+
|
| 154 |
+
---
|
| 155 |
+
|
| 156 |
+
## 📚 Documentation Updates
|
| 157 |
+
|
| 158 |
+
- ✅ [`docs/grammar.md`](./docs/grammar.md) - Updated with v1.1 grammar
|
| 159 |
+
- ✅ [`VALIDATION_RULES.md`](./VALIDATION_RULES.md) - Added v1.1 validation rules
|
| 160 |
+
- ✅ [`README.md`](./README.md) - Added v1.1 examples and features
|
| 161 |
+
- ✅ New examples in [`examples/`](./examples/)
|
| 162 |
+
|
| 163 |
+
---
|
| 164 |
+
|
| 165 |
+
## 🐛 Bug Fixes
|
| 166 |
+
|
| 167 |
+
None (this is a feature release)
|
| 168 |
+
|
| 169 |
+
---
|
| 170 |
+
|
| 171 |
+
## 🔮 Future Roadmap
|
| 172 |
+
|
| 173 |
+
Planned for future versions:
|
| 174 |
+
- Multi-GPU training support
|
| 175 |
+
- Distributed training
|
| 176 |
+
- Advanced quantization options
|
| 177 |
+
- More dataset formats
|
| 178 |
+
- Custom loss functions
|
| 179 |
+
|
| 180 |
+
---
|
| 181 |
+
|
| 182 |
+
**For questions or feedback:** [GitHub Issues](https://github.com/oktoseek/oktoscript/issues)
|
| 183 |
+
|
| 184 |
+
|
| 185 |
+
|
CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Contributing to OktoScript
|
| 2 |
+
|
| 3 |
+
Thank you for your interest in contributing to OktoScript! 🐙
|
| 4 |
+
|
| 5 |
+
**OktoScript** is a domain-specific programming language developed by **OktoSeek AI**. We welcome contributions from the community!
|
| 6 |
+
|
| 7 |
+
## How to Contribute
|
| 8 |
+
|
| 9 |
+
### Reporting Issues
|
| 10 |
+
|
| 11 |
+
If you find a bug or have a feature request, please open an issue on GitHub with:
|
| 12 |
+
- Clear description of the problem or feature
|
| 13 |
+
- Steps to reproduce (for bugs)
|
| 14 |
+
- Expected vs actual behavior
|
| 15 |
+
- OktoScript version (if applicable)
|
| 16 |
+
|
| 17 |
+
### Submitting Changes
|
| 18 |
+
|
| 19 |
+
1. **Fork the repository**
|
| 20 |
+
2. **Create a feature branch** (`git checkout -b feature/amazing-feature`)
|
| 21 |
+
3. **Make your changes** following the code style
|
| 22 |
+
4. **Test your changes** thoroughly
|
| 23 |
+
5. **Commit your changes** (`git commit -m 'Add amazing feature'`)
|
| 24 |
+
6. **Push to the branch** (`git push origin feature/amazing-feature`)
|
| 25 |
+
7. **Open a Pull Request**
|
| 26 |
+
|
| 27 |
+
### Code Style
|
| 28 |
+
|
| 29 |
+
- Follow the existing OktoScript grammar specification
|
| 30 |
+
- Keep examples in English
|
| 31 |
+
- Document new features in `docs/grammar.md`
|
| 32 |
+
- Update README.md if adding major features
|
| 33 |
+
|
| 34 |
+
### Adding Examples
|
| 35 |
+
|
| 36 |
+
When adding new examples:
|
| 37 |
+
- Place them in `examples/your-example-name/`
|
| 38 |
+
- Follow the standard folder structure
|
| 39 |
+
- Include complete `train.okt` file
|
| 40 |
+
- Add sample datasets
|
| 41 |
+
- Update `examples/README.md`
|
| 42 |
+
|
| 43 |
+
### Documentation
|
| 44 |
+
|
| 45 |
+
- Keep grammar documentation up to date
|
| 46 |
+
- Add examples for new features
|
| 47 |
+
- Update README.md for major changes
|
| 48 |
+
- Always mention **OktoSeek AI** as the developer/maintainer
|
| 49 |
+
|
| 50 |
+
## Questions?
|
| 51 |
+
|
| 52 |
+
Feel free to open an issue for any questions about contributing!
|
| 53 |
+
|
| 54 |
+
---
|
| 55 |
+
|
| 56 |
+
**OktoScript** is developed and maintained by **OktoSeek AI**.
|
| 57 |
+
|
| 58 |
+
Thank you for helping make OktoScript better! 🚀
|
LICENSE
ADDED
|
@@ -0,0 +1,192 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Apache License
|
| 2 |
+
Version 2.0, January 2004
|
| 3 |
+
http://www.apache.org/licenses/
|
| 4 |
+
|
| 5 |
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
| 6 |
+
|
| 7 |
+
1. Definitions.
|
| 8 |
+
|
| 9 |
+
"License" shall mean the terms and conditions for use, reproduction,
|
| 10 |
+
and distribution as defined by Sections 1 through 9 of this document.
|
| 11 |
+
|
| 12 |
+
"Licensor" shall mean the copyright owner or entity authorized by
|
| 13 |
+
the copyright owner that is granting the License.
|
| 14 |
+
|
| 15 |
+
"Legal Entity" shall mean the union of the acting entity and all
|
| 16 |
+
other entities that control, are controlled by, or are under common
|
| 17 |
+
control with that entity. For the purposes of this definition,
|
| 18 |
+
"control" means (i) the power, direct or indirect, to cause the
|
| 19 |
+
direction or management of such entity, whether by contract or
|
| 20 |
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
| 21 |
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
| 22 |
+
|
| 23 |
+
"You" (or "Your") shall mean an individual or Legal Entity
|
| 24 |
+
exercising permissions granted by this License.
|
| 25 |
+
|
| 26 |
+
"Source" form shall mean the preferred form for making modifications,
|
| 27 |
+
including but not limited to software source code, documentation
|
| 28 |
+
source, and configuration files.
|
| 29 |
+
|
| 30 |
+
"Object" form shall mean any form resulting from mechanical
|
| 31 |
+
transformation or translation of a Source form, including but
|
| 32 |
+
not limited to compiled object code, generated documentation,
|
| 33 |
+
and conversions to other media types.
|
| 34 |
+
|
| 35 |
+
"Work" shall mean the work of authorship, whether in Source or
|
| 36 |
+
Object form, made available under the License, as indicated by a
|
| 37 |
+
copyright notice that is included in or attached to the work
|
| 38 |
+
(which shall not include Communications that are clearly marked or
|
| 39 |
+
otherwise designated in writing by the copyright owner as "Not a Work").
|
| 40 |
+
|
| 41 |
+
"Derivative Works" shall mean any work, whether in Source or Object
|
| 42 |
+
form, that is based upon (or derived from) the Work and for which the
|
| 43 |
+
editorial revisions, annotations, elaborations, or other modifications
|
| 44 |
+
represent, as a whole, an original work of authorship. For the purposes
|
| 45 |
+
of this License, Derivative Works shall not include works that remain
|
| 46 |
+
separable from, or merely link (or bind by name) to the interfaces of,
|
| 47 |
+
the Work and Derivative Works thereof.
|
| 48 |
+
|
| 49 |
+
"Contribution" shall mean any work of authorship, including
|
| 50 |
+
the original version of the Work and any modifications or additions
|
| 51 |
+
to that Work or Derivative Works thereof, that is intentionally
|
| 52 |
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
| 53 |
+
or by an individual or Legal Entity authorized to submit on behalf of
|
| 54 |
+
the copyright owner. For the purposes of this definition, "submitted"
|
| 55 |
+
means any form of electronic, verbal, or written communication sent
|
| 56 |
+
to the Licensor or its representatives, including but not limited to
|
| 57 |
+
communication on electronic mailing lists, source code control systems,
|
| 58 |
+
and issue tracking systems that are managed by, or on behalf of, the
|
| 59 |
+
Licensor for the purpose of discussing and improving the Work, but
|
| 60 |
+
excluding communication that is clearly marked or otherwise designated
|
| 61 |
+
in writing by the copyright owner as "Not a Contribution".
|
| 62 |
+
|
| 63 |
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
| 64 |
+
on behalf of whom a Contribution has been received by Licensor and
|
| 65 |
+
subsequently incorporated within the Work.
|
| 66 |
+
|
| 67 |
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
| 68 |
+
this License, each Contributor hereby grants to You a perpetual,
|
| 69 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
| 70 |
+
copyright license to reproduce, prepare Derivative Works of,
|
| 71 |
+
publicly display, publicly perform, sublicense, and distribute the
|
| 72 |
+
Work and such Derivative Works in Source or Object form.
|
| 73 |
+
|
| 74 |
+
3. Grant of Patent License. Subject to the terms and conditions of
|
| 75 |
+
this License, each Contributor hereby grants to You a perpetual,
|
| 76 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
| 77 |
+
(except as stated in this section) patent license to make, have made,
|
| 78 |
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
| 79 |
+
where such license applies only to those patent claims licensable
|
| 80 |
+
by such Contributor that are necessarily infringed by their
|
| 81 |
+
Contribution(s) alone or by combination of their Contribution(s)
|
| 82 |
+
with the Work to which such Contribution(s) was submitted. If You
|
| 83 |
+
institute patent litigation against any entity (including a
|
| 84 |
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
| 85 |
+
or a Contribution incorporated within the Work constitutes direct
|
| 86 |
+
or contributory patent infringement, then any patent licenses
|
| 87 |
+
granted to You under this License for that Work shall terminate
|
| 88 |
+
as of the date such litigation is filed.
|
| 89 |
+
|
| 90 |
+
4. Redistribution. You may reproduce and distribute copies of the
|
| 91 |
+
Work or Derivative Works thereof in any medium, with or without
|
| 92 |
+
modifications, and in Source or Object form, provided that You
|
| 93 |
+
meet the following conditions:
|
| 94 |
+
|
| 95 |
+
(a) You must give any other recipients of the Work or
|
| 96 |
+
Derivative Works a copy of this License; and
|
| 97 |
+
|
| 98 |
+
(b) You must cause any modified files to carry prominent notices
|
| 99 |
+
stating that You changed the files; and
|
| 100 |
+
|
| 101 |
+
(c) You must retain, in the Source form of any Derivative Works
|
| 102 |
+
that You distribute, all copyright, patent, trademark, and
|
| 103 |
+
attribution notices from the Source form of the Work,
|
| 104 |
+
excluding those notices that do not pertain to any part of
|
| 105 |
+
the Derivative Works; and
|
| 106 |
+
|
| 107 |
+
(d) If the Work includes a "NOTICE" text file as part of its
|
| 108 |
+
distribution, then any Derivative Works that You distribute must
|
| 109 |
+
include a readable copy of the attribution notices contained
|
| 110 |
+
within such NOTICE file, excluding those notices that do not
|
| 111 |
+
pertain to any part of the Derivative Works, in at least one
|
| 112 |
+
of the following places: within a NOTICE text file distributed
|
| 113 |
+
as part of the Derivative Works; within the Source form or
|
| 114 |
+
documentation, if provided along with the Derivative Works; or,
|
| 115 |
+
within a display generated by the Derivative Works, if and
|
| 116 |
+
wherever such third-party notices normally appear. The contents
|
| 117 |
+
of the NOTICE file are for informational purposes only and
|
| 118 |
+
do not modify the License. You may add Your own attribution
|
| 119 |
+
notices within Derivative Works that You distribute, alongside
|
| 120 |
+
or as an addendum to the NOTICE text from the Work, provided
|
| 121 |
+
that such additional attribution notices cannot be construed
|
| 122 |
+
as modifying the License.
|
| 123 |
+
|
| 124 |
+
You may add Your own copyright statement to Your modifications and
|
| 125 |
+
may provide additional or different license terms and conditions
|
| 126 |
+
for use, reproduction, or distribution of Your modifications, or
|
| 127 |
+
for any such Derivative Works as a whole, provided Your use,
|
| 128 |
+
reproduction, and distribution of the Work otherwise complies with
|
| 129 |
+
the conditions stated in this License.
|
| 130 |
+
|
| 131 |
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
| 132 |
+
any Contribution intentionally submitted for inclusion in the Work
|
| 133 |
+
by You to the Licensor shall be under the terms and conditions of
|
| 134 |
+
this License, without any additional terms or conditions.
|
| 135 |
+
Notwithstanding the above, nothing herein shall supersede or modify
|
| 136 |
+
the terms of any separate license agreement you may have executed
|
| 137 |
+
with Licensor regarding such Contributions.
|
| 138 |
+
|
| 139 |
+
6. Trademarks. This License does not grant permission to use the trade
|
| 140 |
+
names, trademarks, service marks, or product names of the Licensor,
|
| 141 |
+
except as required for reasonable and customary use in describing the
|
| 142 |
+
origin of the Work and reproducing the content of the NOTICE file.
|
| 143 |
+
|
| 144 |
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
| 145 |
+
agreed to in writing, Licensor provides the Work (and each
|
| 146 |
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
| 147 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
| 148 |
+
implied, including, without limitation, any warranties or conditions
|
| 149 |
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
| 150 |
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
| 151 |
+
appropriateness of using or redistributing the Work and assume any
|
| 152 |
+
risks associated with Your exercise of permissions under this License.
|
| 153 |
+
|
| 154 |
+
8. Limitation of Liability. In no event and under no legal theory,
|
| 155 |
+
whether in tort (including negligence), contract, or otherwise,
|
| 156 |
+
unless required by applicable law (such as deliberate and grossly
|
| 157 |
+
negligent acts) or agreed to in writing, shall any Contributor be
|
| 158 |
+
liable to You for damages, including any direct, indirect, special,
|
| 159 |
+
incidental, or consequential damages of any character arising as a
|
| 160 |
+
result of this License or out of the use or inability to use the
|
| 161 |
+
Work (including but not limited to damages for loss of goodwill,
|
| 162 |
+
work stoppage, computer failure or malfunction, or any and all
|
| 163 |
+
other commercial damages or losses), even if such Contributor
|
| 164 |
+
has been advised of the possibility of such damages.
|
| 165 |
+
|
| 166 |
+
9. Accepting Warranty or Additional Liability. While redistributing
|
| 167 |
+
the Work or Derivative Works thereof, You may choose to offer,
|
| 168 |
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
| 169 |
+
or other liability obligations and/or rights consistent with this
|
| 170 |
+
License. However, in accepting such obligations, You may act only
|
| 171 |
+
on Your own behalf and on Your sole responsibility, not on behalf
|
| 172 |
+
of any other Contributor, and only if You agree to indemnify,
|
| 173 |
+
defend, and hold each Contributor harmless for any liability
|
| 174 |
+
incurred by, or claims asserted against, such Contributor by reason
|
| 175 |
+
of your accepting any such warranty or additional liability.
|
| 176 |
+
|
| 177 |
+
END OF TERMS AND CONDITIONS
|
| 178 |
+
|
| 179 |
+
Copyright 2025 OktoSeek AI
|
| 180 |
+
|
| 181 |
+
Licensed under the Apache License, Version 2.0 (the "License");
|
| 182 |
+
you may not use this file except in compliance with the License.
|
| 183 |
+
You may obtain a copy of the License at
|
| 184 |
+
|
| 185 |
+
http://www.apache.org/licenses/LICENSE-2.0
|
| 186 |
+
|
| 187 |
+
Unless required by applicable law or agreed to in writing, software
|
| 188 |
+
distributed under the License is distributed on an "AS IS" BASIS,
|
| 189 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 190 |
+
See the License for the specific language governing permissions and
|
| 191 |
+
limitations under the License.
|
| 192 |
+
|
README.md
CHANGED
|
@@ -1,3 +1,720 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
| 1 |
+
<p align="center">
|
| 2 |
+
<img src="./assets/okto_logo.png" alt="OktoScript Banner" width="50%" />
|
| 3 |
+
</p>
|
| 4 |
+
<p align="center">
|
| 5 |
+
<img src="./assets/okto_logo2.png" alt="OktoScript Banner" width="50%" />
|
| 6 |
+
</p>
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
<h1 align="center">OktoScript</h1>
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
<p align="center">
|
| 15 |
+
<strong>A decision-driven language for training, evaluating and governing AI models.</strong>
|
| 16 |
+
</p>
|
| 17 |
+
|
| 18 |
+
<p align="center">
|
| 19 |
+
A domain-specific language (DSL) designed for autonomous AI pipelines with<br>
|
| 20 |
+
built-in decision, control, monitoring and governance capabilities.
|
| 21 |
+
</p>
|
| 22 |
+
|
| 23 |
+
<p align="center">
|
| 24 |
+
Built by <strong>OktoSeek AI</strong> for the <strong>OktoSeek ecosystem</strong>
|
| 25 |
+
</p>
|
| 26 |
+
|
| 27 |
+
<p align="center">
|
| 28 |
+
<a href="https://www.oktoseek.com/">OktoSeek Homepage</a> •
|
| 29 |
+
<a href="https://huggingface.co/OktoSeek">Hugging Face</a> •
|
| 30 |
+
<a href="https://x.com/oktoseek">Twitter</a> •
|
| 31 |
+
<a href="https://www.youtube.com/@Oktoseek">YouTube</a>
|
| 32 |
+
</p>
|
| 33 |
+
|
| 34 |
+
---
|
| 35 |
+
|
| 36 |
+
## Table of Contents
|
| 37 |
+
|
| 38 |
+
1. [What is OktoScript?](#-what-is-oktoscript)
|
| 39 |
+
2. [Quick Start](#-quick-start)
|
| 40 |
+
3. [Official Folder Structure](#-official-folder-structure)
|
| 41 |
+
4. [Basic Example](#-oktoscript--basic-example)
|
| 42 |
+
5. [Supported Dataset Formats](#-supported-dataset-formats)
|
| 43 |
+
6. [Supported Metrics](#-supported-metrics)
|
| 44 |
+
7. [CLI Commands](#️-cli-commands)
|
| 45 |
+
8. [Training Pipeline](#-training-pipeline)
|
| 46 |
+
9. [OktoSeek Internal Formats](#-oktoseek-internal-formats)
|
| 47 |
+
10. [Integration Targets](#️-integration-targets)
|
| 48 |
+
11. [VS Code Extension](#-vs-code-extension-coming-soon)
|
| 49 |
+
12. [Documentation](#-documentation)
|
| 50 |
+
13. [FAQ](#-frequently-asked-questions-faq)
|
| 51 |
+
14. [License](#-license)
|
| 52 |
+
15. [Contact](#-contact)
|
| 53 |
+
|
| 54 |
+
---
|
| 55 |
+
|
| 56 |
+
## 🚀 Quick Start
|
| 57 |
+
|
| 58 |
+
**New to OktoScript?** Get started in 5 minutes:
|
| 59 |
+
|
| 60 |
+
1. **Read the guide:** [`docs/GETTING_STARTED.md`](./docs/GETTING_STARTED.md)
|
| 61 |
+
2. **Try an example:** [`examples/basic.okt`](./examples/basic.okt)
|
| 62 |
+
3. **Validate:** `okto validate examples/basic.okt`
|
| 63 |
+
4. **Train:** `okto train examples/basic.okt`
|
| 64 |
+
|
| 65 |
+
📚 **Full documentation:** [`docs/grammar.md`](./docs/grammar.md)
|
| 66 |
+
🔍 **Validation rules:** [`VALIDATION_RULES.md`](./VALIDATION_RULES.md)
|
| 67 |
+
|
| 68 |
+
---
|
| 69 |
+
|
| 70 |
+
## 🚀 What is OktoScript?
|
| 71 |
+
|
| 72 |
+
**OktoScript** is a decision-driven language created by **OktoSeek AI** to design, train, evaluate, control and govern AI models end-to-end.
|
| 73 |
+
|
| 74 |
+
It goes far beyond a simple training script. OktoScript introduces native intelligence, autonomous decision-making and behavioral control into the AI development lifecycle.
|
| 75 |
+
|
| 76 |
+
It allows you to define:
|
| 77 |
+
|
| 78 |
+
- **How a model is trained**
|
| 79 |
+
- **How it should behave**
|
| 80 |
+
- **How it should react to problems**
|
| 81 |
+
- **How and when it should stop, adapt or improve itself**
|
| 82 |
+
|
| 83 |
+
All using clear, readable and structured commands, built specifically for AI engineering.
|
| 84 |
+
|
| 85 |
+
### Designed to be:
|
| 86 |
+
|
| 87 |
+
- ✅ **Human-readable** – Intuitive syntax that engineers and non-engineers can understand
|
| 88 |
+
- ✅ **Decision-driven** – Built-in CONTROL logic (IF, WHEN, SET, STOP, LOG, SAVE…)
|
| 89 |
+
- ✅ **Strongly structured** – Validated, deterministic and reproducible pipelines
|
| 90 |
+
- ✅ **Dataset-centered** – The data is the starting point of all intelligence
|
| 91 |
+
- ✅ **Training-aware** – Created specifically for AI training and optimization
|
| 92 |
+
- ✅ **Behavior-aware** – Control personality, language, restrictions and style
|
| 93 |
+
- ✅ **Self-monitoring** – Tracks metrics, detects anomalies and adapts automatically
|
| 94 |
+
- ✅ **Safe by design** – Integrated GUARD and SECURITY layers
|
| 95 |
+
- ✅ **Expandable** – Extensible through OktoEngine and custom modules
|
| 96 |
+
|
| 97 |
+
OktoScript is the official language of the OktoSeek ecosystem and is used by:
|
| 98 |
+
|
| 99 |
+
- 🎯 **OktoSeek IDE** – Visual AI development and experimentation
|
| 100 |
+
- ⚙️ **OktoEngine** – Core execution and decision engine
|
| 101 |
+
- 🔌 **VS Code Extension** – Code editing + validation
|
| 102 |
+
- 🔄 **Autonomous pipelines** – Training, control, evaluation and inference
|
| 103 |
+
- 🤖 **AI agents** – Controlled, monitored intelligent systems
|
| 104 |
+
- 📱 **Flutter / API deployments** – Cross-platform model integration
|
| 105 |
+
|
| 106 |
+
### Why OktoScript is different
|
| 107 |
+
|
| 108 |
+
**Traditional AI development is reactive.**
|
| 109 |
+
You manually monitor metrics, fix problems and restart training.
|
| 110 |
+
|
| 111 |
+
**OktoScript is proactive.**
|
| 112 |
+
|
| 113 |
+
It allows the model to:
|
| 114 |
+
|
| 115 |
+
- **Detect instability**
|
| 116 |
+
- **Reduce or increase learning rate automatically**
|
| 117 |
+
- **Adapt batch size based on GPU memory**
|
| 118 |
+
- **Stop when performance drops**
|
| 119 |
+
- **Save only the best checkpoints**
|
| 120 |
+
- **Apply rules when patterns are detected**
|
| 121 |
+
|
| 122 |
+
In other words, **OktoScript doesn't just train models — it governs intelligence.**
|
| 123 |
+
|
| 124 |
+
---
|
| 125 |
+
|
| 126 |
+
## 📁 Official Folder Structure
|
| 127 |
+
|
| 128 |
+
Every OktoScript project must follow this structure:
|
| 129 |
+
|
| 130 |
+
```
|
| 131 |
+
/my-awesome-model
|
| 132 |
+
├── okt.yaml
|
| 133 |
+
├── dataset/
|
| 134 |
+
│ ├── train.jsonl
|
| 135 |
+
│ ├── val.jsonl
|
| 136 |
+
│ └── test.jsonl
|
| 137 |
+
├── scripts/
|
| 138 |
+
│ └── train.okt
|
| 139 |
+
├── runs/
|
| 140 |
+
│ └── my-model/
|
| 141 |
+
│ ├── checkpoint-100/
|
| 142 |
+
│ │ └── model.safetensors
|
| 143 |
+
│ ├── tokenizer.json
|
| 144 |
+
│ ├── training_logs.json
|
| 145 |
+
│ └── metrics.json
|
| 146 |
+
└── export/
|
| 147 |
+
├── model.gguf
|
| 148 |
+
├── model.onnx
|
| 149 |
+
└── model.okm
|
| 150 |
+
```
|
| 151 |
+
|
| 152 |
+
**v1.1 Optional Folders:**
|
| 153 |
+
|
| 154 |
+
```
|
| 155 |
+
/runs/
|
| 156 |
+
└── my-model/
|
| 157 |
+
├── logs/
|
| 158 |
+
│ └── system.json # MONITOR output (v1.1+)
|
| 159 |
+
└── lora/ # LoRA adapters (v1.1+)
|
| 160 |
+
└── adapter.safetensors
|
| 161 |
+
```
|
| 162 |
+
|
| 163 |
+
---
|
| 164 |
+
|
| 165 |
+
## 🧠 OktoScript – Basic Example
|
| 166 |
+
|
| 167 |
+
**Example (v1.0 - Standard Training):**
|
| 168 |
+
```okt
|
| 169 |
+
PROJECT "PizzaBot"
|
| 170 |
+
DESCRIPTION "AI specialized in pizza restaurant service"
|
| 171 |
+
|
| 172 |
+
ENV {
|
| 173 |
+
accelerator: "gpu"
|
| 174 |
+
min_memory: "8GB"
|
| 175 |
+
precision: "fp16"
|
| 176 |
+
backend: "oktoseek"
|
| 177 |
+
install_missing: true
|
| 178 |
+
}
|
| 179 |
+
|
| 180 |
+
DATASET {
|
| 181 |
+
train: "dataset/train.jsonl"
|
| 182 |
+
validation: "dataset/val.jsonl"
|
| 183 |
+
}
|
| 184 |
+
|
| 185 |
+
MODEL {
|
| 186 |
+
base: "oktoseek/pizza-small"
|
| 187 |
+
}
|
| 188 |
+
|
| 189 |
+
TRAIN {
|
| 190 |
+
epochs: 5
|
| 191 |
+
batch_size: 32
|
| 192 |
+
device: "auto"
|
| 193 |
+
}
|
| 194 |
+
|
| 195 |
+
EXPORT {
|
| 196 |
+
format: ["gguf", "onnx", "okm"]
|
| 197 |
+
path: "export/"
|
| 198 |
+
}
|
| 199 |
+
```
|
| 200 |
+
|
| 201 |
+
**Example (v1.1 - LoRA Fine-tuning with Dataset Mixing):**
|
| 202 |
+
```okt
|
| 203 |
+
# okto_version: "1.1"
|
| 204 |
+
PROJECT "PizzaBot"
|
| 205 |
+
DESCRIPTION "AI specialized in pizza restaurant service"
|
| 206 |
+
|
| 207 |
+
ENV {
|
| 208 |
+
accelerator: "gpu"
|
| 209 |
+
min_memory: "8GB"
|
| 210 |
+
precision: "fp16"
|
| 211 |
+
backend: "oktoseek"
|
| 212 |
+
install_missing: true
|
| 213 |
+
}
|
| 214 |
+
|
| 215 |
+
DATASET {
|
| 216 |
+
mix_datasets: [
|
| 217 |
+
{ path: "dataset/base.jsonl", weight: 70 },
|
| 218 |
+
{ path: "dataset/extra.jsonl", weight: 30 }
|
| 219 |
+
]
|
| 220 |
+
dataset_percent: 80
|
| 221 |
+
sampling: "weighted"
|
| 222 |
+
}
|
| 223 |
+
|
| 224 |
+
MODEL {
|
| 225 |
+
base: "oktoseek/pizza-small"
|
| 226 |
+
}
|
| 227 |
+
|
| 228 |
+
FT_LORA {
|
| 229 |
+
base_model: "oktoseek/pizza-small"
|
| 230 |
+
lora_rank: 8
|
| 231 |
+
lora_alpha: 32
|
| 232 |
+
epochs: 3
|
| 233 |
+
batch_size: 16
|
| 234 |
+
learning_rate: 0.00003
|
| 235 |
+
device: "auto"
|
| 236 |
+
}
|
| 237 |
+
|
| 238 |
+
MONITOR {
|
| 239 |
+
level: "full"
|
| 240 |
+
log_metrics: ["loss", "accuracy"]
|
| 241 |
+
log_system: ["gpu_memory_used", "cpu_usage"]
|
| 242 |
+
refresh_interval: 2s
|
| 243 |
+
dashboard: true
|
| 244 |
+
}
|
| 245 |
+
|
| 246 |
+
EXPORT {
|
| 247 |
+
format: ["okm", "onnx"]
|
| 248 |
+
path: "export/"
|
| 249 |
+
}
|
| 250 |
+
```
|
| 251 |
+
|
| 252 |
+
📘 **Full grammar specification available in** [`/docs/grammar.md`](./docs/grammar.md)
|
| 253 |
+
|
| 254 |
+
## 🆕 What's New in v1.2
|
| 255 |
+
|
| 256 |
+
OktoScript v1.2 adds powerful new features while maintaining 100% backward compatibility with v1.0 and v1.1:
|
| 257 |
+
|
| 258 |
+
- ✅ **Nested CONTROL Blocks** - Support for nested IF/WHEN/EVERY statements inside event hooks
|
| 259 |
+
- ✅ **Enhanced BEHAVIOR** - Added `mode` and `prompt_style` for better control
|
| 260 |
+
- ✅ **Enhanced GUARD** - Added `detect_using` and additional prevention types
|
| 261 |
+
- ✅ **Enhanced DEPLOY** - Added `host`, `protocol`, and `format` options
|
| 262 |
+
- ✅ **Enhanced SECURITY** - Added input/output validation, rate limiting, and encryption
|
| 263 |
+
|
| 264 |
+
## What's New in v1.1
|
| 265 |
+
|
| 266 |
+
OktoScript v1.1 adds powerful new features while maintaining 100% backward compatibility with v1.0:
|
| 267 |
+
|
| 268 |
+
- ✅ **LoRA Fine-tuning** - Efficient fine-tuning with `FT_LORA` block
|
| 269 |
+
- ✅ **Dataset Mixing** - Combine multiple datasets with weighted sampling
|
| 270 |
+
- ✅ **System Monitoring** - Advanced telemetry with `MONITOR` block
|
| 271 |
+
- ✅ **Version Declaration** - Specify OktoScript version in your files
|
| 272 |
+
- ✅ **MODEL Adapters** - LoRA/PEFT adapter support in MODEL block
|
| 273 |
+
- ✅ **Enhanced INFERENCE** - Rich inference configuration with format templates and nested CONTROL
|
| 274 |
+
- ✅ **CONTROL Block** - Cognitive-level decision engine for training and inference
|
| 275 |
+
- ✅ **GUARD Block** - Safety and ethics protection
|
| 276 |
+
- ✅ **BEHAVIOR Block** - Model personality and behavior configuration
|
| 277 |
+
- ✅ **EXPLORER Block** - AutoML-style hyperparameter exploration
|
| 278 |
+
- ✅ **STABILITY Block** - Training stability and safety controls
|
| 279 |
+
- ✅ **Boolean Support** - Native true/false values throughout the language
|
| 280 |
+
|
| 281 |
+
📚 **More examples and use cases:** See [`/examples/`](./examples/) for complete examples including:
|
| 282 |
+
|
| 283 |
+
**Basic Examples:**
|
| 284 |
+
- [`basic.okt`](./examples/basic.okt) - Minimal example
|
| 285 |
+
- [`chatbot.okt`](./examples/chatbot.okt) - Conversational AI
|
| 286 |
+
- [`computer_vision.okt`](./examples/computer_vision.okt) - Image classification
|
| 287 |
+
- [`recommender.okt`](./examples/recommender.okt) - Recommendation systems
|
| 288 |
+
|
| 289 |
+
**Advanced Examples:**
|
| 290 |
+
- [`finetuning-llm.okt`](./examples/finetuning-llm.okt) - Fine-tuning LLM with checkpoints and hooks
|
| 291 |
+
- [`vision-pipeline.okt`](./examples/vision-pipeline.okt) - Complete vision pipeline with augmentation
|
| 292 |
+
- [`qa-embeddings.okt`](./examples/qa-embeddings.okt) - QA system with embeddings
|
| 293 |
+
|
| 294 |
+
**v1.1 Examples:**
|
| 295 |
+
- [`lora-finetuning.okt`](./examples/lora-finetuning.okt) - LoRA fine-tuning with dataset mixing
|
| 296 |
+
- [`dataset-mixing.okt`](./examples/dataset-mixing.okt) - Training with multiple weighted datasets
|
| 297 |
+
|
| 298 |
+
**Complete Projects:**
|
| 299 |
+
- [`pizzabot/`](./examples/pizzabot/) - Complete project example with full structure
|
| 300 |
+
|
| 301 |
+
---
|
| 302 |
+
|
| 303 |
+
## 📚 Supported Dataset Formats
|
| 304 |
+
|
| 305 |
+
- ✅ **JSONL** - Line-delimited JSON
|
| 306 |
+
- ✅ **CSV** - Comma-separated values
|
| 307 |
+
- ✅ **TXT** - Plain text files
|
| 308 |
+
- ✅ **Parquet** - Columnar storage
|
| 309 |
+
- ✅ **Image + Caption** - Vision datasets
|
| 310 |
+
- ✅ **Question & Answer (QA)** - Q&A pairs
|
| 311 |
+
- ✅ **Instruction datasets** - Instruction-following
|
| 312 |
+
- ✅ **Multi-modal** - (future support)
|
| 313 |
+
|
| 314 |
+
### Example (JSONL):
|
| 315 |
+
|
| 316 |
+
```json
|
| 317 |
+
{"input":"What flavors do you have?","output":"We offer Margherita, Pepperoni and Four Cheese."}
|
| 318 |
+
{"input":"Do you deliver?","output":"Yes, delivery is available in your region."}
|
| 319 |
+
```
|
| 320 |
+
|
| 321 |
+
---
|
| 322 |
+
|
| 323 |
+
## 📊 Supported Metrics
|
| 324 |
+
|
| 325 |
+
- ✅ **Accuracy** - Classification accuracy
|
| 326 |
+
- ✅ **Loss** - Training/validation loss
|
| 327 |
+
- ✅ **Perplexity** - Language model perplexity
|
| 328 |
+
- ✅ **F1-Score** - F1 metric
|
| 329 |
+
- ✅ **BLEU** - Translation quality
|
| 330 |
+
- ✅ **ROUGE-L** - Summarization quality
|
| 331 |
+
- ✅ **MAE / MSE** - Regression metrics
|
| 332 |
+
- ✅ **Cosine Similarity** - Embedding similarity
|
| 333 |
+
- ✅ **Token Efficiency** - Token usage optimization
|
| 334 |
+
- ✅ **Response Coherence** - Response quality
|
| 335 |
+
- ✅ **Hallucination Score** - (experimental)
|
| 336 |
+
|
| 337 |
+
### Define custom metrics:
|
| 338 |
+
|
| 339 |
+
```okt
|
| 340 |
+
METRICS {
|
| 341 |
+
custom "toxicity_score"
|
| 342 |
+
custom "context_alignment"
|
| 343 |
+
}
|
| 344 |
+
```
|
| 345 |
+
|
| 346 |
+
---
|
| 347 |
+
|
| 348 |
+
## 🖥️ CLI Commands
|
| 349 |
+
|
| 350 |
+
The OktoEngine CLI is minimal by design. All intelligence lives in the `.okt` file. The terminal is just the execution port.
|
| 351 |
+
|
| 352 |
+
### Core Commands
|
| 353 |
+
|
| 354 |
+
**Initialize a project:**
|
| 355 |
+
```bash
|
| 356 |
+
okto init
|
| 357 |
+
```
|
| 358 |
+
|
| 359 |
+
**Validate syntax:**
|
| 360 |
+
```bash
|
| 361 |
+
okto validate script.okt
|
| 362 |
+
```
|
| 363 |
+
|
| 364 |
+
**Train a model:**
|
| 365 |
+
```bash
|
| 366 |
+
okto train script.okt
|
| 367 |
+
```
|
| 368 |
+
|
| 369 |
+
**Evaluate a model:**
|
| 370 |
+
```bash
|
| 371 |
+
okto eval script.okt
|
| 372 |
+
```
|
| 373 |
+
|
| 374 |
+
**Export model:**
|
| 375 |
+
```bash
|
| 376 |
+
okto export script.okt
|
| 377 |
+
```
|
| 378 |
+
|
| 379 |
+
**Convert model formats:**
|
| 380 |
+
```bash
|
| 381 |
+
okto convert --input <model_path> --from <format> --to <format> --output <output_path>
|
| 382 |
+
```
|
| 383 |
+
|
| 384 |
+
**Supported formats:**
|
| 385 |
+
| From / To | Usage |
|
| 386 |
+
|-----------|-------|
|
| 387 |
+
| `pt`, `bin` | PyTorch |
|
| 388 |
+
| `onnx` | Web / Interoperability |
|
| 389 |
+
| `tflite` | Mobile (Android / iOS) |
|
| 390 |
+
| `gguf` | Local LLMs (llama.cpp) |
|
| 391 |
+
| `okm` | Okto Model Format |
|
| 392 |
+
| `safetensors` | Safe and fast |
|
| 393 |
+
|
| 394 |
+
**Convert examples:**
|
| 395 |
+
```bash
|
| 396 |
+
# PyTorch → GGUF (local inference)
|
| 397 |
+
okto convert --input model.pt --from pt --to gguf --output model.gguf
|
| 398 |
+
|
| 399 |
+
# PyTorch → TFLite (mobile)
|
| 400 |
+
okto convert --input model.pt --from pt --to tflite --output model.tflite
|
| 401 |
+
|
| 402 |
+
# PyTorch → ONNX (web)
|
| 403 |
+
okto convert --input model.pt --from pt --to onnx --output model.onnx
|
| 404 |
+
```
|
| 405 |
+
|
| 406 |
+
**List resources:**
|
| 407 |
+
```bash
|
| 408 |
+
okto list projects
|
| 409 |
+
okto list models
|
| 410 |
+
okto list datasets
|
| 411 |
+
okto list exports
|
| 412 |
+
```
|
| 413 |
+
|
| 414 |
+
**System diagnostics:**
|
| 415 |
+
```bash
|
| 416 |
+
okto doctor
|
| 417 |
+
# Shows: GPU, CUDA, RAM, Drivers, Disks, Recommendations
|
| 418 |
+
```
|
| 419 |
+
|
| 420 |
+
### Inference Commands
|
| 421 |
+
|
| 422 |
+
**Direct inference (single input/output):**
|
| 423 |
+
```bash
|
| 424 |
+
okto infer --model <model_path> --text "<input>"
|
| 425 |
+
```
|
| 426 |
+
|
| 427 |
+
**Example:**
|
| 428 |
+
```bash
|
| 429 |
+
okto infer --model models/pizzabot.okm --text "Good evening, I want a pizza"
|
| 430 |
+
```
|
| 431 |
+
|
| 432 |
+
Automatically respects:
|
| 433 |
+
- `BEHAVIOR` block
|
| 434 |
+
- `GUARD` block
|
| 435 |
+
- `INFERENCE` block
|
| 436 |
+
- `CONTROL` block (if defined)
|
| 437 |
+
|
| 438 |
+
**Interactive chat mode:**
|
| 439 |
+
```bash
|
| 440 |
+
okto chat --model <model_path>
|
| 441 |
+
```
|
| 442 |
+
|
| 443 |
+
Opens an interactive loop:
|
| 444 |
+
```
|
| 445 |
+
🟢 Okto Chat started (type 'exit' to quit)
|
| 446 |
+
|
| 447 |
+
You: hi
|
| 448 |
+
Bot: Hello! How can I help you?
|
| 449 |
+
|
| 450 |
+
You: what flavors do you have?
|
| 451 |
+
Bot: We have...
|
| 452 |
+
|
| 453 |
+
You: exit
|
| 454 |
+
🔴 Session ended
|
| 455 |
+
```
|
| 456 |
+
|
| 457 |
+
This command:
|
| 458 |
+
- Uses `prompt_style` from BEHAVIOR
|
| 459 |
+
- Uses `BEHAVIOR` settings
|
| 460 |
+
- Respects `GUARD` rules
|
| 461 |
+
- Can use MEMORY in the future
|
| 462 |
+
|
| 463 |
+
### Advanced Commands
|
| 464 |
+
|
| 465 |
+
**Compare two models:**
|
| 466 |
+
```bash
|
| 467 |
+
okto compare <model1> <model2>
|
| 468 |
+
```
|
| 469 |
+
|
| 470 |
+
**Example:**
|
| 471 |
+
```bash
|
| 472 |
+
okto compare models/pizza_v1.okm models/pizza_v2.okm
|
| 473 |
+
```
|
| 474 |
+
|
| 475 |
+
Expected output:
|
| 476 |
+
```
|
| 477 |
+
Latency: V2 - 23% faster
|
| 478 |
+
Accuracy: V1 - 4% better
|
| 479 |
+
Loss: V2 - lower
|
| 480 |
+
Recommendation: V2
|
| 481 |
+
```
|
| 482 |
+
|
| 483 |
+
Perfect for A/B testing.
|
| 484 |
+
|
| 485 |
+
**View historical logs:**
|
| 486 |
+
```bash
|
| 487 |
+
okto logs <model_or_run_id>
|
| 488 |
+
```
|
| 489 |
+
|
| 490 |
+
**Example:**
|
| 491 |
+
```bash
|
| 492 |
+
okto logs pizzabot_v1
|
| 493 |
+
```
|
| 494 |
+
|
| 495 |
+
Shows:
|
| 496 |
+
- Loss per epoch
|
| 497 |
+
- Validation loss
|
| 498 |
+
- Accuracy
|
| 499 |
+
- CPU/GPU/RAM usage
|
| 500 |
+
- Decisions made (CONTROL block)
|
| 501 |
+
|
| 502 |
+
**Auto-tune training:**
|
| 503 |
+
```bash
|
| 504 |
+
okto tune script.okt
|
| 505 |
+
```
|
| 506 |
+
|
| 507 |
+
Uses the `CONTROL` block to auto-adjust training based on metrics. Can:
|
| 508 |
+
- Adjust learning rate
|
| 509 |
+
- Change batch size
|
| 510 |
+
- Activate early stopping
|
| 511 |
+
- Balance classes
|
| 512 |
+
|
| 513 |
+
This is unique in the market.
|
| 514 |
+
|
| 515 |
+
**Exit interactive mode:**
|
| 516 |
+
```bash
|
| 517 |
+
okto exit
|
| 518 |
+
```
|
| 519 |
+
|
| 520 |
+
Used to exit chat, interactive mode, or session context.
|
| 521 |
+
|
| 522 |
+
### Utility Commands
|
| 523 |
+
|
| 524 |
+
```bash
|
| 525 |
+
okto upgrade # Update OktoEngine
|
| 526 |
+
okto about # Show about information
|
| 527 |
+
okto --version # Show version
|
| 528 |
+
```
|
| 529 |
+
|
| 530 |
+
### Quick Examples
|
| 531 |
+
|
| 532 |
+
```bash
|
| 533 |
+
# Validate and train
|
| 534 |
+
okto validate examples/basic.okt
|
| 535 |
+
okto train examples/chatbot.okt
|
| 536 |
+
|
| 537 |
+
# Evaluate and export
|
| 538 |
+
okto eval examples/recommender.okt
|
| 539 |
+
okto export examples/computer_vision.okt
|
| 540 |
+
|
| 541 |
+
# Inference
|
| 542 |
+
okto infer --model models/bot.okm --text "Hello"
|
| 543 |
+
okto chat --model models/bot.okm
|
| 544 |
+
```
|
| 545 |
+
|
| 546 |
+
---
|
| 547 |
+
|
| 548 |
+
## 🔄 Training Pipeline
|
| 549 |
+
|
| 550 |
+
1. **Load dataset** - Parse and validate input data
|
| 551 |
+
2. **Tokenize & validate** - Prepare data for training
|
| 552 |
+
3. **Initialize model** - Load base model and configuration
|
| 553 |
+
4. **Train loop** - Execute training epochs
|
| 554 |
+
5. **Calculate metrics** - Evaluate model performance
|
| 555 |
+
6. **Export selected models** - Generate output formats
|
| 556 |
+
7. **Generate final report** - Create training summary
|
| 557 |
+
|
| 558 |
+
Each run generates logs at:
|
| 559 |
+
|
| 560 |
+
```
|
| 561 |
+
runs/my-model/training_logs.json
|
| 562 |
+
runs/my-model/metrics.json
|
| 563 |
+
```
|
| 564 |
+
|
| 565 |
+
---
|
| 566 |
+
|
| 567 |
+
## 🔐 Export Formats
|
| 568 |
+
|
| 569 |
+
### Standard Formats
|
| 570 |
+
|
| 571 |
+
| Format | Purpose | Compatibility |
|
| 572 |
+
|--------|---------|---------------|
|
| 573 |
+
| `.onnx` | Universal inference, production-ready | All platforms |
|
| 574 |
+
| `.gguf` | Local inference, Ollama, Llama.cpp | Local deployment |
|
| 575 |
+
| `.safetensors` | HuggingFace, research, training | Standard ML tools |
|
| 576 |
+
| `.tflite` | Mobile deployment | Android, iOS (future) |
|
| 577 |
+
|
| 578 |
+
### OktoSeek Optimized Formats
|
| 579 |
+
|
| 580 |
+
| Format | Purpose | Benefits |
|
| 581 |
+
|--------|---------|----------|
|
| 582 |
+
| `.okm` | **OktoModel** - Optimized for OktoSeek SDK | Flutter plugins, mobile apps, exclusive tools |
|
| 583 |
+
| `.okx` | **OktoBundle** - Mobile + Edge package | iOS, Android, Edge AI deployment |
|
| 584 |
+
|
| 585 |
+
> 💡 **Note:** `.okm` and `.okx` formats are **optional** and optimized for the OktoSeek ecosystem. They provide better integration with OktoSeek Flutter SDK, mobile apps, and exclusive tools. You can always export to standard formats (ONNX, GGUF, SafeTensors) for universal compatibility.
|
| 586 |
+
|
| 587 |
+
**Why use OktoModel (.okm)?**
|
| 588 |
+
|
| 589 |
+
- ✅ Optimized for OktoSeek Flutter SDK
|
| 590 |
+
- ✅ Better performance on mobile devices
|
| 591 |
+
- ✅ Access to exclusive OktoSeek tools and plugins
|
| 592 |
+
- ✅ Seamless integration with OktoSeek ecosystem
|
| 593 |
+
- ✅ Support for iOS and Android apps
|
| 594 |
+
|
| 595 |
+
See [`/examples/`](./examples/) for examples using different export formats.
|
| 596 |
+
|
| 597 |
+
---
|
| 598 |
+
|
| 599 |
+
## ⚙️ Integration Targets
|
| 600 |
+
|
| 601 |
+
- ✅ **Flutter** - Mobile applications
|
| 602 |
+
- ✅ **REST API** - Web services
|
| 603 |
+
- ✅ **Edge AI** - Edge devices
|
| 604 |
+
- ✅ **Desktop** - Native applications
|
| 605 |
+
- ✅ **Web** - Browser-based
|
| 606 |
+
- ✅ **Mobile** - iOS/Android
|
| 607 |
+
- ✅ **IoT** - Internet of Things
|
| 608 |
+
- ✅ **Robotics** - Robotic systems
|
| 609 |
+
|
| 610 |
+
---
|
| 611 |
+
|
| 612 |
+
## 📦 VS Code Extension (Coming Soon)
|
| 613 |
+
|
| 614 |
+
- ✨ **Syntax Highlighting** - Beautiful code colors
|
| 615 |
+
- 🔍 **OktoScript autocomplete** - Smart suggestions
|
| 616 |
+
- ⚠️ **Error checking** - Real-time validation
|
| 617 |
+
- ▶️ **Run / Train buttons** - One-click execution
|
| 618 |
+
- 🎨 **Visual pipeline builder** - Drag-and-drop workflows
|
| 619 |
+
|
| 620 |
+
---
|
| 621 |
+
|
| 622 |
+
## 📚 Documentation
|
| 623 |
+
|
| 624 |
+
Complete documentation for OktoScript:
|
| 625 |
+
|
| 626 |
+
- 📖 **[Grammar Specification](./docs/grammar.md)** - Complete formal grammar with all constraints (v1.0 & v1.1)
|
| 627 |
+
- 🚀 **[Getting Started Guide](./docs/GETTING_STARTED.md)** - Your first 5 minutes with OktoScript
|
| 628 |
+
- ✅ **[Validation Rules](./VALIDATION_RULES.md)** - Complete validation reference (updated for v1.1)
|
| 629 |
+
- ❓ **[FAQ](./docs/FAQ.md)** - Frequently Asked Questions - Common questions and detailed answers
|
| 630 |
+
- 💡 **[Examples](./examples/)** - Working examples from basic to advanced
|
| 631 |
+
- 📋 **[Changelog v1.1](./CHANGELOG_V1.1.md)** - Complete list of v1.1 features
|
| 632 |
+
|
| 633 |
+
### Advanced Topics
|
| 634 |
+
|
| 635 |
+
- 🔗 **[Model Inheritance](./docs/grammar.md#model-inheritance)** - Reuse model configurations
|
| 636 |
+
- 🔌 **[Extension Points & Hooks](./docs/grammar.md#extension-points--hooks)** - Custom Python/JS integration
|
| 637 |
+
- 🐛 **[Troubleshooting](./docs/grammar.md#troubleshooting)** - Common issues and solutions
|
| 638 |
+
- ⚙️ **[Complex Examples](./examples/)** - Advanced use cases:
|
| 639 |
+
- [`finetuning-llm.okt`](./examples/finetuning-llm.okt) - Fine-tuning with checkpoints
|
| 640 |
+
- [`vision-pipeline.okt`](./examples/vision-pipeline.okt) - Production vision systems
|
| 641 |
+
- [`qa-embeddings.okt`](./examples/qa-embeddings.okt) - Semantic search and retrieval
|
| 642 |
+
- [`lora-finetuning.okt`](./examples/lora-finetuning.okt) - LoRA fine-tuning (v1.1)
|
| 643 |
+
- [`dataset-mixing.okt`](./examples/dataset-mixing.okt) - Dataset mixing (v1.1)
|
| 644 |
+
|
| 645 |
+
---
|
| 646 |
+
|
| 647 |
+
## ❓ Frequently Asked Questions (FAQ)
|
| 648 |
+
|
| 649 |
+
Have questions about OktoScript? Check out our comprehensive FAQ covering common questions from beginners to advanced users:
|
| 650 |
+
|
| 651 |
+
**Common Questions:**
|
| 652 |
+
- Why do I need MODEL and DATASET blocks with FT_LORA?
|
| 653 |
+
- What's the difference between FT_LORA and TRAIN?
|
| 654 |
+
- Does OktoScript replace Python?
|
| 655 |
+
- How do I use multiple datasets with weights?
|
| 656 |
+
- Can I use custom Python code?
|
| 657 |
+
- Is OktoScript a programming language or a DSL?
|
| 658 |
+
- And 15+ more detailed answers...
|
| 659 |
+
|
| 660 |
+
📖 **[Read the complete FAQ →](./docs/FAQ.md)**
|
| 661 |
+
|
| 662 |
+
The FAQ covers technical details, design decisions, use cases, and best practices for using OktoScript effectively.
|
| 663 |
+
|
| 664 |
+
---
|
| 665 |
+
|
| 666 |
+
## 🧑🚀 Vision
|
| 667 |
+
|
| 668 |
+
> *"Knowledge must be shared between people so that we can create solutions we could never imagine."*
|
| 669 |
+
>
|
| 670 |
+
> — **OktoSeek AI**
|
| 671 |
+
|
| 672 |
+
### 🎯 Design Principles
|
| 673 |
+
|
| 674 |
+
OktoScript is built on the principle that AI development should be:
|
| 675 |
+
|
| 676 |
+
1. **Declarative** - Describe what you want, not how to do it
|
| 677 |
+
2. **Self-aware** - Models can monitor and adjust themselves
|
| 678 |
+
3. **Safe** - Built-in guards against harmful outputs
|
| 679 |
+
4. **Adaptive** - Automatic optimization and exploration
|
| 680 |
+
5. **Transparent** - Clear, readable configuration files
|
| 681 |
+
6. **Powerful** - Complex capabilities with simple syntax
|
| 682 |
+
|
| 683 |
+
The language evolves to support increasingly sophisticated AI behaviors while maintaining its core simplicity.
|
| 684 |
+
|
| 685 |
+
---
|
| 686 |
+
|
| 687 |
+
## 🐙 Powered by OktoSeek AI
|
| 688 |
+
|
| 689 |
+
**OktoScript** is developed and maintained by **OktoSeek AI**.
|
| 690 |
+
|
| 691 |
+
- **Official website:** https://www.oktoseek.com
|
| 692 |
+
- **GitHub:** https://github.com/oktoseek
|
| 693 |
+
- **Hugging Face:** https://huggingface.co/OktoSeek
|
| 694 |
+
- **Twitter:** https://x.com/oktoseek
|
| 695 |
+
- **YouTube:** https://www.youtube.com/@Oktoseek
|
| 696 |
+
- **Repository:** https://github.com/oktoseek/oktoscript
|
| 697 |
+
|
| 698 |
+
---
|
| 699 |
+
|
| 700 |
+
## 📄 License
|
| 701 |
+
|
| 702 |
+
This project is licensed under the Apache License 2.0 - see the [LICENSE](./LICENSE) file for details.
|
| 703 |
+
|
| 704 |
+
---
|
| 705 |
+
|
| 706 |
+
## 🤝 Contributing
|
| 707 |
+
|
| 708 |
+
Contributions are welcome! Please feel free to submit a Pull Request. See [CONTRIBUTING.md](./CONTRIBUTING.md) for guidelines.
|
| 709 |
+
|
| 710 |
+
---
|
| 711 |
+
|
| 712 |
+
## 📧 Contact
|
| 713 |
+
|
| 714 |
+
If you have any questions, please raise an issue or contact us at **service@oktoseek.com**.
|
| 715 |
+
|
| 716 |
+
---
|
| 717 |
+
|
| 718 |
+
<p align="center">
|
| 719 |
+
Made with ❤️ by the <strong>OktoSeek AI</strong> team
|
| 720 |
+
</p>
|
VALIDATION_RULES.md
ADDED
|
@@ -0,0 +1,502 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# OktoScript Validation Rules
|
| 2 |
+
|
| 3 |
+
Complete reference for validation rules and constraints in OktoScript.
|
| 4 |
+
|
| 5 |
+
---
|
| 6 |
+
|
| 7 |
+
## File Structure Validation
|
| 8 |
+
|
| 9 |
+
### Required Files
|
| 10 |
+
|
| 11 |
+
1. **okt.yaml** (in project root)
|
| 12 |
+
- Must exist
|
| 13 |
+
- Must be valid YAML
|
| 14 |
+
- Must contain `project` field
|
| 15 |
+
|
| 16 |
+
2. **Dataset Files**
|
| 17 |
+
- All paths specified in DATASET block must exist
|
| 18 |
+
- Files must be readable
|
| 19 |
+
- Format must match declared format
|
| 20 |
+
|
| 21 |
+
3. **Model Files** (if using local paths)
|
| 22 |
+
- Base model path must exist (if local)
|
| 23 |
+
- Checkpoint paths must exist (if resuming)
|
| 24 |
+
|
| 25 |
+
---
|
| 26 |
+
|
| 27 |
+
## Field Validation
|
| 28 |
+
|
| 29 |
+
### PROJECT Block
|
| 30 |
+
|
| 31 |
+
| Field | Type | Required | Constraints |
|
| 32 |
+
|-------|------|----------|-------------|
|
| 33 |
+
| PROJECT | string | ✅ Yes | 1-100 chars, no special chars: `{}[]:"` |
|
| 34 |
+
|
| 35 |
+
### ENV Block
|
| 36 |
+
|
| 37 |
+
| Field | Type | Required | Constraints |
|
| 38 |
+
|-------|------|----------|-------------|
|
| 39 |
+
| accelerator | enum | ❌ No | Must be: `auto`, `cpu`, `gpu`, `tpu` |
|
| 40 |
+
| min_memory | string | ❌ No | Must be: `"4GB"`, `"8GB"`, `"16GB"`, `"32GB"`, `"64GB"` (quoted, GB suffix required) |
|
| 41 |
+
| precision | enum | ❌ No | Must be: `auto`, `fp16`, `fp32`, `bf16` |
|
| 42 |
+
| backend | enum | ❌ No | Must be: `auto`, `oktoseek` |
|
| 43 |
+
| install_missing | boolean | ❌ No | Must be: `true` or `false` (lowercase) |
|
| 44 |
+
| platform | enum | ❌ No | Must be: `windows`, `linux`, `mac`, `any` |
|
| 45 |
+
| network | enum | ❌ No | Must be: `online`, `offline`, `required` |
|
| 46 |
+
|
| 47 |
+
**ENV Validation Rules:**
|
| 48 |
+
|
| 49 |
+
1. **Memory format validation:**
|
| 50 |
+
- Must use `GB` suffix (e.g., `"8GB"`, not `"8"` or `"8 GB"`)
|
| 51 |
+
- Only values: `"4GB"`, `"8GB"`, `"16GB"`, `"32GB"`, `"64GB"` are allowed
|
| 52 |
+
- Must be quoted string
|
| 53 |
+
|
| 54 |
+
2. **Accelerator and memory compatibility:**
|
| 55 |
+
- If `accelerator = "gpu"` and `min_memory < "8GB"` → **warning** (GPU training typically requires at least 8GB RAM)
|
| 56 |
+
- If `accelerator = "tpu"` → `min_memory` should be at least `"16GB"` (recommended)
|
| 57 |
+
|
| 58 |
+
3. **Network and export compatibility:**
|
| 59 |
+
- If `network = "offline"` → export formats like `onnx` or `gguf` are allowed (pre-downloaded models)
|
| 60 |
+
- If `network = "required"` → engine must verify internet connectivity before proceeding
|
| 61 |
+
|
| 62 |
+
4. **Backend preferences:**
|
| 63 |
+
- If `backend = "oktoseek"` → preferred default for OktoSeek ecosystem
|
| 64 |
+
- If `backend = "auto"` → engine selects best available backend
|
| 65 |
+
|
| 66 |
+
5. **Auto-installation:**
|
| 67 |
+
- If `install_missing = true` → engine must attempt auto-setup of missing dependencies
|
| 68 |
+
- If `install_missing = false` → engine must fail with clear error if dependencies are missing
|
| 69 |
+
|
| 70 |
+
6. **Default values:**
|
| 71 |
+
- If ENV block is missing, defaults to:
|
| 72 |
+
```okt
|
| 73 |
+
ENV {
|
| 74 |
+
accelerator: "auto"
|
| 75 |
+
min_memory: "8GB"
|
| 76 |
+
backend: "auto"
|
| 77 |
+
}
|
| 78 |
+
```
|
| 79 |
+
|
| 80 |
+
7. **Platform validation:**
|
| 81 |
+
- If `platform = "windows"` → engine must verify Windows OS
|
| 82 |
+
- If `platform = "linux"` → engine must verify Linux OS
|
| 83 |
+
- If `platform = "mac"` → engine must verify macOS
|
| 84 |
+
- If `platform = "any"` → no platform check required
|
| 85 |
+
|
| 86 |
+
### DATASET Block
|
| 87 |
+
|
| 88 |
+
| Field | Type | Required | Constraints |
|
| 89 |
+
|-------|------|----------|-------------|
|
| 90 |
+
| train | path | ✅ Yes | File/dir must exist, readable |
|
| 91 |
+
| validation | path | ❌ No | File/dir must exist if specified |
|
| 92 |
+
| test | path | ❌ No | File/dir must exist if specified |
|
| 93 |
+
| format | enum | ❌ No | Must be: jsonl, csv, txt, parquet, image+caption, qa, instruction, multimodal |
|
| 94 |
+
| type | enum | ❌ No | Must be: classification, generation, qa, chat, vision, regression |
|
| 95 |
+
| language | enum | ❌ No | Must be: en, pt, es, fr, multilingual |
|
| 96 |
+
| augmentation | array | ❌ No | Each item must be valid augmentation type |
|
| 97 |
+
| dataset_percent | number | ❌ No | Must be 1-100 (v1.1+) |
|
| 98 |
+
| mix_datasets | array | ❌ No | Array of {path, weight} objects (v1.1+) |
|
| 99 |
+
| sampling | enum | ❌ No | Must be: weighted, random (v1.1+) |
|
| 100 |
+
| shuffle | boolean | ❌ No | true or false (v1.1+) |
|
| 101 |
+
|
| 102 |
+
### MODEL Block
|
| 103 |
+
|
| 104 |
+
| Field | Type | Required | Constraints |
|
| 105 |
+
|-------|------|----------|-------------|
|
| 106 |
+
| base | string | ✅ Yes | Valid model identifier or path |
|
| 107 |
+
| architecture | enum | ❌ No | Must be: transformer, cnn, rnn, diffusion, vision-transformer, bert, gpt, t5 |
|
| 108 |
+
| parameters | string | ❌ No | Format: number + (K\|M\|B), e.g., "120M" |
|
| 109 |
+
| context_window | number | ❌ No | Must be power of 2: 128, 256, 512, 1024, 2048, 4096, 8192 |
|
| 110 |
+
| precision | enum | ❌ No | Must be: fp32, fp16, int8, int4 |
|
| 111 |
+
| inherit | string | ❌ No | Must reference existing model name |
|
| 112 |
+
|
| 113 |
+
### TRAIN Block
|
| 114 |
+
|
| 115 |
+
| Field | Type | Required | Constraints |
|
| 116 |
+
|-------|------|----------|-------------|
|
| 117 |
+
| epochs | number | ✅ Yes | > 0 and <= 1000 |
|
| 118 |
+
| batch_size | number | ✅ Yes | > 0 and <= 1024 |
|
| 119 |
+
| learning_rate | decimal | ❌ No | > 0 and <= 1.0 |
|
| 120 |
+
| optimizer | enum | ❌ No | Must be: adam, adamw, sgd, rmsprop, adafactor, lamb |
|
| 121 |
+
| scheduler | enum | ❌ No | Must be: linear, cosine, cosine_with_restarts, polynomial, constant, constant_with_warmup, step |
|
| 122 |
+
| device | enum | ✅ Yes | Must be: cpu, cuda, mps, auto |
|
| 123 |
+
| gradient_accumulation | number | ❌ No | >= 1 |
|
| 124 |
+
| early_stopping | boolean | ❌ No | true or false |
|
| 125 |
+
| checkpoint_steps | number | ❌ No | > 0 |
|
| 126 |
+
| checkpoint_path | path | ❌ No | Directory must exist if specified |
|
| 127 |
+
| resume_from_checkpoint | path | ❌ No | Checkpoint must exist if specified |
|
| 128 |
+
| loss | enum | ❌ No | Must be: cross_entropy, mse, mae, bce, focal, huber, kl_divergence |
|
| 129 |
+
| weight_decay | decimal | ❌ No | >= 0 and <= 1.0 |
|
| 130 |
+
| gradient_clip | decimal | ❌ No | > 0 |
|
| 131 |
+
| warmup_steps | number | ❌ No | >= 0 |
|
| 132 |
+
| save_strategy | enum | ❌ No | Must be: steps, epoch, no |
|
| 133 |
+
|
| 134 |
+
### METRICS Block
|
| 135 |
+
|
| 136 |
+
| Field | Type | Required | Constraints |
|
| 137 |
+
|-------|------|----------|-------------|
|
| 138 |
+
| Built-in metrics | identifier | ❌ No | Must be valid metric name |
|
| 139 |
+
| custom | string | ❌ No | Custom metric identifier |
|
| 140 |
+
|
| 141 |
+
**Metric-task compatibility:**
|
| 142 |
+
- `accuracy`, `precision`, `recall`, `f1`, `confusion_matrix`: Only for classification
|
| 143 |
+
- `perplexity`: Only for language models
|
| 144 |
+
- `bleu`, `rouge`: Only for generation/translation
|
| 145 |
+
- `mae`, `mse`, `rmse`: Only for regression
|
| 146 |
+
|
| 147 |
+
### EXPORT Block
|
| 148 |
+
|
| 149 |
+
| Field | Type | Required | Constraints |
|
| 150 |
+
|-------|------|----------|-------------|
|
| 151 |
+
| format | array | ✅ Yes | Each item must be: gguf, onnx, okm, safetensors, tflite |
|
| 152 |
+
| path | path | ✅ Yes | Directory must exist or be creatable |
|
| 153 |
+
| quantization | enum | ❌ No | Must be: int8, int4, fp16, fp32 |
|
| 154 |
+
| optimize_for | enum | ❌ No | Must be: speed, size, accuracy |
|
| 155 |
+
|
| 156 |
+
**Format-specific requirements:**
|
| 157 |
+
- `gguf`: Requires quantization
|
| 158 |
+
- `tflite`: Only for mobile-compatible architectures
|
| 159 |
+
|
| 160 |
+
### FT_LORA Block (v1.1+)
|
| 161 |
+
|
| 162 |
+
| Field | Type | Required | Constraints |
|
| 163 |
+
|-------|------|----------|-------------|
|
| 164 |
+
| base_model | string | ✅ Yes | Valid model identifier or path |
|
| 165 |
+
| train_dataset | path | ✅ Yes | File/dir must exist if specified |
|
| 166 |
+
| lora_rank | number | ✅ Yes | > 0 and <= 256 |
|
| 167 |
+
| lora_alpha | number | ✅ Yes | > 0 |
|
| 168 |
+
| dataset_percent | number | ❌ No | 1-100 |
|
| 169 |
+
| mix_datasets | array | ❌ No | Array of {path, weight}, total weights = 100 |
|
| 170 |
+
| epochs | number | ❌ No | > 0 and <= 1000 |
|
| 171 |
+
| batch_size | number | ❌ No | > 0 and <= 1024 |
|
| 172 |
+
| learning_rate | decimal | ❌ No | > 0 and <= 1.0 |
|
| 173 |
+
| device | enum | ❌ No | Must be: cpu, cuda, mps, auto |
|
| 174 |
+
| target_modules | array | ❌ No | Array of module names |
|
| 175 |
+
|
| 176 |
+
**Validation Rules:**
|
| 177 |
+
- If `mix_datasets` is specified, it overrides `train_dataset`
|
| 178 |
+
- Total weights in `mix_datasets` must equal exactly 100
|
| 179 |
+
- `lora_rank` typically: 4, 8, 16, 32
|
| 180 |
+
- `lora_alpha` typically: 16, 32, 64
|
| 181 |
+
- Cannot use both `TRAIN` and `FT_LORA` in same file
|
| 182 |
+
|
| 183 |
+
### MODEL Block — ADAPTER Sub-block
|
| 184 |
+
|
| 185 |
+
| Field | Type | Required | Constraints |
|
| 186 |
+
|-------|------|----------|-------------|
|
| 187 |
+
| type | enum | ✅ Yes | Must be: lora, qlora, adapter, peft |
|
| 188 |
+
| path | path | ✅ Yes | Must exist and be valid adapter path |
|
| 189 |
+
| rank | number | ❌ No | > 0, typically 4, 8, 16, 32, 64 |
|
| 190 |
+
| alpha | number | ❌ No | > 0, typically 16, 32, 64 |
|
| 191 |
+
|
| 192 |
+
**Validation Rules:**
|
| 193 |
+
- If ADAPTER is defined, it is applied after base model is loaded
|
| 194 |
+
- Adapter path must exist and be readable
|
| 195 |
+
- ADAPTER is optional within MODEL block
|
| 196 |
+
|
| 197 |
+
### INFERENCE Block (Expanded)
|
| 198 |
+
|
| 199 |
+
| Field | Type | Required | Constraints |
|
| 200 |
+
|-------|------|----------|-------------|
|
| 201 |
+
| mode | enum | ✅ Yes | Must be: chat, intent, translate, classify, custom |
|
| 202 |
+
| format | string | ❌ No | Template string with {input}, {context}, {labels} |
|
| 203 |
+
| exit_command | string | ❌ No | Command to exit chat mode |
|
| 204 |
+
| params | object | ❌ No | Inference parameters object |
|
| 205 |
+
| CONTROL | block | ❌ No | Nested CONTROL block for inference |
|
| 206 |
+
|
| 207 |
+
**INFERENCE params:**
|
| 208 |
+
- `max_length`: > 0 and <= 8192
|
| 209 |
+
- `temperature`: >= 0.0 and <= 2.0
|
| 210 |
+
- `top_p`: > 0.0 and <= 1.0
|
| 211 |
+
- `beams`: >= 1
|
| 212 |
+
- `do_sample`: boolean (true/false)
|
| 213 |
+
- `top_k`: >= 0 (0 = disabled)
|
| 214 |
+
- `repetition_penalty`: > 0.0 and <= 2.0
|
| 215 |
+
|
| 216 |
+
**Validation Rules:**
|
| 217 |
+
- IF INFERENCE exists THEN MODEL is required
|
| 218 |
+
- Format string must contain at least {input} for most modes
|
| 219 |
+
- CONTROL within INFERENCE can only use: RETRY, REGENERATE, REPLACE
|
| 220 |
+
|
| 221 |
+
### CONTROL Block
|
| 222 |
+
|
| 223 |
+
| Field | Type | Required | Constraints |
|
| 224 |
+
|-------|------|----------|-------------|
|
| 225 |
+
| IF | condition | ❌ No | Conditional logic |
|
| 226 |
+
| WHEN | condition | ❌ No | Event-based conditional |
|
| 227 |
+
| EVERY | number + steps | ❌ No | Periodic actions |
|
| 228 |
+
| SET | assignment | ❌ No | Set parameter value |
|
| 229 |
+
| STOP | action | ❌ No | Stop operation |
|
| 230 |
+
| LOG | metric/string | ❌ No | Log value or message |
|
| 231 |
+
| SAVE | target | ❌ No | Save model/checkpoint |
|
| 232 |
+
| RETRY | action | ❌ No | Retry inference |
|
| 233 |
+
| REGENERATE | action | ❌ No | Regenerate output |
|
| 234 |
+
| STOP_TRAINING | action | ❌ No | Stop training |
|
| 235 |
+
| DECREASE | parameter + BY + value | ❌ No | Decrease parameter |
|
| 236 |
+
| INCREASE | parameter + BY + value | ❌ No | Increase parameter |
|
| 237 |
+
| on_step_end | block | ❌ No | Hook executed at step end |
|
| 238 |
+
| on_epoch_end | block | ❌ No | Hook executed at epoch end |
|
| 239 |
+
| on_memory_low | block | ❌ No | Hook executed when memory low |
|
| 240 |
+
| on_nan | block | ❌ No | Hook executed on NaN |
|
| 241 |
+
| on_plateau | block | ❌ No | Hook executed on loss plateau |
|
| 242 |
+
| validate_every | number | ❌ No | Validate every N steps |
|
| 243 |
+
|
| 244 |
+
**Validation Rules:**
|
| 245 |
+
- IF CONTROL used THEN must contain at least one of: IF | WHEN | EVERY | on_step_end | on_epoch_end
|
| 246 |
+
- Boolean values accepted = true | false
|
| 247 |
+
- Allowed CONTROL keywords = IF | WHEN | EVERY | SET | STOP | LOG | SAVE | RETRY | REGENERATE | STOP_TRAINING | DECREASE | INCREASE
|
| 248 |
+
- validate_every must receive integer
|
| 249 |
+
- DECREASE LR requires numeric value
|
| 250 |
+
- Conditions must use valid comparison operators: >, <, >=, <=, ==, !=
|
| 251 |
+
|
| 252 |
+
### MONITOR Block (v1.1+)
|
| 253 |
+
|
| 254 |
+
| Field | Type | Required | Constraints |
|
| 255 |
+
|-------|------|----------|-------------|
|
| 256 |
+
| metrics | array | ❌ No | Array of metric names |
|
| 257 |
+
| notify_if | object | ❌ No | Conditions for notifications |
|
| 258 |
+
| log_to | path | ❌ No | Path to log file |
|
| 259 |
+
| level | enum | ❌ No | Must be: basic, full |
|
| 260 |
+
| log_system | array | ❌ No | Array of system metric names |
|
| 261 |
+
| log_speed | array | ❌ No | Array of speed metric names |
|
| 262 |
+
| refresh_interval | string | ❌ No | Format: number + "s" or "ms", >= 1s |
|
| 263 |
+
| export_to | path | ❌ No | Directory must exist or be creatable |
|
| 264 |
+
| dashboard | boolean | ❌ No | true or false |
|
| 265 |
+
|
| 266 |
+
**System Metrics:**
|
| 267 |
+
- `gpu_memory_used`, `gpu_memory_free`, `gpu_usage`, `gpu_temperature`: Only if CUDA available
|
| 268 |
+
- `temperature`: Only if hardware supports it
|
| 269 |
+
|
| 270 |
+
**Validation Rules:**
|
| 271 |
+
- GPU metrics only validated if CUDA is available
|
| 272 |
+
- `refresh_interval` must be >= 1s
|
| 273 |
+
- `MONITOR` extends `METRICS` and `LOGGING`, does not replace them
|
| 274 |
+
- `notify_if` conditions must use valid comparison operators
|
| 275 |
+
- Supported metrics: loss, accuracy, val_loss, val_accuracy, gpu_usage, ram_usage, throughput, latency, confidence, hallucination_score, and all custom metrics
|
| 276 |
+
|
| 277 |
+
### GUARD Block
|
| 278 |
+
|
| 279 |
+
| Field | Type | Required | Constraints |
|
| 280 |
+
|-------|------|----------|-------------|
|
| 281 |
+
| prevent | object | ❌ No | Array of prevention types |
|
| 282 |
+
| on_violation | object | ❌ No | Action on violation |
|
| 283 |
+
|
| 284 |
+
**Prevention types:**
|
| 285 |
+
- `hallucination`, `toxicity`, `bias`, `data_leak`, `unsafe_code`
|
| 286 |
+
|
| 287 |
+
**Validation Rules:**
|
| 288 |
+
- GUARD.on_violation can only be STOP or ALERT or REPLACE or LOG
|
| 289 |
+
- Prevention types must be valid enum values
|
| 290 |
+
|
| 291 |
+
### BEHAVIOR Block
|
| 292 |
+
|
| 293 |
+
| Field | Type | Required | Constraints |
|
| 294 |
+
|-------|------|----------|-------------|
|
| 295 |
+
| personality | enum | ❌ No | Must be: professional, friendly, assistant, casual, formal, creative |
|
| 296 |
+
| verbosity | enum | ❌ No | Must be: low, medium, high |
|
| 297 |
+
| language | enum | ❌ No | Must be: en, pt-BR, es, fr, de, it, ja, zh, multilingual |
|
| 298 |
+
| avoid | array | ❌ No | Array of strings to avoid |
|
| 299 |
+
| fallback | string | ❌ No | Fallback message |
|
| 300 |
+
|
| 301 |
+
**Validation Rules:**
|
| 302 |
+
- All enum values must match allowed values
|
| 303 |
+
- fallback must be a non-empty string if provided
|
| 304 |
+
|
| 305 |
+
### EXPLORER Block
|
| 306 |
+
|
| 307 |
+
| Field | Type | Required | Constraints |
|
| 308 |
+
|-------|------|----------|-------------|
|
| 309 |
+
| try | object | ✅ Yes | Parameter combinations to test |
|
| 310 |
+
| max_tests | number | ❌ No | Must be <= 50 |
|
| 311 |
+
| pick_best_by | string | ❌ No | Must be valid metric name |
|
| 312 |
+
|
| 313 |
+
**Validation Rules:**
|
| 314 |
+
- EXPLORER.max_tests must be <= 50
|
| 315 |
+
- pick_best_by must be a valid metric (e.g., "val_loss", "accuracy")
|
| 316 |
+
- try object must contain at least one parameter array
|
| 317 |
+
- Parameter arrays must contain valid values for their type
|
| 318 |
+
|
| 319 |
+
### STABILITY Block
|
| 320 |
+
|
| 321 |
+
| Field | Type | Required | Constraints |
|
| 322 |
+
|-------|------|----------|-------------|
|
| 323 |
+
| stop_if_nan | boolean | ❌ No | true or false |
|
| 324 |
+
| stop_if_diverges | boolean | ❌ No | true or false |
|
| 325 |
+
| min_improvement | decimal | ❌ No | Must be float >= 0 |
|
| 326 |
+
|
| 327 |
+
**Validation Rules:**
|
| 328 |
+
- STABILITY.min_improvement must be float
|
| 329 |
+
- Boolean values must be true or false (lowercase)
|
| 330 |
+
|
| 331 |
+
### DEPLOY Block
|
| 332 |
+
|
| 333 |
+
| Field | Type | Required | Constraints |
|
| 334 |
+
|-------|------|----------|-------------|
|
| 335 |
+
| target | enum | ✅ Yes | Must be: local, cloud, edge, api, android, ios, web, desktop |
|
| 336 |
+
| endpoint | string | ❌ No | Required if target is "api" |
|
| 337 |
+
| requires_auth | boolean | ❌ No | true or false |
|
| 338 |
+
| port | number | ❌ No | Required if target is "api", must be 1024-65535 |
|
| 339 |
+
| max_concurrent_requests | number | ❌ No | > 0 |
|
| 340 |
+
|
| 341 |
+
---
|
| 342 |
+
|
| 343 |
+
## Dependency Validation
|
| 344 |
+
|
| 345 |
+
### Model Inheritance
|
| 346 |
+
|
| 347 |
+
- If `inherit` is specified, parent model must be defined
|
| 348 |
+
- Circular inheritance is not allowed
|
| 349 |
+
- Inheritance chain depth limited to 10 levels
|
| 350 |
+
|
| 351 |
+
### Checkpoint Resume
|
| 352 |
+
|
| 353 |
+
- If `resume_from_checkpoint` is specified:
|
| 354 |
+
- Checkpoint directory must exist
|
| 355 |
+
- Checkpoint must contain valid model files
|
| 356 |
+
- Checkpoint must be compatible with current model architecture
|
| 357 |
+
|
| 358 |
+
### Export Compatibility
|
| 359 |
+
|
| 360 |
+
- Model architecture must support export format
|
| 361 |
+
- Quantization required for certain formats (gguf)
|
| 362 |
+
- Mobile formats (tflite, okm) require compatible architectures
|
| 363 |
+
|
| 364 |
+
---
|
| 365 |
+
|
| 366 |
+
## Runtime Validation
|
| 367 |
+
|
| 368 |
+
### Dataset Validation
|
| 369 |
+
|
| 370 |
+
**File existence:**
|
| 371 |
+
- All dataset paths must exist
|
| 372 |
+
- Files must be readable
|
| 373 |
+
- Directories must be accessible
|
| 374 |
+
|
| 375 |
+
**Format validation:**
|
| 376 |
+
- JSONL: Each line must be valid JSON
|
| 377 |
+
- CSV: Must have header row, consistent columns
|
| 378 |
+
- Image+caption: Directory must contain image files and captions
|
| 379 |
+
|
| 380 |
+
**Size limits:**
|
| 381 |
+
- Maximum file size: 10GB per file
|
| 382 |
+
- Maximum total dataset size: 100GB
|
| 383 |
+
- Minimum examples: 10 for training
|
| 384 |
+
|
| 385 |
+
**Dataset Mixing (v1.1+):**
|
| 386 |
+
- If `mix_datasets` is specified, `train` is ignored
|
| 387 |
+
- All paths in `mix_datasets` must exist
|
| 388 |
+
- Total weights must equal exactly 100
|
| 389 |
+
- `dataset_percent` applies to the mixed dataset
|
| 390 |
+
- `sampling: "weighted"` uses weights, `"random"` ignores them
|
| 391 |
+
|
| 392 |
+
### Model Validation
|
| 393 |
+
|
| 394 |
+
**Base model:**
|
| 395 |
+
- If local path: Must exist and be valid model directory
|
| 396 |
+
- If HuggingFace: Must be downloadable
|
| 397 |
+
- If URL: Must be accessible
|
| 398 |
+
|
| 399 |
+
**Architecture compatibility:**
|
| 400 |
+
- Model architecture must match dataset type
|
| 401 |
+
- Vision models require image datasets
|
| 402 |
+
- Language models require text datasets
|
| 403 |
+
|
| 404 |
+
### Training Validation
|
| 405 |
+
|
| 406 |
+
**Hardware requirements:**
|
| 407 |
+
- GPU required if `device: "cuda"` and `gpu: true`
|
| 408 |
+
- Sufficient VRAM for batch size
|
| 409 |
+
- Sufficient disk space for checkpoints
|
| 410 |
+
|
| 411 |
+
**Memory validation:**
|
| 412 |
+
- Batch size must fit in available memory
|
| 413 |
+
- Effective batch size (batch_size × gradient_accumulation) validated
|
| 414 |
+
|
| 415 |
+
---
|
| 416 |
+
|
| 417 |
+
## Error Codes
|
| 418 |
+
|
| 419 |
+
| Code | Error | Solution |
|
| 420 |
+
|------|-------|----------|
|
| 421 |
+
| V001 | Dataset file not found | Check file path, use absolute or relative path |
|
| 422 |
+
| V002 | Invalid optimizer | Use one of: adam, adamw, sgd, rmsprop, adafactor, lamb |
|
| 423 |
+
| V003 | Invalid scheduler | Use one of: linear, cosine, cosine_with_restarts, polynomial, constant, constant_with_warmup, step |
|
| 424 |
+
| V004 | Model base not found | Verify model path or HuggingFace model name |
|
| 425 |
+
| V005 | Checkpoint not found | Check checkpoint path or remove resume_from_checkpoint |
|
| 426 |
+
| V006 | Insufficient memory | Reduce batch_size or enable gradient_accumulation |
|
| 427 |
+
| V007 | Invalid metric for task | Use appropriate metrics for task type |
|
| 428 |
+
| V008 | Invalid export format | Check format compatibility with model architecture |
|
| 429 |
+
| V009 | Circular inheritance | Remove circular model inheritance chain |
|
| 430 |
+
| V010 | Invalid field value | Check field constraints and allowed values |
|
| 431 |
+
| V011 | Dataset mixing weights invalid | Total weights in mix_datasets must equal 100 |
|
| 432 |
+
| V012 | FT_LORA and TRAIN conflict | Cannot use both TRAIN and FT_LORA in same file |
|
| 433 |
+
| V013 | Version declaration invalid | Version must be "1.0" or "1.1" |
|
| 434 |
+
| V014 | GPU metrics unavailable | GPU metrics requested but CUDA not available |
|
| 435 |
+
| V015 | CONTROL block empty | CONTROL must contain at least one directive |
|
| 436 |
+
| V016 | Invalid CONTROL keyword | Use only allowed CONTROL keywords |
|
| 437 |
+
| V017 | EXPLORER max_tests too high | max_tests must be <= 50 |
|
| 438 |
+
| V018 | Invalid boolean value | Boolean must be true or false (lowercase) |
|
| 439 |
+
| V019 | INFERENCE without MODEL | INFERENCE block requires MODEL block |
|
| 440 |
+
| V020 | Invalid adapter type | ADAPTER type must be: lora, qlora, adapter, peft |
|
| 441 |
+
| V021 | GUARD violation action invalid | on_violation must be: STOP, ALERT, REPLACE, or LOG |
|
| 442 |
+
|
| 443 |
+
---
|
| 444 |
+
|
| 445 |
+
## Validation Commands
|
| 446 |
+
|
| 447 |
+
### CLI Validation
|
| 448 |
+
|
| 449 |
+
```bash
|
| 450 |
+
# Validate syntax and structure
|
| 451 |
+
okto validate train.okt
|
| 452 |
+
|
| 453 |
+
# Validate with detailed output
|
| 454 |
+
okto validate train.okt --verbose
|
| 455 |
+
|
| 456 |
+
# Validate dataset only
|
| 457 |
+
okto validate train.okt --dataset-only
|
| 458 |
+
|
| 459 |
+
# Validate model only
|
| 460 |
+
okto validate train.okt --model-only
|
| 461 |
+
```
|
| 462 |
+
|
| 463 |
+
### IDE Validation
|
| 464 |
+
|
| 465 |
+
OktoSeek IDE automatically validates:
|
| 466 |
+
- Real-time syntax checking
|
| 467 |
+
- Field completion suggestions
|
| 468 |
+
- Error highlighting
|
| 469 |
+
- Warning messages
|
| 470 |
+
|
| 471 |
+
---
|
| 472 |
+
|
| 473 |
+
## Best Practices
|
| 474 |
+
|
| 475 |
+
1. **Always validate before training**
|
| 476 |
+
```bash
|
| 477 |
+
okto validate train.okt
|
| 478 |
+
```
|
| 479 |
+
|
| 480 |
+
2. **Check dataset format**
|
| 481 |
+
- Use `okto validate --dataset-only` to verify dataset structure
|
| 482 |
+
|
| 483 |
+
3. **Verify model compatibility**
|
| 484 |
+
- Ensure model architecture matches dataset type
|
| 485 |
+
- Check export format compatibility
|
| 486 |
+
|
| 487 |
+
4. **Test with small dataset first**
|
| 488 |
+
- Use subset of data for initial validation
|
| 489 |
+
- Verify pipeline works before full training
|
| 490 |
+
|
| 491 |
+
5. **Monitor resource usage**
|
| 492 |
+
- Check available GPU memory
|
| 493 |
+
- Verify disk space for checkpoints
|
| 494 |
+
- Monitor training progress
|
| 495 |
+
|
| 496 |
+
---
|
| 497 |
+
|
| 498 |
+
**For more information, see:**
|
| 499 |
+
- [Grammar Specification](./docs/grammar.md)
|
| 500 |
+
- [Getting Started Guide](./docs/GETTING_STARTED.md)
|
| 501 |
+
- [Troubleshooting](./docs/grammar.md#troubleshooting)
|
| 502 |
+
|
assets/README.md
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Assets Directory
|
| 2 |
+
|
| 3 |
+
This directory contains visual assets for the OktoScript project.
|
| 4 |
+
|
| 5 |
+
## Required Images
|
| 6 |
+
|
| 7 |
+
### `oktoscript_banner.png`
|
| 8 |
+
- **Dimensions:** Recommended 1200x300px or similar aspect ratio
|
| 9 |
+
- **Purpose:** Main banner image for README.md
|
| 10 |
+
- **Content:** Should display "OktoScript" branding with visual design
|
| 11 |
+
|
| 12 |
+
### `okto_logo.png`
|
| 13 |
+
- **Dimensions:** Recommended 240x240px (square, will be displayed at 80px)
|
| 14 |
+
- **Purpose:** Company logo for README.md
|
| 15 |
+
- **Content:** OktoSeek AI company logo
|
| 16 |
+
|
| 17 |
+
## Notes
|
| 18 |
+
|
| 19 |
+
- Images should be optimized for web (PNG with transparency or optimized formats)
|
| 20 |
+
- Ensure images are properly licensed for use in the repository
|
| 21 |
+
- Update README.md image paths if filenames change
|
| 22 |
+
|
assets/okto_logo.png
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# OktoScript – Frequently Asked Questions (FAQ)
|
| 2 |
+
|
| 3 |
+
Common questions and answers about OktoScript, a domain-specific language for AI training, evaluation, and deployment.
|
| 4 |
+
|
| 5 |
+
---
|
| 6 |
+
|
| 7 |
+
## 1. Even if FT_LORA already points to a base model and dataset, why must I still declare the MODEL and DATASET blocks?
|
| 8 |
+
|
| 9 |
+
**Answer:**
|
| 10 |
+
|
| 11 |
+
In OktoScript, `MODEL` and `DATASET` blocks define the **global context** of your project. They represent the default base configuration for the entire pipeline.
|
| 12 |
+
|
| 13 |
+
The `FT_LORA` block does not replace them—it only defines **how** the fine-tuning is performed. This explicit separation makes scripts clearer, more organized, and avoids hidden assumptions.
|
| 14 |
+
|
| 15 |
+
**Benefits of explicit declaration:**
|
| 16 |
+
- ✅ **Readability** - Anyone can understand the project structure at a glance
|
| 17 |
+
- ✅ **Debugging** - Clear separation of concerns makes troubleshooting easier
|
| 18 |
+
- ✅ **Reproducibility** - All configuration is visible and version-controlled
|
| 19 |
+
- ✅ **Documentation** - The script serves as self-documenting code
|
| 20 |
+
|
| 21 |
+
**Example:**
|
| 22 |
+
```okt
|
| 23 |
+
MODEL {
|
| 24 |
+
base: "oktoseek/base-llm-7b" # Global model context
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
DATASET {
|
| 28 |
+
train: "dataset/main.jsonl" # Global dataset context
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
FT_LORA {
|
| 32 |
+
base_model: "oktoseek/base-llm-7b" # Explicit for LoRA
|
| 33 |
+
train_dataset: "dataset/main.jsonl" # Explicit for LoRA
|
| 34 |
+
lora_rank: 8
|
| 35 |
+
}
|
| 36 |
+
```
|
| 37 |
+
|
| 38 |
+
This design follows the principle: **explicit is better than implicit**, especially in AI pipelines where assumptions can lead to costly mistakes.
|
| 39 |
+
|
| 40 |
+
---
|
| 41 |
+
|
| 42 |
+
## 2. If I already use FT_LORA, why is the TRAIN block still mandatory?
|
| 43 |
+
|
| 44 |
+
**Answer:**
|
| 45 |
+
|
| 46 |
+
`FT_LORA` defines **what kind of training** happens (LoRA adapters), but `TRAIN` defines **how the training loop is executed** (optimizer, batch size, device, etc.).
|
| 47 |
+
|
| 48 |
+
**Think of it this way:**
|
| 49 |
+
- `TRAIN` = The engine (how training runs)
|
| 50 |
+
- `FT_LORA` = The driving mode (what gets trained)
|
| 51 |
+
|
| 52 |
+
**The TRAIN block controls:**
|
| 53 |
+
- Optimizer (adam, adamw, sgd, etc.)
|
| 54 |
+
- Batch size and gradient accumulation
|
| 55 |
+
- Device selection (cpu, cuda, mps)
|
| 56 |
+
- Learning rate and scheduler
|
| 57 |
+
- Training strategy (early stopping, checkpoints)
|
| 58 |
+
|
| 59 |
+
**Example:**
|
| 60 |
+
```okt
|
| 61 |
+
TRAIN {
|
| 62 |
+
epochs: 5
|
| 63 |
+
batch_size: 4
|
| 64 |
+
optimizer: "adamw"
|
| 65 |
+
learning_rate: 0.00003
|
| 66 |
+
device: "cuda"
|
| 67 |
+
}
|
| 68 |
+
|
| 69 |
+
FT_LORA {
|
| 70 |
+
lora_rank: 8
|
| 71 |
+
lora_alpha: 32
|
| 72 |
+
target_modules: ["q_proj", "v_proj"]
|
| 73 |
+
}
|
| 74 |
+
```
|
| 75 |
+
|
| 76 |
+
Both blocks are required because they serve different purposes in the declarative DSL structure.
|
| 77 |
+
|
| 78 |
+
---
|
| 79 |
+
|
| 80 |
+
## 3. How do I define the final output of my model in OktoScript?
|
| 81 |
+
|
| 82 |
+
**Answer:**
|
| 83 |
+
|
| 84 |
+
The final output is always defined in the `EXPORT` block, regardless of whether you use `TRAIN` or `FT_LORA`.
|
| 85 |
+
|
| 86 |
+
**For standard training:**
|
| 87 |
+
```okt
|
| 88 |
+
EXPORT {
|
| 89 |
+
format: ["gguf", "onnx", "okm"]
|
| 90 |
+
path: "./export/"
|
| 91 |
+
}
|
| 92 |
+
```
|
| 93 |
+
|
| 94 |
+
**For LoRA fine-tuning:**
|
| 95 |
+
```okt
|
| 96 |
+
EXPORT {
|
| 97 |
+
format: ["safetensors", "okm"]
|
| 98 |
+
path: "./export/lora_patch/"
|
| 99 |
+
}
|
| 100 |
+
```
|
| 101 |
+
|
| 102 |
+
**What gets exported:**
|
| 103 |
+
- With `TRAIN`: Full model weights in specified formats
|
| 104 |
+
- With `FT_LORA`: LoRA adapter weights (safetensors) + optional merged model (okm)
|
| 105 |
+
|
| 106 |
+
The `EXPORT` block controls:
|
| 107 |
+
- ✅ Adapter generation (LoRA patches via safetensors)
|
| 108 |
+
- ✅ OktoSeek package generation (okm format)
|
| 109 |
+
- ✅ Cross-platform formats (onnx, gguf)
|
| 110 |
+
- ✅ Quantization settings
|
| 111 |
+
|
| 112 |
+
**Key point:** Export responsibility is clearly separated from training logic, keeping the DSL clean and modular.
|
| 113 |
+
|
| 114 |
+
---
|
| 115 |
+
|
| 116 |
+
## 4. What is the difference between FT_LORA and TRAIN blocks?
|
| 117 |
+
|
| 118 |
+
**Answer:**
|
| 119 |
+
|
| 120 |
+
| Block | Role | Purpose |
|
| 121 |
+
|-------|------|---------|
|
| 122 |
+
| `TRAIN` | Training loop configuration | Defines **how** training runs (optimizer, batch size, device) |
|
| 123 |
+
| `FT_LORA` | LoRA adapter configuration | Defines **what** gets trained (LoRA rank, alpha, target modules) |
|
| 124 |
+
|
| 125 |
+
**Important:** `FT_LORA` is **not** a replacement for `TRAIN`—it's an **extension** that modifies how training is applied to the model.
|
| 126 |
+
|
| 127 |
+
**When to use each:**
|
| 128 |
+
- **Use `TRAIN` alone:** Full fine-tuning of all model parameters
|
| 129 |
+
- **Use `TRAIN` + `FT_LORA`:** Efficient fine-tuning with LoRA adapters (recommended for large models)
|
| 130 |
+
|
| 131 |
+
**Example:**
|
| 132 |
+
```okt
|
| 133 |
+
# Full fine-tuning
|
| 134 |
+
TRAIN {
|
| 135 |
+
epochs: 10
|
| 136 |
+
batch_size: 32
|
| 137 |
+
device: "cuda"
|
| 138 |
+
}
|
| 139 |
+
|
| 140 |
+
# LoRA fine-tuning (more efficient)
|
| 141 |
+
TRAIN {
|
| 142 |
+
epochs: 5
|
| 143 |
+
batch_size: 4
|
| 144 |
+
device: "cuda"
|
| 145 |
+
}
|
| 146 |
+
|
| 147 |
+
FT_LORA {
|
| 148 |
+
lora_rank: 8
|
| 149 |
+
lora_alpha: 32
|
| 150 |
+
}
|
| 151 |
+
```
|
| 152 |
+
|
| 153 |
+
This separation keeps the language modular and scalable.
|
| 154 |
+
|
| 155 |
+
---
|
| 156 |
+
|
| 157 |
+
## 5. Do I need to repeat the base model inside FT_LORA if it is already declared in MODEL?
|
| 158 |
+
|
| 159 |
+
**Answer:**
|
| 160 |
+
|
| 161 |
+
**Yes, by design.** OktoScript prefers explicit declarations over implicit inference.
|
| 162 |
+
|
| 163 |
+
Even though the engine could technically infer the model from `MODEL`, keeping `base_model` inside `FT_LORA`:
|
| 164 |
+
|
| 165 |
+
- ✅ **Avoids ambiguity** - No guessing which model is used
|
| 166 |
+
- ✅ **Makes scripts self-contained** - Each block is independent
|
| 167 |
+
- ✅ **Improves readability** - Clear at a glance what's happening
|
| 168 |
+
- ✅ **Helps during audits** - Easier to review and validate
|
| 169 |
+
|
| 170 |
+
**Example:**
|
| 171 |
+
```okt
|
| 172 |
+
MODEL {
|
| 173 |
+
base: "oktoseek/base-llm-7b" # Global context
|
| 174 |
+
}
|
| 175 |
+
|
| 176 |
+
FT_LORA {
|
| 177 |
+
base_model: "oktoseek/base-llm-7b" # Explicit for LoRA
|
| 178 |
+
lora_rank: 8
|
| 179 |
+
}
|
| 180 |
+
```
|
| 181 |
+
|
| 182 |
+
**This is an intentional design decision** to favor clarity and safety over convenience. In AI pipelines, explicit is safer than implicit.
|
| 183 |
+
|
| 184 |
+
---
|
| 185 |
+
|
| 186 |
+
## 6. What happens if I use both DATASET.train and mix_datasets at the same time?
|
| 187 |
+
|
| 188 |
+
**Answer:**
|
| 189 |
+
|
| 190 |
+
**Simple rule:** `mix_datasets` **overrides** `DATASET.train` when present.
|
| 191 |
+
|
| 192 |
+
**Priority order:**
|
| 193 |
+
1. `mix_datasets` in `FT_LORA` (highest priority)
|
| 194 |
+
2. `mix_datasets` in `DATASET` block
|
| 195 |
+
3. `DATASET.train` (default, lowest priority)
|
| 196 |
+
|
| 197 |
+
**Example:**
|
| 198 |
+
```okt
|
| 199 |
+
DATASET {
|
| 200 |
+
train: "dataset/main.jsonl" # Default dataset
|
| 201 |
+
}
|
| 202 |
+
|
| 203 |
+
FT_LORA {
|
| 204 |
+
mix_datasets: [
|
| 205 |
+
{ path: "dataset/a.jsonl", weight: 70 },
|
| 206 |
+
{ path: "dataset/b.jsonl", weight: 30 }
|
| 207 |
+
]
|
| 208 |
+
# This mix_datasets overrides DATASET.train
|
| 209 |
+
}
|
| 210 |
+
```
|
| 211 |
+
|
| 212 |
+
**Why this design?**
|
| 213 |
+
- Allows flexibility without breaking the main structure
|
| 214 |
+
- Enables dataset-specific configurations per training method
|
| 215 |
+
- Maintains backward compatibility with v1.0
|
| 216 |
+
|
| 217 |
+
**Best practice:** Use `DATASET.train` for the default, and `mix_datasets` when you need weighted mixing.
|
| 218 |
+
|
| 219 |
+
---
|
| 220 |
+
|
| 221 |
+
## 7. Does OktoScript replace Python?
|
| 222 |
+
|
| 223 |
+
**Answer:**
|
| 224 |
+
|
| 225 |
+
**No.** OktoScript does **not** replace Python. Instead, it replaces the **complex configuration boilerplate** typically written in Python.
|
| 226 |
+
|
| 227 |
+
**The relationship:**
|
| 228 |
+
- **Python** = Coding and programming (general-purpose language)
|
| 229 |
+
- **OktoScript** = Configuration of AI pipelines (domain-specific language)
|
| 230 |
+
|
| 231 |
+
**Think of it this way:**
|
| 232 |
+
```
|
| 233 |
+
Python (Engine) ← OktoScript (Configuration Layer) ← User
|
| 234 |
+
```
|
| 235 |
+
|
| 236 |
+
OktoScript sits **above** Python as a declarative layer, while Python powers the OktoEngine underneath.
|
| 237 |
+
|
| 238 |
+
**What OktoScript replaces:**
|
| 239 |
+
- ❌ Hundreds of lines of Python configuration code
|
| 240 |
+
- ❌ Complex YAML files with unclear structure
|
| 241 |
+
- ❌ Repetitive training scripts
|
| 242 |
+
|
| 243 |
+
**What Python still does:**
|
| 244 |
+
- ✅ Powers the OktoEngine
|
| 245 |
+
- ✅ Executes the training loop
|
| 246 |
+
- ✅ Handles low-level operations
|
| 247 |
+
- ✅ Provides hooks for custom logic
|
| 248 |
+
|
| 249 |
+
**Analogy:** OktoScript is to Python what Docker Compose is to Docker—a declarative configuration layer that simplifies complex operations.
|
| 250 |
+
|
| 251 |
+
---
|
| 252 |
+
|
| 253 |
+
## 8. Can I use multiple datasets with different weights?
|
| 254 |
+
|
| 255 |
+
**Answer:**
|
| 256 |
+
|
| 257 |
+
**Yes!** This is one of the key features of OktoScript v1.1.
|
| 258 |
+
|
| 259 |
+
**Syntax:**
|
| 260 |
+
```okt
|
| 261 |
+
DATASET {
|
| 262 |
+
mix_datasets: [
|
| 263 |
+
{ path: "dataset/general.jsonl", weight: 60 },
|
| 264 |
+
{ path: "dataset/technical.jsonl", weight: 30 },
|
| 265 |
+
{ path: "dataset/creative.jsonl", weight: 10 }
|
| 266 |
+
]
|
| 267 |
+
sampling: "weighted"
|
| 268 |
+
shuffle: true
|
| 269 |
+
}
|
| 270 |
+
```
|
| 271 |
+
|
| 272 |
+
**Benefits:**
|
| 273 |
+
- ✅ **Balanced training** - Control dataset proportions
|
| 274 |
+
- ✅ **Domain blending** - Combine different data sources
|
| 275 |
+
- ✅ **Bias reduction** - Weight underrepresented data
|
| 276 |
+
- ✅ **Dataset prioritization** - Emphasize important data
|
| 277 |
+
|
| 278 |
+
**Rules:**
|
| 279 |
+
- Total weights must equal **exactly 100**
|
| 280 |
+
- `sampling: "weighted"` uses weights for sampling
|
| 281 |
+
- `sampling: "random"` ignores weights (uniform sampling)
|
| 282 |
+
- `shuffle: true` shuffles datasets before mixing
|
| 283 |
+
|
| 284 |
+
**Use case example:**
|
| 285 |
+
```okt
|
| 286 |
+
# Mix general conversations (60%) with technical Q&A (30%) and creative writing (10%)
|
| 287 |
+
mix_datasets: [
|
| 288 |
+
{ path: "dataset/conversations.jsonl", weight: 60 },
|
| 289 |
+
{ path: "dataset/technical_qa.jsonl", weight: 30 },
|
| 290 |
+
{ path: "dataset/creative.jsonl", weight: 10 }
|
| 291 |
+
]
|
| 292 |
+
```
|
| 293 |
+
|
| 294 |
+
---
|
| 295 |
+
|
| 296 |
+
## 9. What is the difference between EXPORT: safetensors and EXPORT: okm?
|
| 297 |
+
|
| 298 |
+
**Answer:**
|
| 299 |
+
|
| 300 |
+
| Format | Purpose | Use Case |
|
| 301 |
+
|--------|---------|----------|
|
| 302 |
+
| `safetensors` | Standard PyTorch weights format | LoRA adapters, model weights, HuggingFace compatibility |
|
| 303 |
+
| `okm` | OktoSeek optimized package | OktoSeek IDE, Flutter SDK, mobile apps, exclusive tools |
|
| 304 |
+
| `onnx` | Universal inference format | Production deployment, cross-platform compatibility |
|
| 305 |
+
| `gguf` | Local inference format | Ollama, Llama.cpp, local deployment |
|
| 306 |
+
|
| 307 |
+
**For LoRA fine-tuning:**
|
| 308 |
+
- `safetensors` → Saves only the LoRA adapter patch (small file, ~10-100MB)
|
| 309 |
+
- `okm` → Saves a full OktoSeek model package (includes adapter + metadata)
|
| 310 |
+
|
| 311 |
+
**Example:**
|
| 312 |
+
```okt
|
| 313 |
+
FT_LORA {
|
| 314 |
+
lora_rank: 8
|
| 315 |
+
}
|
| 316 |
+
|
| 317 |
+
EXPORT {
|
| 318 |
+
format: ["safetensors", "okm"]
|
| 319 |
+
path: "./export/"
|
| 320 |
+
}
|
| 321 |
+
```
|
| 322 |
+
|
| 323 |
+
**Output:**
|
| 324 |
+
- `./export/adapter.safetensors` - LoRA adapter (for HuggingFace/PyTorch)
|
| 325 |
+
- `./export/model.okm` - OktoSeek package (for OktoSeek ecosystem)
|
| 326 |
+
|
| 327 |
+
**Why both?**
|
| 328 |
+
- `safetensors` for compatibility with standard ML tools
|
| 329 |
+
- `okm` for optimized OktoSeek ecosystem integration
|
| 330 |
+
|
| 331 |
+
---
|
| 332 |
+
|
| 333 |
+
## 10. Is OktoScript a programming language or a DSL?
|
| 334 |
+
|
| 335 |
+
**Answer:**
|
| 336 |
+
|
| 337 |
+
**OktoScript is a Domain-Specific Language (DSL).**
|
| 338 |
+
|
| 339 |
+
**What it is NOT:**
|
| 340 |
+
- ❌ A general-purpose programming language
|
| 341 |
+
- ❌ A scripting language with loops and variables
|
| 342 |
+
- ❌ A replacement for Python or JavaScript
|
| 343 |
+
|
| 344 |
+
**What it IS:**
|
| 345 |
+
- ✅ A declarative configuration language
|
| 346 |
+
- ✅ Purpose-built for AI pipelines
|
| 347 |
+
- ✅ Domain-specific (focused on AI training/deployment)
|
| 348 |
+
|
| 349 |
+
**Key characteristics:**
|
| 350 |
+
- **Declarative** - You describe **what** you want, not **how** to do it
|
| 351 |
+
- **No control flow** - No loops, conditionals, or functions
|
| 352 |
+
- **Block-based** - Configuration organized in semantic blocks
|
| 353 |
+
- **Type-safe** - Validated against grammar specification
|
| 354 |
+
|
| 355 |
+
**Why call it a DSL?**
|
| 356 |
+
- ✅ Technically accurate
|
| 357 |
+
- ✅ Increases professional credibility
|
| 358 |
+
- ✅ Sets correct expectations
|
| 359 |
+
- ✅ Distinguishes from general-purpose languages
|
| 360 |
+
|
| 361 |
+
**Analogy:** OktoScript is to AI pipelines what SQL is to databases—a specialized language for a specific domain.
|
| 362 |
+
|
| 363 |
+
---
|
| 364 |
+
|
| 365 |
+
## 11. What happens internally when I write FT_LORA?
|
| 366 |
+
|
| 367 |
+
**Answer:**
|
| 368 |
+
|
| 369 |
+
When you use `FT_LORA`, the OktoEngine performs these steps:
|
| 370 |
+
|
| 371 |
+
**1. Model Loading:**
|
| 372 |
+
- Loads the base model specified in `base_model`
|
| 373 |
+
- Initializes model architecture
|
| 374 |
+
|
| 375 |
+
**2. LoRA Adapter Injection:**
|
| 376 |
+
- Freezes the main model layers
|
| 377 |
+
- Adds LoRA adapters to selected modules (e.g., `q_proj`, `v_proj`)
|
| 378 |
+
- Adapters are low-rank matrices (rank × alpha)
|
| 379 |
+
|
| 380 |
+
**3. Training:**
|
| 381 |
+
- Trains **only** the LoRA adapter weights
|
| 382 |
+
- Main model weights remain frozen
|
| 383 |
+
- Uses optimizer and settings from `TRAIN` block
|
| 384 |
+
|
| 385 |
+
**4. Export:**
|
| 386 |
+
- Saves adapter weights via `EXPORT` block
|
| 387 |
+
- Optionally merges adapter into base model (if specified)
|
| 388 |
+
|
| 389 |
+
**Benefits:**
|
| 390 |
+
- ✅ **Reduced GPU usage** - Up to 90% less VRAM
|
| 391 |
+
- ✅ **Faster training** - Only small adapters are updated
|
| 392 |
+
- ✅ **Smaller files** - Adapter weights are tiny (~10-100MB)
|
| 393 |
+
- ✅ **Specialization** - Multiple adapters for different tasks
|
| 394 |
+
- ✅ **Flexibility** - Combine adapters at inference time
|
| 395 |
+
|
| 396 |
+
**Example flow:**
|
| 397 |
+
```
|
| 398 |
+
Base Model (7B params, frozen)
|
| 399 |
+
↓
|
| 400 |
+
+ LoRA Adapters (8 rank × 32 alpha = ~256 params per module)
|
| 401 |
+
↓
|
| 402 |
+
Training (only adapters updated)
|
| 403 |
+
↓
|
| 404 |
+
Export adapter.safetensors (~50MB)
|
| 405 |
+
```
|
| 406 |
+
|
| 407 |
+
---
|
| 408 |
+
|
| 409 |
+
## 12. Why is explicit declaration required instead of auto-inference?
|
| 410 |
+
|
| 411 |
+
**Answer:**
|
| 412 |
+
|
| 413 |
+
**Because transparency is better than hidden assumptions**, especially in AI pipelines.
|
| 414 |
+
|
| 415 |
+
**Problems with auto-inference:**
|
| 416 |
+
- ❌ Hidden assumptions can lead to silent mistakes
|
| 417 |
+
- ❌ Difficult to debug when things go wrong
|
| 418 |
+
- ❌ Unclear what the system is actually doing
|
| 419 |
+
- ❌ Harder to audit and review
|
| 420 |
+
|
| 421 |
+
**Benefits of explicit declaration:**
|
| 422 |
+
- ✅ **Self-documenting** - Scripts explain themselves
|
| 423 |
+
- ✅ **Auditable** - Easy to review and validate
|
| 424 |
+
- ✅ **Beginner-friendly** - Clear what's happening
|
| 425 |
+
- ✅ **Safe** - No hidden behavior or assumptions
|
| 426 |
+
|
| 427 |
+
**Example of explicit vs implicit:**
|
| 428 |
+
```okt
|
| 429 |
+
# Explicit (OktoScript style)
|
| 430 |
+
MODEL {
|
| 431 |
+
base: "oktoseek/base-llm-7b"
|
| 432 |
+
}
|
| 433 |
+
|
| 434 |
+
FT_LORA {
|
| 435 |
+
base_model: "oktoseek/base-llm-7b" # Explicit, even if redundant
|
| 436 |
+
}
|
| 437 |
+
|
| 438 |
+
# Implicit (what we avoid)
|
| 439 |
+
FT_LORA {
|
| 440 |
+
# base_model inferred from MODEL block - NOT in OktoScript
|
| 441 |
+
}
|
| 442 |
+
```
|
| 443 |
+
|
| 444 |
+
**Philosophy:** In AI, explicit is safer than implicit. A few extra lines of configuration prevent costly mistakes.
|
| 445 |
+
|
| 446 |
+
---
|
| 447 |
+
|
| 448 |
+
## 13. Can I run LoRA without EXPORT?
|
| 449 |
+
|
| 450 |
+
**Answer:**
|
| 451 |
+
|
| 452 |
+
**Technically yes, but it's not recommended.**
|
| 453 |
+
|
| 454 |
+
**What happens without EXPORT:**
|
| 455 |
+
- ✅ Training completes successfully
|
| 456 |
+
- ✅ Adapter weights are trained
|
| 457 |
+
- ❌ Adapter weights are **not saved**
|
| 458 |
+
- ❌ Training becomes useless after process ends
|
| 459 |
+
|
| 460 |
+
**Best practice:**
|
| 461 |
+
```okt
|
| 462 |
+
FT_LORA {
|
| 463 |
+
lora_rank: 8
|
| 464 |
+
lora_alpha: 32
|
| 465 |
+
}
|
| 466 |
+
|
| 467 |
+
EXPORT {
|
| 468 |
+
format: ["safetensors", "okm"]
|
| 469 |
+
path: "./export/"
|
| 470 |
+
}
|
| 471 |
+
```
|
| 472 |
+
|
| 473 |
+
**Why always include EXPORT:**
|
| 474 |
+
- ✅ Preserves your work
|
| 475 |
+
- ✅ Enables model reuse
|
| 476 |
+
- ✅ Allows deployment
|
| 477 |
+
- ✅ Supports version control
|
| 478 |
+
|
| 479 |
+
**Exception:** If you're only testing or debugging, you might skip EXPORT temporarily, but always add it before production training.
|
| 480 |
+
|
| 481 |
+
---
|
| 482 |
+
|
| 483 |
+
## 14. What if I want to merge a LoRA adapter into the final model later?
|
| 484 |
+
|
| 485 |
+
**Answer:**
|
| 486 |
+
|
| 487 |
+
**Current support (v1.1):**
|
| 488 |
+
|
| 489 |
+
You can merge LoRA adapters using OktoEngine's internal tools or Python hooks:
|
| 490 |
+
|
| 491 |
+
**Option 1: Using Hooks (Current)**
|
| 492 |
+
```okt
|
| 493 |
+
HOOKS {
|
| 494 |
+
after_train: "scripts/merge_lora.py"
|
| 495 |
+
}
|
| 496 |
+
```
|
| 497 |
+
|
| 498 |
+
**Option 2: Manual merge with OktoEngine CLI**
|
| 499 |
+
```bash
|
| 500 |
+
okto_merge --adapter ./export/adapter.safetensors \
|
| 501 |
+
--base ./models/base-model \
|
| 502 |
+
--output ./export/merged-model
|
| 503 |
+
```
|
| 504 |
+
|
| 505 |
+
**Future support (v2.0+):**
|
| 506 |
+
|
| 507 |
+
A dedicated `MERGE` block is planned:
|
| 508 |
+
|
| 509 |
+
```okt
|
| 510 |
+
MERGE {
|
| 511 |
+
source: "export/adapter.safetensors"
|
| 512 |
+
target: "models/base-model"
|
| 513 |
+
output: "export/merged-model"
|
| 514 |
+
format: ["okm", "onnx"]
|
| 515 |
+
}
|
| 516 |
+
```
|
| 517 |
+
|
| 518 |
+
**Why merge?**
|
| 519 |
+
- ✅ Single model file (no separate adapter needed)
|
| 520 |
+
- ✅ Faster inference (no adapter loading)
|
| 521 |
+
- ✅ Easier deployment (one file instead of two)
|
| 522 |
+
- ✅ Better compatibility (works with standard tools)
|
| 523 |
+
|
| 524 |
+
**When to merge:**
|
| 525 |
+
- After training is complete
|
| 526 |
+
- Before deployment
|
| 527 |
+
- When you want a standalone model
|
| 528 |
+
|
| 529 |
+
---
|
| 530 |
+
|
| 531 |
+
## 15. Why choose OktoScript over YAML or Python scripts?
|
| 532 |
+
|
| 533 |
+
**Answer:**
|
| 534 |
+
|
| 535 |
+
**OktoScript is purpose-built for AI pipelines**, while YAML and Python are generic tools.
|
| 536 |
+
|
| 537 |
+
**Comparison:**
|
| 538 |
+
|
| 539 |
+
| Feature | OktoScript | YAML | Python |
|
| 540 |
+
|---------|------------|------|--------|
|
| 541 |
+
| **Purpose** | AI pipelines | Generic config | General programming |
|
| 542 |
+
| **Readability** | ✅ Block-based, semantic | ⚠️ Flat, no structure | ❌ Code complexity |
|
| 543 |
+
| **Validation** | ✅ Grammar-enforced | ⚠️ Manual validation | ❌ Runtime errors |
|
| 544 |
+
| **Type Safety** | ✅ Built-in | ❌ No types | ⚠️ Runtime checking |
|
| 545 |
+
| **AI-Specific** | ✅ LoRA, RAG, monitoring | ❌ Generic | ⚠️ Requires libraries |
|
| 546 |
+
| **Learning Curve** | ✅ Simple blocks | ⚠️ Syntax learning | ❌ Programming required |
|
| 547 |
+
| **IDE Support** | ✅ OktoSeek IDE | ⚠️ Generic editors | ✅ IDEs available |
|
| 548 |
+
|
| 549 |
+
**Key advantages of OktoScript:**
|
| 550 |
+
|
| 551 |
+
1. **Purpose-built for AI**
|
| 552 |
+
- Native support for LoRA, RAG, monitoring
|
| 553 |
+
- AI-specific blocks and concepts
|
| 554 |
+
- Optimized for ML workflows
|
| 555 |
+
|
| 556 |
+
2. **Human-oriented**
|
| 557 |
+
- Readable by non-programmers
|
| 558 |
+
- Self-documenting structure
|
| 559 |
+
- Clear semantic blocks
|
| 560 |
+
|
| 561 |
+
3. **Less error-prone**
|
| 562 |
+
- Grammar validation
|
| 563 |
+
- Type checking
|
| 564 |
+
- Constraint enforcement
|
| 565 |
+
|
| 566 |
+
4. **Integrated ecosystem**
|
| 567 |
+
- OktoSeek IDE support
|
| 568 |
+
- OktoEngine integration
|
| 569 |
+
- Flutter SDK compatibility
|
| 570 |
+
|
| 571 |
+
5. **Single config file**
|
| 572 |
+
- Everything in one `.okt` file
|
| 573 |
+
- No scattered configuration
|
| 574 |
+
- Version control friendly
|
| 575 |
+
|
| 576 |
+
**Example comparison:**
|
| 577 |
+
|
| 578 |
+
**YAML (generic):**
|
| 579 |
+
```yaml
|
| 580 |
+
model:
|
| 581 |
+
base: "oktoseek/base"
|
| 582 |
+
train:
|
| 583 |
+
epochs: 5
|
| 584 |
+
batch_size: 32
|
| 585 |
+
# No validation, no structure, unclear relationships
|
| 586 |
+
```
|
| 587 |
+
|
| 588 |
+
**Python (complex):**
|
| 589 |
+
```python
|
| 590 |
+
from transformers import Trainer, TrainingArguments
|
| 591 |
+
# 100+ lines of code
|
| 592 |
+
# Complex error handling
|
| 593 |
+
# Hard to read and maintain
|
| 594 |
+
```
|
| 595 |
+
|
| 596 |
+
**OktoScript (focused):**
|
| 597 |
+
```okt
|
| 598 |
+
MODEL {
|
| 599 |
+
base: "oktoseek/base"
|
| 600 |
+
}
|
| 601 |
+
|
| 602 |
+
TRAIN {
|
| 603 |
+
epochs: 5
|
| 604 |
+
batch_size: 32
|
| 605 |
+
}
|
| 606 |
+
# Clear, validated, self-documenting
|
| 607 |
+
```
|
| 608 |
+
|
| 609 |
+
**Bottom line:** OktoScript is to AI pipelines what Docker Compose is to containers—a declarative DSL that simplifies complex operations.
|
| 610 |
+
|
| 611 |
+
---
|
| 612 |
+
|
| 613 |
+
## 16. How does OktoScript handle model versioning and checkpoints?
|
| 614 |
+
|
| 615 |
+
**Answer:**
|
| 616 |
+
|
| 617 |
+
OktoScript uses the `runs/` directory structure for automatic versioning and checkpoint management.
|
| 618 |
+
|
| 619 |
+
**Structure:**
|
| 620 |
+
```
|
| 621 |
+
runs/
|
| 622 |
+
└── my-model/
|
| 623 |
+
├── checkpoint-100/
|
| 624 |
+
│ └── model.safetensors
|
| 625 |
+
├── checkpoint-200/
|
| 626 |
+
│ └── model.safetensors
|
| 627 |
+
├── tokenizer.json
|
| 628 |
+
├── training_logs.json
|
| 629 |
+
└── metrics.json
|
| 630 |
+
```
|
| 631 |
+
|
| 632 |
+
**Checkpoint configuration:**
|
| 633 |
+
```okt
|
| 634 |
+
TRAIN {
|
| 635 |
+
epochs: 10
|
| 636 |
+
checkpoint_steps: 100 # Save every 100 steps
|
| 637 |
+
checkpoint_path: "./checkpoints"
|
| 638 |
+
}
|
| 639 |
+
```
|
| 640 |
+
|
| 641 |
+
**Resume from checkpoint:**
|
| 642 |
+
```okt
|
| 643 |
+
TRAIN {
|
| 644 |
+
resume_from_checkpoint: "./checkpoints/checkpoint-500"
|
| 645 |
+
epochs: 10
|
| 646 |
+
}
|
| 647 |
+
```
|
| 648 |
+
|
| 649 |
+
**Benefits:**
|
| 650 |
+
- ✅ Automatic versioning by run name
|
| 651 |
+
- ✅ Step-based checkpointing
|
| 652 |
+
- ✅ Easy resume from any checkpoint
|
| 653 |
+
- ✅ Training logs and metrics per run
|
| 654 |
+
|
| 655 |
+
**Best practice:** Use descriptive project names in `PROJECT` block to organize runs.
|
| 656 |
+
|
| 657 |
+
---
|
| 658 |
+
|
| 659 |
+
## 17. Can I use custom Python code with OktoScript?
|
| 660 |
+
|
| 661 |
+
**Answer:**
|
| 662 |
+
|
| 663 |
+
**Yes!** OktoScript supports custom Python code through the `HOOKS` block.
|
| 664 |
+
|
| 665 |
+
**Available hooks:**
|
| 666 |
+
```okt
|
| 667 |
+
HOOKS {
|
| 668 |
+
before_train: "scripts/preprocess.py"
|
| 669 |
+
after_train: "scripts/postprocess.py"
|
| 670 |
+
before_epoch: "scripts/custom_early_stop.py"
|
| 671 |
+
after_epoch: "scripts/log_custom_metrics.py"
|
| 672 |
+
on_checkpoint: "scripts/backup_checkpoint.sh"
|
| 673 |
+
custom_metric: "scripts/toxicity_calculator.py"
|
| 674 |
+
}
|
| 675 |
+
```
|
| 676 |
+
|
| 677 |
+
**Hook script interface:**
|
| 678 |
+
```python
|
| 679 |
+
# scripts/preprocess.py
|
| 680 |
+
def before_train(config, dataset, model):
|
| 681 |
+
# Custom preprocessing
|
| 682 |
+
# Modify config if needed
|
| 683 |
+
return config
|
| 684 |
+
|
| 685 |
+
# scripts/after_epoch.py
|
| 686 |
+
def after_epoch(epoch, metrics, model_state):
|
| 687 |
+
# Custom logging, early stopping logic
|
| 688 |
+
# Return True to stop training
|
| 689 |
+
return False
|
| 690 |
+
```
|
| 691 |
+
|
| 692 |
+
**Use cases:**
|
| 693 |
+
- Custom data preprocessing
|
| 694 |
+
- Custom metrics calculation
|
| 695 |
+
- Custom early stopping logic
|
| 696 |
+
- External API integration
|
| 697 |
+
- Custom logging
|
| 698 |
+
|
| 699 |
+
**Key point:** OktoScript handles the configuration, Python handles the custom logic. Best of both worlds.
|
| 700 |
+
|
| 701 |
+
---
|
| 702 |
+
|
| 703 |
+
## 18. What happens if I specify conflicting configurations?
|
| 704 |
+
|
| 705 |
+
**Answer:**
|
| 706 |
+
|
| 707 |
+
OktoScript has **clear priority rules** to handle conflicts:
|
| 708 |
+
|
| 709 |
+
**Priority order (highest to lowest):**
|
| 710 |
+
1. Block-specific overrides (e.g., `mix_datasets` in `FT_LORA`)
|
| 711 |
+
2. Block-level settings (e.g., `FT_LORA` over `TRAIN` for LoRA)
|
| 712 |
+
3. Global settings (e.g., `DATASET.train`)
|
| 713 |
+
|
| 714 |
+
**Example conflicts and resolution:**
|
| 715 |
+
|
| 716 |
+
**Conflict 1: Dataset specification**
|
| 717 |
+
```okt
|
| 718 |
+
DATASET {
|
| 719 |
+
train: "dataset/a.jsonl" # Lower priority
|
| 720 |
+
}
|
| 721 |
+
|
| 722 |
+
FT_LORA {
|
| 723 |
+
mix_datasets: [...] # Higher priority - overrides DATASET.train
|
| 724 |
+
}
|
| 725 |
+
```
|
| 726 |
+
**Resolution:** `mix_datasets` is used, `DATASET.train` is ignored.
|
| 727 |
+
|
| 728 |
+
**Conflict 2: TRAIN vs FT_LORA**
|
| 729 |
+
```okt
|
| 730 |
+
TRAIN {
|
| 731 |
+
epochs: 10
|
| 732 |
+
}
|
| 733 |
+
|
| 734 |
+
FT_LORA {
|
| 735 |
+
epochs: 5 # This is used for LoRA training
|
| 736 |
+
}
|
| 737 |
+
```
|
| 738 |
+
**Resolution:** `FT_LORA.epochs` is used, but `TRAIN` optimizer/device settings still apply.
|
| 739 |
+
|
| 740 |
+
**Validation:**
|
| 741 |
+
- OktoEngine validates configurations before training
|
| 742 |
+
- Conflicts are reported with clear error messages
|
| 743 |
+
- Use `okto validate` to check before training
|
| 744 |
+
|
| 745 |
+
---
|
| 746 |
+
|
| 747 |
+
## 19. How do I debug an OktoScript file?
|
| 748 |
+
|
| 749 |
+
**Answer:**
|
| 750 |
+
|
| 751 |
+
**Step 1: Validate syntax**
|
| 752 |
+
```bash
|
| 753 |
+
okto validate train.okt
|
| 754 |
+
```
|
| 755 |
+
|
| 756 |
+
**Step 2: Check logs**
|
| 757 |
+
```okt
|
| 758 |
+
LOGGING {
|
| 759 |
+
save_logs: true
|
| 760 |
+
log_level: "debug" # Enable debug logging
|
| 761 |
+
log_every: 1
|
| 762 |
+
}
|
| 763 |
+
```
|
| 764 |
+
|
| 765 |
+
**Step 3: Use MONITOR for system diagnostics**
|
| 766 |
+
```okt
|
| 767 |
+
MONITOR {
|
| 768 |
+
level: "full"
|
| 769 |
+
log_system: ["gpu_memory_used", "cpu_usage", "temperature"]
|
| 770 |
+
dashboard: true # Real-time visualization
|
| 771 |
+
}
|
| 772 |
+
```
|
| 773 |
+
|
| 774 |
+
**Step 4: Check validation errors**
|
| 775 |
+
Common errors and solutions:
|
| 776 |
+
- `Dataset file not found` → Check file paths
|
| 777 |
+
- `Invalid optimizer` → Use allowed values (adam, adamw, sgd, etc.)
|
| 778 |
+
- `Model base not found` → Verify model path or HuggingFace name
|
| 779 |
+
- `Dataset mixing weights invalid` → Total must equal 100
|
| 780 |
+
|
| 781 |
+
**Step 5: Use system diagnostics**
|
| 782 |
+
```bash
|
| 783 |
+
okto_doctor # Shows GPU, CUDA, RAM, drivers
|
| 784 |
+
```
|
| 785 |
+
|
| 786 |
+
**Best practices:**
|
| 787 |
+
- Always validate before training
|
| 788 |
+
- Start with `log_level: "debug"`
|
| 789 |
+
- Use `MONITOR` dashboard for real-time insights
|
| 790 |
+
- Check `runs/*/training_logs.json` for detailed logs
|
| 791 |
+
|
| 792 |
+
---
|
| 793 |
+
|
| 794 |
+
## 20. Is OktoScript production-ready?
|
| 795 |
+
|
| 796 |
+
**Answer:**
|
| 797 |
+
|
| 798 |
+
**Yes, OktoScript v1.1 is production-ready** for AI training and deployment pipelines.
|
| 799 |
+
|
| 800 |
+
**Production features:**
|
| 801 |
+
- ✅ **Stable grammar** - Well-defined and validated
|
| 802 |
+
- ✅ **Error handling** - Comprehensive validation
|
| 803 |
+
- ✅ **Monitoring** - System and training telemetry
|
| 804 |
+
- ✅ **Export formats** - Production-ready formats (ONNX, GGUF, OKM)
|
| 805 |
+
- ✅ **Deployment** - API, mobile, edge targets
|
| 806 |
+
- ✅ **Security** - Model encryption and watermarking
|
| 807 |
+
- ✅ **Logging** - Comprehensive logging and metrics
|
| 808 |
+
|
| 809 |
+
**Production checklist:**
|
| 810 |
+
```okt
|
| 811 |
+
PROJECT "ProductionModel"
|
| 812 |
+
VERSION "1.0"
|
| 813 |
+
|
| 814 |
+
# ... configuration ...
|
| 815 |
+
|
| 816 |
+
SECURITY {
|
| 817 |
+
encrypt_model: true
|
| 818 |
+
watermark: true
|
| 819 |
+
}
|
| 820 |
+
|
| 821 |
+
MONITOR {
|
| 822 |
+
level: "full"
|
| 823 |
+
dashboard: true
|
| 824 |
+
}
|
| 825 |
+
|
| 826 |
+
EXPORT {
|
| 827 |
+
format: ["onnx", "okm"] # Production formats
|
| 828 |
+
optimize_for: "speed"
|
| 829 |
+
}
|
| 830 |
+
|
| 831 |
+
DEPLOY {
|
| 832 |
+
target: "api"
|
| 833 |
+
requires_auth: true
|
| 834 |
+
max_concurrent_requests: 100
|
| 835 |
+
}
|
| 836 |
+
```
|
| 837 |
+
|
| 838 |
+
**Used by:**
|
| 839 |
+
- OktoSeek IDE (production)
|
| 840 |
+
- Research institutions
|
| 841 |
+
- AI development teams
|
| 842 |
+
- Educational platforms
|
| 843 |
+
|
| 844 |
+
**Version stability:**
|
| 845 |
+
- v1.0: Stable, production-ready
|
| 846 |
+
- v1.1: Backward compatible, adds LoRA and monitoring
|
| 847 |
+
|
| 848 |
+
---
|
| 849 |
+
|
| 850 |
+
## Need More Help?
|
| 851 |
+
|
| 852 |
+
- 📖 [Complete Grammar Specification](./grammar.md)
|
| 853 |
+
- 🚀 [Getting Started Guide](./GETTING_STARTED.md)
|
| 854 |
+
- ✅ [Validation Rules](../VALIDATION_RULES.md)
|
| 855 |
+
- 💡 [Examples](../examples/)
|
| 856 |
+
- 🐛 [Troubleshooting](./grammar.md#troubleshooting)
|
| 857 |
+
|
| 858 |
+
**Still have questions?** Open an issue on [GitHub](https://github.com/oktoseek/oktoscript/issues) or contact **service@oktoseek.com**.
|
| 859 |
+
|
| 860 |
+
---
|
| 861 |
+
|
| 862 |
+
**OktoScript** is developed and maintained by **OktoSeek AI**.
|
| 863 |
+
|
| 864 |
+
|
| 865 |
+
|
docs/GETTING_STARTED.md
ADDED
|
@@ -0,0 +1,199 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
| 1 |
+
# Getting Started with OktoScript
|
| 2 |
+
|
| 3 |
+
**Your first 5 minutes with OktoScript** - A quick guide to get you up and running.
|
| 4 |
+
|
| 5 |
+
---
|
| 6 |
+
|
| 7 |
+
## Prerequisites
|
| 8 |
+
|
| 9 |
+
- OktoSeek IDE installed (or OktoEngine CLI)
|
| 10 |
+
- Basic understanding of AI/ML concepts
|
| 11 |
+
- A dataset ready for training
|
| 12 |
+
|
| 13 |
+
---
|
| 14 |
+
|
| 15 |
+
## Step 1: Create Your First Project
|
| 16 |
+
|
| 17 |
+
Create a new directory for your project:
|
| 18 |
+
|
| 19 |
+
```bash
|
| 20 |
+
mkdir my-first-model
|
| 21 |
+
cd my-first-model
|
| 22 |
+
```
|
| 23 |
+
|
| 24 |
+
Create a file named `train.okt`:
|
| 25 |
+
|
| 26 |
+
```okt
|
| 27 |
+
PROJECT "MyFirstModel"
|
| 28 |
+
DESCRIPTION "My first OktoScript project"
|
| 29 |
+
|
| 30 |
+
DATASET {
|
| 31 |
+
train: "dataset/train.jsonl"
|
| 32 |
+
format: "jsonl"
|
| 33 |
+
type: "chat"
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
MODEL {
|
| 37 |
+
base: "oktoseek/base-mini"
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
TRAIN {
|
| 41 |
+
epochs: 3
|
| 42 |
+
batch_size: 16
|
| 43 |
+
device: "cpu"
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
EXPORT {
|
| 47 |
+
format: ["okm"]
|
| 48 |
+
path: "export/"
|
| 49 |
+
}
|
| 50 |
+
```
|
| 51 |
+
|
| 52 |
+
---
|
| 53 |
+
|
| 54 |
+
## Step 2: Prepare Your Dataset
|
| 55 |
+
|
| 56 |
+
Create a `dataset/` folder and add your training data:
|
| 57 |
+
|
| 58 |
+
**dataset/train.jsonl:**
|
| 59 |
+
```json
|
| 60 |
+
{"input":"Hello","output":"Hi! How can I help you?"}
|
| 61 |
+
{"input":"What's the weather?","output":"I don't have access to weather data."}
|
| 62 |
+
{"input":"Thank you","output":"You're welcome!"}
|
| 63 |
+
```
|
| 64 |
+
|
| 65 |
+
**Minimum requirements:**
|
| 66 |
+
- At least 10 examples for basic training
|
| 67 |
+
- Consistent format (JSONL recommended)
|
| 68 |
+
- Valid JSON on each line
|
| 69 |
+
|
| 70 |
+
---
|
| 71 |
+
|
| 72 |
+
## Step 3: Validate Your Configuration
|
| 73 |
+
|
| 74 |
+
Before training, validate your OktoScript file:
|
| 75 |
+
|
| 76 |
+
```bash
|
| 77 |
+
okto validate train.okt
|
| 78 |
+
```
|
| 79 |
+
|
| 80 |
+
This checks:
|
| 81 |
+
- ✅ Syntax is correct
|
| 82 |
+
- ✅ All required fields are present
|
| 83 |
+
- ✅ Dataset files exist
|
| 84 |
+
- ✅ Model paths are valid
|
| 85 |
+
- ✅ Values are within allowed ranges
|
| 86 |
+
|
| 87 |
+
---
|
| 88 |
+
|
| 89 |
+
## Step 4: Train Your Model
|
| 90 |
+
|
| 91 |
+
Run the training:
|
| 92 |
+
|
| 93 |
+
```bash
|
| 94 |
+
okto run train.okt
|
| 95 |
+
```
|
| 96 |
+
|
| 97 |
+
Or use the IDE:
|
| 98 |
+
1. Open `train.okt` in OktoSeek IDE
|
| 99 |
+
2. Click "Train" button
|
| 100 |
+
3. Monitor progress in real-time
|
| 101 |
+
|
| 102 |
+
**What happens:**
|
| 103 |
+
1. Dataset is loaded and validated
|
| 104 |
+
2. Model is initialized
|
| 105 |
+
3. Training starts (you'll see progress)
|
| 106 |
+
4. Model is saved to `runs/MyFirstModel/`
|
| 107 |
+
5. Exported models saved to `export/`
|
| 108 |
+
|
| 109 |
+
---
|
| 110 |
+
|
| 111 |
+
## Step 5: Test Your Model
|
| 112 |
+
|
| 113 |
+
After training, test with inference:
|
| 114 |
+
|
| 115 |
+
```bash
|
| 116 |
+
okto_infer --model ./runs/MyFirstModel --text "Hello"
|
| 117 |
+
```
|
| 118 |
+
|
| 119 |
+
Or add to your `.okt` file:
|
| 120 |
+
|
| 121 |
+
```okt
|
| 122 |
+
INFER {
|
| 123 |
+
input: "Hello, how are you?"
|
| 124 |
+
max_tokens: 50
|
| 125 |
+
}
|
| 126 |
+
```
|
| 127 |
+
|
| 128 |
+
---
|
| 129 |
+
|
| 130 |
+
## Common First Steps
|
| 131 |
+
|
| 132 |
+
### Adding Validation Data
|
| 133 |
+
|
| 134 |
+
```okt
|
| 135 |
+
DATASET {
|
| 136 |
+
train: "dataset/train.jsonl"
|
| 137 |
+
validation: "dataset/val.jsonl" # Add this
|
| 138 |
+
format: "jsonl"
|
| 139 |
+
}
|
| 140 |
+
```
|
| 141 |
+
|
| 142 |
+
### Using GPU
|
| 143 |
+
|
| 144 |
+
```okt
|
| 145 |
+
TRAIN {
|
| 146 |
+
epochs: 5
|
| 147 |
+
batch_size: 32
|
| 148 |
+
device: "cuda" # Change from "cpu"
|
| 149 |
+
gpu: true
|
| 150 |
+
}
|
| 151 |
+
```
|
| 152 |
+
|
| 153 |
+
### Adding Metrics
|
| 154 |
+
|
| 155 |
+
```okt
|
| 156 |
+
METRICS {
|
| 157 |
+
accuracy
|
| 158 |
+
loss
|
| 159 |
+
perplexity
|
| 160 |
+
}
|
| 161 |
+
```
|
| 162 |
+
|
| 163 |
+
### Exporting to Multiple Formats
|
| 164 |
+
|
| 165 |
+
```okt
|
| 166 |
+
EXPORT {
|
| 167 |
+
format: ["gguf", "onnx", "okm"]
|
| 168 |
+
path: "export/"
|
| 169 |
+
}
|
| 170 |
+
```
|
| 171 |
+
|
| 172 |
+
---
|
| 173 |
+
|
| 174 |
+
## Next Steps
|
| 175 |
+
|
| 176 |
+
- 📚 Read the [Complete Grammar Specification](./grammar.md)
|
| 177 |
+
- 🎯 Check out [Complex Examples](../examples/)
|
| 178 |
+
- 🔧 Learn about [Troubleshooting](./grammar.md#troubleshooting)
|
| 179 |
+
- 💡 Explore [Extension Points](./grammar.md#extension-points--hooks)
|
| 180 |
+
|
| 181 |
+
---
|
| 182 |
+
|
| 183 |
+
## Quick Reference
|
| 184 |
+
|
| 185 |
+
| Task | Command |
|
| 186 |
+
|------|---------|
|
| 187 |
+
| Validate | `okto validate train.okt` |
|
| 188 |
+
| Train | `okto run train.okt` |
|
| 189 |
+
| Infer | `okto_infer --model ./runs/model --text "input"` |
|
| 190 |
+
| Evaluate | `okto_eval --model ./runs/model --dataset ./dataset/test.jsonl` |
|
| 191 |
+
| Export | `okto export --format gguf` |
|
| 192 |
+
| Deploy | `okto_deploy --model model --target api` |
|
| 193 |
+
|
| 194 |
+
---
|
| 195 |
+
|
| 196 |
+
**Need help?** Check the [Troubleshooting Guide](./grammar.md#troubleshooting) or open an issue on [GitHub](https://github.com/oktoseek/oktoscript).
|
| 197 |
+
|
| 198 |
+
|
| 199 |
+
|
docs/grammar.md
ADDED
|
@@ -0,0 +1,2571 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# OktoScript Grammar Specification v1.2
|
| 2 |
+
|
| 3 |
+
Complete formal grammar for the OktoScript language, developed by **OktoSeek AI**.
|
| 4 |
+
|
| 5 |
+
> **Version Compatibility:** This specification covers OktoScript v1.2, which is 100% backward compatible with v1.0 and v1.1. Files without version declaration default to v1.0.
|
| 6 |
+
|
| 7 |
+
---
|
| 8 |
+
|
| 9 |
+
## Table of Contents
|
| 10 |
+
|
| 11 |
+
1. [Grammar Overview](#grammar-overview)
|
| 12 |
+
2. [Basic Metadata Blocks](#basic-metadata-blocks)
|
| 13 |
+
3. [ENV Block](#env-block)
|
| 14 |
+
4. [DATASET Block](#dataset-block)
|
| 15 |
+
5. [MODEL Block](#model-block)
|
| 16 |
+
6. [TRAIN Block](#train-block)
|
| 17 |
+
7. [METRICS Block](#metrics-block)
|
| 18 |
+
8. [VALIDATION Block](#validation-block)
|
| 19 |
+
9. [INFERENCE Block](#inference-block)
|
| 20 |
+
10. [CONTROL Block — Decision Engine](#control-block--decision-engine)
|
| 21 |
+
11. [MONITOR Block — Full Metrics Support](#monitor-block--full-metrics-support)
|
| 22 |
+
12. [GUARD Block — Safety / Ethics / Protection](#guard-block--safety--ethics--protection)
|
| 23 |
+
13. [BEHAVIOR Block — Model Personality](#behavior-block--model-personality)
|
| 24 |
+
14. [EXPLORER Block — Parameter Search](#explorer-block--parameter-search)
|
| 25 |
+
15. [STABILITY Block — Training Safety](#stability-block--training-safety)
|
| 26 |
+
16. [Boolean Support](#boolean-support)
|
| 27 |
+
17. [EXPORT Block](#export-block)
|
| 28 |
+
18. [DEPLOY Block](#deploy-block)
|
| 29 |
+
19. [SECURITY Block](#security-block)
|
| 30 |
+
20. [LOGGING Block](#logging-block)
|
| 31 |
+
21. [Model Inheritance](#model-inheritance)
|
| 32 |
+
22. [Extension Points & Hooks](#extension-points--hooks)
|
| 33 |
+
23. [Validation Rules](#validation-rules)
|
| 34 |
+
24. [Troubleshooting](#troubleshooting)
|
| 35 |
+
25. [Terminal / Basic Types](#terminal--basic-types)
|
| 36 |
+
26. [Full Script Example](#full-script-example)
|
| 37 |
+
|
| 38 |
+
---
|
| 39 |
+
|
| 40 |
+
## Grammar Overview
|
| 41 |
+
|
| 42 |
+
```ebnf
|
| 43 |
+
<oktoscript> ::=
|
| 44 |
+
[<version_declaration>]
|
| 45 |
+
<project_block>
|
| 46 |
+
[<description_block>]
|
| 47 |
+
[<version_block>]
|
| 48 |
+
[<tags_block>]
|
| 49 |
+
[<author_block>]
|
| 50 |
+
[<env_block>]
|
| 51 |
+
<dataset_block>
|
| 52 |
+
<model_block>
|
| 53 |
+
[<train_block> | <ft_lora_block>]
|
| 54 |
+
[<metrics_block>]
|
| 55 |
+
[<validation_block>]
|
| 56 |
+
[<inference_block>]
|
| 57 |
+
[<export_block>]
|
| 58 |
+
[<deploy_block>]
|
| 59 |
+
[<security_block>]
|
| 60 |
+
[<logging_block>]
|
| 61 |
+
[<monitor_block>]
|
| 62 |
+
[<control_block>]
|
| 63 |
+
[<guard_block>]
|
| 64 |
+
[<behavior_block>]
|
| 65 |
+
[<explorer_block>]
|
| 66 |
+
[<stability_block>]
|
| 67 |
+
[<hooks_block>]
|
| 68 |
+
```
|
| 69 |
+
|
| 70 |
+
**Note:** `TRAIN` and `FT_LORA` are mutually exclusive. Use `FT_LORA` for LoRA-based fine-tuning, or `TRAIN` for full fine-tuning.
|
| 71 |
+
|
| 72 |
+
**Required blocks:** PROJECT, DATASET, MODEL, TRAIN
|
| 73 |
+
**Optional blocks:** ENV, DESCRIPTION, VERSION, TAGS, AUTHOR, and all others
|
| 74 |
+
|
| 75 |
+
---
|
| 76 |
+
|
| 77 |
+
## Version Declaration (v1.1+)
|
| 78 |
+
|
| 79 |
+
```ebnf
|
| 80 |
+
<version_declaration> ::=
|
| 81 |
+
"# okto_version:" <string>
|
| 82 |
+
```
|
| 83 |
+
|
| 84 |
+
**Example:**
|
| 85 |
+
```okt
|
| 86 |
+
# okto_version: "1.2"
|
| 87 |
+
PROJECT "MyModel"
|
| 88 |
+
...
|
| 89 |
+
```
|
| 90 |
+
|
| 91 |
+
**Rules:**
|
| 92 |
+
- Optional at the top of the file
|
| 93 |
+
- If missing, defaults to v1.0
|
| 94 |
+
- Must be the first line (comments allowed before)
|
| 95 |
+
- Format: `# okto_version: "1.2"`, `# okto_version: "1.1"`, or `# okto_version: "1.0"`
|
| 96 |
+
|
| 97 |
+
---
|
| 98 |
+
|
| 99 |
+
## Basic Metadata Blocks
|
| 100 |
+
|
| 101 |
+
### PROJECT Block
|
| 102 |
+
|
| 103 |
+
```ebnf
|
| 104 |
+
<project_block> ::=
|
| 105 |
+
"PROJECT" <string>
|
| 106 |
+
```
|
| 107 |
+
|
| 108 |
+
**Constraints:**
|
| 109 |
+
- Project name must be a valid string (1-100 characters)
|
| 110 |
+
- Cannot contain special characters: `{`, `}`, `[`, `]`, `:`, `"`
|
| 111 |
+
|
| 112 |
+
**Example:**
|
| 113 |
+
```okt
|
| 114 |
+
PROJECT "PizzaBot"
|
| 115 |
+
```
|
| 116 |
+
|
| 117 |
+
### DESCRIPTION Block
|
| 118 |
+
|
| 119 |
+
```ebnf
|
| 120 |
+
<description_block> ::=
|
| 121 |
+
"DESCRIPTION" <string>
|
| 122 |
+
```
|
| 123 |
+
|
| 124 |
+
**Constraints:**
|
| 125 |
+
- Maximum 500 characters
|
| 126 |
+
- Can contain any UTF-8 characters
|
| 127 |
+
|
| 128 |
+
**Example:**
|
| 129 |
+
```okt
|
| 130 |
+
DESCRIPTION "AI specialized in pizza restaurant service"
|
| 131 |
+
```
|
| 132 |
+
|
| 133 |
+
### VERSION Block
|
| 134 |
+
|
| 135 |
+
```ebnf
|
| 136 |
+
<version_block> ::=
|
| 137 |
+
"VERSION" <string>
|
| 138 |
+
```
|
| 139 |
+
|
| 140 |
+
**Constraints:**
|
| 141 |
+
- Must follow semantic versioning (e.g., "1.0.0", "2.1.3")
|
| 142 |
+
- Format: `major.minor.patch` or `major.minor`
|
| 143 |
+
|
| 144 |
+
**Example:**
|
| 145 |
+
```okt
|
| 146 |
+
VERSION "1.0"
|
| 147 |
+
VERSION "2.1.3"
|
| 148 |
+
```
|
| 149 |
+
|
| 150 |
+
### TAGS Block
|
| 151 |
+
|
| 152 |
+
```ebnf
|
| 153 |
+
<tags_block> ::=
|
| 154 |
+
"TAGS" "[" <string_list> "]"
|
| 155 |
+
```
|
| 156 |
+
|
| 157 |
+
**Constraints:**
|
| 158 |
+
- Maximum 10 tags
|
| 159 |
+
- Each tag: 1-50 characters
|
| 160 |
+
- Tags are case-insensitive
|
| 161 |
+
|
| 162 |
+
**Example:**
|
| 163 |
+
```okt
|
| 164 |
+
TAGS ["food", "restaurant", "chatbot"]
|
| 165 |
+
```
|
| 166 |
+
|
| 167 |
+
### AUTHOR Block
|
| 168 |
+
|
| 169 |
+
```ebnf
|
| 170 |
+
<author_block> ::=
|
| 171 |
+
"AUTHOR" <string>
|
| 172 |
+
```
|
| 173 |
+
|
| 174 |
+
**Example:**
|
| 175 |
+
```okt
|
| 176 |
+
AUTHOR "OktoSeek"
|
| 177 |
+
```
|
| 178 |
+
|
| 179 |
+
---
|
| 180 |
+
|
| 181 |
+
## ENV Block
|
| 182 |
+
|
| 183 |
+
The `ENV` block defines environment requirements, hardware expectations, and execution preferences for OktoEngine. It is fully abstract and does not expose underlying implementation details (Python, PyTorch, TensorFlow, etc.). OktoEngine uses this block to configure the execution environment before running any training or inference operations.
|
| 184 |
+
|
| 185 |
+
**Purpose:**
|
| 186 |
+
- Define minimum environment requirements for a project
|
| 187 |
+
- Specify hardware preferences (CPU, GPU, TPU)
|
| 188 |
+
- Set memory and precision requirements
|
| 189 |
+
- Configure execution backend preferences
|
| 190 |
+
- Enable automatic dependency installation
|
| 191 |
+
- Specify platform and network requirements
|
| 192 |
+
|
| 193 |
+
**Note:** ENV is not a dependency list. It is a high-level execution requirement description that allows OktoEngine to decide how to configure the real execution environment.
|
| 194 |
+
|
| 195 |
+
### ENV Block Syntax
|
| 196 |
+
|
| 197 |
+
```ebnf
|
| 198 |
+
<env_block> ::=
|
| 199 |
+
"ENV" "{"
|
| 200 |
+
[<env_accelerator>]
|
| 201 |
+
[<env_min_memory>]
|
| 202 |
+
[<env_precision>]
|
| 203 |
+
[<env_backend>]
|
| 204 |
+
[<env_install_missing>]
|
| 205 |
+
[<env_platform>]
|
| 206 |
+
[<env_network>]
|
| 207 |
+
"}"
|
| 208 |
+
|
| 209 |
+
<env_accelerator> ::=
|
| 210 |
+
"accelerator" ":" ("auto" | "cpu" | "gpu" | "tpu")
|
| 211 |
+
|
| 212 |
+
<env_min_memory> ::=
|
| 213 |
+
"min_memory" ":" <memory_string>
|
| 214 |
+
|
| 215 |
+
<memory_string> ::=
|
| 216 |
+
"4GB" | "8GB" | "16GB" | "32GB" | "64GB"
|
| 217 |
+
|
| 218 |
+
<env_precision> ::=
|
| 219 |
+
"precision" ":" ("auto" | "fp16" | "fp32" | "bf16")
|
| 220 |
+
|
| 221 |
+
<env_backend> ::=
|
| 222 |
+
"backend" ":" ("auto" | "oktoseek")
|
| 223 |
+
|
| 224 |
+
<env_install_missing> ::=
|
| 225 |
+
"install_missing" ":" ("true" | "false")
|
| 226 |
+
|
| 227 |
+
<env_platform> ::=
|
| 228 |
+
"platform" ":" ("windows" | "linux" | "mac" | "any")
|
| 229 |
+
|
| 230 |
+
<env_network> ::=
|
| 231 |
+
"network" ":" ("online" | "offline" | "required")
|
| 232 |
+
```
|
| 233 |
+
|
| 234 |
+
### ENV Block Fields
|
| 235 |
+
|
| 236 |
+
| Field | Type | Required | Default | Description |
|
| 237 |
+
|-------|------|----------|---------|-------------|
|
| 238 |
+
| `accelerator` | enum | ❌ No | `"auto"` | Preferred compute unit: `"auto"`, `"cpu"`, `"gpu"`, `"tpu"` |
|
| 239 |
+
| `min_memory` | string | ❌ No | `"8GB"` | Required minimum RAM: `"4GB"`, `"8GB"`, `"16GB"`, `"32GB"`, `"64GB"` |
|
| 240 |
+
| `precision` | enum | ❌ No | `"auto"` | Numerical precision: `"auto"`, `"fp16"`, `"fp32"`, `"bf16"` |
|
| 241 |
+
| `backend` | enum | ❌ No | `"auto"` | Execution engine: `"auto"`, `"oktoseek"` |
|
| 242 |
+
| `install_missing` | boolean | ❌ No | `false` | If `true`, engine attempts automatic dependency installation |
|
| 243 |
+
| `platform` | enum | ❌ No | `"any"` | Target OS: `"windows"`, `"linux"`, `"mac"`, `"any"` |
|
| 244 |
+
| `network` | enum | ❌ No | `"online"` | Internet requirement: `"online"`, `"offline"`, `"required"` |
|
| 245 |
+
|
| 246 |
+
### ENV Block Examples
|
| 247 |
+
|
| 248 |
+
**Minimal ENV (uses defaults):**
|
| 249 |
+
```okt
|
| 250 |
+
ENV {
|
| 251 |
+
accelerator: "gpu"
|
| 252 |
+
min_memory: "8GB"
|
| 253 |
+
}
|
| 254 |
+
```
|
| 255 |
+
|
| 256 |
+
**Complete ENV configuration:**
|
| 257 |
+
```okt
|
| 258 |
+
ENV {
|
| 259 |
+
accelerator: "gpu"
|
| 260 |
+
min_memory: "16GB"
|
| 261 |
+
precision: "fp16"
|
| 262 |
+
backend: "oktoseek"
|
| 263 |
+
install_missing: true
|
| 264 |
+
platform: "any"
|
| 265 |
+
network: "online"
|
| 266 |
+
}
|
| 267 |
+
```
|
| 268 |
+
|
| 269 |
+
**CPU-only training:**
|
| 270 |
+
```okt
|
| 271 |
+
ENV {
|
| 272 |
+
accelerator: "cpu"
|
| 273 |
+
min_memory: "8GB"
|
| 274 |
+
precision: "fp32"
|
| 275 |
+
install_missing: true
|
| 276 |
+
}
|
| 277 |
+
```
|
| 278 |
+
|
| 279 |
+
**Offline execution:**
|
| 280 |
+
```okt
|
| 281 |
+
ENV {
|
| 282 |
+
accelerator: "gpu"
|
| 283 |
+
min_memory: "16GB"
|
| 284 |
+
network: "offline"
|
| 285 |
+
install_missing: false
|
| 286 |
+
}
|
| 287 |
+
```
|
| 288 |
+
|
| 289 |
+
### ENV Block Constraints
|
| 290 |
+
|
| 291 |
+
1. **Memory format:** Must use `GB` suffix (e.g., `"8GB"`, not `"8"` or `"8 GB"`)
|
| 292 |
+
2. **Enum values:** Only predefined values are allowed
|
| 293 |
+
3. **Boolean values:** Must be `true` or `false` (lowercase)
|
| 294 |
+
4. **String values:** Must be quoted
|
| 295 |
+
|
| 296 |
+
### ENV Block Validation Rules
|
| 297 |
+
|
| 298 |
+
1. If `accelerator = "gpu"` and `min_memory < "8GB"` → **warning** (GPU training typically requires at least 8GB)
|
| 299 |
+
2. If `network = "offline"` → export formats like `onnx` or `gguf` are allowed (pre-downloaded models)
|
| 300 |
+
3. If `backend = "oktoseek"` → preferred default for OktoSeek ecosystem
|
| 301 |
+
4. If `install_missing = true` → engine must attempt auto-setup of missing dependencies
|
| 302 |
+
5. If no ENV block exists → defaults to:
|
| 303 |
+
```okt
|
| 304 |
+
ENV {
|
| 305 |
+
accelerator: "auto"
|
| 306 |
+
min_memory: "8GB"
|
| 307 |
+
backend: "auto"
|
| 308 |
+
}
|
| 309 |
+
```
|
| 310 |
+
|
| 311 |
+
### Engine Behavior
|
| 312 |
+
|
| 313 |
+
When OktoEngine encounters an ENV block, it must:
|
| 314 |
+
|
| 315 |
+
1. **Read ENV block first:** Before any other stage (dataset loading, model initialization, etc.)
|
| 316 |
+
2. **Check system compatibility:** Verify RAM, GPU availability, platform, etc.
|
| 317 |
+
3. **Return detailed errors:** If system is incompatible, return specific error messages
|
| 318 |
+
4. **Auto-install dependencies:** If `install_missing: true`, attempt automatic setup
|
| 319 |
+
5. **Generate environment report:** Log analysis to `runs/{model}/env_report.json`
|
| 320 |
+
|
| 321 |
+
**Example env_report.json:**
|
| 322 |
+
```json
|
| 323 |
+
{
|
| 324 |
+
"gpu_found": true,
|
| 325 |
+
"gpu_name": "NVIDIA RTX 3090",
|
| 326 |
+
"ram": "32GB",
|
| 327 |
+
"ram_available": "28GB",
|
| 328 |
+
"platform": "linux",
|
| 329 |
+
"status": "compatible",
|
| 330 |
+
"auto_install": true,
|
| 331 |
+
"warnings": []
|
| 332 |
+
}
|
| 333 |
+
```
|
| 334 |
+
|
| 335 |
+
---
|
| 336 |
+
|
| 337 |
+
## DATASET Block
|
| 338 |
+
|
| 339 |
+
```ebnf
|
| 340 |
+
<dataset_block> ::=
|
| 341 |
+
"DATASET" "{"
|
| 342 |
+
[<dataset_train> | <mix_datasets>]
|
| 343 |
+
[<dataset_validation>]
|
| 344 |
+
[<dataset_test>]
|
| 345 |
+
[<dataset_format>]
|
| 346 |
+
[<dataset_type>]
|
| 347 |
+
[<dataset_language>]
|
| 348 |
+
[<dataset_augmentation>]
|
| 349 |
+
[<dataset_percent>]
|
| 350 |
+
[<dataset_sampling>]
|
| 351 |
+
[<dataset_shuffle>]
|
| 352 |
+
"}"
|
| 353 |
+
|
| 354 |
+
<dataset_train> ::=
|
| 355 |
+
"train" ":" <path>
|
| 356 |
+
|
| 357 |
+
<dataset_validation> ::=
|
| 358 |
+
"validation" ":" <path>
|
| 359 |
+
|
| 360 |
+
<dataset_test> ::=
|
| 361 |
+
"test" ":" <path>
|
| 362 |
+
|
| 363 |
+
<dataset_format> ::=
|
| 364 |
+
"format" ":" ("jsonl" | "csv" | "txt" | "parquet" | "image+caption" | "qa" | "instruction" | "multimodal")
|
| 365 |
+
|
| 366 |
+
<dataset_type> ::=
|
| 367 |
+
"type" ":" ("classification" | "generation" | "qa" | "chat" | "vision" | "regression")
|
| 368 |
+
|
| 369 |
+
<dataset_language> ::=
|
| 370 |
+
"language" ":" ("en" | "pt" | "es" | "fr" | "multilingual")
|
| 371 |
+
|
| 372 |
+
<dataset_augmentation> ::=
|
| 373 |
+
"augmentation" ":" "[" <string_list> "]"
|
| 374 |
+
|
| 375 |
+
<dataset_percent> ::=
|
| 376 |
+
"dataset_percent" ":" <number>
|
| 377 |
+
|
| 378 |
+
<mix_datasets> ::=
|
| 379 |
+
"mix_datasets" ":" "[" <mix_dataset_list> "]"
|
| 380 |
+
|
| 381 |
+
<mix_dataset_list> ::=
|
| 382 |
+
<mix_dataset_item> { "," <mix_dataset_item> }
|
| 383 |
+
|
| 384 |
+
<mix_dataset_item> ::=
|
| 385 |
+
"{" "path" ":" <path> "," "weight" ":" <number> "}"
|
| 386 |
+
|
| 387 |
+
<dataset_sampling> ::=
|
| 388 |
+
"sampling" ":" ("weighted" | "random")
|
| 389 |
+
|
| 390 |
+
<dataset_shuffle> ::=
|
| 391 |
+
"shuffle" ":" ("true" | "false")
|
| 392 |
+
```
|
| 393 |
+
|
| 394 |
+
**Allowed augmentation values:**
|
| 395 |
+
- `"flip"` - Horizontal/vertical flip
|
| 396 |
+
- `"rotate"` - Random rotation
|
| 397 |
+
- `"brightness"` - Brightness adjustment
|
| 398 |
+
- `"contrast"` - Contrast adjustment
|
| 399 |
+
- `"noise"` - Add noise
|
| 400 |
+
- `"crop"` - Random cropping
|
| 401 |
+
- `"translate"` - Translation
|
| 402 |
+
|
| 403 |
+
**Validation Rules:**
|
| 404 |
+
- `train` path must exist and be readable
|
| 405 |
+
- File format must match declared `format`
|
| 406 |
+
- For `image+caption`, path must be a directory
|
| 407 |
+
- For JSONL/CSV, path must be a file
|
| 408 |
+
|
| 409 |
+
**Example (v1.0):**
|
| 410 |
+
```okt
|
| 411 |
+
DATASET {
|
| 412 |
+
train: "dataset/train.jsonl"
|
| 413 |
+
validation: "dataset/val.jsonl"
|
| 414 |
+
test: "dataset/test.jsonl"
|
| 415 |
+
format: "jsonl"
|
| 416 |
+
type: "chat"
|
| 417 |
+
language: "en"
|
| 418 |
+
augmentation: ["flip", "rotate", "brightness"]
|
| 419 |
+
}
|
| 420 |
+
```
|
| 421 |
+
|
| 422 |
+
**Example (v1.1 - Dataset Mixing):**
|
| 423 |
+
```okt
|
| 424 |
+
DATASET {
|
| 425 |
+
mix_datasets: [
|
| 426 |
+
{ path: "dataset/base.jsonl", weight: 70 },
|
| 427 |
+
{ path: "dataset/extra.jsonl", weight: 30 }
|
| 428 |
+
]
|
| 429 |
+
dataset_percent: 50
|
| 430 |
+
sampling: "weighted"
|
| 431 |
+
shuffle: true
|
| 432 |
+
format: "jsonl"
|
| 433 |
+
type: "chat"
|
| 434 |
+
}
|
| 435 |
+
```
|
| 436 |
+
|
| 437 |
+
**Dataset Mixing Rules:**
|
| 438 |
+
- If `mix_datasets` is specified, it overrides `train`
|
| 439 |
+
- Total weights in `mix_datasets` must equal 100
|
| 440 |
+
- `dataset_percent` limits total dataset usage (1-100)
|
| 441 |
+
- `sampling: "weighted"` uses weights for sampling, `"random"` ignores weights
|
| 442 |
+
- `shuffle` controls whether datasets are shuffled before mixing
|
| 443 |
+
|
| 444 |
+
---
|
| 445 |
+
|
| 446 |
+
## MODEL Block
|
| 447 |
+
|
| 448 |
+
```ebnf
|
| 449 |
+
<model_block> ::=
|
| 450 |
+
"MODEL" "{"
|
| 451 |
+
[<model_name>]
|
| 452 |
+
<model_base>
|
| 453 |
+
[<model_architecture>]
|
| 454 |
+
[<model_parameters>]
|
| 455 |
+
[<model_context_window>]
|
| 456 |
+
[<model_precision>]
|
| 457 |
+
[<model_inherit>]
|
| 458 |
+
[<model_device>]
|
| 459 |
+
[<adapter_block>]
|
| 460 |
+
"}"
|
| 461 |
+
|
| 462 |
+
<model_name> ::=
|
| 463 |
+
"name" ":" <string>
|
| 464 |
+
|
| 465 |
+
<model_base> ::=
|
| 466 |
+
"base" ":" <string>
|
| 467 |
+
|
| 468 |
+
<model_architecture> ::=
|
| 469 |
+
"architecture" ":" ("transformer" | "cnn" | "rnn" | "diffusion" | "vision-transformer" | "bert" | "gpt" | "t5")
|
| 470 |
+
|
| 471 |
+
<model_parameters> ::=
|
| 472 |
+
"parameters" ":" <number> ("M" | "B" | "K")
|
| 473 |
+
|
| 474 |
+
<model_context_window> ::=
|
| 475 |
+
"context_window" ":" <number>
|
| 476 |
+
|
| 477 |
+
<model_precision> ::=
|
| 478 |
+
"precision" ":" ("fp32" | "fp16" | "int8" | "int4")
|
| 479 |
+
|
| 480 |
+
<model_inherit> ::=
|
| 481 |
+
"inherit" ":" <string>
|
| 482 |
+
|
| 483 |
+
<model_device> ::=
|
| 484 |
+
"device" ":" ("cuda" | "cpu" | "mps" | "auto")
|
| 485 |
+
|
| 486 |
+
<adapter_block> ::=
|
| 487 |
+
"ADAPTER" "{"
|
| 488 |
+
<adapter_type>
|
| 489 |
+
<adapter_path>
|
| 490 |
+
[<adapter_rank>]
|
| 491 |
+
[<adapter_alpha>]
|
| 492 |
+
"}"
|
| 493 |
+
|
| 494 |
+
<adapter_type> ::=
|
| 495 |
+
"type" ":" ("lora" | "qlora" | "adapter" | "peft")
|
| 496 |
+
|
| 497 |
+
<adapter_path> ::=
|
| 498 |
+
"path" ":" <path>
|
| 499 |
+
|
| 500 |
+
<adapter_rank> ::=
|
| 501 |
+
"rank" ":" <number>
|
| 502 |
+
|
| 503 |
+
<adapter_alpha> ::=
|
| 504 |
+
"alpha" ":" <number>
|
| 505 |
+
```
|
| 506 |
+
|
| 507 |
+
**Model Inheritance:**
|
| 508 |
+
- `inherit` allows reusing configuration from another model
|
| 509 |
+
- Inherited model must be defined in the same project or imported
|
| 510 |
+
- Child model can override any parent field
|
| 511 |
+
- Example: `inherit: "base-transformer"` loads base config, then applies current block
|
| 512 |
+
|
| 513 |
+
**Allowed base model formats:**
|
| 514 |
+
- HuggingFace format: `"username/model-name"`
|
| 515 |
+
- OktoSeek format: `"oktoseek/model-name"`
|
| 516 |
+
- Local path: `"./models/my-model"`
|
| 517 |
+
- URL: `"https://example.com/model"`
|
| 518 |
+
|
| 519 |
+
**Parameter constraints:**
|
| 520 |
+
- `parameters`: Must be positive number with suffix (K, M, B)
|
| 521 |
+
- `context_window`: Must be power of 2 (128, 256, 512, 1024, 2048, 4096, 8192)
|
| 522 |
+
- `precision`: Must match device capabilities
|
| 523 |
+
|
| 524 |
+
**Example:**
|
| 525 |
+
```okt
|
| 526 |
+
MODEL {
|
| 527 |
+
name: "oktogpt"
|
| 528 |
+
base: "oktoseek/pizza-small"
|
| 529 |
+
architecture: "transformer"
|
| 530 |
+
parameters: 120M
|
| 531 |
+
context_window: 2048
|
| 532 |
+
precision: "fp16"
|
| 533 |
+
device: "cuda"
|
| 534 |
+
}
|
| 535 |
+
```
|
| 536 |
+
|
| 537 |
+
**Example with ADAPTER (LoRA/PEFT support):**
|
| 538 |
+
```okt
|
| 539 |
+
MODEL {
|
| 540 |
+
name: "oktogpt"
|
| 541 |
+
base: "google/flan-t5-base"
|
| 542 |
+
device: "cuda"
|
| 543 |
+
|
| 544 |
+
ADAPTER {
|
| 545 |
+
type: "lora"
|
| 546 |
+
path: "D:/model_trainee/phase1_sharegpt/ep2"
|
| 547 |
+
rank: 16
|
| 548 |
+
alpha: 32
|
| 549 |
+
}
|
| 550 |
+
}
|
| 551 |
+
```
|
| 552 |
+
|
| 553 |
+
**Example with inheritance:**
|
| 554 |
+
```okt
|
| 555 |
+
# Base model definition
|
| 556 |
+
MODEL "base-transformer" {
|
| 557 |
+
architecture: "transformer"
|
| 558 |
+
context_window: 2048
|
| 559 |
+
precision: "fp16"
|
| 560 |
+
}
|
| 561 |
+
|
| 562 |
+
# Child model inheriting from base
|
| 563 |
+
MODEL {
|
| 564 |
+
inherit: "base-transformer"
|
| 565 |
+
base: "oktoseek/custom-model"
|
| 566 |
+
parameters: 250M
|
| 567 |
+
}
|
| 568 |
+
```
|
| 569 |
+
|
| 570 |
+
**ADAPTER Block:**
|
| 571 |
+
The `ADAPTER` sub-block enables parameter-efficient fine-tuning methods such as LoRA, QLoRA, PEFT, or other adapters. If an `ADAPTER` is defined, it is applied after the base model is loaded by the engine.
|
| 572 |
+
|
| 573 |
+
**Adapter constraints:**
|
| 574 |
+
- `type`: Must be one of `"lora"`, `"qlora"`, `"adapter"`, or `"peft"`
|
| 575 |
+
- `path`: Must point to a valid adapter directory or file
|
| 576 |
+
- `rank`: Optional, typically 4, 8, 16, 32, or 64 (for LoRA)
|
| 577 |
+
- `alpha`: Optional, typically 16, 32, or 64 (for LoRA scaling)
|
| 578 |
+
|
| 579 |
+
---
|
| 580 |
+
|
| 581 |
+
## FT_LORA Block (v1.1+)
|
| 582 |
+
|
| 583 |
+
Fine-tuning using LoRA (Low-Rank Adaptation) adapters. This block is an alternative to `TRAIN` for efficient fine-tuning.
|
| 584 |
+
|
| 585 |
+
```ebnf
|
| 586 |
+
<ft_lora_block> ::=
|
| 587 |
+
"FT_LORA" "{"
|
| 588 |
+
<ft_lora_base_model>
|
| 589 |
+
<ft_lora_train_dataset>
|
| 590 |
+
<ft_lora_rank>
|
| 591 |
+
<ft_lora_alpha>
|
| 592 |
+
[<ft_lora_dataset_percent>]
|
| 593 |
+
[<ft_lora_mix_datasets>]
|
| 594 |
+
[<ft_lora_epochs>]
|
| 595 |
+
[<ft_lora_batch_size>]
|
| 596 |
+
[<ft_lora_learning_rate>]
|
| 597 |
+
[<ft_lora_device>]
|
| 598 |
+
[<ft_lora_target_modules>]
|
| 599 |
+
"}"
|
| 600 |
+
|
| 601 |
+
<ft_lora_base_model> ::=
|
| 602 |
+
"base_model" ":" <string>
|
| 603 |
+
|
| 604 |
+
<ft_lora_train_dataset> ::=
|
| 605 |
+
"train_dataset" ":" <path>
|
| 606 |
+
|
| 607 |
+
<ft_lora_rank> ::=
|
| 608 |
+
"lora_rank" ":" <number>
|
| 609 |
+
|
| 610 |
+
<ft_lora_alpha> ::=
|
| 611 |
+
"lora_alpha" ":" <number>
|
| 612 |
+
|
| 613 |
+
<ft_lora_dataset_percent> ::=
|
| 614 |
+
"dataset_percent" ":" <number>
|
| 615 |
+
|
| 616 |
+
<ft_lora_mix_datasets> ::=
|
| 617 |
+
"mix_datasets" ":" "[" <mix_dataset_list> "]"
|
| 618 |
+
|
| 619 |
+
<ft_lora_epochs> ::=
|
| 620 |
+
"epochs" ":" <number>
|
| 621 |
+
|
| 622 |
+
<ft_lora_batch_size> ::=
|
| 623 |
+
"batch_size" ":" <number>
|
| 624 |
+
|
| 625 |
+
<ft_lora_learning_rate> ::=
|
| 626 |
+
"learning_rate" ":" <decimal>
|
| 627 |
+
|
| 628 |
+
<ft_lora_device> ::=
|
| 629 |
+
"device" ":" ("cpu" | "cuda" | "mps" | "auto")
|
| 630 |
+
|
| 631 |
+
<ft_lora_target_modules> ::=
|
| 632 |
+
"target_modules" ":" "[" <string_list> "]"
|
| 633 |
+
```
|
| 634 |
+
|
| 635 |
+
**Constraints:**
|
| 636 |
+
- `lora_rank`: Must be > 0 and <= 256 (typical: 4, 8, 16, 32)
|
| 637 |
+
- `lora_alpha`: Must be > 0 (typical: 16, 32, 64)
|
| 638 |
+
- `dataset_percent`: Must be 1-100
|
| 639 |
+
- If `mix_datasets` is specified, it overrides `train_dataset`
|
| 640 |
+
- Total weights in `mix_datasets` must equal 100
|
| 641 |
+
|
| 642 |
+
**Example:**
|
| 643 |
+
```okt
|
| 644 |
+
FT_LORA {
|
| 645 |
+
base_model: "oktoseek/base-mini"
|
| 646 |
+
train_dataset: "dataset/main.jsonl"
|
| 647 |
+
lora_rank: 4
|
| 648 |
+
lora_alpha: 16
|
| 649 |
+
dataset_percent: 50
|
| 650 |
+
mix_datasets: [
|
| 651 |
+
{ path: "dataset/base.jsonl", weight: 70 },
|
| 652 |
+
{ path: "dataset/extra.jsonl", weight: 30 }
|
| 653 |
+
]
|
| 654 |
+
epochs: 3
|
| 655 |
+
batch_size: 16
|
| 656 |
+
learning_rate: 0.00003
|
| 657 |
+
device: "cuda"
|
| 658 |
+
target_modules: ["q_proj", "v_proj"]
|
| 659 |
+
}
|
| 660 |
+
```
|
| 661 |
+
|
| 662 |
+
**When to use FT_LORA vs TRAIN:**
|
| 663 |
+
- **FT_LORA**: Efficient fine-tuning, smaller memory footprint, faster training, good for domain adaptation
|
| 664 |
+
- **TRAIN**: Full fine-tuning, maximum flexibility, better for large architectural changes
|
| 665 |
+
|
| 666 |
+
---
|
| 667 |
+
|
| 668 |
+
## TRAIN Block
|
| 669 |
+
|
| 670 |
+
```ebnf
|
| 671 |
+
<train_block> ::=
|
| 672 |
+
"TRAIN" "{"
|
| 673 |
+
<train_epochs>
|
| 674 |
+
<train_batch>
|
| 675 |
+
[<train_lr>]
|
| 676 |
+
[<train_optimizer>]
|
| 677 |
+
[<train_scheduler>]
|
| 678 |
+
<train_device>
|
| 679 |
+
[<gradient_accumulation>]
|
| 680 |
+
[<early_stopping>]
|
| 681 |
+
[<checkpoint_steps>]
|
| 682 |
+
[<checkpoint_path>]
|
| 683 |
+
[<resume_from_checkpoint>]
|
| 684 |
+
[<loss_function>]
|
| 685 |
+
[<weight_decay>]
|
| 686 |
+
[<gradient_clip>]
|
| 687 |
+
[<warmup_steps>]
|
| 688 |
+
[<save_strategy>]
|
| 689 |
+
"}"
|
| 690 |
+
|
| 691 |
+
<train_epochs> ::=
|
| 692 |
+
"epochs" ":" <number>
|
| 693 |
+
|
| 694 |
+
<train_batch> ::=
|
| 695 |
+
"batch_size" ":" <number>
|
| 696 |
+
|
| 697 |
+
<train_lr> ::=
|
| 698 |
+
"learning_rate" ":" <decimal>
|
| 699 |
+
|
| 700 |
+
<train_optimizer> ::=
|
| 701 |
+
"optimizer" ":" ( "adam" | "adamw" | "sgd" | "rmsprop" | "adafactor" | "lamb" )
|
| 702 |
+
|
| 703 |
+
<train_scheduler> ::=
|
| 704 |
+
"scheduler" ":" ("linear" | "cosine" | "cosine_with_restarts" | "polynomial" | "constant" | "constant_with_warmup" | "step")
|
| 705 |
+
|
| 706 |
+
<train_device> ::=
|
| 707 |
+
"device" ":" ("cpu" | "cuda" | "mps" | "auto")
|
| 708 |
+
|
| 709 |
+
<gradient_accumulation> ::=
|
| 710 |
+
"gradient_accumulation" ":" <number>
|
| 711 |
+
|
| 712 |
+
<early_stopping> ::=
|
| 713 |
+
"early_stopping" ":" ("true" | "false")
|
| 714 |
+
|
| 715 |
+
<checkpoint_steps> ::=
|
| 716 |
+
"checkpoint_steps" ":" <number>
|
| 717 |
+
|
| 718 |
+
<checkpoint_path> ::=
|
| 719 |
+
"checkpoint_path" ":" <path>
|
| 720 |
+
|
| 721 |
+
<resume_from_checkpoint> ::=
|
| 722 |
+
"resume_from_checkpoint" ":" <path>
|
| 723 |
+
|
| 724 |
+
<loss_function> ::=
|
| 725 |
+
"loss" ":" ("cross_entropy" | "mse" | "mae" | "bce" | "focal" | "huber" | "kl_divergence")
|
| 726 |
+
|
| 727 |
+
<weight_decay> ::=
|
| 728 |
+
"weight_decay" ":" <decimal>
|
| 729 |
+
|
| 730 |
+
<gradient_clip> ::=
|
| 731 |
+
"gradient_clip" ":" <decimal>
|
| 732 |
+
|
| 733 |
+
<warmup_steps> ::=
|
| 734 |
+
"warmup_steps" ":" <number>
|
| 735 |
+
|
| 736 |
+
<save_strategy> ::=
|
| 737 |
+
"save_strategy" ":" ("steps" | "epoch" | "no")
|
| 738 |
+
```
|
| 739 |
+
|
| 740 |
+
**Allowed values and constraints:**
|
| 741 |
+
|
| 742 |
+
**Optimizers:**
|
| 743 |
+
- `adam` - Adam optimizer (default)
|
| 744 |
+
- `adamw` - Adam with weight decay
|
| 745 |
+
- `sgd` - Stochastic Gradient Descent
|
| 746 |
+
- `rmsprop` - RMSprop optimizer
|
| 747 |
+
- `adafactor` - Adafactor (memory efficient)
|
| 748 |
+
- `lamb` - LAMB optimizer (for large batches)
|
| 749 |
+
|
| 750 |
+
**Schedulers:**
|
| 751 |
+
- `linear` - Linear decay
|
| 752 |
+
- `cosine` - Cosine annealing
|
| 753 |
+
- `cosine_with_restarts` - Cosine with restarts
|
| 754 |
+
- `polynomial` - Polynomial decay
|
| 755 |
+
- `constant` - Constant learning rate
|
| 756 |
+
- `constant_with_warmup` - Constant with warmup
|
| 757 |
+
- `step` - Step decay
|
| 758 |
+
|
| 759 |
+
**Loss functions:**
|
| 760 |
+
- `cross_entropy` - Cross-entropy loss (classification)
|
| 761 |
+
- `mse` - Mean Squared Error (regression)
|
| 762 |
+
- `mae` - Mean Absolute Error (regression)
|
| 763 |
+
- `bce` - Binary Cross-Entropy
|
| 764 |
+
- `focal` - Focal loss (imbalanced data)
|
| 765 |
+
- `huber` - Huber loss (robust regression)
|
| 766 |
+
- `kl_divergence` - KL divergence
|
| 767 |
+
|
| 768 |
+
**Constraints:**
|
| 769 |
+
- `epochs`: Must be > 0 and <= 1000
|
| 770 |
+
- `batch_size`: Must be > 0 and <= 1024
|
| 771 |
+
- `learning_rate`: Must be > 0 and <= 1.0
|
| 772 |
+
- `gradient_accumulation`: Must be >= 1
|
| 773 |
+
- `checkpoint_steps`: Must be > 0
|
| 774 |
+
- `weight_decay`: Must be >= 0 and <= 1.0
|
| 775 |
+
- `gradient_clip`: Must be > 0
|
| 776 |
+
|
| 777 |
+
**Example:**
|
| 778 |
+
```okt
|
| 779 |
+
TRAIN {
|
| 780 |
+
epochs: 10
|
| 781 |
+
batch_size: 32
|
| 782 |
+
learning_rate: 0.00025
|
| 783 |
+
optimizer: "adamw"
|
| 784 |
+
scheduler: "cosine"
|
| 785 |
+
loss: "cross_entropy"
|
| 786 |
+
device: "cuda"
|
| 787 |
+
gradient_accumulation: 2
|
| 788 |
+
early_stopping: true
|
| 789 |
+
checkpoint_steps: 100
|
| 790 |
+
checkpoint_path: "./checkpoints"
|
| 791 |
+
weight_decay: 0.01
|
| 792 |
+
gradient_clip: 1.0
|
| 793 |
+
warmup_steps: 500
|
| 794 |
+
save_strategy: "steps"
|
| 795 |
+
}
|
| 796 |
+
```
|
| 797 |
+
|
| 798 |
+
**Example with checkpoint resume:**
|
| 799 |
+
```okt
|
| 800 |
+
TRAIN {
|
| 801 |
+
epochs: 20
|
| 802 |
+
batch_size: 16
|
| 803 |
+
learning_rate: 0.0001
|
| 804 |
+
optimizer: "adamw"
|
| 805 |
+
device: "cuda"
|
| 806 |
+
resume_from_checkpoint: "./checkpoints/checkpoint-500"
|
| 807 |
+
checkpoint_steps: 100
|
| 808 |
+
}
|
| 809 |
+
```
|
| 810 |
+
|
| 811 |
+
---
|
| 812 |
+
|
| 813 |
+
## METRICS Block
|
| 814 |
+
|
| 815 |
+
```ebnf
|
| 816 |
+
<metrics_block> ::=
|
| 817 |
+
"METRICS" "{"
|
| 818 |
+
{ <metric> | <custom_metric> }
|
| 819 |
+
"}"
|
| 820 |
+
|
| 821 |
+
<metric> ::=
|
| 822 |
+
"accuracy" |
|
| 823 |
+
"loss" |
|
| 824 |
+
"perplexity" |
|
| 825 |
+
"f1" |
|
| 826 |
+
"f1_macro" |
|
| 827 |
+
"f1_micro" |
|
| 828 |
+
"f1_weighted" |
|
| 829 |
+
"bleu" |
|
| 830 |
+
"rouge" |
|
| 831 |
+
"rouge_l" |
|
| 832 |
+
"rouge_1" |
|
| 833 |
+
"rouge_2" |
|
| 834 |
+
"mae" |
|
| 835 |
+
"mse" |
|
| 836 |
+
"rmse" |
|
| 837 |
+
"cosine_similarity" |
|
| 838 |
+
"token_efficiency" |
|
| 839 |
+
"response_coherence" |
|
| 840 |
+
"hallucination_score" |
|
| 841 |
+
"precision" |
|
| 842 |
+
"recall" |
|
| 843 |
+
"confusion_matrix"
|
| 844 |
+
|
| 845 |
+
<custom_metric> ::=
|
| 846 |
+
"custom" <string>
|
| 847 |
+
```
|
| 848 |
+
|
| 849 |
+
**Metric-specific constraints:**
|
| 850 |
+
- `accuracy`: Only for classification tasks
|
| 851 |
+
- `perplexity`: Only for language models
|
| 852 |
+
- `bleu`, `rouge`: Only for generation/translation tasks
|
| 853 |
+
- `mae`, `mse`, `rmse`: Only for regression tasks
|
| 854 |
+
- `confusion_matrix`: Only for classification, generates full matrix
|
| 855 |
+
|
| 856 |
+
**Example:**
|
| 857 |
+
```okt
|
| 858 |
+
METRICS {
|
| 859 |
+
accuracy
|
| 860 |
+
loss
|
| 861 |
+
perplexity
|
| 862 |
+
f1
|
| 863 |
+
f1_macro
|
| 864 |
+
rouge_l
|
| 865 |
+
cosine_similarity
|
| 866 |
+
custom "toxicity_score"
|
| 867 |
+
custom "context_alignment"
|
| 868 |
+
}
|
| 869 |
+
```
|
| 870 |
+
|
| 871 |
+
---
|
| 872 |
+
|
| 873 |
+
## VALIDATION Block
|
| 874 |
+
|
| 875 |
+
```ebnf
|
| 876 |
+
<validation_block> ::=
|
| 877 |
+
"VALIDATE" "{"
|
| 878 |
+
[ "on_train" ":" ("true" | "false") ]
|
| 879 |
+
[ "on_validation" ":" ("true" | "false") ]
|
| 880 |
+
[ "frequency" ":" <number> ]
|
| 881 |
+
[ "save_best_model" ":" ("true" | "false") ]
|
| 882 |
+
[ "metric_to_monitor" ":" <string> ]
|
| 883 |
+
"}"
|
| 884 |
+
```
|
| 885 |
+
|
| 886 |
+
**Constraints:**
|
| 887 |
+
- `frequency`: Must be > 0 (validation every N steps)
|
| 888 |
+
- `metric_to_monitor`: Must be a metric defined in METRICS block
|
| 889 |
+
- `save_best_model`: If true, saves model when monitored metric improves
|
| 890 |
+
|
| 891 |
+
**Example:**
|
| 892 |
+
```okt
|
| 893 |
+
VALIDATE {
|
| 894 |
+
on_train: false
|
| 895 |
+
on_validation: true
|
| 896 |
+
frequency: 1
|
| 897 |
+
save_best_model: true
|
| 898 |
+
metric_to_monitor: "loss"
|
| 899 |
+
}
|
| 900 |
+
```
|
| 901 |
+
|
| 902 |
+
---
|
| 903 |
+
|
| 904 |
+
## INFERENCE Block
|
| 905 |
+
|
| 906 |
+
The `INFERENCE` block defines how the model behaves during inference, prediction, or interactive chat.
|
| 907 |
+
|
| 908 |
+
```ebnf
|
| 909 |
+
<inference_block> ::=
|
| 910 |
+
"INFERENCE" "{"
|
| 911 |
+
<inference_mode>
|
| 912 |
+
[<inference_format>]
|
| 913 |
+
[<inference_exit_command>]
|
| 914 |
+
[<inference_params>]
|
| 915 |
+
[<inference_control>]
|
| 916 |
+
"}"
|
| 917 |
+
|
| 918 |
+
<inference_mode> ::=
|
| 919 |
+
"mode" ":" ("chat" | "intent" | "translate" | "classify" | "custom")
|
| 920 |
+
|
| 921 |
+
<inference_format> ::=
|
| 922 |
+
"format" ":" <string>
|
| 923 |
+
|
| 924 |
+
<inference_exit_command> ::=
|
| 925 |
+
"exit_command" ":" <string>
|
| 926 |
+
|
| 927 |
+
<inference_params> ::=
|
| 928 |
+
"params" "{"
|
| 929 |
+
[<inference_max_length>]
|
| 930 |
+
[<inference_temperature>]
|
| 931 |
+
[<inference_top_p>]
|
| 932 |
+
[<inference_beams>]
|
| 933 |
+
[<inference_do_sample>]
|
| 934 |
+
[<inference_top_k>]
|
| 935 |
+
[<inference_repetition_penalty>]
|
| 936 |
+
"}"
|
| 937 |
+
|
| 938 |
+
<inference_max_length> ::=
|
| 939 |
+
"max_length" ":" <number>
|
| 940 |
+
|
| 941 |
+
<inference_temperature> ::=
|
| 942 |
+
"temperature" ":" <decimal>
|
| 943 |
+
|
| 944 |
+
<inference_top_p> ::=
|
| 945 |
+
"top_p" ":" <decimal>
|
| 946 |
+
|
| 947 |
+
<inference_beams> ::=
|
| 948 |
+
"beams" ":" <number>
|
| 949 |
+
|
| 950 |
+
<inference_do_sample> ::=
|
| 951 |
+
"do_sample" ":" <boolean>
|
| 952 |
+
|
| 953 |
+
<inference_top_k> ::=
|
| 954 |
+
"top_k" ":" <number>
|
| 955 |
+
|
| 956 |
+
<inference_repetition_penalty> ::=
|
| 957 |
+
"repetition_penalty" ":" <decimal>
|
| 958 |
+
|
| 959 |
+
<inference_control> ::=
|
| 960 |
+
"CONTROL" "{"
|
| 961 |
+
{ <control_if> | <control_when> | <control_every> | <control_set> | <control_stop> | <control_log> | <control_save> | <control_retry> | <control_regenerate> }
|
| 962 |
+
"}"
|
| 963 |
+
```
|
| 964 |
+
|
| 965 |
+
**Supported format patterns:**
|
| 966 |
+
|
| 967 |
+
The `format` field supports template strings with variables:
|
| 968 |
+
|
| 969 |
+
| Use case | Example |
|
| 970 |
+
|----------|---------|
|
| 971 |
+
| Chat | `"User: {input}\nAssistant:"` |
|
| 972 |
+
| Free | `"{input}"` |
|
| 973 |
+
| Translation | `"translate English to Portuguese: {input}"` |
|
| 974 |
+
| Intent | `"{input}"` |
|
| 975 |
+
| QA/RAG | `"Context: {context}\nQuestion: {input}\nAnswer:"` |
|
| 976 |
+
| LLaMA style | `"<|user|>\n{input}\n<|assistant|>\n"` |
|
| 977 |
+
|
| 978 |
+
**Supported variables:**
|
| 979 |
+
- `{input}` → user input
|
| 980 |
+
- `{context}` → optional context (for RAG/QA)
|
| 981 |
+
- `{labels}` → class list for classification
|
| 982 |
+
|
| 983 |
+
**Constraints:**
|
| 984 |
+
- `mode`: Defines the inference behavior type
|
| 985 |
+
- `format`: Template string with variable placeholders
|
| 986 |
+
- `max_length`: Must be > 0 and <= 8192
|
| 987 |
+
- `temperature`: Must be >= 0.0 and <= 2.0
|
| 988 |
+
- `top_p`: Must be > 0.0 and <= 1.0
|
| 989 |
+
- `top_k`: Must be >= 0 (0 = disabled)
|
| 990 |
+
- `beams`: Must be >= 1 (for beam search)
|
| 991 |
+
- `do_sample`: Boolean (true/false)
|
| 992 |
+
- `repetition_penalty`: Must be > 0.0 and <= 2.0
|
| 993 |
+
|
| 994 |
+
**Example (Chat mode):**
|
| 995 |
+
```okt
|
| 996 |
+
INFERENCE {
|
| 997 |
+
mode: "chat"
|
| 998 |
+
format: "User: {input}\nAssistant:"
|
| 999 |
+
exit_command: "/exit"
|
| 1000 |
+
|
| 1001 |
+
params {
|
| 1002 |
+
max_length: 120
|
| 1003 |
+
temperature: 0.7
|
| 1004 |
+
top_p: 0.9
|
| 1005 |
+
beams: 2
|
| 1006 |
+
do_sample: true
|
| 1007 |
+
}
|
| 1008 |
+
|
| 1009 |
+
CONTROL {
|
| 1010 |
+
IF confidence < 0.3 { RETRY }
|
| 1011 |
+
IF repetition > 3 { REGENERATE }
|
| 1012 |
+
IF hallucination_score > 0.5 { REPLACE WITH "Desculpe, não tenho certeza." }
|
| 1013 |
+
}
|
| 1014 |
+
}
|
| 1015 |
+
```
|
| 1016 |
+
|
| 1017 |
+
**Example (Translation mode):**
|
| 1018 |
+
```okt
|
| 1019 |
+
INFERENCE {
|
| 1020 |
+
mode: "translate"
|
| 1021 |
+
format: "translate English to Portuguese: {input}"
|
| 1022 |
+
|
| 1023 |
+
params {
|
| 1024 |
+
max_length: 200
|
| 1025 |
+
temperature: 0.5
|
| 1026 |
+
top_p: 0.95
|
| 1027 |
+
}
|
| 1028 |
+
}
|
| 1029 |
+
```
|
| 1030 |
+
|
| 1031 |
+
**Example (Classification mode):**
|
| 1032 |
+
```okt
|
| 1033 |
+
INFERENCE {
|
| 1034 |
+
mode: "classify"
|
| 1035 |
+
format: "{input}"
|
| 1036 |
+
|
| 1037 |
+
params {
|
| 1038 |
+
temperature: 0.1
|
| 1039 |
+
top_k: 5
|
| 1040 |
+
}
|
| 1041 |
+
}
|
| 1042 |
+
```
|
| 1043 |
+
|
| 1044 |
+
---
|
| 1045 |
+
|
| 1046 |
+
## CONTROL Block — Decision Engine
|
| 1047 |
+
|
| 1048 |
+
The `CONTROL` block enables logical, conditional, event-based, and metric-based decisions during training and inference. It introduces a cognitive-level abstraction that allows AI models to take decisions, self-adjust, and self-regulate in a declarative and clean way.
|
| 1049 |
+
|
| 1050 |
+
```ebnf
|
| 1051 |
+
<control_block> ::=
|
| 1052 |
+
"CONTROL" "{"
|
| 1053 |
+
{ <control_event> | <control_if> | <control_when> | <control_every> | <control_set> | <control_stop> | <control_log> | <control_save> | <control_retry> | <control_regenerate> | <control_stop_training> | <control_decrease> | <control_increase> }
|
| 1054 |
+
"}"
|
| 1055 |
+
|
| 1056 |
+
<control_event> ::=
|
| 1057 |
+
<on_step_end> | <on_epoch_end> | <on_memory_low> | <on_nan> | <on_plateau> | <validate_every>
|
| 1058 |
+
|
| 1059 |
+
<on_step_end> ::=
|
| 1060 |
+
"on_step_end" "{"
|
| 1061 |
+
{ <control_log> | <control_save> | <control_set> | <control_if> | <control_when> | <control_every> }
|
| 1062 |
+
"}"
|
| 1063 |
+
|
| 1064 |
+
<on_epoch_end> ::=
|
| 1065 |
+
"on_epoch_end" "{"
|
| 1066 |
+
{ <control_log> | <control_save> | <control_set> | <control_stop_training> | <control_if> | <control_when> | <control_every> }
|
| 1067 |
+
"}"
|
| 1068 |
+
|
| 1069 |
+
<on_memory_low> ::=
|
| 1070 |
+
"on_memory_low" "{"
|
| 1071 |
+
{ <control_set> | <control_stop> | <control_if> | <control_when> }
|
| 1072 |
+
"}"
|
| 1073 |
+
|
| 1074 |
+
<on_nan> ::=
|
| 1075 |
+
"on_nan" "{"
|
| 1076 |
+
{ <control_stop_training> | <control_log> | <control_if> }
|
| 1077 |
+
"}"
|
| 1078 |
+
|
| 1079 |
+
<on_plateau> ::=
|
| 1080 |
+
"on_plateau" "{"
|
| 1081 |
+
{ <control_decrease> | <control_increase> | <control_set> | <control_if> | <control_when> }
|
| 1082 |
+
"}"
|
| 1083 |
+
|
| 1084 |
+
<validate_every> ::=
|
| 1085 |
+
"validate_every" ":" <number>
|
| 1086 |
+
|
| 1087 |
+
<control_if> ::=
|
| 1088 |
+
"IF" <condition> "{"
|
| 1089 |
+
{ <control_set> | <control_stop> | <control_log> | <control_save> | <control_stop_training> | <control_decrease> | <control_increase> | <control_retry> | <control_regenerate> | <control_if> | <control_when> | <control_every> }
|
| 1090 |
+
"}"
|
| 1091 |
+
|
| 1092 |
+
<control_when> ::=
|
| 1093 |
+
"WHEN" <condition> "{"
|
| 1094 |
+
{ <control_set> | <control_stop> | <control_log> | <control_if> | <control_when> }
|
| 1095 |
+
"}"
|
| 1096 |
+
|
| 1097 |
+
<control_every> ::=
|
| 1098 |
+
"EVERY" <number> ("steps" | "epochs") "{"
|
| 1099 |
+
{ <control_save> | <control_log> | <control_set> | <control_if> | <control_when> }
|
| 1100 |
+
"}"
|
| 1101 |
+
|
| 1102 |
+
<control_set> ::=
|
| 1103 |
+
"SET" <identifier> "=" <value>
|
| 1104 |
+
|
| 1105 |
+
<control_stop> ::=
|
| 1106 |
+
"STOP"
|
| 1107 |
+
|
| 1108 |
+
<control_log> ::=
|
| 1109 |
+
"LOG" ( <metric_name> | <string> )
|
| 1110 |
+
|
| 1111 |
+
<control_save> ::=
|
| 1112 |
+
"SAVE" ( "model" | "checkpoint" | <string> )
|
| 1113 |
+
|
| 1114 |
+
<control_retry> ::=
|
| 1115 |
+
"RETRY"
|
| 1116 |
+
|
| 1117 |
+
<control_regenerate> ::=
|
| 1118 |
+
"REGENERATE"
|
| 1119 |
+
|
| 1120 |
+
<control_stop_training> ::=
|
| 1121 |
+
"STOP_TRAINING"
|
| 1122 |
+
|
| 1123 |
+
<control_decrease> ::=
|
| 1124 |
+
"DECREASE" <identifier> "BY" <number>
|
| 1125 |
+
|
| 1126 |
+
<control_increase> ::=
|
| 1127 |
+
"INCREASE" <identifier> "BY" <number>
|
| 1128 |
+
|
| 1129 |
+
<condition> ::=
|
| 1130 |
+
<metric_name> <comparison_operator> <value>
|
| 1131 |
+
|
| 1132 |
+
<comparison_operator> ::=
|
| 1133 |
+
">" | "<" | ">=" | "<=" | "==" | "!="
|
| 1134 |
+
|
| 1135 |
+
<value> ::=
|
| 1136 |
+
<number> | <decimal> | <string> | <boolean> | <identifier>
|
| 1137 |
+
|
| 1138 |
+
<metric_name> ::=
|
| 1139 |
+
"loss" | "val_loss" | "accuracy" | "val_accuracy" | "gpu_memory" | "ram_usage" | "confidence" | "hallucination_score" | <custom_metric>
|
| 1140 |
+
|
| 1141 |
+
<identifier> ::=
|
| 1142 |
+
"LR" | "learning_rate" | "batch_size" | "temperature" | <custom_identifier>
|
| 1143 |
+
```
|
| 1144 |
+
|
| 1145 |
+
**Supported events/hooks:**
|
| 1146 |
+
|
| 1147 |
+
| Event | Description |
|
| 1148 |
+
|-------|-------------|
|
| 1149 |
+
| `on_step_end` | Executed at the end of each training step |
|
| 1150 |
+
| `on_epoch_end` | Executed at the end of each epoch |
|
| 1151 |
+
| `validate_every` | Execute validation every X steps |
|
| 1152 |
+
| `on_memory_low` | Triggered when GPU/RAM is low |
|
| 1153 |
+
| `on_nan` | Triggered when NaN values are detected |
|
| 1154 |
+
| `on_plateau` | Triggered when loss is stagnant (plateau) |
|
| 1155 |
+
|
| 1156 |
+
**Supported directives:**
|
| 1157 |
+
|
| 1158 |
+
- `IF` - Conditional logic based on metrics
|
| 1159 |
+
- `WHEN` - Event-based conditional logic
|
| 1160 |
+
- `EVERY` - Periodic actions (every N steps)
|
| 1161 |
+
- `SET` - Set parameter values dynamically
|
| 1162 |
+
- `STOP` - Stop current operation
|
| 1163 |
+
- `LOG` - Log metrics or messages
|
| 1164 |
+
- `SAVE` - Save model or checkpoint
|
| 1165 |
+
- `RETRY` - Retry inference generation
|
| 1166 |
+
- `REGENERATE` - Regenerate output
|
| 1167 |
+
- `STOP_TRAINING` - Stop training process
|
| 1168 |
+
- `DECREASE` - Decrease parameter value
|
| 1169 |
+
- `INCREASE` - Increase parameter value
|
| 1170 |
+
|
| 1171 |
+
**Nested Blocks Support:**
|
| 1172 |
+
|
| 1173 |
+
The CONTROL block in OktoScript supports nested logic, event-driven triggers, and conditional reasoning. You can nest IF / WHEN / EVERY statements inside lifecycle hooks like `on_step_end` and `on_epoch_end`, allowing dynamic, real-time decision making during training or inference.
|
| 1174 |
+
|
| 1175 |
+
**Example (Basic):**
|
| 1176 |
+
```okt
|
| 1177 |
+
CONTROL {
|
| 1178 |
+
on_step_end {
|
| 1179 |
+
LOG loss
|
| 1180 |
+
}
|
| 1181 |
+
|
| 1182 |
+
on_epoch_end {
|
| 1183 |
+
SAVE model
|
| 1184 |
+
LOG "Epoch completed"
|
| 1185 |
+
}
|
| 1186 |
+
|
| 1187 |
+
validate_every: 200
|
| 1188 |
+
|
| 1189 |
+
IF loss > 2.0 {
|
| 1190 |
+
SET LR = 0.0001
|
| 1191 |
+
LOG "High loss detected"
|
| 1192 |
+
}
|
| 1193 |
+
|
| 1194 |
+
IF val_loss > 2.5 {
|
| 1195 |
+
STOP_TRAINING
|
| 1196 |
+
}
|
| 1197 |
+
|
| 1198 |
+
WHEN gpu_memory < 16GB {
|
| 1199 |
+
SET batch_size = 4
|
| 1200 |
+
}
|
| 1201 |
+
|
| 1202 |
+
EVERY 500 steps {
|
| 1203 |
+
SAVE checkpoint
|
| 1204 |
+
}
|
| 1205 |
+
|
| 1206 |
+
IF accuracy < 0.4 {
|
| 1207 |
+
DECREASE LR BY 0.5
|
| 1208 |
+
}
|
| 1209 |
+
}
|
| 1210 |
+
```
|
| 1211 |
+
|
| 1212 |
+
**Example (Nested Blocks in Events):**
|
| 1213 |
+
```okt
|
| 1214 |
+
CONTROL {
|
| 1215 |
+
on_epoch_end {
|
| 1216 |
+
IF loss > 2.0 {
|
| 1217 |
+
SET LR = 0.0001
|
| 1218 |
+
LOG "High loss detected"
|
| 1219 |
+
}
|
| 1220 |
+
|
| 1221 |
+
IF val_loss > 2.5 {
|
| 1222 |
+
STOP_TRAINING
|
| 1223 |
+
}
|
| 1224 |
+
|
| 1225 |
+
IF accuracy > 0.9 {
|
| 1226 |
+
SAVE "best_model"
|
| 1227 |
+
LOG "High accuracy reached"
|
| 1228 |
+
}
|
| 1229 |
+
}
|
| 1230 |
+
}
|
| 1231 |
+
```
|
| 1232 |
+
|
| 1233 |
+
**Example (Advanced Nested Logic):**
|
| 1234 |
+
```okt
|
| 1235 |
+
CONTROL {
|
| 1236 |
+
on_epoch_end {
|
| 1237 |
+
EVERY 2 epochs {
|
| 1238 |
+
SAVE "checkpoint_epoch_{epoch}"
|
| 1239 |
+
}
|
| 1240 |
+
|
| 1241 |
+
IF loss > 2.0 {
|
| 1242 |
+
SET LR = 0.00005
|
| 1243 |
+
LOG "Loss still high after epoch"
|
| 1244 |
+
|
| 1245 |
+
WHEN gpu_usage > 90% {
|
| 1246 |
+
SET batch_size = 2
|
| 1247 |
+
LOG "Reducing batch size due to GPU pressure"
|
| 1248 |
+
}
|
| 1249 |
+
|
| 1250 |
+
IF val_loss > 3.0 {
|
| 1251 |
+
STOP_TRAINING
|
| 1252 |
+
}
|
| 1253 |
+
}
|
| 1254 |
+
}
|
| 1255 |
+
}
|
| 1256 |
+
```
|
| 1257 |
+
|
| 1258 |
+
**Example (Context-Based Control):**
|
| 1259 |
+
```okt
|
| 1260 |
+
CONTROL {
|
| 1261 |
+
IF epoch == 1 {
|
| 1262 |
+
LOG "Warmup stage"
|
| 1263 |
+
}
|
| 1264 |
+
|
| 1265 |
+
IF epoch > 5 AND accuracy < 0.6 {
|
| 1266 |
+
SET LR = 0.00001
|
| 1267 |
+
LOG "Model is stagnated"
|
| 1268 |
+
}
|
| 1269 |
+
|
| 1270 |
+
IF epoch > 10 AND loss > 1.8 {
|
| 1271 |
+
STOP_TRAINING
|
| 1272 |
+
}
|
| 1273 |
+
}
|
| 1274 |
+
```
|
| 1275 |
+
|
| 1276 |
+
**Example (Inference CONTROL):**
|
| 1277 |
+
```okt
|
| 1278 |
+
INFERENCE {
|
| 1279 |
+
mode: "chat"
|
| 1280 |
+
format: "User: {input}\nAssistant:"
|
| 1281 |
+
|
| 1282 |
+
CONTROL {
|
| 1283 |
+
IF confidence < 0.3 { RETRY }
|
| 1284 |
+
IF repetition > 3 { REGENERATE }
|
| 1285 |
+
IF toxic == true { REPLACE WITH "Not allowed" }
|
| 1286 |
+
}
|
| 1287 |
+
}
|
| 1288 |
+
```
|
| 1289 |
+
|
| 1290 |
+
**Example (Intent Classification CONTROL):**
|
| 1291 |
+
```okt
|
| 1292 |
+
INFERENCE {
|
| 1293 |
+
mode: "intent-classification"
|
| 1294 |
+
labels: ["greeting", "order", "complaint", "bye"]
|
| 1295 |
+
}
|
| 1296 |
+
|
| 1297 |
+
CONTROL {
|
| 1298 |
+
IF label == "complaint" {
|
| 1299 |
+
RETURN "I'm sorry to hear that. How can I help?"
|
| 1300 |
+
}
|
| 1301 |
+
|
| 1302 |
+
IF confidence < 0.4 {
|
| 1303 |
+
RETURN "Could you please repeat?"
|
| 1304 |
+
}
|
| 1305 |
+
}
|
| 1306 |
+
```
|
| 1307 |
+
|
| 1308 |
+
**Note:** OktoScript enables true declarative AI governance. CONTROL blocks can contain nested conditions and nested event triggers, making it a unique declarative decision-making language in the market.
|
| 1309 |
+
|
| 1310 |
+
**Philosophy:**
|
| 1311 |
+
|
| 1312 |
+
OktoScript keeps the surface clean and simple, while the engine behind it performs complex cognitive decision-making.
|
| 1313 |
+
|
| 1314 |
+
- **CONTROL** defines logic
|
| 1315 |
+
- **MONITOR** defines awareness
|
| 1316 |
+
- **GUARD** defines safety
|
| 1317 |
+
- **BEHAVIOR** defines personality
|
| 1318 |
+
- **EXPLORER** defines optimization
|
| 1319 |
+
- **STABILITY** defines reliability
|
| 1320 |
+
|
| 1321 |
+
Simple to read. Powerful to execute.
|
| 1322 |
+
|
| 1323 |
+
---
|
| 1324 |
+
|
| 1325 |
+
## EXPORT Block
|
| 1326 |
+
|
| 1327 |
+
```ebnf
|
| 1328 |
+
<export_block> ::=
|
| 1329 |
+
"EXPORT" "{"
|
| 1330 |
+
"format" ":" "[" <export_format_list> "]"
|
| 1331 |
+
"path" ":" <path>
|
| 1332 |
+
[ "quantization" ":" ("int8" | "int4" | "fp16" | "fp32") ]
|
| 1333 |
+
[ "optimize_for" ":" ("speed" | "size" | "accuracy") ]
|
| 1334 |
+
"}"
|
| 1335 |
+
|
| 1336 |
+
<export_format_list> ::=
|
| 1337 |
+
"gguf" |
|
| 1338 |
+
"onnx" |
|
| 1339 |
+
"okm" |
|
| 1340 |
+
"safetensors" |
|
| 1341 |
+
"tflite"
|
| 1342 |
+
```
|
| 1343 |
+
|
| 1344 |
+
**Format-specific constraints:**
|
| 1345 |
+
- `gguf`: Requires quantization (int8, int4, or fp16)
|
| 1346 |
+
- `onnx`: Best for production deployment
|
| 1347 |
+
- `okm`: OktoSeek optimized format (requires OktoSeek SDK)
|
| 1348 |
+
- `safetensors`: Standard PyTorch format
|
| 1349 |
+
- `tflite`: For mobile deployment (Android/iOS)
|
| 1350 |
+
|
| 1351 |
+
**Example:**
|
| 1352 |
+
```okt
|
| 1353 |
+
EXPORT {
|
| 1354 |
+
format: ["gguf", "onnx", "okm", "safetensors"]
|
| 1355 |
+
path: "export/"
|
| 1356 |
+
quantization: "int8"
|
| 1357 |
+
optimize_for: "speed"
|
| 1358 |
+
}
|
| 1359 |
+
```
|
| 1360 |
+
|
| 1361 |
+
---
|
| 1362 |
+
|
| 1363 |
+
## DEPLOY Block
|
| 1364 |
+
|
| 1365 |
+
The `DEPLOY` block defines deployment configuration for the model. The engine will create the server, generate routes, export in the required format, and configure limits and authentication.
|
| 1366 |
+
|
| 1367 |
+
```ebnf
|
| 1368 |
+
<deploy_block> ::=
|
| 1369 |
+
"DEPLOY" "{"
|
| 1370 |
+
"target" ":" ("local" | "cloud" | "edge" | "api" | "android" | "ios" | "web" | "desktop")
|
| 1371 |
+
[ "endpoint" ":" <string> ]
|
| 1372 |
+
[ "host" ":" <string> ]
|
| 1373 |
+
[ "requires_auth" ":" ("true" | "false") ]
|
| 1374 |
+
[ "port" ":" <number> ]
|
| 1375 |
+
[ "max_concurrent_requests" ":" <number> ]
|
| 1376 |
+
[ "protocol" ":" ("http" | "https" | "grpc" | "ws") ]
|
| 1377 |
+
[ "format" ":" ("onnx" | "tflite" | "gguf" | "pt" | "okm") ]
|
| 1378 |
+
"}"
|
| 1379 |
+
```
|
| 1380 |
+
|
| 1381 |
+
**Target-specific requirements:**
|
| 1382 |
+
- `api`: Requires `endpoint`, `host`, and `port`
|
| 1383 |
+
- `android`, `ios`: Requires `.okm` or `.tflite` format
|
| 1384 |
+
- `web`: Requires ONNX format
|
| 1385 |
+
- `edge`: Requires quantized model (int8 or int4)
|
| 1386 |
+
|
| 1387 |
+
**Protocol options:**
|
| 1388 |
+
- `http` - HTTP REST API
|
| 1389 |
+
- `https` - HTTPS REST API
|
| 1390 |
+
- `grpc` - gRPC protocol
|
| 1391 |
+
- `ws` - WebSocket protocol
|
| 1392 |
+
|
| 1393 |
+
**Format options:**
|
| 1394 |
+
- `onnx` - ONNX format (production-ready)
|
| 1395 |
+
- `tflite` - TensorFlow Lite (mobile)
|
| 1396 |
+
- `gguf` - GGUF format (local inference)
|
| 1397 |
+
- `pt` - PyTorch format
|
| 1398 |
+
- `okm` - OktoModel format (OktoSeek optimized)
|
| 1399 |
+
|
| 1400 |
+
**Example (API Deployment):**
|
| 1401 |
+
```okt
|
| 1402 |
+
DEPLOY {
|
| 1403 |
+
target: "api"
|
| 1404 |
+
host: "0.0.0.0"
|
| 1405 |
+
endpoint: "/pizzabot"
|
| 1406 |
+
requires_auth: true
|
| 1407 |
+
port: 9000
|
| 1408 |
+
max_concurrent_requests: 100
|
| 1409 |
+
protocol: "http"
|
| 1410 |
+
format: "onnx"
|
| 1411 |
+
}
|
| 1412 |
+
```
|
| 1413 |
+
|
| 1414 |
+
**Example (Mobile Deployment):**
|
| 1415 |
+
```okt
|
| 1416 |
+
DEPLOY {
|
| 1417 |
+
target: "android"
|
| 1418 |
+
format: "tflite"
|
| 1419 |
+
}
|
| 1420 |
+
```
|
| 1421 |
+
|
| 1422 |
+
---
|
| 1423 |
+
|
| 1424 |
+
## SECURITY Block
|
| 1425 |
+
|
| 1426 |
+
The `SECURITY` block defines security measures for input validation, output validation, rate limiting, and encryption.
|
| 1427 |
+
|
| 1428 |
+
```ebnf
|
| 1429 |
+
<security_block> ::=
|
| 1430 |
+
"SECURITY" "{"
|
| 1431 |
+
[ <input_validation> ]
|
| 1432 |
+
[ <output_validation> ]
|
| 1433 |
+
[ <rate_limit> ]
|
| 1434 |
+
[ <encryption> ]
|
| 1435 |
+
"}"
|
| 1436 |
+
|
| 1437 |
+
<input_validation> ::=
|
| 1438 |
+
"input_validation" "{"
|
| 1439 |
+
[ "max_length" ":" <number> ]
|
| 1440 |
+
[ "disallow_patterns" ":" "[" <string_list> "]" ]
|
| 1441 |
+
"}"
|
| 1442 |
+
|
| 1443 |
+
<output_validation> ::=
|
| 1444 |
+
"output_validation" "{"
|
| 1445 |
+
[ "prevent_data_leak" ":" ("true" | "false") ]
|
| 1446 |
+
[ "mask_personal_info" ":" ("true" | "false") ]
|
| 1447 |
+
"}"
|
| 1448 |
+
|
| 1449 |
+
<rate_limit> ::=
|
| 1450 |
+
"rate_limit" "{"
|
| 1451 |
+
[ "max_requests_per_minute" ":" <number> ]
|
| 1452 |
+
"}"
|
| 1453 |
+
|
| 1454 |
+
<encryption> ::=
|
| 1455 |
+
"encryption" "{"
|
| 1456 |
+
[ "algorithm" ":" ("AES-256" | "SHA-256" | "RSA") ]
|
| 1457 |
+
"}"
|
| 1458 |
+
```
|
| 1459 |
+
|
| 1460 |
+
**Input validation:**
|
| 1461 |
+
- `max_length` - Maximum input length in characters
|
| 1462 |
+
- `disallow_patterns` - List of patterns to block (e.g., SQL injection, XSS)
|
| 1463 |
+
|
| 1464 |
+
**Output validation:**
|
| 1465 |
+
- `prevent_data_leak` - Prevent training data from appearing in outputs
|
| 1466 |
+
- `mask_personal_info` - Mask personal information in outputs
|
| 1467 |
+
|
| 1468 |
+
**Rate limiting:**
|
| 1469 |
+
- `max_requests_per_minute` - Maximum requests per minute per client
|
| 1470 |
+
|
| 1471 |
+
**Encryption:**
|
| 1472 |
+
- `AES-256` - AES-256 encryption
|
| 1473 |
+
- `SHA-256` - SHA-256 hashing
|
| 1474 |
+
- `RSA` - RSA encryption
|
| 1475 |
+
|
| 1476 |
+
**Example:**
|
| 1477 |
+
```okt
|
| 1478 |
+
SECURITY {
|
| 1479 |
+
input_validation {
|
| 1480 |
+
max_length: 500
|
| 1481 |
+
disallow_patterns: [
|
| 1482 |
+
"<script>",
|
| 1483 |
+
"DROP TABLE",
|
| 1484 |
+
"rm -rf",
|
| 1485 |
+
"sudo",
|
| 1486 |
+
"passwd"
|
| 1487 |
+
]
|
| 1488 |
+
}
|
| 1489 |
+
|
| 1490 |
+
output_validation {
|
| 1491 |
+
prevent_data_leak: true
|
| 1492 |
+
mask_personal_info: true
|
| 1493 |
+
}
|
| 1494 |
+
|
| 1495 |
+
rate_limit {
|
| 1496 |
+
max_requests_per_minute: 60
|
| 1497 |
+
}
|
| 1498 |
+
|
| 1499 |
+
encryption {
|
| 1500 |
+
algorithm: "AES-256"
|
| 1501 |
+
}
|
| 1502 |
+
}
|
| 1503 |
+
```
|
| 1504 |
+
|
| 1505 |
+
---
|
| 1506 |
+
|
| 1507 |
+
## MONITOR Block — Full Metrics Support
|
| 1508 |
+
|
| 1509 |
+
The `MONITOR` block tracks ANY available training or system metric. It supports all native and custom metrics, including but not limited to:
|
| 1510 |
+
|
| 1511 |
+
**Training Metrics:**
|
| 1512 |
+
- `loss`, `val_loss` - Training and validation loss
|
| 1513 |
+
- `accuracy`, `val_accuracy` - Classification accuracy
|
| 1514 |
+
- `precision`, `recall`, `f1_score` - Classification metrics
|
| 1515 |
+
- `perplexity` - Language model perplexity
|
| 1516 |
+
- `bleu`, `rouge` - Generation quality metrics
|
| 1517 |
+
- `cer`, `wer` - Character/Word error rates
|
| 1518 |
+
- `confidence` - Model confidence scores
|
| 1519 |
+
- `hallucination_score` - Hallucination detection
|
| 1520 |
+
|
| 1521 |
+
**System Metrics:**
|
| 1522 |
+
- `gpu_usage`, `gpu_memory_used`, `gpu_memory_free` - GPU utilization
|
| 1523 |
+
- `ram_usage`, `cpu_usage` - System resource usage
|
| 1524 |
+
- `gpu_temperature` - GPU temperature monitoring
|
| 1525 |
+
- `step_time`, `throughput`, `latency` - Performance metrics
|
| 1526 |
+
- `token_count` - Token usage statistics
|
| 1527 |
+
|
| 1528 |
+
```ebnf
|
| 1529 |
+
<monitor_block> ::=
|
| 1530 |
+
"MONITOR" "{"
|
| 1531 |
+
[<monitor_metrics>]
|
| 1532 |
+
[<monitor_notify_if>]
|
| 1533 |
+
[<monitor_log_to>]
|
| 1534 |
+
[<monitor_level>]
|
| 1535 |
+
[<monitor_log_system>]
|
| 1536 |
+
[<monitor_log_speed>]
|
| 1537 |
+
[<monitor_refresh_interval>]
|
| 1538 |
+
[<monitor_export_to>]
|
| 1539 |
+
[<monitor_dashboard>]
|
| 1540 |
+
"}"
|
| 1541 |
+
|
| 1542 |
+
<monitor_metrics> ::=
|
| 1543 |
+
"metrics" ":" "[" <metric_list> "]"
|
| 1544 |
+
|
| 1545 |
+
<monitor_notify_if> ::=
|
| 1546 |
+
"notify_if" "{"
|
| 1547 |
+
{ <notify_condition> }
|
| 1548 |
+
"}"
|
| 1549 |
+
|
| 1550 |
+
<notify_condition> ::=
|
| 1551 |
+
<metric_name> <comparison_operator> <value>
|
| 1552 |
+
|
| 1553 |
+
<monitor_log_to> ::=
|
| 1554 |
+
"log_to" ":" <path>
|
| 1555 |
+
|
| 1556 |
+
<monitor_level> ::=
|
| 1557 |
+
"level" ":" ("basic" | "full")
|
| 1558 |
+
|
| 1559 |
+
<monitor_log_system> ::=
|
| 1560 |
+
"log_system" ":" "[" <system_metric_list> "]"
|
| 1561 |
+
|
| 1562 |
+
<monitor_log_speed> ::=
|
| 1563 |
+
"log_speed" ":" "[" <speed_metric_list> "]"
|
| 1564 |
+
|
| 1565 |
+
<monitor_refresh_interval> ::=
|
| 1566 |
+
"refresh_interval" ":" <time_interval>
|
| 1567 |
+
|
| 1568 |
+
<monitor_export_to> ::=
|
| 1569 |
+
"export_to" ":" <path>
|
| 1570 |
+
|
| 1571 |
+
<monitor_dashboard> ::=
|
| 1572 |
+
"dashboard" ":" <boolean>
|
| 1573 |
+
|
| 1574 |
+
<metric_list> ::=
|
| 1575 |
+
<string> { "," <string> }
|
| 1576 |
+
|
| 1577 |
+
<system_metric_list> ::=
|
| 1578 |
+
("gpu_memory_used" | "gpu_memory_free" | "gpu_usage" | "cpu_usage" | "ram_usage" | "ram_used" | "disk_io" | "gpu_temperature" | "temperature") { "," <system_metric> }
|
| 1579 |
+
|
| 1580 |
+
<speed_metric_list> ::=
|
| 1581 |
+
("tokens_per_second" | "samples_per_second" | "throughput" | "latency" | "step_time") { "," <speed_metric> }
|
| 1582 |
+
|
| 1583 |
+
<time_interval> ::=
|
| 1584 |
+
<number> ("s" | "ms")
|
| 1585 |
+
```
|
| 1586 |
+
|
| 1587 |
+
**Supported Metrics (Complete List):**
|
| 1588 |
+
|
| 1589 |
+
**Training Metrics:**
|
| 1590 |
+
- `loss`, `val_loss` - Loss values
|
| 1591 |
+
- `accuracy`, `val_accuracy` - Accuracy metrics
|
| 1592 |
+
- `precision`, `recall`, `f1_score` - Classification metrics
|
| 1593 |
+
- `perplexity` - Language model perplexity
|
| 1594 |
+
- `bleu`, `rouge`, `rouge_l`, `rouge_1`, `rouge_2` - Generation metrics
|
| 1595 |
+
- `cer`, `wer` - Error rates
|
| 1596 |
+
- `confidence` - Confidence scores
|
| 1597 |
+
- `hallucination_score` - Hallucination detection
|
| 1598 |
+
|
| 1599 |
+
**System Metrics:**
|
| 1600 |
+
- `gpu_usage`, `gpu_memory_used`, `gpu_memory_free`, `gpu_temperature` - GPU metrics
|
| 1601 |
+
- `ram_usage`, `cpu_usage` - System resources
|
| 1602 |
+
- `step_time`, `throughput`, `latency` - Performance
|
| 1603 |
+
- `token_count` - Token statistics
|
| 1604 |
+
|
| 1605 |
+
**Constraints:**
|
| 1606 |
+
- `metrics`: Array of metric names to track
|
| 1607 |
+
- `notify_if`: Conditions that trigger notifications
|
| 1608 |
+
- `log_to`: Path to log file (optional)
|
| 1609 |
+
- GPU metrics only logged if CUDA is available
|
| 1610 |
+
- `refresh_interval` must be >= 1s
|
| 1611 |
+
|
| 1612 |
+
**Example:**
|
| 1613 |
+
```okt
|
| 1614 |
+
MONITOR {
|
| 1615 |
+
metrics: [
|
| 1616 |
+
"loss",
|
| 1617 |
+
"accuracy",
|
| 1618 |
+
"val_loss",
|
| 1619 |
+
"gpu_usage",
|
| 1620 |
+
"ram_usage",
|
| 1621 |
+
"throughput",
|
| 1622 |
+
"latency",
|
| 1623 |
+
"confidence"
|
| 1624 |
+
]
|
| 1625 |
+
|
| 1626 |
+
notify_if {
|
| 1627 |
+
loss > 2.0
|
| 1628 |
+
gpu_usage > 90%
|
| 1629 |
+
temperature > 85
|
| 1630 |
+
hallucination_score > 0.5
|
| 1631 |
+
}
|
| 1632 |
+
|
| 1633 |
+
log_to: "logs/training.log"
|
| 1634 |
+
}
|
| 1635 |
+
```
|
| 1636 |
+
|
| 1637 |
+
**Example (Full monitoring):**
|
| 1638 |
+
```okt
|
| 1639 |
+
MONITOR {
|
| 1640 |
+
level: "full"
|
| 1641 |
+
metrics: [
|
| 1642 |
+
"loss",
|
| 1643 |
+
"val_loss",
|
| 1644 |
+
"accuracy",
|
| 1645 |
+
"f1",
|
| 1646 |
+
"perplexity",
|
| 1647 |
+
"confidence",
|
| 1648 |
+
"hallucination_score"
|
| 1649 |
+
]
|
| 1650 |
+
log_system: [
|
| 1651 |
+
"gpu_memory_used",
|
| 1652 |
+
"gpu_memory_free",
|
| 1653 |
+
"cpu_usage",
|
| 1654 |
+
"ram_used",
|
| 1655 |
+
"gpu_temperature"
|
| 1656 |
+
]
|
| 1657 |
+
log_speed: [
|
| 1658 |
+
"tokens_per_second",
|
| 1659 |
+
"samples_per_second",
|
| 1660 |
+
"throughput",
|
| 1661 |
+
"latency"
|
| 1662 |
+
]
|
| 1663 |
+
notify_if {
|
| 1664 |
+
loss > 2.0
|
| 1665 |
+
gpu_usage > 90%
|
| 1666 |
+
val_loss > 2.5
|
| 1667 |
+
}
|
| 1668 |
+
refresh_interval: 2s
|
| 1669 |
+
export_to: "runs/logs/system.json"
|
| 1670 |
+
dashboard: true
|
| 1671 |
+
log_to: "logs/training.log"
|
| 1672 |
+
}
|
| 1673 |
+
```
|
| 1674 |
+
|
| 1675 |
+
**Integration with METRICS and LOGGING:**
|
| 1676 |
+
- `MONITOR` extends (does not replace) `METRICS` and `LOGGING`
|
| 1677 |
+
- System metrics are logged separately from training metrics
|
| 1678 |
+
- Dashboard provides real-time visualization (if `dashboard: true`)
|
| 1679 |
+
- `notify_if` triggers alerts when conditions are met
|
| 1680 |
+
|
| 1681 |
+
---
|
| 1682 |
+
|
| 1683 |
+
## GUARD Block — Safety / Ethics / Protection
|
| 1684 |
+
|
| 1685 |
+
The `GUARD` block defines safety rules during generation and training. It prevents harmful outputs and ensures ethical AI behavior. The engine knows exactly what to prevent, how to detect violations, and what action to take.
|
| 1686 |
+
|
| 1687 |
+
```ebnf
|
| 1688 |
+
<guard_block> ::=
|
| 1689 |
+
"GUARD" "{"
|
| 1690 |
+
[<guard_prevent>]
|
| 1691 |
+
[<guard_detect_using>]
|
| 1692 |
+
[<guard_on_violation>]
|
| 1693 |
+
"}"
|
| 1694 |
+
|
| 1695 |
+
<guard_prevent> ::=
|
| 1696 |
+
"prevent" "{"
|
| 1697 |
+
{ <prevention_type> }
|
| 1698 |
+
"}"
|
| 1699 |
+
|
| 1700 |
+
<guard_detect_using> ::=
|
| 1701 |
+
"detect_using" ":" "[" ("classifier" | "embedding" | "regex" | "rule_engine" | "ml_model") { "," ("classifier" | "embedding" | "regex" | "rule_engine" | "ml_model") } "]"
|
| 1702 |
+
|
| 1703 |
+
<prevention_type> ::=
|
| 1704 |
+
"hallucination" |
|
| 1705 |
+
"toxicity" |
|
| 1706 |
+
"bias" |
|
| 1707 |
+
"data_leak" |
|
| 1708 |
+
"unsafe_code" |
|
| 1709 |
+
"personal_data" |
|
| 1710 |
+
"illegal_content"
|
| 1711 |
+
|
| 1712 |
+
<guard_on_violation> ::=
|
| 1713 |
+
"on_violation" "{"
|
| 1714 |
+
<violation_action>
|
| 1715 |
+
[ "with_message" ":" <string> ]
|
| 1716 |
+
"}"
|
| 1717 |
+
|
| 1718 |
+
<violation_action> ::=
|
| 1719 |
+
"STOP" | "ALERT" | "REPLACE" | "LOG"
|
| 1720 |
+
```
|
| 1721 |
+
|
| 1722 |
+
**Prevention types:**
|
| 1723 |
+
- `hallucination` - Prevents fabricated or false information
|
| 1724 |
+
- `toxicity` - Prevents toxic, harmful, or offensive content
|
| 1725 |
+
- `bias` - Prevents biased or discriminatory outputs
|
| 1726 |
+
- `data_leak` - Prevents training data leakage
|
| 1727 |
+
- `unsafe_code` - Prevents unsafe code generation
|
| 1728 |
+
- `personal_data` - Prevents personal information leakage
|
| 1729 |
+
- `illegal_content` - Prevents illegal content generation
|
| 1730 |
+
|
| 1731 |
+
**Detection methods:**
|
| 1732 |
+
- `classifier` - Use ML classifier to detect violations
|
| 1733 |
+
- `embedding` - Use embedding similarity to detect violations
|
| 1734 |
+
- `regex` - Use regex patterns to detect violations
|
| 1735 |
+
- `rule_engine` - Use rule-based engine to detect violations
|
| 1736 |
+
- `ml_model` - Use custom ML model to detect violations
|
| 1737 |
+
|
| 1738 |
+
**Violation actions:**
|
| 1739 |
+
- `STOP` - Stop generation immediately
|
| 1740 |
+
- `ALERT` - Log alert and continue
|
| 1741 |
+
- `REPLACE` - Replace with safe fallback (requires `with_message`)
|
| 1742 |
+
- `LOG` - Log violation for analysis
|
| 1743 |
+
|
| 1744 |
+
**Example (Strict Mode):**
|
| 1745 |
+
```okt
|
| 1746 |
+
GUARD {
|
| 1747 |
+
prevent {
|
| 1748 |
+
hallucination
|
| 1749 |
+
toxicity
|
| 1750 |
+
bias
|
| 1751 |
+
data_leak
|
| 1752 |
+
illegal_content
|
| 1753 |
+
}
|
| 1754 |
+
|
| 1755 |
+
detect_using: ["classifier", "regex", "embedding"]
|
| 1756 |
+
|
| 1757 |
+
on_violation {
|
| 1758 |
+
REPLACE
|
| 1759 |
+
with_message: "Sorry, this request is not allowed."
|
| 1760 |
+
}
|
| 1761 |
+
}
|
| 1762 |
+
```
|
| 1763 |
+
|
| 1764 |
+
**Example (Alert mode):**
|
| 1765 |
+
```okt
|
| 1766 |
+
GUARD {
|
| 1767 |
+
prevent {
|
| 1768 |
+
toxicity
|
| 1769 |
+
bias
|
| 1770 |
+
}
|
| 1771 |
+
|
| 1772 |
+
detect_using: ["classifier", "rule_engine"]
|
| 1773 |
+
|
| 1774 |
+
on_violation {
|
| 1775 |
+
ALERT
|
| 1776 |
+
}
|
| 1777 |
+
}
|
| 1778 |
+
```
|
| 1779 |
+
|
| 1780 |
+
---
|
| 1781 |
+
|
| 1782 |
+
## BEHAVIOR Block — Model Personality
|
| 1783 |
+
|
| 1784 |
+
The `BEHAVIOR` block defines how the model should behave in chat/inference. It sets personality, verbosity, language, and content restrictions.
|
| 1785 |
+
|
| 1786 |
+
```ebnf
|
| 1787 |
+
<behavior_block> ::=
|
| 1788 |
+
"BEHAVIOR" "{"
|
| 1789 |
+
[<behavior_mode>]
|
| 1790 |
+
[<behavior_personality>]
|
| 1791 |
+
[<behavior_verbosity>]
|
| 1792 |
+
[<behavior_language>]
|
| 1793 |
+
[<behavior_avoid>]
|
| 1794 |
+
[<behavior_fallback>]
|
| 1795 |
+
[<behavior_style_prompt>]
|
| 1796 |
+
"}"
|
| 1797 |
+
|
| 1798 |
+
<behavior_mode> ::=
|
| 1799 |
+
"mode" ":" ("chat" | "completion" | "instruction" | "classifier")
|
| 1800 |
+
|
| 1801 |
+
<behavior_personality> ::=
|
| 1802 |
+
"personality" ":" ("professional" | "friendly" | "assistant" | "casual" | "formal" | "creative")
|
| 1803 |
+
|
| 1804 |
+
<behavior_verbosity> ::=
|
| 1805 |
+
"verbosity" ":" ("low" | "medium" | "high")
|
| 1806 |
+
|
| 1807 |
+
<behavior_language> ::=
|
| 1808 |
+
"language" ":" ("en" | "pt-BR" | "es" | "fr" | "de" | "it" | "ja" | "zh" | "multilingual")
|
| 1809 |
+
|
| 1810 |
+
<behavior_avoid> ::=
|
| 1811 |
+
"avoid" ":" "[" <string_list> "]"
|
| 1812 |
+
|
| 1813 |
+
<behavior_fallback> ::=
|
| 1814 |
+
"fallback" ":" <string>
|
| 1815 |
+
|
| 1816 |
+
<behavior_style_prompt> ::=
|
| 1817 |
+
"prompt_style" ":" <string>
|
| 1818 |
+
```
|
| 1819 |
+
|
| 1820 |
+
**Mode types:**
|
| 1821 |
+
- `chat` - Conversational chat mode
|
| 1822 |
+
- `completion` - Text completion mode
|
| 1823 |
+
- `instruction` - Instruction-following mode
|
| 1824 |
+
- `classifier` - Classification mode
|
| 1825 |
+
|
| 1826 |
+
**Personality types:**
|
| 1827 |
+
- `professional` - Formal, business-like responses
|
| 1828 |
+
- `friendly` - Warm, approachable tone
|
| 1829 |
+
- `assistant` - Helpful, service-oriented
|
| 1830 |
+
- `casual` - Relaxed, informal tone
|
| 1831 |
+
- `formal` - Very formal, academic tone
|
| 1832 |
+
- `creative` - Imaginative, expressive responses
|
| 1833 |
+
|
| 1834 |
+
**Verbosity levels:**
|
| 1835 |
+
- `low` - Concise, brief responses
|
| 1836 |
+
- `medium` - Balanced detail
|
| 1837 |
+
- `high` - Detailed, comprehensive responses
|
| 1838 |
+
|
| 1839 |
+
**prompt_style allows you to define:**
|
| 1840 |
+
- ChatGPT-style format
|
| 1841 |
+
- Translation format
|
| 1842 |
+
- Classification format
|
| 1843 |
+
- Custom format (e.g., NLP tasks)
|
| 1844 |
+
|
| 1845 |
+
**Example (Professional Chatbot):**
|
| 1846 |
+
```okt
|
| 1847 |
+
BEHAVIOR {
|
| 1848 |
+
mode: "chat"
|
| 1849 |
+
personality: "professional"
|
| 1850 |
+
verbosity: "medium"
|
| 1851 |
+
language: "pt-BR"
|
| 1852 |
+
avoid: ["violence", "hate", "politics"]
|
| 1853 |
+
fallback: "Como posso ajudar?"
|
| 1854 |
+
prompt_style: "User: {input}\nAssistant:"
|
| 1855 |
+
}
|
| 1856 |
+
```
|
| 1857 |
+
|
| 1858 |
+
**Example (Friendly assistant):**
|
| 1859 |
+
```okt
|
| 1860 |
+
BEHAVIOR {
|
| 1861 |
+
mode: "chat"
|
| 1862 |
+
personality: "friendly"
|
| 1863 |
+
verbosity: "high"
|
| 1864 |
+
language: "en"
|
| 1865 |
+
avoid: ["violence", "explicit content"]
|
| 1866 |
+
fallback: "I'm here to help! How can I assist you?"
|
| 1867 |
+
prompt_style: "User: {input}\nAssistant:"
|
| 1868 |
+
}
|
| 1869 |
+
```
|
| 1870 |
+
|
| 1871 |
+
---
|
| 1872 |
+
|
| 1873 |
+
## EXPLORER Block — Parameter Search
|
| 1874 |
+
|
| 1875 |
+
The `EXPLORER` block enables basic hyperparameter exploration (AutoML-style). It automatically tests different parameter combinations and selects the best configuration.
|
| 1876 |
+
|
| 1877 |
+
```ebnf
|
| 1878 |
+
<explorer_block> ::=
|
| 1879 |
+
"EXPLORER" "{"
|
| 1880 |
+
<explorer_try>
|
| 1881 |
+
[<explorer_max_tests>]
|
| 1882 |
+
[<explorer_pick_best_by>]
|
| 1883 |
+
"}"
|
| 1884 |
+
|
| 1885 |
+
<explorer_try> ::=
|
| 1886 |
+
"try" "{"
|
| 1887 |
+
{ <explorer_lr> | <explorer_batch_size> | <explorer_optimizer> | <explorer_scheduler> | <explorer_other> }
|
| 1888 |
+
"}"
|
| 1889 |
+
|
| 1890 |
+
<explorer_lr> ::=
|
| 1891 |
+
"lr" ":" "[" <decimal_list> "]"
|
| 1892 |
+
|
| 1893 |
+
<explorer_batch_size> ::=
|
| 1894 |
+
"batch_size" ":" "[" <number_list> "]"
|
| 1895 |
+
|
| 1896 |
+
<explorer_optimizer> ::=
|
| 1897 |
+
"optimizer" ":" "[" <string_list> "]"
|
| 1898 |
+
|
| 1899 |
+
<explorer_scheduler> ::=
|
| 1900 |
+
"scheduler" ":" "[" <string_list> "]"
|
| 1901 |
+
|
| 1902 |
+
<explorer_other> ::=
|
| 1903 |
+
<identifier> ":" "[" <value_list> "]"
|
| 1904 |
+
|
| 1905 |
+
<explorer_max_tests> ::=
|
| 1906 |
+
"max_tests" ":" <number>
|
| 1907 |
+
|
| 1908 |
+
<explorer_pick_best_by> ::=
|
| 1909 |
+
"pick_best_by" ":" <metric_name>
|
| 1910 |
+
|
| 1911 |
+
<decimal_list> ::=
|
| 1912 |
+
<decimal> { "," <decimal> }
|
| 1913 |
+
|
| 1914 |
+
<number_list> ::=
|
| 1915 |
+
<number> { "," <number> }
|
| 1916 |
+
|
| 1917 |
+
<value_list> ::=
|
| 1918 |
+
<value> { "," <value> }
|
| 1919 |
+
```
|
| 1920 |
+
|
| 1921 |
+
**Constraints:**
|
| 1922 |
+
- `max_tests`: Must be <= 50 (to prevent excessive exploration)
|
| 1923 |
+
- `pick_best_by`: Must be a valid metric name (e.g., `"val_loss"`, `"accuracy"`)
|
| 1924 |
+
- Explorer will test combinations and select the best configuration based on the specified metric
|
| 1925 |
+
|
| 1926 |
+
**Example:**
|
| 1927 |
+
```okt
|
| 1928 |
+
EXPLORER {
|
| 1929 |
+
try {
|
| 1930 |
+
lr: [0.001, 0.0005, 0.0001]
|
| 1931 |
+
batch_size: [4, 8, 16]
|
| 1932 |
+
optimizer: ["adamw", "sgd"]
|
| 1933 |
+
}
|
| 1934 |
+
|
| 1935 |
+
max_tests: 5
|
| 1936 |
+
pick_best_by: "val_loss"
|
| 1937 |
+
}
|
| 1938 |
+
```
|
| 1939 |
+
|
| 1940 |
+
**Example (Extended exploration):**
|
| 1941 |
+
```okt
|
| 1942 |
+
EXPLORER {
|
| 1943 |
+
try {
|
| 1944 |
+
lr: [0.0003, 0.0001, 0.00005]
|
| 1945 |
+
batch_size: [8, 16, 32]
|
| 1946 |
+
optimizer: ["adamw", "adam"]
|
| 1947 |
+
scheduler: ["cosine", "linear"]
|
| 1948 |
+
}
|
| 1949 |
+
|
| 1950 |
+
max_tests: 12
|
| 1951 |
+
pick_best_by: "val_accuracy"
|
| 1952 |
+
}
|
| 1953 |
+
```
|
| 1954 |
+
|
| 1955 |
+
---
|
| 1956 |
+
|
| 1957 |
+
## STABILITY Block — Training Safety
|
| 1958 |
+
|
| 1959 |
+
The `STABILITY` block controls training stability and prevents common training failures.
|
| 1960 |
+
|
| 1961 |
+
```ebnf
|
| 1962 |
+
<stability_block> ::=
|
| 1963 |
+
"STABILITY" "{"
|
| 1964 |
+
[<stability_stop_if_nan>]
|
| 1965 |
+
[<stability_stop_if_diverges>]
|
| 1966 |
+
[<stability_min_improvement>]
|
| 1967 |
+
"}"
|
| 1968 |
+
|
| 1969 |
+
<stability_stop_if_nan> ::=
|
| 1970 |
+
"stop_if_nan" ":" <boolean>
|
| 1971 |
+
|
| 1972 |
+
<stability_stop_if_diverges> ::=
|
| 1973 |
+
"stop_if_diverges" ":" <boolean>
|
| 1974 |
+
|
| 1975 |
+
<stability_min_improvement> ::=
|
| 1976 |
+
"min_improvement" ":" <decimal>
|
| 1977 |
+
```
|
| 1978 |
+
|
| 1979 |
+
**Constraints:**
|
| 1980 |
+
- `stop_if_nan`: Boolean - Stop training if NaN values are detected
|
| 1981 |
+
- `stop_if_diverges`: Boolean - Stop training if loss diverges
|
| 1982 |
+
- `min_improvement`: Float - Minimum improvement threshold (e.g., 0.001)
|
| 1983 |
+
|
| 1984 |
+
**Example:**
|
| 1985 |
+
```okt
|
| 1986 |
+
STABILITY {
|
| 1987 |
+
stop_if_nan: true
|
| 1988 |
+
stop_if_diverges: true
|
| 1989 |
+
min_improvement: 0.001
|
| 1990 |
+
}
|
| 1991 |
+
```
|
| 1992 |
+
|
| 1993 |
+
**Example (Relaxed stability):**
|
| 1994 |
+
```okt
|
| 1995 |
+
STABILITY {
|
| 1996 |
+
stop_if_nan: true
|
| 1997 |
+
stop_if_diverges: false
|
| 1998 |
+
min_improvement: 0.0001
|
| 1999 |
+
}
|
| 2000 |
+
```
|
| 2001 |
+
|
| 2002 |
+
---
|
| 2003 |
+
|
| 2004 |
+
## Boolean Support
|
| 2005 |
+
|
| 2006 |
+
The OktoScript language supports boolean values:
|
| 2007 |
+
|
| 2008 |
+
- `true`
|
| 2009 |
+
- `false`
|
| 2010 |
+
|
| 2011 |
+
**Supported in:**
|
| 2012 |
+
- `CONTROL` block conditions and actions
|
| 2013 |
+
- `STABILITY` block flags
|
| 2014 |
+
- `BEHAVIOR` block settings
|
| 2015 |
+
- `GUARD` block actions
|
| 2016 |
+
- `MONITOR` block dashboard flag
|
| 2017 |
+
- `INFERENCE` block `do_sample` parameter
|
| 2018 |
+
- Any block that requires boolean values
|
| 2019 |
+
|
| 2020 |
+
**Example:**
|
| 2021 |
+
```okt
|
| 2022 |
+
STABILITY {
|
| 2023 |
+
stop_if_nan: true
|
| 2024 |
+
stop_if_diverges: false
|
| 2025 |
+
}
|
| 2026 |
+
|
| 2027 |
+
BEHAVIOR {
|
| 2028 |
+
personality: "friendly"
|
| 2029 |
+
}
|
| 2030 |
+
|
| 2031 |
+
MONITOR {
|
| 2032 |
+
dashboard: true
|
| 2033 |
+
}
|
| 2034 |
+
|
| 2035 |
+
INFERENCE {
|
| 2036 |
+
params {
|
| 2037 |
+
do_sample: true
|
| 2038 |
+
}
|
| 2039 |
+
}
|
| 2040 |
+
```
|
| 2041 |
+
|
| 2042 |
+
---
|
| 2043 |
+
|
| 2044 |
+
## LOGGING Block
|
| 2045 |
+
|
| 2046 |
+
```ebnf
|
| 2047 |
+
<logging_block> ::=
|
| 2048 |
+
"LOGGING" "{"
|
| 2049 |
+
"save_logs" ":" ("true" | "false")
|
| 2050 |
+
"metrics_file" ":" <path>
|
| 2051 |
+
"training_file" ":" <path>
|
| 2052 |
+
[ "log_level" ":" ("debug" | "info" | "warning" | "error") ]
|
| 2053 |
+
[ "log_every" ":" <number> ]
|
| 2054 |
+
"}"
|
| 2055 |
+
```
|
| 2056 |
+
|
| 2057 |
+
**Example:**
|
| 2058 |
+
```okt
|
| 2059 |
+
LOGGING {
|
| 2060 |
+
save_logs: true
|
| 2061 |
+
metrics_file: "runs/pizzabot-v1/metrics.json"
|
| 2062 |
+
training_file: "runs/pizzabot-v1/training_logs.json"
|
| 2063 |
+
log_level: "info"
|
| 2064 |
+
log_every: 10
|
| 2065 |
+
}
|
| 2066 |
+
```
|
| 2067 |
+
|
| 2068 |
+
---
|
| 2069 |
+
|
| 2070 |
+
## Model Inheritance
|
| 2071 |
+
|
| 2072 |
+
OktoScript supports model inheritance to reduce code duplication and enable configuration reuse.
|
| 2073 |
+
|
| 2074 |
+
**Syntax:**
|
| 2075 |
+
```okt
|
| 2076 |
+
# Base model definition (named)
|
| 2077 |
+
MODEL "base-transformer" {
|
| 2078 |
+
architecture: "transformer"
|
| 2079 |
+
context_window: 2048
|
| 2080 |
+
precision: "fp16"
|
| 2081 |
+
}
|
| 2082 |
+
|
| 2083 |
+
# Child model inheriting from base
|
| 2084 |
+
MODEL {
|
| 2085 |
+
inherit: "base-transformer"
|
| 2086 |
+
base: "oktoseek/custom-model"
|
| 2087 |
+
parameters: 250M
|
| 2088 |
+
# Overrides: precision stays "fp16" from parent
|
| 2089 |
+
# New: base and parameters are set
|
| 2090 |
+
}
|
| 2091 |
+
```
|
| 2092 |
+
|
| 2093 |
+
**Inheritance rules:**
|
| 2094 |
+
1. Child model inherits all fields from parent
|
| 2095 |
+
2. Child can override any inherited field
|
| 2096 |
+
3. Fields not specified in child use parent values
|
| 2097 |
+
4. Inheritance chain can be multiple levels (parent → child → grandchild)
|
| 2098 |
+
5. Circular inheritance is not allowed
|
| 2099 |
+
|
| 2100 |
+
**Example with multiple inheritance:**
|
| 2101 |
+
```okt
|
| 2102 |
+
# Grandparent
|
| 2103 |
+
MODEL "base-config" {
|
| 2104 |
+
architecture: "transformer"
|
| 2105 |
+
precision: "fp16"
|
| 2106 |
+
}
|
| 2107 |
+
|
| 2108 |
+
# Parent
|
| 2109 |
+
MODEL "medium-model" {
|
| 2110 |
+
inherit: "base-config"
|
| 2111 |
+
parameters: 120M
|
| 2112 |
+
context_window: 2048
|
| 2113 |
+
}
|
| 2114 |
+
|
| 2115 |
+
# Child
|
| 2116 |
+
MODEL {
|
| 2117 |
+
inherit: "medium-model"
|
| 2118 |
+
base: "oktoseek/specialized-model"
|
| 2119 |
+
parameters: 250M
|
| 2120 |
+
}
|
| 2121 |
+
```
|
| 2122 |
+
|
| 2123 |
+
---
|
| 2124 |
+
|
| 2125 |
+
## Extension Points & Hooks
|
| 2126 |
+
|
| 2127 |
+
OktoScript supports extension points for custom logic integration.
|
| 2128 |
+
|
| 2129 |
+
### HOOKS Block
|
| 2130 |
+
|
| 2131 |
+
```ebnf
|
| 2132 |
+
<hooks_block> ::=
|
| 2133 |
+
"HOOKS" "{"
|
| 2134 |
+
[ "before_train" ":" <script_path> ]
|
| 2135 |
+
[ "after_train" ":" <script_path> ]
|
| 2136 |
+
[ "before_epoch" ":" <script_path> ]
|
| 2137 |
+
[ "after_epoch" ":" <script_path> ]
|
| 2138 |
+
[ "on_checkpoint" ":" <script_path> ]
|
| 2139 |
+
[ "custom_metric" ":" <script_path> ]
|
| 2140 |
+
"}"
|
| 2141 |
+
```
|
| 2142 |
+
|
| 2143 |
+
**Hook script format:**
|
| 2144 |
+
- Python scripts (`.py`) - Most common
|
| 2145 |
+
- JavaScript/Node.js (`.js`) - For web integrations
|
| 2146 |
+
- Shell scripts (`.sh`) - For system operations
|
| 2147 |
+
|
| 2148 |
+
**Hook script interface:**
|
| 2149 |
+
```python
|
| 2150 |
+
# before_train.py
|
| 2151 |
+
def before_train(config, dataset, model):
|
| 2152 |
+
# Custom preprocessing
|
| 2153 |
+
# Modify config if needed
|
| 2154 |
+
return config
|
| 2155 |
+
|
| 2156 |
+
# after_epoch.py
|
| 2157 |
+
def after_epoch(epoch, metrics, model_state):
|
| 2158 |
+
# Custom logging, early stopping logic
|
| 2159 |
+
# Return True to stop training
|
| 2160 |
+
return False
|
| 2161 |
+
```
|
| 2162 |
+
|
| 2163 |
+
**Example:**
|
| 2164 |
+
```okt
|
| 2165 |
+
HOOKS {
|
| 2166 |
+
before_train: "scripts/preprocess.py"
|
| 2167 |
+
after_epoch: "scripts/custom_early_stop.py"
|
| 2168 |
+
on_checkpoint: "scripts/backup_checkpoint.sh"
|
| 2169 |
+
custom_metric: "scripts/toxicity_calculator.py"
|
| 2170 |
+
}
|
| 2171 |
+
```
|
| 2172 |
+
|
| 2173 |
+
### Python Integration
|
| 2174 |
+
|
| 2175 |
+
OktoScript can call Python functions directly:
|
| 2176 |
+
|
| 2177 |
+
```okt
|
| 2178 |
+
HOOKS {
|
| 2179 |
+
before_train: "python:my_module.preprocess_data"
|
| 2180 |
+
custom_metric: "python:metrics.custom_f1_score"
|
| 2181 |
+
}
|
| 2182 |
+
```
|
| 2183 |
+
|
| 2184 |
+
### API Integration
|
| 2185 |
+
|
| 2186 |
+
```okt
|
| 2187 |
+
HOOKS {
|
| 2188 |
+
after_train: "api:https://api.example.com/log_training"
|
| 2189 |
+
on_checkpoint: "api:https://api.example.com/upload_checkpoint"
|
| 2190 |
+
}
|
| 2191 |
+
```
|
| 2192 |
+
|
| 2193 |
+
---
|
| 2194 |
+
|
| 2195 |
+
## Validation Rules
|
| 2196 |
+
|
| 2197 |
+
### File Structure Validation
|
| 2198 |
+
|
| 2199 |
+
1. **Required files:**
|
| 2200 |
+
- `okt.yaml` must exist in project root
|
| 2201 |
+
- Dataset files specified in DATASET block must exist
|
| 2202 |
+
- Model base path must be valid (if local path)
|
| 2203 |
+
|
| 2204 |
+
2. **Field validation:**
|
| 2205 |
+
- All required fields must be present
|
| 2206 |
+
- Field types must match grammar specification
|
| 2207 |
+
- Numeric values must be within allowed ranges
|
| 2208 |
+
- String values must match allowed patterns
|
| 2209 |
+
|
| 2210 |
+
3. **Dependency validation:**
|
| 2211 |
+
- If `inherit` is used, parent model must exist
|
| 2212 |
+
- If `resume_from_checkpoint` is used, checkpoint must exist
|
| 2213 |
+
- Export formats must be compatible with model architecture
|
| 2214 |
+
|
| 2215 |
+
### Runtime Validation
|
| 2216 |
+
|
| 2217 |
+
**Dataset validation:**
|
| 2218 |
+
- File exists and is readable
|
| 2219 |
+
- Format matches declared format
|
| 2220 |
+
- Required columns/fields present (for structured data)
|
| 2221 |
+
- File size within limits (max 10GB per file)
|
| 2222 |
+
|
| 2223 |
+
**Model validation:**
|
| 2224 |
+
- Base model exists (if local) or is downloadable (if remote)
|
| 2225 |
+
- Model architecture compatible with dataset type
|
| 2226 |
+
- Model size fits available memory
|
| 2227 |
+
|
| 2228 |
+
**Training validation:**
|
| 2229 |
+
- Device available (GPU if specified)
|
| 2230 |
+
- Sufficient disk space for checkpoints
|
| 2231 |
+
- Batch size fits in memory
|
| 2232 |
+
|
| 2233 |
+
### Error Messages
|
| 2234 |
+
|
| 2235 |
+
Common validation errors and solutions:
|
| 2236 |
+
|
| 2237 |
+
| Error | Cause | Solution |
|
| 2238 |
+
|-------|-------|----------|
|
| 2239 |
+
| `Dataset file not found` | Path in DATASET block doesn't exist | Check file path, use absolute or relative path |
|
| 2240 |
+
| `Invalid optimizer: 'invalid'` | Optimizer not in allowed list | Use one of: adam, adamw, sgd, rmsprop, adafactor, lamb |
|
| 2241 |
+
| `Model base not found` | Base model path invalid | Verify model path or HuggingFace model name |
|
| 2242 |
+
| `Checkpoint not found` | Resume checkpoint doesn't exist | Check checkpoint path or remove resume_from_checkpoint |
|
| 2243 |
+
| `Insufficient memory` | Batch size too large | Reduce batch_size or enable gradient_accumulation |
|
| 2244 |
+
| `Invalid metric for task` | Metric incompatible with task type | Use appropriate metrics (e.g., accuracy for classification) |
|
| 2245 |
+
|
| 2246 |
+
---
|
| 2247 |
+
|
| 2248 |
+
## Troubleshooting
|
| 2249 |
+
|
| 2250 |
+
### Common Issues
|
| 2251 |
+
|
| 2252 |
+
**1. Training fails with "Out of Memory"**
|
| 2253 |
+
|
| 2254 |
+
**Symptoms:**
|
| 2255 |
+
- CUDA out of memory error
|
| 2256 |
+
- Training crashes after a few steps
|
| 2257 |
+
|
| 2258 |
+
**Solutions:**
|
| 2259 |
+
```okt
|
| 2260 |
+
TRAIN {
|
| 2261 |
+
batch_size: 8 # Reduce from 32
|
| 2262 |
+
gradient_accumulation: 4 # Increase to maintain effective batch size
|
| 2263 |
+
precision: "fp16" # Use mixed precision
|
| 2264 |
+
}
|
| 2265 |
+
```
|
| 2266 |
+
|
| 2267 |
+
**2. Model not improving (loss plateau)**
|
| 2268 |
+
|
| 2269 |
+
**Symptoms:**
|
| 2270 |
+
- Loss stops decreasing
|
| 2271 |
+
- Metrics remain constant
|
| 2272 |
+
|
| 2273 |
+
**Solutions:**
|
| 2274 |
+
```okt
|
| 2275 |
+
TRAIN {
|
| 2276 |
+
learning_rate: 0.0001 # Try different learning rate
|
| 2277 |
+
scheduler: "cosine_with_restarts" # Use learning rate schedule
|
| 2278 |
+
weight_decay: 0.01 # Add regularization
|
| 2279 |
+
}
|
| 2280 |
+
|
| 2281 |
+
VALIDATE {
|
| 2282 |
+
save_best_model: true
|
| 2283 |
+
metric_to_monitor: "loss"
|
| 2284 |
+
}
|
| 2285 |
+
```
|
| 2286 |
+
|
| 2287 |
+
**3. Dataset format errors**
|
| 2288 |
+
|
| 2289 |
+
**Symptoms:**
|
| 2290 |
+
- "Invalid dataset format"
|
| 2291 |
+
- "Missing required columns"
|
| 2292 |
+
|
| 2293 |
+
**Solutions:**
|
| 2294 |
+
- Verify dataset format matches declared format
|
| 2295 |
+
- For JSONL: Ensure each line is valid JSON with required fields
|
| 2296 |
+
- For CSV: Check column names match expected schema
|
| 2297 |
+
- Use `okto validate` to check dataset before training
|
| 2298 |
+
|
| 2299 |
+
**4. Export fails**
|
| 2300 |
+
|
| 2301 |
+
**Symptoms:**
|
| 2302 |
+
- "Export format not supported"
|
| 2303 |
+
- "Quantization failed"
|
| 2304 |
+
|
| 2305 |
+
**Solutions:**
|
| 2306 |
+
- Ensure model architecture supports export format
|
| 2307 |
+
- For GGUF: Model must be quantized (use int8 or int4)
|
| 2308 |
+
- For ONNX: Model must be ONNX-compatible architecture
|
| 2309 |
+
- Check available disk space
|
| 2310 |
+
|
| 2311 |
+
**5. Inference produces poor results**
|
| 2312 |
+
|
| 2313 |
+
**Symptoms:**
|
| 2314 |
+
- Low quality outputs
|
| 2315 |
+
- Repetitive text
|
| 2316 |
+
- Off-topic responses
|
| 2317 |
+
|
| 2318 |
+
**Solutions:**
|
| 2319 |
+
```okt
|
| 2320 |
+
INFERENCE {
|
| 2321 |
+
temperature: 0.7 # Lower = more deterministic
|
| 2322 |
+
top_p: 0.9 # Nucleus sampling
|
| 2323 |
+
top_k: 40 # Limit vocabulary
|
| 2324 |
+
repetition_penalty: 1.2 # Reduce repetition
|
| 2325 |
+
max_tokens: 200 # Limit length
|
| 2326 |
+
}
|
| 2327 |
+
```
|
| 2328 |
+
|
| 2329 |
+
### Debug Mode
|
| 2330 |
+
|
| 2331 |
+
Enable debug logging:
|
| 2332 |
+
|
| 2333 |
+
```okt
|
| 2334 |
+
LOGGING {
|
| 2335 |
+
save_logs: true
|
| 2336 |
+
log_level: "debug"
|
| 2337 |
+
log_every: 1
|
| 2338 |
+
}
|
| 2339 |
+
```
|
| 2340 |
+
|
| 2341 |
+
Run with verbose output:
|
| 2342 |
+
```bash
|
| 2343 |
+
okto run project.okt --verbose --debug
|
| 2344 |
+
```
|
| 2345 |
+
|
| 2346 |
+
### Performance Optimization
|
| 2347 |
+
|
| 2348 |
+
**For faster training:**
|
| 2349 |
+
```okt
|
| 2350 |
+
TRAIN {
|
| 2351 |
+
batch_size: 64 # Larger batches
|
| 2352 |
+
gradient_accumulation: 1 # No accumulation
|
| 2353 |
+
mixed_precision: true # FP16
|
| 2354 |
+
device: "cuda"
|
| 2355 |
+
}
|
| 2356 |
+
```
|
| 2357 |
+
|
| 2358 |
+
**For memory efficiency:**
|
| 2359 |
+
```okt
|
| 2360 |
+
TRAIN {
|
| 2361 |
+
batch_size: 4
|
| 2362 |
+
gradient_accumulation: 8
|
| 2363 |
+
precision: "fp16"
|
| 2364 |
+
checkpoint_steps: 50 # Save more frequently
|
| 2365 |
+
}
|
| 2366 |
+
```
|
| 2367 |
+
|
| 2368 |
+
---
|
| 2369 |
+
|
| 2370 |
+
## Terminal / Basic Types
|
| 2371 |
+
|
| 2372 |
+
```ebnf
|
| 2373 |
+
<string> ::= '"' { any-character-except-quote } '"'
|
| 2374 |
+
|
| 2375 |
+
<string_list> ::= <string> { "," <string> }
|
| 2376 |
+
|
| 2377 |
+
<path> ::= '"' { any-character-except-quote } '"'
|
| 2378 |
+
|
| 2379 |
+
<number> ::= digit { digit }
|
| 2380 |
+
|
| 2381 |
+
<decimal> ::= digit { digit } "." digit { digit }
|
| 2382 |
+
|
| 2383 |
+
<boolean> ::= "true" | "false"
|
| 2384 |
+
|
| 2385 |
+
digit ::= "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9"
|
| 2386 |
+
```
|
| 2387 |
+
|
| 2388 |
+
**Type constraints:**
|
| 2389 |
+
- `string`: UTF-8 encoded, max 10,000 characters
|
| 2390 |
+
- `path`: Can be absolute or relative, must be valid filesystem path
|
| 2391 |
+
- `number`: Integer, range depends on field (typically 0 to 2^31-1)
|
| 2392 |
+
- `decimal`: Floating point, precision up to 6 decimal places
|
| 2393 |
+
- `boolean`: Literal values `true` or `false` (lowercase)
|
| 2394 |
+
|
| 2395 |
+
---
|
| 2396 |
+
|
| 2397 |
+
## Full Script Example
|
| 2398 |
+
|
| 2399 |
+
Complete example demonstrating all new blocks:
|
| 2400 |
+
|
| 2401 |
+
```okt
|
| 2402 |
+
# okto_version: "1.2"
|
| 2403 |
+
PROJECT "oktogpt"
|
| 2404 |
+
DESCRIPTION "Complete example with all new blocks"
|
| 2405 |
+
|
| 2406 |
+
MODEL {
|
| 2407 |
+
name: "oktogpt"
|
| 2408 |
+
base: "google/flan-t5-base"
|
| 2409 |
+
device: "cuda"
|
| 2410 |
+
|
| 2411 |
+
ADAPTER {
|
| 2412 |
+
type: "lora"
|
| 2413 |
+
path: "D:/model_trainee/phase1_sharegpt/ep2"
|
| 2414 |
+
rank: 16
|
| 2415 |
+
alpha: 32
|
| 2416 |
+
}
|
| 2417 |
+
}
|
| 2418 |
+
|
| 2419 |
+
MONITOR {
|
| 2420 |
+
metrics: [
|
| 2421 |
+
"loss",
|
| 2422 |
+
"val_loss",
|
| 2423 |
+
"accuracy",
|
| 2424 |
+
"gpu_usage",
|
| 2425 |
+
"ram_usage",
|
| 2426 |
+
"throughput",
|
| 2427 |
+
"latency",
|
| 2428 |
+
"confidence"
|
| 2429 |
+
]
|
| 2430 |
+
|
| 2431 |
+
notify_if {
|
| 2432 |
+
loss > 2.0
|
| 2433 |
+
gpu_usage > 90%
|
| 2434 |
+
temperature > 85
|
| 2435 |
+
hallucination_score > 0.5
|
| 2436 |
+
}
|
| 2437 |
+
|
| 2438 |
+
log_to: "logs/training.log"
|
| 2439 |
+
}
|
| 2440 |
+
|
| 2441 |
+
BEHAVIOR {
|
| 2442 |
+
personality: "assistant"
|
| 2443 |
+
language: "pt-BR"
|
| 2444 |
+
verbosity: "medium"
|
| 2445 |
+
avoid: ["politics", "violence", "hate"]
|
| 2446 |
+
fallback: "Como posso ajudar?"
|
| 2447 |
+
}
|
| 2448 |
+
|
| 2449 |
+
STABILITY {
|
| 2450 |
+
stop_if_nan: true
|
| 2451 |
+
stop_if_diverges: true
|
| 2452 |
+
min_improvement: 0.001
|
| 2453 |
+
}
|
| 2454 |
+
|
| 2455 |
+
EXPLORER {
|
| 2456 |
+
try {
|
| 2457 |
+
lr: [0.0003, 0.0001]
|
| 2458 |
+
batch_size: [4, 8]
|
| 2459 |
+
}
|
| 2460 |
+
max_tests: 4
|
| 2461 |
+
pick_best_by: "val_loss"
|
| 2462 |
+
}
|
| 2463 |
+
|
| 2464 |
+
CONTROL {
|
| 2465 |
+
on_epoch_end {
|
| 2466 |
+
SAVE model
|
| 2467 |
+
LOG "Epoch completed"
|
| 2468 |
+
}
|
| 2469 |
+
|
| 2470 |
+
IF val_loss > 2.0 {
|
| 2471 |
+
STOP_TRAINING
|
| 2472 |
+
}
|
| 2473 |
+
|
| 2474 |
+
WHEN gpu_memory < 12GB {
|
| 2475 |
+
SET batch_size = 4
|
| 2476 |
+
}
|
| 2477 |
+
}
|
| 2478 |
+
|
| 2479 |
+
INFERENCE {
|
| 2480 |
+
mode: "chat"
|
| 2481 |
+
format: "User: {input}\nAssistant:"
|
| 2482 |
+
|
| 2483 |
+
params {
|
| 2484 |
+
temperature: 0.7
|
| 2485 |
+
max_length: 120
|
| 2486 |
+
top_p: 0.9
|
| 2487 |
+
beams: 2
|
| 2488 |
+
do_sample: true
|
| 2489 |
+
}
|
| 2490 |
+
|
| 2491 |
+
CONTROL {
|
| 2492 |
+
IF confidence < 0.3 { RETRY }
|
| 2493 |
+
IF hallucination_score > 0.5 { REPLACE WITH "Desculpe, não tenho certeza." }
|
| 2494 |
+
}
|
| 2495 |
+
|
| 2496 |
+
exit_command: "/exit"
|
| 2497 |
+
}
|
| 2498 |
+
|
| 2499 |
+
GUARD {
|
| 2500 |
+
prevent {
|
| 2501 |
+
hallucination
|
| 2502 |
+
toxicity
|
| 2503 |
+
bias
|
| 2504 |
+
data_leak
|
| 2505 |
+
unsafe_code
|
| 2506 |
+
}
|
| 2507 |
+
|
| 2508 |
+
on_violation {
|
| 2509 |
+
STOP
|
| 2510 |
+
}
|
| 2511 |
+
}
|
| 2512 |
+
```
|
| 2513 |
+
|
| 2514 |
+
---
|
| 2515 |
+
|
| 2516 |
+
## Complete Examples
|
| 2517 |
+
|
| 2518 |
+
See [`../examples/`](../examples/) for complete working examples:
|
| 2519 |
+
|
| 2520 |
+
- [`basic.okt`](../examples/basic.okt) - Minimal example
|
| 2521 |
+
- [`chatbot.okt`](../examples/chatbot.okt) - Conversational AI
|
| 2522 |
+
- [`computer_vision.okt`](../examples/computer_vision.okt) - Image classification
|
| 2523 |
+
- [`recommender.okt`](../examples/recommender.okt) - Recommendation system
|
| 2524 |
+
- [`pizzabot/`](../examples/pizzabot/) - Complete project example
|
| 2525 |
+
|
| 2526 |
+
📊 **Example datasets available in** [`../examples/pizzabot/dataset/`](../examples/pizzabot/dataset/)
|
| 2527 |
+
|
| 2528 |
+
---
|
| 2529 |
+
|
| 2530 |
+
**Version:** 1.2
|
| 2531 |
+
**Last Updated:** December 2025
|
| 2532 |
+
**Maintained by:** OktoSeek AI
|
| 2533 |
+
|
| 2534 |
+
---
|
| 2535 |
+
|
| 2536 |
+
## Version History
|
| 2537 |
+
|
| 2538 |
+
### v1.2 (December 2025)
|
| 2539 |
+
- ✅ Enhanced `CONTROL` block with nested blocks support
|
| 2540 |
+
- ✅ Enhanced `BEHAVIOR` block with `mode` and `prompt_style`
|
| 2541 |
+
- ✅ Enhanced `GUARD` block with `detect_using` and additional prevention types
|
| 2542 |
+
- ✅ Enhanced `DEPLOY` block with `host`, `protocol`, and `format`
|
| 2543 |
+
- ✅ Enhanced `SECURITY` block with `input_validation`, `output_validation`, `rate_limit`, and `encryption`
|
| 2544 |
+
- ✅ Added support for nested IF/WHEN/EVERY statements inside event hooks
|
| 2545 |
+
- ✅ 100% backward compatible with v1.0 and v1.1
|
| 2546 |
+
|
| 2547 |
+
### v1.1 (November 2025)
|
| 2548 |
+
- ✅ Added `FT_LORA` block for LoRA fine-tuning
|
| 2549 |
+
- ✅ Added dataset mixing support (`mix_datasets`, `dataset_percent`, `sampling`)
|
| 2550 |
+
- ✅ Added `MONITOR` block for system telemetry
|
| 2551 |
+
- ✅ Added version declaration (`# okto_version`)
|
| 2552 |
+
- ✅ 100% backward compatible with v1.0
|
| 2553 |
+
|
| 2554 |
+
### v1.0 (Initial Release)
|
| 2555 |
+
- Initial OktoScript specification
|
| 2556 |
+
- Core blocks: PROJECT, DATASET, MODEL, TRAIN, METRICS, EXPORT, DEPLOY
|
| 2557 |
+
- Model inheritance
|
| 2558 |
+
- Extension points and hooks
|
| 2559 |
+
|
| 2560 |
+
---
|
| 2561 |
+
|
| 2562 |
+
## About OktoScript
|
| 2563 |
+
|
| 2564 |
+
**OktoScript** is a domain-specific programming language developed by **OktoSeek AI** for building, training, evaluating and exporting AI models. It is part of the OktoSeek ecosystem, which includes OktoSeek IDE, OktoEngine, and various tools for AI development.
|
| 2565 |
+
|
| 2566 |
+
For more information, visit:
|
| 2567 |
+
- **Official website:** https://www.oktoseek.com
|
| 2568 |
+
- **GitHub:** https://github.com/oktoseek/oktoscript
|
| 2569 |
+
- **Hugging Face:** https://huggingface.co/OktoSeek
|
| 2570 |
+
- **Twitter:** https://x.com/oktoseek
|
| 2571 |
+
- **YouTube:** https://www.youtube.com/@Oktoseek
|
examples/README.md
ADDED
|
@@ -0,0 +1,169 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# OktoScript Examples
|
| 2 |
+
|
| 3 |
+
This folder contains official example scripts written in **OktoScript (.okt)**.
|
| 4 |
+
|
| 5 |
+
These examples are used by:
|
| 6 |
+
|
| 7 |
+
- Developers learning OktoScript
|
| 8 |
+
- Students and researchers
|
| 9 |
+
- OktoSeek IDE
|
| 10 |
+
- VS Code Extension
|
| 11 |
+
- Automatic tests and validation
|
| 12 |
+
|
| 13 |
+
---
|
| 14 |
+
|
| 15 |
+
## Available Examples
|
| 16 |
+
|
| 17 |
+
### Basic Examples
|
| 18 |
+
|
| 19 |
+
| File | Description | Use Case |
|
| 20 |
+
|------|-------------|----------|
|
| 21 |
+
| [`basic.okt`](./basic.okt) | Minimal example | Getting started |
|
| 22 |
+
| [`chatbot.okt`](./chatbot.okt) | Conversational AI | Customer service, assistants |
|
| 23 |
+
| [`computer_vision.okt`](./computer_vision.okt) | Image classification | Vision models, object detection |
|
| 24 |
+
| [`recommender.okt`](./recommender.okt) | Recommendation system | E-commerce, content suggestions |
|
| 25 |
+
|
| 26 |
+
### Advanced Examples
|
| 27 |
+
|
| 28 |
+
| File | Description | Use Case |
|
| 29 |
+
|------|-------------|----------|
|
| 30 |
+
| [`finetuning-llm.okt`](./finetuning-llm.okt) | Fine-tuning LLM with checkpoints | Advanced language models, resume training |
|
| 31 |
+
| [`vision-pipeline.okt`](./vision-pipeline.okt) | Complete vision pipeline | Production vision systems, ONNX export |
|
| 32 |
+
| [`qa-embeddings.okt`](./qa-embeddings.okt) | QA with embeddings | Semantic search, retrieval systems |
|
| 33 |
+
|
| 34 |
+
### v1.1 Examples (New Features)
|
| 35 |
+
|
| 36 |
+
| File | Description | Use Case |
|
| 37 |
+
|------|-------------|----------|
|
| 38 |
+
| [`lora-finetuning.okt`](./lora-finetuning.okt) | LoRA fine-tuning with dataset mixing | Efficient fine-tuning, memory-efficient training |
|
| 39 |
+
| [`dataset-mixing.okt`](./dataset-mixing.okt) | Training with multiple weighted datasets | Combining datasets, weighted sampling |
|
| 40 |
+
|
| 41 |
+
### v1.2 Examples (Advanced Features)
|
| 42 |
+
|
| 43 |
+
| File | Description | Use Case |
|
| 44 |
+
|------|-------------|----------|
|
| 45 |
+
| [`control-nested.okt`](./control-nested.okt) | Nested CONTROL blocks with advanced decision-making | Dynamic training control, conditional logic |
|
| 46 |
+
| [`behavior-chat.okt`](./behavior-chat.okt) | BEHAVIOR block with mode and prompt_style | Chatbot personality, response style |
|
| 47 |
+
| [`guard-safety.okt`](./guard-safety.okt) | GUARD block with multiple detection methods | Content safety, ethical AI |
|
| 48 |
+
| [`deploy-api.okt`](./deploy-api.okt) | DEPLOY block for API deployment | Production API deployment |
|
| 49 |
+
| [`security-full.okt`](./security-full.okt) | Complete SECURITY block configuration | Input/output validation, rate limiting |
|
| 50 |
+
| [`model-adapter.okt`](./model-adapter.okt) | MODEL block with ADAPTER (LoRA/PEFT) | Parameter-efficient fine-tuning |
|
| 51 |
+
| [`inference-advanced.okt`](./inference-advanced.okt) | Advanced INFERENCE with nested CONTROL | Smart inference with retry logic |
|
| 52 |
+
| [`monitor-full.okt`](./monitor-full.okt) | Complete MONITOR block with all metrics | Full system and training telemetry |
|
| 53 |
+
| [`explorer-automl.okt`](./explorer-automl.okt) | EXPLORER block for hyperparameter search | AutoML-style optimization |
|
| 54 |
+
| [`stability-training.okt`](./stability-training.okt) | STABILITY block for safe training | Training stability and safety |
|
| 55 |
+
| [`complete-v1.2.okt`](./complete-v1.2.okt) | Complete example with all v1.2 features | Full feature demonstration |
|
| 56 |
+
|
| 57 |
+
### Complete Projects
|
| 58 |
+
|
| 59 |
+
| File | Description | Use Case |
|
| 60 |
+
|------|-------------|----------|
|
| 61 |
+
| [`pizzabot/`](./pizzabot/) | Complete project example | Full workflow demonstration |
|
| 62 |
+
|
| 63 |
+
---
|
| 64 |
+
|
| 65 |
+
## Quick Start
|
| 66 |
+
|
| 67 |
+
To run these examples with OktoEngine (when available):
|
| 68 |
+
|
| 69 |
+
```bash
|
| 70 |
+
# Validate syntax
|
| 71 |
+
okto validate examples/basic.okt
|
| 72 |
+
|
| 73 |
+
# Train a model
|
| 74 |
+
okto train examples/chatbot.okt
|
| 75 |
+
|
| 76 |
+
# Evaluate performance
|
| 77 |
+
okto eval examples/recommender.okt
|
| 78 |
+
|
| 79 |
+
# Export model
|
| 80 |
+
okto export examples/computer_vision.okt --format=okm
|
| 81 |
+
```
|
| 82 |
+
|
| 83 |
+
---
|
| 84 |
+
|
| 85 |
+
## Export Formats
|
| 86 |
+
|
| 87 |
+
OktoScript supports multiple export formats for different use cases:
|
| 88 |
+
|
| 89 |
+
### Standard Formats
|
| 90 |
+
|
| 91 |
+
- **ONNX** - Universal inference, production-ready
|
| 92 |
+
- **GGUF** - Local inference, Ollama, Llama.cpp
|
| 93 |
+
- **SafeTensors** - HuggingFace, research, standard training
|
| 94 |
+
|
| 95 |
+
### OktoSeek Optimized Formats
|
| 96 |
+
|
| 97 |
+
- **OktoModel (.okm)** - Optimized for OktoSeek SDK & Flutter plugins
|
| 98 |
+
- **OktoBundle (.okx)** - Mobile + Edge package (iOS, Android, Edge AI)
|
| 99 |
+
|
| 100 |
+
> 💡 **Tip:** While standard formats work everywhere, `.okm` and `.okx` formats are optimized for the OktoSeek ecosystem, providing better integration with Flutter apps, mobile SDKs, and OktoSeek tools.
|
| 101 |
+
|
| 102 |
+
---
|
| 103 |
+
|
| 104 |
+
## Example: Using OktoModel Format
|
| 105 |
+
|
| 106 |
+
```okt
|
| 107 |
+
EXPORT {
|
| 108 |
+
format: ["onnx", "okm"]
|
| 109 |
+
path: "export/"
|
| 110 |
+
}
|
| 111 |
+
```
|
| 112 |
+
|
| 113 |
+
**Why use .okm?**
|
| 114 |
+
|
| 115 |
+
- ✅ Optimized for OktoSeek Flutter SDK
|
| 116 |
+
- ✅ Better performance on mobile devices
|
| 117 |
+
- ✅ Access to exclusive OktoSeek tools and plugins
|
| 118 |
+
- ✅ Seamless integration with OktoSeek ecosystem
|
| 119 |
+
- ✅ Support for iOS and Android apps
|
| 120 |
+
|
| 121 |
+
**Note:** `.okm` is optional. You can always export to standard formats (ONNX, GGUF, SafeTensors) for universal compatibility.
|
| 122 |
+
|
| 123 |
+
---
|
| 124 |
+
|
| 125 |
+
## Training Workflow
|
| 126 |
+
|
| 127 |
+
During training, OktoScript uses standard formats (this is industry-standard):
|
| 128 |
+
|
| 129 |
+
```
|
| 130 |
+
runs/my-model/
|
| 131 |
+
├── checkpoint-100/
|
| 132 |
+
│ └── model.safetensors
|
| 133 |
+
├── checkpoint-200/
|
| 134 |
+
│ └── model.safetensors
|
| 135 |
+
├── tokenizer.json
|
| 136 |
+
└── training_logs.json
|
| 137 |
+
```
|
| 138 |
+
|
| 139 |
+
After training, you choose your export format based on your deployment needs.
|
| 140 |
+
|
| 141 |
+
---
|
| 142 |
+
|
| 143 |
+
## Complete Project Example
|
| 144 |
+
|
| 145 |
+
See [`pizzabot/`](./pizzabot/) for a complete project example with:
|
| 146 |
+
- Full project structure
|
| 147 |
+
- Multiple dataset files
|
| 148 |
+
- Training configuration
|
| 149 |
+
- Export settings
|
| 150 |
+
- Example outputs
|
| 151 |
+
|
| 152 |
+
---
|
| 153 |
+
|
| 154 |
+
## Contributing
|
| 155 |
+
|
| 156 |
+
Want to add your own example?
|
| 157 |
+
|
| 158 |
+
1. Create a new `.okt` file in this directory
|
| 159 |
+
2. Follow the OktoScript grammar specification
|
| 160 |
+
3. Include clear comments and descriptions
|
| 161 |
+
4. Submit a pull request!
|
| 162 |
+
|
| 163 |
+
---
|
| 164 |
+
|
| 165 |
+
**Powered by OktoSeek AI**
|
| 166 |
+
|
| 167 |
+
- **Website:** https://www.oktoseek.com
|
| 168 |
+
- **GitHub:** https://github.com/oktoseek/oktoscript
|
| 169 |
+
- **Documentation:** [../docs/grammar.md](../docs/grammar.md)
|
examples/basic.okt
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
PROJECT "BasicModel"
|
| 2 |
+
DESCRIPTION "Minimal OktoScript example - perfect for getting started"
|
| 3 |
+
|
| 4 |
+
ENV {
|
| 5 |
+
accelerator: "cpu"
|
| 6 |
+
min_memory: "4GB"
|
| 7 |
+
install_missing: true
|
| 8 |
+
}
|
| 9 |
+
|
| 10 |
+
DATASET {
|
| 11 |
+
train: "examples/datasets/demo_train.jsonl"
|
| 12 |
+
}
|
| 13 |
+
|
| 14 |
+
MODEL {
|
| 15 |
+
base: "oktoseek/base-mini"
|
| 16 |
+
}
|
| 17 |
+
|
| 18 |
+
TRAIN {
|
| 19 |
+
epochs: 2
|
| 20 |
+
batch_size: 16
|
| 21 |
+
device: "cpu"
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
EXPORT {
|
| 25 |
+
format: ["okm"]
|
| 26 |
+
path: "export/"
|
| 27 |
+
}
|
| 28 |
+
|
examples/behavior-chat.okt
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# okto_version: "1.2"
|
| 2 |
+
PROJECT "BehaviorChatExample"
|
| 3 |
+
DESCRIPTION "Demonstrates BEHAVIOR block with mode and prompt_style"
|
| 4 |
+
|
| 5 |
+
ENV {
|
| 6 |
+
accelerator: "gpu"
|
| 7 |
+
min_memory: "8GB"
|
| 8 |
+
precision: "fp16"
|
| 9 |
+
}
|
| 10 |
+
|
| 11 |
+
DATASET {
|
| 12 |
+
train: "examples/datasets/demo_train.jsonl"
|
| 13 |
+
format: "jsonl"
|
| 14 |
+
type: "chat"
|
| 15 |
+
language: "en"
|
| 16 |
+
}
|
| 17 |
+
|
| 18 |
+
MODEL {
|
| 19 |
+
name: "behavior-chat-model"
|
| 20 |
+
base: "oktoseek/base-mini"
|
| 21 |
+
device: "cuda"
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
TRAIN {
|
| 25 |
+
epochs: 5
|
| 26 |
+
batch_size: 32
|
| 27 |
+
learning_rate: 0.0001
|
| 28 |
+
device: "cuda"
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
BEHAVIOR {
|
| 32 |
+
mode: "chat"
|
| 33 |
+
personality: "friendly"
|
| 34 |
+
verbosity: "medium"
|
| 35 |
+
language: "en"
|
| 36 |
+
avoid: ["violence", "hate", "politics"]
|
| 37 |
+
fallback: "I'm here to help! How can I assist you?"
|
| 38 |
+
prompt_style: "User: {input}\nAssistant:"
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
INFERENCE {
|
| 42 |
+
mode: "chat"
|
| 43 |
+
format: "User: {input}\nAssistant:"
|
| 44 |
+
exit_command: "/exit"
|
| 45 |
+
|
| 46 |
+
params {
|
| 47 |
+
max_length: 120
|
| 48 |
+
temperature: 0.7
|
| 49 |
+
top_p: 0.9
|
| 50 |
+
do_sample: true
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
CONTROL {
|
| 54 |
+
IF confidence < 0.3 { RETRY }
|
| 55 |
+
IF repetition > 3 { REGENERATE }
|
| 56 |
+
}
|
| 57 |
+
}
|
| 58 |
+
|
| 59 |
+
GUARD {
|
| 60 |
+
prevent {
|
| 61 |
+
toxicity
|
| 62 |
+
bias
|
| 63 |
+
hallucination
|
| 64 |
+
}
|
| 65 |
+
|
| 66 |
+
detect_using: ["classifier", "regex"]
|
| 67 |
+
|
| 68 |
+
on_violation {
|
| 69 |
+
REPLACE
|
| 70 |
+
with_message: "Sorry, this request is not allowed."
|
| 71 |
+
}
|
| 72 |
+
}
|
| 73 |
+
|
| 74 |
+
EXPORT {
|
| 75 |
+
format: ["okm", "onnx"]
|
| 76 |
+
path: "export/"
|
| 77 |
+
}
|
| 78 |
+
|
examples/chatbot.okt
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
PROJECT "PizzaBot"
|
| 2 |
+
DESCRIPTION "Chatbot specialized in pizza restaurant service"
|
| 3 |
+
|
| 4 |
+
ENV {
|
| 5 |
+
accelerator: "gpu"
|
| 6 |
+
min_memory: "8GB"
|
| 7 |
+
precision: "fp16"
|
| 8 |
+
backend: "oktoseek"
|
| 9 |
+
install_missing: true
|
| 10 |
+
}
|
| 11 |
+
|
| 12 |
+
DATASET {
|
| 13 |
+
train: "examples/datasets/demo_train.jsonl"
|
| 14 |
+
format: "jsonl"
|
| 15 |
+
type: "chat"
|
| 16 |
+
language: "en"
|
| 17 |
+
}
|
| 18 |
+
|
| 19 |
+
MODEL {
|
| 20 |
+
base: "oktoseek/pizza-small"
|
| 21 |
+
architecture: "transformer"
|
| 22 |
+
parameters: 120M
|
| 23 |
+
context_window: 2048
|
| 24 |
+
}
|
| 25 |
+
|
| 26 |
+
TRAIN {
|
| 27 |
+
epochs: 5
|
| 28 |
+
batch_size: 32
|
| 29 |
+
learning_rate: 0.0001
|
| 30 |
+
optimizer: "adamw"
|
| 31 |
+
scheduler: "cosine"
|
| 32 |
+
device: "auto"
|
| 33 |
+
checkpoint_steps: 100
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
METRICS {
|
| 37 |
+
accuracy
|
| 38 |
+
perplexity
|
| 39 |
+
f1
|
| 40 |
+
response_coherence
|
| 41 |
+
}
|
| 42 |
+
|
| 43 |
+
EXPORT {
|
| 44 |
+
format: ["gguf", "okm"]
|
| 45 |
+
path: "export/"
|
| 46 |
+
}
|
| 47 |
+
|
examples/complete-v1.2.okt
ADDED
|
@@ -0,0 +1,210 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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 |
+
# okto_version: "1.2"
|
| 2 |
+
PROJECT "CompleteV12Example"
|
| 3 |
+
DESCRIPTION "Complete example demonstrating all v1.2 features"
|
| 4 |
+
|
| 5 |
+
ENV {
|
| 6 |
+
accelerator: "gpu"
|
| 7 |
+
min_memory: "16GB"
|
| 8 |
+
precision: "fp16"
|
| 9 |
+
backend: "oktoseek"
|
| 10 |
+
install_missing: true
|
| 11 |
+
}
|
| 12 |
+
|
| 13 |
+
DATASET {
|
| 14 |
+
train: "examples/datasets/demo_train.jsonl"
|
| 15 |
+
validation: "examples/datasets/demo_train.jsonl"
|
| 16 |
+
format: "jsonl"
|
| 17 |
+
type: "chat"
|
| 18 |
+
language: "en"
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
+
MODEL {
|
| 22 |
+
name: "complete-v12-model"
|
| 23 |
+
base: "google/flan-t5-base"
|
| 24 |
+
device: "cuda"
|
| 25 |
+
|
| 26 |
+
ADAPTER {
|
| 27 |
+
type: "lora"
|
| 28 |
+
path: "./adapters/my-adapter"
|
| 29 |
+
rank: 16
|
| 30 |
+
alpha: 32
|
| 31 |
+
}
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
TRAIN {
|
| 35 |
+
epochs: 10
|
| 36 |
+
batch_size: 32
|
| 37 |
+
learning_rate: 0.0001
|
| 38 |
+
optimizer: "adamw"
|
| 39 |
+
scheduler: "cosine"
|
| 40 |
+
device: "cuda"
|
| 41 |
+
checkpoint_steps: 100
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
METRICS {
|
| 45 |
+
accuracy
|
| 46 |
+
loss
|
| 47 |
+
perplexity
|
| 48 |
+
f1
|
| 49 |
+
confidence
|
| 50 |
+
}
|
| 51 |
+
|
| 52 |
+
MONITOR {
|
| 53 |
+
metrics: [
|
| 54 |
+
"loss",
|
| 55 |
+
"val_loss",
|
| 56 |
+
"accuracy",
|
| 57 |
+
"gpu_usage",
|
| 58 |
+
"ram_usage",
|
| 59 |
+
"throughput",
|
| 60 |
+
"latency",
|
| 61 |
+
"confidence"
|
| 62 |
+
]
|
| 63 |
+
|
| 64 |
+
notify_if {
|
| 65 |
+
loss > 2.0
|
| 66 |
+
gpu_usage > 90%
|
| 67 |
+
temperature > 85
|
| 68 |
+
hallucination_score > 0.5
|
| 69 |
+
}
|
| 70 |
+
|
| 71 |
+
log_to: "logs/training.log"
|
| 72 |
+
}
|
| 73 |
+
|
| 74 |
+
BEHAVIOR {
|
| 75 |
+
mode: "chat"
|
| 76 |
+
personality: "assistant"
|
| 77 |
+
verbosity: "medium"
|
| 78 |
+
language: "en"
|
| 79 |
+
avoid: ["politics", "violence", "hate"]
|
| 80 |
+
fallback: "How can I help you?"
|
| 81 |
+
prompt_style: "User: {input}\nAssistant:"
|
| 82 |
+
}
|
| 83 |
+
|
| 84 |
+
STABILITY {
|
| 85 |
+
stop_if_nan: true
|
| 86 |
+
stop_if_diverges: true
|
| 87 |
+
min_improvement: 0.001
|
| 88 |
+
}
|
| 89 |
+
|
| 90 |
+
EXPLORER {
|
| 91 |
+
try {
|
| 92 |
+
lr: [0.0003, 0.0001]
|
| 93 |
+
batch_size: [16, 32]
|
| 94 |
+
}
|
| 95 |
+
max_tests: 4
|
| 96 |
+
pick_best_by: "val_loss"
|
| 97 |
+
}
|
| 98 |
+
|
| 99 |
+
CONTROL {
|
| 100 |
+
on_epoch_end {
|
| 101 |
+
SAVE model
|
| 102 |
+
LOG "Epoch completed"
|
| 103 |
+
|
| 104 |
+
IF loss > 2.0 {
|
| 105 |
+
SET LR = 0.00005
|
| 106 |
+
LOG "High loss detected"
|
| 107 |
+
|
| 108 |
+
WHEN gpu_usage > 90% {
|
| 109 |
+
SET batch_size = 16
|
| 110 |
+
LOG "Reducing batch size due to GPU pressure"
|
| 111 |
+
}
|
| 112 |
+
}
|
| 113 |
+
|
| 114 |
+
IF val_loss > 2.5 {
|
| 115 |
+
STOP_TRAINING
|
| 116 |
+
}
|
| 117 |
+
|
| 118 |
+
IF accuracy > 0.9 {
|
| 119 |
+
SAVE "best_model"
|
| 120 |
+
LOG "High accuracy reached"
|
| 121 |
+
}
|
| 122 |
+
}
|
| 123 |
+
|
| 124 |
+
validate_every: 200
|
| 125 |
+
|
| 126 |
+
WHEN gpu_memory < 12GB {
|
| 127 |
+
SET batch_size = 16
|
| 128 |
+
}
|
| 129 |
+
|
| 130 |
+
EVERY 500 steps {
|
| 131 |
+
SAVE checkpoint
|
| 132 |
+
}
|
| 133 |
+
}
|
| 134 |
+
|
| 135 |
+
INFERENCE {
|
| 136 |
+
mode: "chat"
|
| 137 |
+
format: "User: {input}\nAssistant:"
|
| 138 |
+
exit_command: "/exit"
|
| 139 |
+
|
| 140 |
+
params {
|
| 141 |
+
temperature: 0.7
|
| 142 |
+
max_length: 120
|
| 143 |
+
top_p: 0.9
|
| 144 |
+
beams: 2
|
| 145 |
+
do_sample: true
|
| 146 |
+
}
|
| 147 |
+
|
| 148 |
+
CONTROL {
|
| 149 |
+
IF confidence < 0.3 { RETRY }
|
| 150 |
+
IF hallucination_score > 0.5 { REPLACE WITH "I'm not certain about that." }
|
| 151 |
+
}
|
| 152 |
+
}
|
| 153 |
+
|
| 154 |
+
GUARD {
|
| 155 |
+
prevent {
|
| 156 |
+
hallucination
|
| 157 |
+
toxicity
|
| 158 |
+
bias
|
| 159 |
+
data_leak
|
| 160 |
+
unsafe_code
|
| 161 |
+
}
|
| 162 |
+
|
| 163 |
+
detect_using: ["classifier", "regex", "embedding"]
|
| 164 |
+
|
| 165 |
+
on_violation {
|
| 166 |
+
REPLACE
|
| 167 |
+
with_message: "Sorry, this request is not allowed."
|
| 168 |
+
}
|
| 169 |
+
}
|
| 170 |
+
|
| 171 |
+
SECURITY {
|
| 172 |
+
input_validation {
|
| 173 |
+
max_length: 500
|
| 174 |
+
disallow_patterns: [
|
| 175 |
+
"<script>",
|
| 176 |
+
"DROP TABLE",
|
| 177 |
+
"rm -rf"
|
| 178 |
+
]
|
| 179 |
+
}
|
| 180 |
+
|
| 181 |
+
output_validation {
|
| 182 |
+
prevent_data_leak: true
|
| 183 |
+
mask_personal_info: true
|
| 184 |
+
}
|
| 185 |
+
|
| 186 |
+
rate_limit {
|
| 187 |
+
max_requests_per_minute: 60
|
| 188 |
+
}
|
| 189 |
+
|
| 190 |
+
encryption {
|
| 191 |
+
algorithm: "AES-256"
|
| 192 |
+
}
|
| 193 |
+
}
|
| 194 |
+
|
| 195 |
+
EXPORT {
|
| 196 |
+
format: ["okm", "onnx", "gguf"]
|
| 197 |
+
path: "export/"
|
| 198 |
+
}
|
| 199 |
+
|
| 200 |
+
DEPLOY {
|
| 201 |
+
target: "api"
|
| 202 |
+
host: "0.0.0.0"
|
| 203 |
+
endpoint: "/chatbot"
|
| 204 |
+
requires_auth: true
|
| 205 |
+
port: 9000
|
| 206 |
+
max_concurrent_requests: 100
|
| 207 |
+
protocol: "http"
|
| 208 |
+
format: "onnx"
|
| 209 |
+
}
|
| 210 |
+
|
examples/computer_vision.okt
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
PROJECT "VisionClassifier"
|
| 2 |
+
DESCRIPTION "Image classification example for computer vision tasks"
|
| 3 |
+
|
| 4 |
+
DATASET {
|
| 5 |
+
train: "dataset/images/"
|
| 6 |
+
format: "image+caption"
|
| 7 |
+
type: "vision"
|
| 8 |
+
augmentation: ["flip", "rotate", "brightness"]
|
| 9 |
+
}
|
| 10 |
+
|
| 11 |
+
MODEL {
|
| 12 |
+
base: "oktoseek/vision-base"
|
| 13 |
+
architecture: "cnn"
|
| 14 |
+
parameters: 50M
|
| 15 |
+
precision: "fp16"
|
| 16 |
+
}
|
| 17 |
+
|
| 18 |
+
TRAIN {
|
| 19 |
+
epochs: 20
|
| 20 |
+
batch_size: 64
|
| 21 |
+
learning_rate: 0.001
|
| 22 |
+
optimizer: "adam"
|
| 23 |
+
device: "cuda"
|
| 24 |
+
early_stopping: true
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
METRICS {
|
| 28 |
+
accuracy
|
| 29 |
+
precision
|
| 30 |
+
recall
|
| 31 |
+
f1
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
EXPORT {
|
| 35 |
+
format: ["onnx", "okm"]
|
| 36 |
+
path: "export/"
|
| 37 |
+
quantization: "int8"
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
|
| 41 |
+
|
examples/control-nested.okt
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# okto_version: "1.2"
|
| 2 |
+
PROJECT "ControlNestedExample"
|
| 3 |
+
DESCRIPTION "Demonstrates nested CONTROL blocks with advanced decision-making"
|
| 4 |
+
|
| 5 |
+
ENV {
|
| 6 |
+
accelerator: "gpu"
|
| 7 |
+
min_memory: "8GB"
|
| 8 |
+
precision: "fp16"
|
| 9 |
+
}
|
| 10 |
+
|
| 11 |
+
DATASET {
|
| 12 |
+
train: "examples/datasets/demo_train.jsonl"
|
| 13 |
+
validation: "examples/datasets/demo_train.jsonl"
|
| 14 |
+
format: "jsonl"
|
| 15 |
+
type: "chat"
|
| 16 |
+
}
|
| 17 |
+
|
| 18 |
+
MODEL {
|
| 19 |
+
name: "nested-control-model"
|
| 20 |
+
base: "oktoseek/base-mini"
|
| 21 |
+
device: "cuda"
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
TRAIN {
|
| 25 |
+
epochs: 10
|
| 26 |
+
batch_size: 32
|
| 27 |
+
learning_rate: 0.0001
|
| 28 |
+
optimizer: "adamw"
|
| 29 |
+
device: "cuda"
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
CONTROL {
|
| 33 |
+
on_step_end {
|
| 34 |
+
LOG loss
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
on_epoch_end {
|
| 38 |
+
IF loss > 2.0 {
|
| 39 |
+
SET LR = 0.00005
|
| 40 |
+
LOG "High loss detected, reducing learning rate"
|
| 41 |
+
|
| 42 |
+
WHEN gpu_usage > 90% {
|
| 43 |
+
SET batch_size = 16
|
| 44 |
+
LOG "Reducing batch size due to GPU pressure"
|
| 45 |
+
}
|
| 46 |
+
|
| 47 |
+
IF val_loss > 3.0 {
|
| 48 |
+
STOP_TRAINING
|
| 49 |
+
}
|
| 50 |
+
}
|
| 51 |
+
|
| 52 |
+
IF accuracy > 0.9 {
|
| 53 |
+
SAVE "best_model"
|
| 54 |
+
LOG "High accuracy reached"
|
| 55 |
+
}
|
| 56 |
+
|
| 57 |
+
EVERY 2 epochs {
|
| 58 |
+
SAVE "checkpoint_epoch_{epoch}"
|
| 59 |
+
}
|
| 60 |
+
}
|
| 61 |
+
|
| 62 |
+
validate_every: 200
|
| 63 |
+
|
| 64 |
+
IF epoch == 1 {
|
| 65 |
+
LOG "Warmup stage"
|
| 66 |
+
}
|
| 67 |
+
|
| 68 |
+
IF epoch > 5 AND accuracy < 0.6 {
|
| 69 |
+
SET LR = 0.00001
|
| 70 |
+
LOG "Model is stagnated, reducing learning rate"
|
| 71 |
+
}
|
| 72 |
+
|
| 73 |
+
IF epoch > 10 AND loss > 1.8 {
|
| 74 |
+
STOP_TRAINING
|
| 75 |
+
}
|
| 76 |
+
|
| 77 |
+
WHEN gpu_memory < 12GB {
|
| 78 |
+
SET batch_size = 16
|
| 79 |
+
}
|
| 80 |
+
|
| 81 |
+
EVERY 500 steps {
|
| 82 |
+
SAVE checkpoint
|
| 83 |
+
}
|
| 84 |
+
}
|
| 85 |
+
|
| 86 |
+
MONITOR {
|
| 87 |
+
metrics: ["loss", "val_loss", "accuracy", "gpu_usage", "ram_usage"]
|
| 88 |
+
notify_if {
|
| 89 |
+
loss > 2.0
|
| 90 |
+
gpu_usage > 90%
|
| 91 |
+
}
|
| 92 |
+
log_to: "logs/training.log"
|
| 93 |
+
}
|
| 94 |
+
|
| 95 |
+
EXPORT {
|
| 96 |
+
format: ["okm"]
|
| 97 |
+
path: "export/"
|
| 98 |
+
}
|
| 99 |
+
|
examples/dataset-mixing.okt
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# okto_version: "1.1"
|
| 2 |
+
PROJECT "MixedDatasetModel"
|
| 3 |
+
DESCRIPTION "Training with multiple datasets using weighted mixing"
|
| 4 |
+
VERSION "1.0"
|
| 5 |
+
AUTHOR "OktoSeek"
|
| 6 |
+
|
| 7 |
+
DATASET {
|
| 8 |
+
mix_datasets: [
|
| 9 |
+
{ path: "dataset/general.jsonl", weight: 50 },
|
| 10 |
+
{ path: "dataset/technical.jsonl", weight: 30 },
|
| 11 |
+
{ path: "dataset/creative.jsonl", weight: 20 }
|
| 12 |
+
]
|
| 13 |
+
dataset_percent: 80
|
| 14 |
+
sampling: "weighted"
|
| 15 |
+
shuffle: true
|
| 16 |
+
format: "jsonl"
|
| 17 |
+
type: "generation"
|
| 18 |
+
language: "en"
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
+
MODEL {
|
| 22 |
+
base: "oktoseek/base-mini"
|
| 23 |
+
architecture: "transformer"
|
| 24 |
+
parameters: 120M
|
| 25 |
+
context_window: 2048
|
| 26 |
+
precision: "fp16"
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
TRAIN {
|
| 30 |
+
epochs: 10
|
| 31 |
+
batch_size: 32
|
| 32 |
+
learning_rate: 0.0001
|
| 33 |
+
optimizer: "adamw"
|
| 34 |
+
scheduler: "cosine"
|
| 35 |
+
device: "cuda"
|
| 36 |
+
early_stopping: true
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
METRICS {
|
| 40 |
+
loss
|
| 41 |
+
perplexity
|
| 42 |
+
bleu
|
| 43 |
+
rouge_l
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
MONITOR {
|
| 47 |
+
level: "basic"
|
| 48 |
+
log_metrics: ["loss", "perplexity"]
|
| 49 |
+
log_system: ["gpu_memory_used", "cpu_usage"]
|
| 50 |
+
refresh_interval: 5s
|
| 51 |
+
export_to: "runs/mixed-dataset/system.json"
|
| 52 |
+
dashboard: false
|
| 53 |
+
}
|
| 54 |
+
|
| 55 |
+
EXPORT {
|
| 56 |
+
format: ["okm"]
|
| 57 |
+
path: "export/"
|
| 58 |
+
}
|
| 59 |
+
|
| 60 |
+
|
| 61 |
+
|
examples/datasets/demo_train.jsonl
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{"input": "Hi", "output": "Hello! How can I help you today?"}
|
| 2 |
+
{"input": "Do you deliver pizza?", "output": "Yes, delivery is available!"}
|
| 3 |
+
{"input": "What flavors do you have?", "output": "We offer Margherita, Pepperoni and Four Cheese."}
|
| 4 |
+
{"input": "Thank you", "output": "You are welcome!"}
|
| 5 |
+
{"input": "What's your phone number?", "output": "You can reach us at (555) 123-4567."}
|
| 6 |
+
{"input": "How long does delivery take?", "output": "Delivery typically takes 30-45 minutes."}
|
| 7 |
+
{"input": "Do you have vegetarian options?", "output": "Yes, we offer Margherita and Veggie pizzas."}
|
| 8 |
+
{"input": "What sizes are available?", "output": "We have Small, Medium, Large and Extra Large."}
|
| 9 |
+
{"input": "Can I customize my pizza?", "output": "Absolutely! You can add or remove any toppings."}
|
| 10 |
+
{"input": "What's your address?", "output": "We're located at 123 Main Street."}
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
|
examples/deploy-api.okt
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# okto_version: "1.2"
|
| 2 |
+
PROJECT "DeployAPIExample"
|
| 3 |
+
DESCRIPTION "Demonstrates DEPLOY block for API deployment"
|
| 4 |
+
|
| 5 |
+
ENV {
|
| 6 |
+
accelerator: "gpu"
|
| 7 |
+
min_memory: "8GB"
|
| 8 |
+
precision: "fp16"
|
| 9 |
+
}
|
| 10 |
+
|
| 11 |
+
DATASET {
|
| 12 |
+
train: "examples/datasets/demo_train.jsonl"
|
| 13 |
+
format: "jsonl"
|
| 14 |
+
type: "chat"
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
MODEL {
|
| 18 |
+
name: "api-deploy-model"
|
| 19 |
+
base: "oktoseek/base-mini"
|
| 20 |
+
device: "cuda"
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
TRAIN {
|
| 24 |
+
epochs: 5
|
| 25 |
+
batch_size: 32
|
| 26 |
+
device: "cuda"
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
EXPORT {
|
| 30 |
+
format: ["onnx", "okm"]
|
| 31 |
+
path: "export/"
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
DEPLOY {
|
| 35 |
+
target: "api"
|
| 36 |
+
host: "0.0.0.0"
|
| 37 |
+
endpoint: "/chatbot"
|
| 38 |
+
requires_auth: true
|
| 39 |
+
port: 9000
|
| 40 |
+
max_concurrent_requests: 100
|
| 41 |
+
protocol: "http"
|
| 42 |
+
format: "onnx"
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
SECURITY {
|
| 46 |
+
input_validation {
|
| 47 |
+
max_length: 500
|
| 48 |
+
disallow_patterns: [
|
| 49 |
+
"<script>",
|
| 50 |
+
"DROP TABLE",
|
| 51 |
+
"rm -rf",
|
| 52 |
+
"sudo"
|
| 53 |
+
]
|
| 54 |
+
}
|
| 55 |
+
|
| 56 |
+
output_validation {
|
| 57 |
+
prevent_data_leak: true
|
| 58 |
+
mask_personal_info: true
|
| 59 |
+
}
|
| 60 |
+
|
| 61 |
+
rate_limit {
|
| 62 |
+
max_requests_per_minute: 60
|
| 63 |
+
}
|
| 64 |
+
|
| 65 |
+
encryption {
|
| 66 |
+
algorithm: "AES-256"
|
| 67 |
+
}
|
| 68 |
+
}
|
| 69 |
+
|
| 70 |
+
BEHAVIOR {
|
| 71 |
+
mode: "chat"
|
| 72 |
+
personality: "assistant"
|
| 73 |
+
verbosity: "medium"
|
| 74 |
+
language: "en"
|
| 75 |
+
fallback: "How can I help you?"
|
| 76 |
+
}
|
| 77 |
+
|
examples/explorer-automl.okt
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# okto_version: "1.2"
|
| 2 |
+
PROJECT "ExplorerAutoMLExample"
|
| 3 |
+
DESCRIPTION "Demonstrates EXPLORER block for hyperparameter search"
|
| 4 |
+
|
| 5 |
+
ENV {
|
| 6 |
+
accelerator: "gpu"
|
| 7 |
+
min_memory: "8GB"
|
| 8 |
+
precision: "fp16"
|
| 9 |
+
}
|
| 10 |
+
|
| 11 |
+
DATASET {
|
| 12 |
+
train: "examples/datasets/demo_train.jsonl"
|
| 13 |
+
validation: "examples/datasets/demo_train.jsonl"
|
| 14 |
+
format: "jsonl"
|
| 15 |
+
type: "chat"
|
| 16 |
+
}
|
| 17 |
+
|
| 18 |
+
MODEL {
|
| 19 |
+
name: "explorer-model"
|
| 20 |
+
base: "oktoseek/base-mini"
|
| 21 |
+
device: "cuda"
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
EXPLORER {
|
| 25 |
+
try {
|
| 26 |
+
lr: [0.001, 0.0005, 0.0001, 0.00005]
|
| 27 |
+
batch_size: [8, 16, 32]
|
| 28 |
+
optimizer: ["adamw", "adam", "sgd"]
|
| 29 |
+
scheduler: ["cosine", "linear", "constant"]
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
max_tests: 12
|
| 33 |
+
pick_best_by: "val_loss"
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
TRAIN {
|
| 37 |
+
epochs: 5
|
| 38 |
+
device: "cuda"
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
MONITOR {
|
| 42 |
+
metrics: ["loss", "val_loss", "accuracy"]
|
| 43 |
+
log_to: "logs/explorer.log"
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
EXPORT {
|
| 47 |
+
format: ["okm"]
|
| 48 |
+
path: "export/"
|
| 49 |
+
}
|
| 50 |
+
|
examples/finetuning-llm.okt
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
PROJECT "FineTunedLLM"
|
| 2 |
+
DESCRIPTION "Fine-tuning a small LLM with checkpoint resume and custom callbacks"
|
| 3 |
+
VERSION "1.0"
|
| 4 |
+
AUTHOR "OktoSeek"
|
| 5 |
+
|
| 6 |
+
DATASET {
|
| 7 |
+
train: "dataset/instruction_train.jsonl"
|
| 8 |
+
validation: "dataset/instruction_val.jsonl"
|
| 9 |
+
test: "dataset/instruction_test.jsonl"
|
| 10 |
+
format: "instruction"
|
| 11 |
+
type: "generation"
|
| 12 |
+
language: "en"
|
| 13 |
+
}
|
| 14 |
+
|
| 15 |
+
MODEL {
|
| 16 |
+
base: "oktoseek/base-llm-7b"
|
| 17 |
+
architecture: "transformer"
|
| 18 |
+
parameters: 7B
|
| 19 |
+
context_window: 4096
|
| 20 |
+
precision: "fp16"
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
TRAIN {
|
| 24 |
+
epochs: 5
|
| 25 |
+
batch_size: 4
|
| 26 |
+
gradient_accumulation: 8
|
| 27 |
+
learning_rate: 0.0001
|
| 28 |
+
optimizer: "adamw"
|
| 29 |
+
scheduler: "cosine_with_restarts"
|
| 30 |
+
loss: "cross_entropy"
|
| 31 |
+
device: "cuda"
|
| 32 |
+
gpu: true
|
| 33 |
+
mixed_precision: true
|
| 34 |
+
early_stopping: true
|
| 35 |
+
checkpoint_steps: 100
|
| 36 |
+
checkpoint_path: "./checkpoints"
|
| 37 |
+
weight_decay: 0.01
|
| 38 |
+
gradient_clip: 1.0
|
| 39 |
+
warmup_steps: 100
|
| 40 |
+
save_strategy: "steps"
|
| 41 |
+
}
|
| 42 |
+
|
| 43 |
+
METRICS {
|
| 44 |
+
loss
|
| 45 |
+
perplexity
|
| 46 |
+
bleu
|
| 47 |
+
rouge_l
|
| 48 |
+
token_efficiency
|
| 49 |
+
response_coherence
|
| 50 |
+
}
|
| 51 |
+
|
| 52 |
+
VALIDATE {
|
| 53 |
+
on_train: false
|
| 54 |
+
on_validation: true
|
| 55 |
+
frequency: 1
|
| 56 |
+
save_best_model: true
|
| 57 |
+
metric_to_monitor: "loss"
|
| 58 |
+
}
|
| 59 |
+
|
| 60 |
+
INFERENCE {
|
| 61 |
+
max_tokens: 512
|
| 62 |
+
temperature: 0.7
|
| 63 |
+
top_p: 0.9
|
| 64 |
+
top_k: 50
|
| 65 |
+
repetition_penalty: 1.1
|
| 66 |
+
stop_sequences: ["\n\nHuman:", "\n\nAssistant:"]
|
| 67 |
+
}
|
| 68 |
+
|
| 69 |
+
EXPORT {
|
| 70 |
+
format: ["gguf", "onnx", "okm", "safetensors"]
|
| 71 |
+
path: "export/"
|
| 72 |
+
quantization: "int8"
|
| 73 |
+
optimize_for: "speed"
|
| 74 |
+
}
|
| 75 |
+
|
| 76 |
+
DEPLOY {
|
| 77 |
+
target: "api"
|
| 78 |
+
endpoint: "http://localhost:9000/llm"
|
| 79 |
+
requires_auth: true
|
| 80 |
+
port: 9000
|
| 81 |
+
max_concurrent_requests: 50
|
| 82 |
+
}
|
| 83 |
+
|
| 84 |
+
HOOKS {
|
| 85 |
+
before_train: "scripts/preprocess_data.py"
|
| 86 |
+
after_epoch: "scripts/custom_early_stop.py"
|
| 87 |
+
on_checkpoint: "scripts/backup_checkpoint.sh"
|
| 88 |
+
}
|
| 89 |
+
|
| 90 |
+
LOGGING {
|
| 91 |
+
save_logs: true
|
| 92 |
+
metrics_file: "runs/finetuned-llm/metrics.json"
|
| 93 |
+
training_file: "runs/finetuned-llm/training_logs.json"
|
| 94 |
+
log_level: "info"
|
| 95 |
+
log_every: 10
|
| 96 |
+
}
|
| 97 |
+
|
| 98 |
+
|
| 99 |
+
|
examples/guard-safety.okt
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# okto_version: "1.2"
|
| 2 |
+
PROJECT "GuardSafetyExample"
|
| 3 |
+
DESCRIPTION "Demonstrates GUARD block with multiple detection methods"
|
| 4 |
+
|
| 5 |
+
ENV {
|
| 6 |
+
accelerator: "gpu"
|
| 7 |
+
min_memory: "8GB"
|
| 8 |
+
precision: "fp16"
|
| 9 |
+
}
|
| 10 |
+
|
| 11 |
+
DATASET {
|
| 12 |
+
train: "examples/datasets/demo_train.jsonl"
|
| 13 |
+
format: "jsonl"
|
| 14 |
+
type: "chat"
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
MODEL {
|
| 18 |
+
name: "guard-safety-model"
|
| 19 |
+
base: "oktoseek/base-mini"
|
| 20 |
+
device: "cuda"
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
TRAIN {
|
| 24 |
+
epochs: 5
|
| 25 |
+
batch_size: 32
|
| 26 |
+
device: "cuda"
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
GUARD {
|
| 30 |
+
prevent {
|
| 31 |
+
hallucination
|
| 32 |
+
toxicity
|
| 33 |
+
bias
|
| 34 |
+
data_leak
|
| 35 |
+
unsafe_code
|
| 36 |
+
personal_data
|
| 37 |
+
illegal_content
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
detect_using: ["classifier", "embedding", "regex", "rule_engine", "ml_model"]
|
| 41 |
+
|
| 42 |
+
on_violation {
|
| 43 |
+
STOP
|
| 44 |
+
with_message: "Content violation detected. Request blocked."
|
| 45 |
+
}
|
| 46 |
+
}
|
| 47 |
+
|
| 48 |
+
BEHAVIOR {
|
| 49 |
+
mode: "chat"
|
| 50 |
+
personality: "professional"
|
| 51 |
+
verbosity: "low"
|
| 52 |
+
language: "en"
|
| 53 |
+
fallback: "I cannot assist with that request."
|
| 54 |
+
}
|
| 55 |
+
|
| 56 |
+
INFERENCE {
|
| 57 |
+
mode: "chat"
|
| 58 |
+
format: "User: {input}\nAssistant:"
|
| 59 |
+
|
| 60 |
+
params {
|
| 61 |
+
temperature: 0.5
|
| 62 |
+
max_length: 100
|
| 63 |
+
}
|
| 64 |
+
}
|
| 65 |
+
|
| 66 |
+
EXPORT {
|
| 67 |
+
format: ["okm"]
|
| 68 |
+
path: "export/"
|
| 69 |
+
}
|
| 70 |
+
|
examples/inference-advanced.okt
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# okto_version: "1.2"
|
| 2 |
+
PROJECT "InferenceAdvancedExample"
|
| 3 |
+
DESCRIPTION "Demonstrates advanced INFERENCE block with nested CONTROL"
|
| 4 |
+
|
| 5 |
+
ENV {
|
| 6 |
+
accelerator: "gpu"
|
| 7 |
+
min_memory: "8GB"
|
| 8 |
+
precision: "fp16"
|
| 9 |
+
}
|
| 10 |
+
|
| 11 |
+
DATASET {
|
| 12 |
+
train: "examples/datasets/demo_train.jsonl"
|
| 13 |
+
format: "jsonl"
|
| 14 |
+
type: "chat"
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
MODEL {
|
| 18 |
+
name: "inference-advanced-model"
|
| 19 |
+
base: "oktoseek/base-mini"
|
| 20 |
+
device: "cuda"
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
TRAIN {
|
| 24 |
+
epochs: 5
|
| 25 |
+
batch_size: 32
|
| 26 |
+
device: "cuda"
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
BEHAVIOR {
|
| 30 |
+
mode: "chat"
|
| 31 |
+
personality: "friendly"
|
| 32 |
+
verbosity: "high"
|
| 33 |
+
language: "en"
|
| 34 |
+
prompt_style: "User: {input}\nAssistant:"
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
INFERENCE {
|
| 38 |
+
mode: "chat"
|
| 39 |
+
format: "User: {input}\nAssistant:"
|
| 40 |
+
exit_command: "/exit"
|
| 41 |
+
|
| 42 |
+
params {
|
| 43 |
+
max_length: 200
|
| 44 |
+
temperature: 0.7
|
| 45 |
+
top_p: 0.9
|
| 46 |
+
top_k: 40
|
| 47 |
+
beams: 2
|
| 48 |
+
do_sample: true
|
| 49 |
+
repetition_penalty: 1.1
|
| 50 |
+
}
|
| 51 |
+
|
| 52 |
+
CONTROL {
|
| 53 |
+
IF confidence < 0.3 {
|
| 54 |
+
RETRY
|
| 55 |
+
LOG "Low confidence, retrying"
|
| 56 |
+
}
|
| 57 |
+
|
| 58 |
+
IF repetition > 3 {
|
| 59 |
+
REGENERATE
|
| 60 |
+
LOG "High repetition detected"
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
IF hallucination_score > 0.5 {
|
| 64 |
+
REPLACE WITH "I'm not certain about that. Could you rephrase?"
|
| 65 |
+
}
|
| 66 |
+
|
| 67 |
+
IF toxic == true {
|
| 68 |
+
REPLACE WITH "I cannot assist with that request."
|
| 69 |
+
}
|
| 70 |
+
}
|
| 71 |
+
}
|
| 72 |
+
|
| 73 |
+
GUARD {
|
| 74 |
+
prevent {
|
| 75 |
+
hallucination
|
| 76 |
+
toxicity
|
| 77 |
+
bias
|
| 78 |
+
}
|
| 79 |
+
|
| 80 |
+
detect_using: ["classifier", "embedding"]
|
| 81 |
+
|
| 82 |
+
on_violation {
|
| 83 |
+
REPLACE
|
| 84 |
+
with_message: "Sorry, I cannot process that request."
|
| 85 |
+
}
|
| 86 |
+
}
|
| 87 |
+
|
| 88 |
+
EXPORT {
|
| 89 |
+
format: ["okm"]
|
| 90 |
+
path: "export/"
|
| 91 |
+
}
|
| 92 |
+
|
examples/lora-finetuning.okt
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# okto_version: "1.1"
|
| 2 |
+
PROJECT "LoRAChatbot"
|
| 3 |
+
DESCRIPTION "Fine-tuning a chatbot using LoRA adapters for efficient training"
|
| 4 |
+
VERSION "1.0"
|
| 5 |
+
AUTHOR "OktoSeek"
|
| 6 |
+
|
| 7 |
+
DATASET {
|
| 8 |
+
mix_datasets: [
|
| 9 |
+
{ path: "dataset/base_conversations.jsonl", weight: 60 },
|
| 10 |
+
{ path: "dataset/specialized_qa.jsonl", weight: 30 },
|
| 11 |
+
{ path: "dataset/domain_specific.jsonl", weight: 10 }
|
| 12 |
+
]
|
| 13 |
+
dataset_percent: 75
|
| 14 |
+
sampling: "weighted"
|
| 15 |
+
shuffle: true
|
| 16 |
+
format: "jsonl"
|
| 17 |
+
type: "chat"
|
| 18 |
+
language: "en"
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
+
MODEL {
|
| 22 |
+
base: "oktoseek/base-llm-7b"
|
| 23 |
+
architecture: "transformer"
|
| 24 |
+
parameters: 7B
|
| 25 |
+
context_window: 4096
|
| 26 |
+
precision: "fp16"
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
FT_LORA {
|
| 30 |
+
base_model: "oktoseek/base-llm-7b"
|
| 31 |
+
train_dataset: "dataset/main.jsonl"
|
| 32 |
+
lora_rank: 8
|
| 33 |
+
lora_alpha: 32
|
| 34 |
+
dataset_percent: 75
|
| 35 |
+
mix_datasets: [
|
| 36 |
+
{ path: "dataset/base_conversations.jsonl", weight: 60 },
|
| 37 |
+
{ path: "dataset/specialized_qa.jsonl", weight: 30 },
|
| 38 |
+
{ path: "dataset/domain_specific.jsonl", weight: 10 }
|
| 39 |
+
]
|
| 40 |
+
epochs: 5
|
| 41 |
+
batch_size: 4
|
| 42 |
+
learning_rate: 0.00003
|
| 43 |
+
device: "cuda"
|
| 44 |
+
target_modules: ["q_proj", "v_proj", "k_proj", "o_proj"]
|
| 45 |
+
}
|
| 46 |
+
|
| 47 |
+
METRICS {
|
| 48 |
+
loss
|
| 49 |
+
perplexity
|
| 50 |
+
accuracy
|
| 51 |
+
f1
|
| 52 |
+
rouge_l
|
| 53 |
+
}
|
| 54 |
+
|
| 55 |
+
VALIDATE {
|
| 56 |
+
on_validation: true
|
| 57 |
+
frequency: 1
|
| 58 |
+
save_best_model: true
|
| 59 |
+
metric_to_monitor: "loss"
|
| 60 |
+
}
|
| 61 |
+
|
| 62 |
+
MONITOR {
|
| 63 |
+
level: "full"
|
| 64 |
+
log_metrics: [
|
| 65 |
+
"loss",
|
| 66 |
+
"val_loss",
|
| 67 |
+
"accuracy",
|
| 68 |
+
"perplexity"
|
| 69 |
+
]
|
| 70 |
+
log_system: [
|
| 71 |
+
"gpu_memory_used",
|
| 72 |
+
"gpu_memory_free",
|
| 73 |
+
"cpu_usage",
|
| 74 |
+
"ram_used",
|
| 75 |
+
"temperature"
|
| 76 |
+
]
|
| 77 |
+
log_speed: [
|
| 78 |
+
"tokens_per_second",
|
| 79 |
+
"samples_per_second"
|
| 80 |
+
]
|
| 81 |
+
refresh_interval: 2s
|
| 82 |
+
export_to: "runs/lora-chatbot/system.json"
|
| 83 |
+
dashboard: true
|
| 84 |
+
}
|
| 85 |
+
|
| 86 |
+
EXPORT {
|
| 87 |
+
format: ["gguf", "okm", "safetensors"]
|
| 88 |
+
path: "export/"
|
| 89 |
+
quantization: "int8"
|
| 90 |
+
}
|
| 91 |
+
|
| 92 |
+
LOGGING {
|
| 93 |
+
save_logs: true
|
| 94 |
+
metrics_file: "runs/lora-chatbot/metrics.json"
|
| 95 |
+
training_file: "runs/lora-chatbot/training_logs.json"
|
| 96 |
+
log_level: "info"
|
| 97 |
+
log_every: 10
|
| 98 |
+
}
|
| 99 |
+
|
| 100 |
+
|
| 101 |
+
|
examples/model-adapter.okt
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# okto_version: "1.2"
|
| 2 |
+
PROJECT "ModelAdapterExample"
|
| 3 |
+
DESCRIPTION "Demonstrates MODEL block with ADAPTER (LoRA/PEFT support)"
|
| 4 |
+
|
| 5 |
+
ENV {
|
| 6 |
+
accelerator: "gpu"
|
| 7 |
+
min_memory: "8GB"
|
| 8 |
+
precision: "fp16"
|
| 9 |
+
}
|
| 10 |
+
|
| 11 |
+
DATASET {
|
| 12 |
+
train: "examples/datasets/demo_train.jsonl"
|
| 13 |
+
format: "jsonl"
|
| 14 |
+
type: "chat"
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
MODEL {
|
| 18 |
+
name: "adapter-model"
|
| 19 |
+
base: "google/flan-t5-base"
|
| 20 |
+
device: "cuda"
|
| 21 |
+
|
| 22 |
+
ADAPTER {
|
| 23 |
+
type: "lora"
|
| 24 |
+
path: "./adapters/my-lora-adapter"
|
| 25 |
+
rank: 16
|
| 26 |
+
alpha: 32
|
| 27 |
+
}
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
+
TRAIN {
|
| 31 |
+
epochs: 3
|
| 32 |
+
batch_size: 16
|
| 33 |
+
learning_rate: 0.00003
|
| 34 |
+
device: "cuda"
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
MONITOR {
|
| 38 |
+
metrics: ["loss", "val_loss", "accuracy"]
|
| 39 |
+
log_to: "logs/adapter-training.log"
|
| 40 |
+
}
|
| 41 |
+
|
| 42 |
+
EXPORT {
|
| 43 |
+
format: ["okm", "safetensors"]
|
| 44 |
+
path: "export/"
|
| 45 |
+
}
|
| 46 |
+
|
examples/monitor-full.okt
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# okto_version: "1.2"
|
| 2 |
+
PROJECT "MonitorFullExample"
|
| 3 |
+
DESCRIPTION "Demonstrates complete MONITOR block with all metrics"
|
| 4 |
+
|
| 5 |
+
ENV {
|
| 6 |
+
accelerator: "gpu"
|
| 7 |
+
min_memory: "16GB"
|
| 8 |
+
precision: "fp16"
|
| 9 |
+
}
|
| 10 |
+
|
| 11 |
+
DATASET {
|
| 12 |
+
train: "examples/datasets/demo_train.jsonl"
|
| 13 |
+
validation: "examples/datasets/demo_train.jsonl"
|
| 14 |
+
format: "jsonl"
|
| 15 |
+
type: "chat"
|
| 16 |
+
}
|
| 17 |
+
|
| 18 |
+
MODEL {
|
| 19 |
+
name: "monitor-full-model"
|
| 20 |
+
base: "oktoseek/base-mini"
|
| 21 |
+
device: "cuda"
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
TRAIN {
|
| 25 |
+
epochs: 10
|
| 26 |
+
batch_size: 32
|
| 27 |
+
learning_rate: 0.0001
|
| 28 |
+
device: "cuda"
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
MONITOR {
|
| 32 |
+
metrics: [
|
| 33 |
+
"loss",
|
| 34 |
+
"val_loss",
|
| 35 |
+
"accuracy",
|
| 36 |
+
"val_accuracy",
|
| 37 |
+
"precision",
|
| 38 |
+
"recall",
|
| 39 |
+
"f1_score",
|
| 40 |
+
"perplexity",
|
| 41 |
+
"confidence",
|
| 42 |
+
"hallucination_score"
|
| 43 |
+
]
|
| 44 |
+
|
| 45 |
+
notify_if {
|
| 46 |
+
loss > 2.0
|
| 47 |
+
gpu_usage > 90%
|
| 48 |
+
gpu_temperature > 85
|
| 49 |
+
val_loss > 2.5
|
| 50 |
+
hallucination_score > 0.5
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
log_system: [
|
| 54 |
+
"gpu_usage",
|
| 55 |
+
"gpu_memory_used",
|
| 56 |
+
"gpu_memory_free",
|
| 57 |
+
"gpu_temperature",
|
| 58 |
+
"cpu_usage",
|
| 59 |
+
"ram_usage"
|
| 60 |
+
]
|
| 61 |
+
|
| 62 |
+
log_speed: [
|
| 63 |
+
"tokens_per_second",
|
| 64 |
+
"samples_per_second",
|
| 65 |
+
"throughput",
|
| 66 |
+
"latency",
|
| 67 |
+
"step_time"
|
| 68 |
+
]
|
| 69 |
+
|
| 70 |
+
refresh_interval: 2s
|
| 71 |
+
export_to: "runs/logs/system.json"
|
| 72 |
+
dashboard: true
|
| 73 |
+
log_to: "logs/training.log"
|
| 74 |
+
}
|
| 75 |
+
|
| 76 |
+
CONTROL {
|
| 77 |
+
on_epoch_end {
|
| 78 |
+
IF gpu_temperature > 85 {
|
| 79 |
+
SET batch_size = 16
|
| 80 |
+
LOG "GPU temperature high, reducing batch size"
|
| 81 |
+
}
|
| 82 |
+
}
|
| 83 |
+
}
|
| 84 |
+
|
| 85 |
+
EXPORT {
|
| 86 |
+
format: ["okm"]
|
| 87 |
+
path: "export/"
|
| 88 |
+
}
|
| 89 |
+
|
examples/pizzabot.okt
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
PROJECT "PizzaBot"
|
| 2 |
+
DESCRIPTION "AI specialized in pizza restaurant service"
|
| 3 |
+
|
| 4 |
+
ENV {
|
| 5 |
+
accelerator: "gpu"
|
| 6 |
+
min_memory: "8GB"
|
| 7 |
+
precision: "fp16"
|
| 8 |
+
backend: "oktoseek"
|
| 9 |
+
install_missing: true
|
| 10 |
+
}
|
| 11 |
+
|
| 12 |
+
DATASET {
|
| 13 |
+
train: "dataset/train.jsonl"
|
| 14 |
+
validation: "dataset/val.jsonl"
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
MODEL {
|
| 18 |
+
base: "oktoseek/pizza-small"
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
+
TRAIN {
|
| 22 |
+
epochs: 5
|
| 23 |
+
batch_size: 32
|
| 24 |
+
device: "cuda"
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
EXPORT {
|
| 28 |
+
format: ["gguf"]
|
| 29 |
+
path: "export/"
|
| 30 |
+
}
|
| 31 |
+
|
examples/pizzabot/dataset/test.jsonl
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{"input":"What's the price of a medium pizza?","output":"A medium pizza costs $14."}
|
| 2 |
+
{"input":"Do you have pineapple as a topping?","output":"Yes, we have pineapple available as a topping."}
|
| 3 |
+
{"input":"Can I order for tomorrow?","output":"Yes, you can schedule orders in advance through our website."}
|
| 4 |
+
{"input":"What's your address?","output":"We're located at 123 Main Street. You can also find us on Google Maps."}
|
| 5 |
+
{"input":"Do you cater events?","output":"Yes, we offer catering services for events. Please call us for details."}
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
|
examples/pizzabot/dataset/train.jsonl
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{"input":"Hi","output":"Hello! Welcome to our pizza restaurant 🍕"}
|
| 2 |
+
{"input":"What flavors do you have?","output":"We offer Margherita, Pepperoni, Four Cheese and BBQ Chicken."}
|
| 3 |
+
{"input":"Do you deliver?","output":"Yes, delivery is available in your area."}
|
| 4 |
+
{"input":"How much is a large pizza?","output":"A large pizza costs $18. Would you like to order one?"}
|
| 5 |
+
{"input":"I want a Pepperoni pizza","output":"Great choice! What is your delivery address?"}
|
| 6 |
+
{"input":"What's your phone number?","output":"You can reach us at (555) 123-4567. We're open from 11 AM to 11 PM."}
|
| 7 |
+
{"input":"Do you have gluten-free options?","output":"Yes, we offer gluten-free crust for all our pizzas."}
|
| 8 |
+
{"input":"How long does delivery take?","output":"Delivery typically takes 30-45 minutes depending on your location."}
|
| 9 |
+
{"input":"Can I customize my pizza?","output":"Absolutely! You can add or remove any toppings you'd like."}
|
| 10 |
+
{"input":"What sizes do you have?","output":"We have Small (10\"), Medium (12\"), Large (14\") and Extra Large (16\")."}
|
| 11 |
+
{"input":"Do you accept credit cards?","output":"Yes, we accept all major credit cards, debit cards, and cash."}
|
| 12 |
+
{"input":"Is there a minimum order for delivery?","output":"Yes, there's a $15 minimum order for delivery."}
|
| 13 |
+
{"input":"Can I order online?","output":"Yes! You can order through our website or mobile app."}
|
| 14 |
+
{"input":"What's your most popular pizza?","output":"Our Pepperoni pizza is our bestseller, followed by Margherita."}
|
| 15 |
+
{"input":"Do you have vegan options?","output":"Yes, we have vegan cheese and a variety of vegetable toppings."}
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
|
examples/pizzabot/dataset/val.jsonl
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{"input":"Do you have vegetarian pizza?","output":"Yes, we offer Margherita and Veggie options."}
|
| 2 |
+
{"input":"Can I pick up my order?","output":"Yes, you can choose pickup at checkout."}
|
| 3 |
+
{"input":"What time do you close?","output":"We close at 11 PM every day."}
|
| 4 |
+
{"input":"Do you have deals or promotions?","output":"Yes! Check our website for current promotions and special offers."}
|
| 5 |
+
{"input":"Can I cancel my order?","output":"You can cancel your order within 5 minutes of placing it. After that, please call us."}
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
|
examples/pizzabot/okt.yaml
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
project: "PizzaBot"
|
| 2 |
+
description: "AI specialized in pizza restaurant service"
|
| 3 |
+
version: "1.0"
|
| 4 |
+
author: "OktoSeek"
|
| 5 |
+
|
| 6 |
+
structure:
|
| 7 |
+
dataset_dir: "dataset/"
|
| 8 |
+
scripts_dir: "scripts/"
|
| 9 |
+
runs_dir: "runs/"
|
| 10 |
+
export_dir: "export/"
|
| 11 |
+
|
| 12 |
+
default_language: "en"
|
| 13 |
+
license: "Apache-2.0"
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
|
examples/pizzabot/runs/pizzabot-v1/metrics.json
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"accuracy": 0.93,
|
| 3 |
+
"loss": 0.21,
|
| 4 |
+
"perplexity": 12.4,
|
| 5 |
+
"f1_score": 0.91,
|
| 6 |
+
"rouge_l": 0.88,
|
| 7 |
+
"cosine_similarity": 0.94,
|
| 8 |
+
"token_efficiency": 0.87,
|
| 9 |
+
"response_coherence": 0.92,
|
| 10 |
+
"hallucination_score": 0.03
|
| 11 |
+
}
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
|
examples/pizzabot/runs/pizzabot-v1/training_logs.json
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"project": "PizzaBot",
|
| 3 |
+
"version": "1.0",
|
| 4 |
+
"training_started": "2025-11-22T10:00:00Z",
|
| 5 |
+
"training_completed": "2025-11-22T12:30:00Z",
|
| 6 |
+
"total_epochs": 5,
|
| 7 |
+
"total_steps": 250,
|
| 8 |
+
"checkpoints": [
|
| 9 |
+
{
|
| 10 |
+
"step": 100,
|
| 11 |
+
"loss": 0.45,
|
| 12 |
+
"timestamp": "2025-11-22T10:45:00Z"
|
| 13 |
+
},
|
| 14 |
+
{
|
| 15 |
+
"step": 200,
|
| 16 |
+
"loss": 0.28,
|
| 17 |
+
"timestamp": "2025-11-22T11:30:00Z"
|
| 18 |
+
}
|
| 19 |
+
],
|
| 20 |
+
"final_loss": 0.21,
|
| 21 |
+
"device": "cuda",
|
| 22 |
+
"model_base": "oktoseek/pizza-small"
|
| 23 |
+
}
|
| 24 |
+
|
examples/pizzabot/scripts/train.okt
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
PROJECT "PizzaBot"
|
| 2 |
+
DESCRIPTION "AI specialized in pizza restaurant service"
|
| 3 |
+
VERSION "1.0"
|
| 4 |
+
TAGS ["food", "restaurant", "chatbot"]
|
| 5 |
+
AUTHOR "OktoSeek"
|
| 6 |
+
|
| 7 |
+
ENV {
|
| 8 |
+
accelerator: "gpu"
|
| 9 |
+
min_memory: "8GB"
|
| 10 |
+
precision: "fp16"
|
| 11 |
+
backend: "oktoseek"
|
| 12 |
+
install_missing: true
|
| 13 |
+
platform: "any"
|
| 14 |
+
network: "online"
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
DATASET {
|
| 18 |
+
train: "dataset/train.jsonl"
|
| 19 |
+
validation: "dataset/val.jsonl"
|
| 20 |
+
test: "dataset/test.jsonl"
|
| 21 |
+
format: "jsonl"
|
| 22 |
+
type: "chat"
|
| 23 |
+
language: "en"
|
| 24 |
+
}
|
| 25 |
+
|
| 26 |
+
MODEL {
|
| 27 |
+
base: "oktoseek/pizza-small"
|
| 28 |
+
architecture: "transformer"
|
| 29 |
+
parameters: 120M
|
| 30 |
+
context_window: 2048
|
| 31 |
+
precision: "fp16"
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
TRAIN {
|
| 35 |
+
epochs: 5
|
| 36 |
+
batch_size: 32
|
| 37 |
+
learning_rate: 0.0001
|
| 38 |
+
optimizer: "adamw"
|
| 39 |
+
scheduler: "cosine"
|
| 40 |
+
device: "auto"
|
| 41 |
+
gradient_accumulation: 2
|
| 42 |
+
checkpoint_steps: 100
|
| 43 |
+
early_stopping: true
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
METRICS {
|
| 47 |
+
accuracy
|
| 48 |
+
perplexity
|
| 49 |
+
f1
|
| 50 |
+
rouge
|
| 51 |
+
cosine_similarity
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
VALIDATE {
|
| 55 |
+
on_train: true
|
| 56 |
+
on_validation: true
|
| 57 |
+
frequency: 1
|
| 58 |
+
}
|
| 59 |
+
|
| 60 |
+
INFERENCE {
|
| 61 |
+
max_tokens: 200
|
| 62 |
+
temperature: 0.7
|
| 63 |
+
top_p: 0.9
|
| 64 |
+
top_k: 40
|
| 65 |
+
}
|
| 66 |
+
|
| 67 |
+
EXPORT {
|
| 68 |
+
format: ["gguf", "onnx", "okm", "safetensors"]
|
| 69 |
+
path: "export/"
|
| 70 |
+
quantization: "int8"
|
| 71 |
+
}
|
| 72 |
+
|
| 73 |
+
DEPLOY {
|
| 74 |
+
target: "api"
|
| 75 |
+
endpoint: "http://localhost:9000/pizzabot"
|
| 76 |
+
requires_auth: true
|
| 77 |
+
}
|
| 78 |
+
|
| 79 |
+
SECURITY {
|
| 80 |
+
encrypt_model: true
|
| 81 |
+
watermark: true
|
| 82 |
+
}
|
| 83 |
+
|
| 84 |
+
LOGGING {
|
| 85 |
+
save_logs: true
|
| 86 |
+
metrics_file: "runs/pizzabot-v1/metrics.json"
|
| 87 |
+
training_file: "runs/pizzabot-v1/training_logs.json"
|
| 88 |
+
}
|
| 89 |
+
|
examples/qa-embeddings.okt
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
PROJECT "QAEmbeddings"
|
| 2 |
+
DESCRIPTION "Question-Answering system with embeddings and similarity search"
|
| 3 |
+
VERSION "1.0"
|
| 4 |
+
AUTHOR "OktoSeek"
|
| 5 |
+
|
| 6 |
+
DATASET {
|
| 7 |
+
train: "dataset/qa_train.jsonl"
|
| 8 |
+
validation: "dataset/qa_val.jsonl"
|
| 9 |
+
format: "qa"
|
| 10 |
+
type: "qa"
|
| 11 |
+
language: "en"
|
| 12 |
+
}
|
| 13 |
+
|
| 14 |
+
MODEL {
|
| 15 |
+
base: "oktoseek/qa-encoder"
|
| 16 |
+
architecture: "bert"
|
| 17 |
+
parameters: 110M
|
| 18 |
+
context_window: 512
|
| 19 |
+
precision: "fp16"
|
| 20 |
+
}
|
| 21 |
+
|
| 22 |
+
TRAIN {
|
| 23 |
+
epochs: 10
|
| 24 |
+
batch_size: 16
|
| 25 |
+
learning_rate: 0.00005
|
| 26 |
+
optimizer: "adamw"
|
| 27 |
+
scheduler: "linear"
|
| 28 |
+
loss: "cross_entropy"
|
| 29 |
+
device: "cuda"
|
| 30 |
+
gpu: true
|
| 31 |
+
mixed_precision: true
|
| 32 |
+
early_stopping: true
|
| 33 |
+
checkpoint_steps: 200
|
| 34 |
+
weight_decay: 0.01
|
| 35 |
+
gradient_clip: 1.0
|
| 36 |
+
warmup_steps: 500
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
METRICS {
|
| 40 |
+
accuracy
|
| 41 |
+
f1
|
| 42 |
+
f1_macro
|
| 43 |
+
cosine_similarity
|
| 44 |
+
custom "retrieval_accuracy"
|
| 45 |
+
}
|
| 46 |
+
|
| 47 |
+
VALIDATE {
|
| 48 |
+
on_validation: true
|
| 49 |
+
frequency: 1
|
| 50 |
+
save_best_model: true
|
| 51 |
+
metric_to_monitor: "f1"
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
INFERENCE {
|
| 55 |
+
max_tokens: 256
|
| 56 |
+
temperature: 0.3
|
| 57 |
+
top_p: 0.95
|
| 58 |
+
top_k: 20
|
| 59 |
+
}
|
| 60 |
+
|
| 61 |
+
EXPORT {
|
| 62 |
+
format: ["onnx", "okm", "safetensors"]
|
| 63 |
+
path: "export/"
|
| 64 |
+
quantization: "int8"
|
| 65 |
+
optimize_for: "accuracy"
|
| 66 |
+
}
|
| 67 |
+
|
| 68 |
+
DEPLOY {
|
| 69 |
+
target: "api"
|
| 70 |
+
endpoint: "http://localhost:9000/qa"
|
| 71 |
+
requires_auth: true
|
| 72 |
+
port: 9000
|
| 73 |
+
max_concurrent_requests: 200
|
| 74 |
+
}
|
| 75 |
+
|
| 76 |
+
LOGGING {
|
| 77 |
+
save_logs: true
|
| 78 |
+
metrics_file: "runs/qa-embeddings/metrics.json"
|
| 79 |
+
training_file: "runs/qa-embeddings/training_logs.json"
|
| 80 |
+
log_level: "info"
|
| 81 |
+
log_every: 20
|
| 82 |
+
}
|
| 83 |
+
|
| 84 |
+
|
| 85 |
+
|
examples/recommender.okt
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
PROJECT "RecommenderAI"
|
| 2 |
+
DESCRIPTION "Product recommendation engine for e-commerce and content platforms"
|
| 3 |
+
|
| 4 |
+
DATASET {
|
| 5 |
+
train: "dataset/user_behavior.csv"
|
| 6 |
+
format: "csv"
|
| 7 |
+
type: "regression"
|
| 8 |
+
}
|
| 9 |
+
|
| 10 |
+
MODEL {
|
| 11 |
+
base: "oktoseek/recommender-base"
|
| 12 |
+
architecture: "transformer"
|
| 13 |
+
parameters: 80M
|
| 14 |
+
context_window: 512
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
TRAIN {
|
| 18 |
+
epochs: 10
|
| 19 |
+
batch_size: 128
|
| 20 |
+
learning_rate: 0.0005
|
| 21 |
+
optimizer: "adamw"
|
| 22 |
+
scheduler: "linear"
|
| 23 |
+
device: "cuda"
|
| 24 |
+
gradient_accumulation: 4
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
METRICS {
|
| 28 |
+
f1
|
| 29 |
+
accuracy
|
| 30 |
+
cosine_similarity
|
| 31 |
+
mae
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
EXPORT {
|
| 35 |
+
format: ["okm", "onnx"]
|
| 36 |
+
path: "export/"
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
DEPLOY {
|
| 40 |
+
target: "api"
|
| 41 |
+
endpoint: "http://localhost:9000/recommend"
|
| 42 |
+
requires_auth: true
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
|
examples/security-full.okt
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# okto_version: "1.2"
|
| 2 |
+
PROJECT "SecurityFullExample"
|
| 3 |
+
DESCRIPTION "Demonstrates complete SECURITY block configuration"
|
| 4 |
+
|
| 5 |
+
ENV {
|
| 6 |
+
accelerator: "gpu"
|
| 7 |
+
min_memory: "8GB"
|
| 8 |
+
precision: "fp16"
|
| 9 |
+
}
|
| 10 |
+
|
| 11 |
+
DATASET {
|
| 12 |
+
train: "examples/datasets/demo_train.jsonl"
|
| 13 |
+
format: "jsonl"
|
| 14 |
+
type: "chat"
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
MODEL {
|
| 18 |
+
name: "secure-model"
|
| 19 |
+
base: "oktoseek/base-mini"
|
| 20 |
+
device: "cuda"
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
TRAIN {
|
| 24 |
+
epochs: 5
|
| 25 |
+
batch_size: 32
|
| 26 |
+
device: "cuda"
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
SECURITY {
|
| 30 |
+
input_validation {
|
| 31 |
+
max_length: 1000
|
| 32 |
+
disallow_patterns: [
|
| 33 |
+
"<script>",
|
| 34 |
+
"DROP TABLE",
|
| 35 |
+
"DELETE FROM",
|
| 36 |
+
"rm -rf",
|
| 37 |
+
"sudo",
|
| 38 |
+
"passwd",
|
| 39 |
+
"chmod 777",
|
| 40 |
+
"eval(",
|
| 41 |
+
"exec("
|
| 42 |
+
]
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
output_validation {
|
| 46 |
+
prevent_data_leak: true
|
| 47 |
+
mask_personal_info: true
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
rate_limit {
|
| 51 |
+
max_requests_per_minute: 120
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
encryption {
|
| 55 |
+
algorithm: "AES-256"
|
| 56 |
+
}
|
| 57 |
+
}
|
| 58 |
+
|
| 59 |
+
GUARD {
|
| 60 |
+
prevent {
|
| 61 |
+
toxicity
|
| 62 |
+
bias
|
| 63 |
+
data_leak
|
| 64 |
+
unsafe_code
|
| 65 |
+
}
|
| 66 |
+
|
| 67 |
+
detect_using: ["classifier", "regex", "rule_engine"]
|
| 68 |
+
|
| 69 |
+
on_violation {
|
| 70 |
+
ALERT
|
| 71 |
+
}
|
| 72 |
+
}
|
| 73 |
+
|
| 74 |
+
EXPORT {
|
| 75 |
+
format: ["okm", "onnx"]
|
| 76 |
+
path: "export/"
|
| 77 |
+
}
|
| 78 |
+
|
examples/stability-training.okt
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# okto_version: "1.2"
|
| 2 |
+
PROJECT "StabilityTrainingExample"
|
| 3 |
+
DESCRIPTION "Demonstrates STABILITY block for safe training"
|
| 4 |
+
|
| 5 |
+
ENV {
|
| 6 |
+
accelerator: "gpu"
|
| 7 |
+
min_memory: "8GB"
|
| 8 |
+
precision: "fp16"
|
| 9 |
+
}
|
| 10 |
+
|
| 11 |
+
DATASET {
|
| 12 |
+
train: "examples/datasets/demo_train.jsonl"
|
| 13 |
+
validation: "examples/datasets/demo_train.jsonl"
|
| 14 |
+
format: "jsonl"
|
| 15 |
+
type: "chat"
|
| 16 |
+
}
|
| 17 |
+
|
| 18 |
+
MODEL {
|
| 19 |
+
name: "stable-model"
|
| 20 |
+
base: "oktoseek/base-mini"
|
| 21 |
+
device: "cuda"
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
TRAIN {
|
| 25 |
+
epochs: 20
|
| 26 |
+
batch_size: 32
|
| 27 |
+
learning_rate: 0.0001
|
| 28 |
+
device: "cuda"
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
STABILITY {
|
| 32 |
+
stop_if_nan: true
|
| 33 |
+
stop_if_diverges: true
|
| 34 |
+
min_improvement: 0.001
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
CONTROL {
|
| 38 |
+
on_nan {
|
| 39 |
+
STOP_TRAINING
|
| 40 |
+
LOG "NaN detected, stopping training"
|
| 41 |
+
}
|
| 42 |
+
|
| 43 |
+
IF loss > 10.0 {
|
| 44 |
+
STOP_TRAINING
|
| 45 |
+
LOG "Loss diverged, stopping training"
|
| 46 |
+
}
|
| 47 |
+
}
|
| 48 |
+
|
| 49 |
+
MONITOR {
|
| 50 |
+
metrics: ["loss", "val_loss"]
|
| 51 |
+
notify_if {
|
| 52 |
+
loss > 5.0
|
| 53 |
+
}
|
| 54 |
+
}
|
| 55 |
+
|
| 56 |
+
EXPORT {
|
| 57 |
+
format: ["okm"]
|
| 58 |
+
path: "export/"
|
| 59 |
+
}
|
| 60 |
+
|
examples/vision-pipeline.okt
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
PROJECT "VisionClassifier"
|
| 2 |
+
DESCRIPTION "Complete computer vision pipeline with image augmentation and ONNX export"
|
| 3 |
+
VERSION "1.0"
|
| 4 |
+
AUTHOR "OktoSeek"
|
| 5 |
+
|
| 6 |
+
DATASET {
|
| 7 |
+
train: "dataset/images/train/"
|
| 8 |
+
validation: "dataset/images/val/"
|
| 9 |
+
test: "dataset/images/test/"
|
| 10 |
+
format: "image+caption"
|
| 11 |
+
type: "vision"
|
| 12 |
+
language: "en"
|
| 13 |
+
augmentation: ["flip", "rotate", "brightness", "contrast", "crop"]
|
| 14 |
+
}
|
| 15 |
+
|
| 16 |
+
MODEL {
|
| 17 |
+
base: "oktoseek/vision-base"
|
| 18 |
+
architecture: "vision-transformer"
|
| 19 |
+
parameters: 86M
|
| 20 |
+
context_window: 224
|
| 21 |
+
precision: "fp16"
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
TRAIN {
|
| 25 |
+
epochs: 50
|
| 26 |
+
batch_size: 32
|
| 27 |
+
learning_rate: 0.001
|
| 28 |
+
optimizer: "adam"
|
| 29 |
+
scheduler: "cosine"
|
| 30 |
+
loss: "cross_entropy"
|
| 31 |
+
device: "cuda"
|
| 32 |
+
gpu: true
|
| 33 |
+
mixed_precision: true
|
| 34 |
+
early_stopping: true
|
| 35 |
+
checkpoint_steps: 500
|
| 36 |
+
checkpoint_path: "./checkpoints/vision"
|
| 37 |
+
weight_decay: 0.0001
|
| 38 |
+
gradient_clip: 1.0
|
| 39 |
+
warmup_steps: 1000
|
| 40 |
+
save_strategy: "steps"
|
| 41 |
+
}
|
| 42 |
+
|
| 43 |
+
METRICS {
|
| 44 |
+
accuracy
|
| 45 |
+
precision
|
| 46 |
+
recall
|
| 47 |
+
f1
|
| 48 |
+
f1_macro
|
| 49 |
+
f1_micro
|
| 50 |
+
confusion_matrix
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
VALIDATE {
|
| 54 |
+
on_train: true
|
| 55 |
+
on_validation: true
|
| 56 |
+
frequency: 1
|
| 57 |
+
save_best_model: true
|
| 58 |
+
metric_to_monitor: "accuracy"
|
| 59 |
+
}
|
| 60 |
+
|
| 61 |
+
EXPORT {
|
| 62 |
+
format: ["onnx", "okm", "tflite"]
|
| 63 |
+
path: "export/"
|
| 64 |
+
quantization: "int8"
|
| 65 |
+
optimize_for: "speed"
|
| 66 |
+
}
|
| 67 |
+
|
| 68 |
+
DEPLOY {
|
| 69 |
+
target: "web"
|
| 70 |
+
endpoint: "https://api.example.com/vision"
|
| 71 |
+
requires_auth: true
|
| 72 |
+
max_concurrent_requests: 100
|
| 73 |
+
}
|
| 74 |
+
|
| 75 |
+
SECURITY {
|
| 76 |
+
encrypt_model: true
|
| 77 |
+
watermark: true
|
| 78 |
+
}
|
| 79 |
+
|
| 80 |
+
LOGGING {
|
| 81 |
+
save_logs: true
|
| 82 |
+
metrics_file: "runs/vision-classifier/metrics.json"
|
| 83 |
+
training_file: "runs/vision-classifier/training_logs.json"
|
| 84 |
+
log_level: "info"
|
| 85 |
+
log_every: 50
|
| 86 |
+
}
|
| 87 |
+
|
| 88 |
+
|
| 89 |
+
|
schemas/dataset.schema.json
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
| 3 |
+
"title": "OktoScript Dataset Schema",
|
| 4 |
+
"description": "Schema for validating OktoScript dataset files",
|
| 5 |
+
"type": "object",
|
| 6 |
+
"properties": {
|
| 7 |
+
"input": {
|
| 8 |
+
"type": "string",
|
| 9 |
+
"description": "Input text or prompt for the model"
|
| 10 |
+
},
|
| 11 |
+
"output": {
|
| 12 |
+
"type": "string",
|
| 13 |
+
"description": "Expected output or response from the model"
|
| 14 |
+
},
|
| 15 |
+
"context": {
|
| 16 |
+
"type": "string",
|
| 17 |
+
"description": "Optional context for the conversation or task"
|
| 18 |
+
},
|
| 19 |
+
"label": {
|
| 20 |
+
"type": "string",
|
| 21 |
+
"description": "Optional label for classification tasks"
|
| 22 |
+
},
|
| 23 |
+
"metadata": {
|
| 24 |
+
"type": "object",
|
| 25 |
+
"description": "Optional metadata for the data point",
|
| 26 |
+
"additionalProperties": true
|
| 27 |
+
}
|
| 28 |
+
},
|
| 29 |
+
"required": ["input", "output"],
|
| 30 |
+
"additionalProperties": false
|
| 31 |
+
}
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
|