File size: 6,714 Bytes
5fc8c9d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5df2c77
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5fc8c9d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
# OktoScript Examples

This folder contains official example scripts written in **OktoScript (.okt)**.

These examples are used by:

- Developers learning OktoScript
- Students and researchers
- OktoSeek IDE
- VS Code Extension
- Automatic tests and validation

---

## Available Examples

### Basic Examples

| File | Description | Use Case |
|------|-------------|----------|
| [`basic.okt`](./basic.okt) | Minimal example | Getting started |
| [`chatbot.okt`](./chatbot.okt) | Conversational AI | Customer service, assistants |
| [`computer_vision.okt`](./computer_vision.okt) | Image classification | Vision models, object detection |
| [`recommender.okt`](./recommender.okt) | Recommendation system | E-commerce, content suggestions |

### Advanced Examples

| File | Description | Use Case |
|------|-------------|----------|
| [`finetuning-llm.okt`](./finetuning-llm.okt) | Fine-tuning LLM with checkpoints | Advanced language models, resume training |
| [`vision-pipeline.okt`](./vision-pipeline.okt) | Complete vision pipeline | Production vision systems, ONNX export |
| [`qa-embeddings.okt`](./qa-embeddings.okt) | QA with embeddings | Semantic search, retrieval systems |

### v1.1 Examples (New Features)

| File | Description | Use Case |
|------|-------------|----------|
| [`lora-finetuning.okt`](./lora-finetuning.okt) | LoRA fine-tuning with dataset mixing | Efficient fine-tuning, memory-efficient training |
| [`dataset-mixing.okt`](./dataset-mixing.okt) | Training with multiple weighted datasets | Combining datasets, weighted sampling |

### πŸ§ͺ Test Scripts (Recommended for Testing)

These scripts are specifically designed for testing different features of OktoScript v1.2:

| File | Description | Features Tested |
|------|-------------|-----------------|
| [`test-t5-basic.okt`](./test-t5-basic.okt) | Basic training | PROJECT, ENV, DATASET, MODEL, TRAIN, EXPORT |
| [`test-t5-monitor.okt`](./test-t5-monitor.okt) | Training with MONITOR | Full metrics tracking, notifications |
| [`test-t5-control.okt`](./test-t5-control.okt) | Training with CONTROL | Automatic decisions, IF/WHEN/EVERY |
| [`test-flan-t5-complete.okt`](./test-flan-t5-complete.okt) | All advanced blocks | MONITOR, CONTROL, STABILITY together |
| [`test-flan-t5-inference.okt`](./test-flan-t5-inference.okt) | Inference with governance | BEHAVIOR, GUARD, INFERENCE blocks |
| [`test-t5-explorer.okt`](./test-t5-explorer.okt) | AutoML with EXPLORER | Hyperparameter search, best model selection |

πŸ“– **See [`TESTING_GUIDE.md`](./TESTING_GUIDE.md) for detailed testing instructions.**

---

### v1.2 Examples (Advanced Features)

| File | Description | Use Case |
|------|-------------|----------|
| [`control-nested.okt`](./control-nested.okt) | Nested CONTROL blocks with advanced decision-making | Dynamic training control, conditional logic |
| [`behavior-chat.okt`](./behavior-chat.okt) | BEHAVIOR block with mode and prompt_style | Chatbot personality, response style |
| [`guard-safety.okt`](./guard-safety.okt) | GUARD block with multiple detection methods | Content safety, ethical AI |
| [`deploy-api.okt`](./deploy-api.okt) | DEPLOY block for API deployment | Production API deployment |
| [`security-full.okt`](./security-full.okt) | Complete SECURITY block configuration | Input/output validation, rate limiting |
| [`model-adapter.okt`](./model-adapter.okt) | MODEL block with ADAPTER (LoRA/PEFT) | Parameter-efficient fine-tuning |
| [`inference-advanced.okt`](./inference-advanced.okt) | Advanced INFERENCE with nested CONTROL | Smart inference with retry logic |
| [`monitor-full.okt`](./monitor-full.okt) | Complete MONITOR block with all metrics | Full system and training telemetry |
| [`explorer-automl.okt`](./explorer-automl.okt) | EXPLORER block for hyperparameter search | AutoML-style optimization |
| [`stability-training.okt`](./stability-training.okt) | STABILITY block for safe training | Training stability and safety |
| [`complete-v1.2.okt`](./complete-v1.2.okt) | Complete example with all v1.2 features | Full feature demonstration |

### Complete Projects

| File | Description | Use Case |
|------|-------------|----------|
| [`pizzabot/`](./pizzabot/) | Complete project example | Full workflow demonstration |

---

## Quick Start

To run these examples with OktoEngine (when available):

```bash
# Validate syntax
okto validate examples/basic.okt

# Train a model
okto train examples/chatbot.okt

# Evaluate performance
okto eval examples/recommender.okt

# Export model
okto export examples/computer_vision.okt --format=okm
```

---

## Export Formats

OktoScript supports multiple export formats for different use cases:

### Standard Formats

- **ONNX** - Universal inference, production-ready
- **GGUF** - Local inference, Ollama, Llama.cpp
- **SafeTensors** - HuggingFace, research, standard training

### OktoSeek Optimized Formats

- **OktoModel (.okm)** - Optimized for OktoSeek SDK & Flutter plugins
- **OktoBundle (.okx)** - Mobile + Edge package (iOS, Android, Edge AI)

> πŸ’‘ **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.

---

## Example: Using OktoModel Format

```okt
EXPORT {
  format: ["onnx", "okm"]
  path: "export/"
}
```

**Why use .okm?**

- βœ… Optimized for OktoSeek Flutter SDK
- βœ… Better performance on mobile devices
- βœ… Access to exclusive OktoSeek tools and plugins
- βœ… Seamless integration with OktoSeek ecosystem
- βœ… Support for iOS and Android apps

**Note:** `.okm` is optional. You can always export to standard formats (ONNX, GGUF, SafeTensors) for universal compatibility.

---

## Training Workflow

During training, OktoScript uses standard formats (this is industry-standard):

```
runs/my-model/
β”œβ”€β”€ checkpoint-100/
β”‚   └── model.safetensors
β”œβ”€β”€ checkpoint-200/
β”‚   └── model.safetensors
β”œβ”€β”€ tokenizer.json
└── training_logs.json
```

After training, you choose your export format based on your deployment needs.

---

## Complete Project Example

See [`pizzabot/`](./pizzabot/) for a complete project example with:
- Full project structure
- Multiple dataset files
- Training configuration
- Export settings
- Example outputs

---

## Contributing

Want to add your own example? 

1. Create a new `.okt` file in this directory
2. Follow the OktoScript grammar specification
3. Include clear comments and descriptions
4. Submit a pull request!

---

**Powered by OktoSeek AI**

- **Website:** https://www.oktoseek.com
- **GitHub:** https://github.com/oktoseek/oktoscript
- **Documentation:** [../docs/grammar.md](../docs/grammar.md)