Update
Browse files- CHANGELOG.md +1 -1
- CONTRIBUTING.md +3 -1
- MANIFEST.md +173 -0
- README.md +50 -22
- docs/CONTEXT_FIELDS.md +204 -0
- docs/CUSTOM_FIELDS.md +262 -0
- docs/PERFORMANCE_TIPS.md +222 -0
- docs/grammar.md +76 -0
- examples/MODEL_NAMES.md +71 -0
- examples/QUICK_FIX.md +82 -0
- examples/README.md +17 -0
- examples/TESTING_GUIDE.md +227 -0
- examples/TROUBLESHOOTING.md +114 -0
- examples/pizzabot/okt.yaml +1 -1
- examples/test-flan-t5-complete.okt +112 -0
- examples/test-flan-t5-inference.okt +94 -0
- examples/test-pizzaria-context.okt +46 -0
- examples/test-t5-basic-clean.okt +38 -0
- examples/test-t5-basic.okt +39 -0
- examples/test-t5-control.okt +77 -0
- examples/test-t5-custom-fields.okt +42 -0
- examples/test-t5-explorer.okt +54 -0
- examples/test-t5-monitor.okt +58 -0
CHANGELOG.md
CHANGED
|
@@ -26,7 +26,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
| 26 |
- Complete PizzaBot example project
|
| 27 |
- JSON Schema for dataset validation
|
| 28 |
- Professional README with documentation
|
| 29 |
-
-
|
| 30 |
|
| 31 |
### Documentation
|
| 32 |
- Grammar specification in EBNF format
|
|
|
|
| 26 |
- Complete PizzaBot example project
|
| 27 |
- JSON Schema for dataset validation
|
| 28 |
- Professional README with documentation
|
| 29 |
+
- OktoScript License 1.0 (Proprietary-Free Use License)
|
| 30 |
|
| 31 |
### Documentation
|
| 32 |
- Grammar specification in EBNF format
|
CONTRIBUTING.md
CHANGED
|
@@ -2,7 +2,9 @@
|
|
| 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 |
|
|
|
|
| 2 |
|
| 3 |
Thank you for your interest in contributing to OktoScript! 🐙
|
| 4 |
|
| 5 |
+
**OktoScript** is a proprietary domain-specific programming language developed and owned by **OktoSeek AI**. We welcome contributions from the community for documentation, examples, bug reports, and feature suggestions!
|
| 6 |
+
|
| 7 |
+
**Important:** OktoScript is a proprietary language. While we welcome contributions, you may not create derivative works, forks, or competing languages based on OktoScript. See [OKTOSCRIPT_LICENSE.md](./OKTOSCRIPT_LICENSE.md) for complete license terms.
|
| 8 |
|
| 9 |
## How to Contribute
|
| 10 |
|
MANIFEST.md
ADDED
|
@@ -0,0 +1,173 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# 🐙 Official Manifesto — OktoSeek
|
| 2 |
+
|
| 3 |
+
<p align="center">
|
| 4 |
+
<strong>The Philosophy and Legacy of What We Created</strong>
|
| 5 |
+
</p>
|
| 6 |
+
|
| 7 |
+
---
|
| 8 |
+
|
| 9 |
+
## Our Vision
|
| 10 |
+
|
| 11 |
+
OktoSeek was born from a simple yet powerful vision:
|
| 12 |
+
|
| 13 |
+
> **To transform the creation of Artificial Intelligence into something accessible, understandable, and possible for anyone in the world.**
|
| 14 |
+
|
| 15 |
+
We are not here just to build another AI tool.
|
| 16 |
+
|
| 17 |
+
We are here to create a new way of thinking, writing, and building Artificial Intelligence.
|
| 18 |
+
|
| 19 |
+
That is why we did not create just code.
|
| 20 |
+
|
| 21 |
+
We created a language.
|
| 22 |
+
|
| 23 |
+
We created an engine.
|
| 24 |
+
|
| 25 |
+
We created an ecosystem.
|
| 26 |
+
|
| 27 |
+
---
|
| 28 |
+
|
| 29 |
+
## 🌍 The Language Belongs to the World
|
| 30 |
+
|
| 31 |
+
OktoSeek believes that no one truly owns a programming language.
|
| 32 |
+
|
| 33 |
+
Languages are extensions of human thought.
|
| 34 |
+
|
| 35 |
+
They may be born in one mind, but they belong to humanity.
|
| 36 |
+
|
| 37 |
+
That is why OktoScript was designed to be:
|
| 38 |
+
|
| 39 |
+
- ✅ **Open to learning** — Anyone can learn, use, and contribute
|
| 40 |
+
- ✅ **Free for experimentation** — No barriers to exploration and innovation
|
| 41 |
+
- ✅ **Simple for beginners** — Intuitive syntax that welcomes newcomers
|
| 42 |
+
- ✅ **Powerful for experts** — Advanced capabilities for complex scenarios
|
| 43 |
+
- ✅ **Evolving for the future** — Designed to grow and adapt with the community
|
| 44 |
+
|
| 45 |
+
OktoScript is not just a language for training AI.
|
| 46 |
+
|
| 47 |
+
It is a new way of communicating with machines.
|
| 48 |
+
|
| 49 |
+
Version 2.0 does not represent control.
|
| 50 |
+
|
| 51 |
+
It represents evolution.
|
| 52 |
+
|
| 53 |
+
Progress.
|
| 54 |
+
|
| 55 |
+
Freedom.
|
| 56 |
+
|
| 57 |
+
---
|
| 58 |
+
|
| 59 |
+
## 🧠 Our Mission
|
| 60 |
+
|
| 61 |
+
OktoSeek's mission is clear:
|
| 62 |
+
|
| 63 |
+
> **To create a global standard that allows anyone to develop, train, and experiment with Artificial Intelligence without relying on hundreds of lines of complex code.**
|
| 64 |
+
|
| 65 |
+
We want a student anywhere in the world to train their own AI.
|
| 66 |
+
|
| 67 |
+
We want a researcher to prototype in minutes.
|
| 68 |
+
|
| 69 |
+
We want a curious child to understand how an AI is born.
|
| 70 |
+
|
| 71 |
+
Artificial Intelligence does not belong to a few.
|
| 72 |
+
|
| 73 |
+
It belongs to the world.
|
| 74 |
+
|
| 75 |
+
And OktoSeek is the gateway.
|
| 76 |
+
|
| 77 |
+
---
|
| 78 |
+
|
| 79 |
+
## ⚙️ Our Ecosystem
|
| 80 |
+
|
| 81 |
+
OktoSeek is built upon three fundamental pillars:
|
| 82 |
+
|
| 83 |
+
| Pillar | Description |
|
| 84 |
+
|--------|-------------|
|
| 85 |
+
| **OktoScript** | The language of intention |
|
| 86 |
+
| **OktoEngine** | The system that brings it to life |
|
| 87 |
+
| **OktoIDE / OktoSeek Studio** | Where everything takes shape |
|
| 88 |
+
|
| 89 |
+
Together, they form the first integrated ecosystem focused on making AI creation and training accessible, powerful, and intuitive.
|
| 90 |
+
|
| 91 |
+
But more important than the technology itself is the creative freedom it enables.
|
| 92 |
+
|
| 93 |
+
---
|
| 94 |
+
|
| 95 |
+
## 🤝 Community First
|
| 96 |
+
|
| 97 |
+
None of this exists without people.
|
| 98 |
+
|
| 99 |
+
OktoSeek believes that:
|
| 100 |
+
|
| 101 |
+
- **Code grows with community** — Every contribution makes the ecosystem stronger
|
| 102 |
+
- **Knowledge expands when shared** — Open documentation and learning resources
|
| 103 |
+
- **Innovation is born from collaboration** — Together we build the future
|
| 104 |
+
|
| 105 |
+
That is why:
|
| 106 |
+
|
| 107 |
+
- **Core parts of the project are open** — Transparency and accessibility
|
| 108 |
+
- **Documentation is public** — Knowledge available to everyone
|
| 109 |
+
- **The community is part of the evolutionary process** — Your voice shapes the future
|
| 110 |
+
|
| 111 |
+
We do not create users.
|
| 112 |
+
|
| 113 |
+
We create creators.
|
| 114 |
+
|
| 115 |
+
---
|
| 116 |
+
|
| 117 |
+
## 🏛️ Origin and Legacy
|
| 118 |
+
|
| 119 |
+
OktoSeek was conceived and architected by
|
| 120 |
+
|
| 121 |
+
**[Ademir Paulo](https://www.linkedin.com/in/ademir-p-de-oliveira-2a2678151/)**, an Artificial Intelligence Engineer,
|
| 122 |
+
|
| 123 |
+
driven by the conviction that technology must be accessible to everyone — not only to large corporations or academic institutions.
|
| 124 |
+
|
| 125 |
+
And as a central principle of OktoSeek, it is recorded:
|
| 126 |
+
|
| 127 |
+
> "When we share knowledge, we unlock the power of people to create things we could never imagine alone."
|
| 128 |
+
|
| 129 |
+
Even as the language evolves, technology transforms, and new generations carry it forward, the origin of OktoSeek will always be tied to this vision.
|
| 130 |
+
|
| 131 |
+
---
|
| 132 |
+
|
| 133 |
+
### The Founder's Message
|
| 134 |
+
|
| 135 |
+
> Because knowledge that is kept is limited.
|
| 136 |
+
>
|
| 137 |
+
> But knowledge that is shared… changes the world.
|
| 138 |
+
>
|
| 139 |
+
> — **[Ademir Paulo](https://www.linkedin.com/in/ademir-p-de-oliveira-2a2678151/)**, Founder OktoSeek
|
| 140 |
+
|
| 141 |
+
---
|
| 142 |
+
|
| 143 |
+
## 📚 Related Resources
|
| 144 |
+
|
| 145 |
+
- **Official Website:** https://www.oktoseek.com
|
| 146 |
+
- **Manifesto (Web):** https://www.oktoseek.com/manifest.html
|
| 147 |
+
- **GitHub:** https://github.com/oktoseek
|
| 148 |
+
- **Hugging Face:** https://huggingface.co/OktoSeek
|
| 149 |
+
- **Twitter:** https://x.com/oktoseek
|
| 150 |
+
- **YouTube:** https://www.youtube.com/@Oktoseek
|
| 151 |
+
|
| 152 |
+
---
|
| 153 |
+
|
| 154 |
+
## 📄 License
|
| 155 |
+
|
| 156 |
+
This manifesto represents the philosophy and vision of OktoSeek AI. The content reflects our commitment to open knowledge, community-driven development, and democratizing AI.
|
| 157 |
+
|
| 158 |
+
For licensing information about OktoScript and related projects, see the [OKTOSCRIPT_LICENSE.md](./OKTOSCRIPT_LICENSE.md) file.
|
| 159 |
+
|
| 160 |
+
---
|
| 161 |
+
|
| 162 |
+
<p align="center">
|
| 163 |
+
<strong>— OktoSeek</strong><br>
|
| 164 |
+
<em>Transforming AI creation for everyone, everywhere.</em>
|
| 165 |
+
</p>
|
| 166 |
+
|
| 167 |
+
<p align="center">
|
| 168 |
+
Made with ❤️ by the <strong>OktoSeek AI</strong> team
|
| 169 |
+
</p>
|
| 170 |
+
|
| 171 |
+
|
| 172 |
+
|
| 173 |
+
|
README.md
CHANGED
|
@@ -1,22 +1,3 @@
|
|
| 1 |
-
---
|
| 2 |
-
license: apache-2.0
|
| 3 |
-
tags:
|
| 4 |
-
- ai
|
| 5 |
-
- training
|
| 6 |
-
- dsl
|
| 7 |
-
- oktoscript
|
| 8 |
-
- oktoseek
|
| 9 |
-
- okto
|
| 10 |
-
- automation
|
| 11 |
-
- ai-pipelines
|
| 12 |
-
- ai-governance
|
| 13 |
-
language:
|
| 14 |
-
- en
|
| 15 |
-
frameworks:
|
| 16 |
-
- pytorch
|
| 17 |
-
- tensorflow
|
| 18 |
-
|
| 19 |
-
---
|
| 20 |
<p align="center">
|
| 21 |
<img src="./assets/okto_logo.png" alt="OktoScript Banner" width="50%" />
|
| 22 |
</p>
|
|
@@ -117,7 +98,8 @@ OktoScript is the official language of the OktoSeek ecosystem and is used by:
|
|
| 117 |
|
| 118 |
- 🎯 **OktoSeek IDE** – Visual AI development and experimentation
|
| 119 |
- ⚙️ **OktoEngine** – Core execution and decision engine
|
| 120 |
-
-
|
|
|
|
| 121 |
- 🔄 **Autonomous pipelines** – Training, control, evaluation and inference
|
| 122 |
- 🤖 **AI agents** – Controlled, monitored intelligent systems
|
| 123 |
- 📱 **Flutter / API deployments** – Cross-platform model integration
|
|
@@ -328,6 +310,7 @@ OktoScript v1.1 adds powerful new features while maintaining 100% backward compa
|
|
| 328 |
- ✅ **Image + Caption** - Vision datasets
|
| 329 |
- ✅ **Question & Answer (QA)** - Q&A pairs
|
| 330 |
- ✅ **Instruction datasets** - Instruction-following
|
|
|
|
| 331 |
- ✅ **Multi-modal** - (future support)
|
| 332 |
|
| 333 |
### Example (JSONL):
|
|
@@ -337,6 +320,22 @@ OktoScript v1.1 adds powerful new features while maintaining 100% backward compa
|
|
| 337 |
{"input":"Do you deliver?","output":"Yes, delivery is available in your region."}
|
| 338 |
```
|
| 339 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 340 |
---
|
| 341 |
|
| 342 |
## 📊 Supported Metrics
|
|
@@ -368,6 +367,27 @@ METRICS {
|
|
| 368 |
|
| 369 |
The OktoEngine CLI is minimal by design. All intelligence lives in the `.okt` file. The terminal is just the execution port.
|
| 370 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 371 |
### Core Commands
|
| 372 |
|
| 373 |
**Initialize a project:**
|
|
@@ -636,6 +656,8 @@ See [`/examples/`](./examples/) for examples using different export formats.
|
|
| 636 |
- ▶️ **Run / Train buttons** - One-click execution
|
| 637 |
- 🎨 **Visual pipeline builder** - Drag-and-drop workflows
|
| 638 |
|
|
|
|
|
|
|
| 639 |
---
|
| 640 |
|
| 641 |
## 📚 Documentation
|
|
@@ -718,13 +740,19 @@ The language evolves to support increasingly sophisticated AI behaviors while ma
|
|
| 718 |
|
| 719 |
## 📄 License
|
| 720 |
|
| 721 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 722 |
|
| 723 |
---
|
| 724 |
|
| 725 |
## 🤝 Contributing
|
| 726 |
|
| 727 |
-
Contributions are welcome!
|
|
|
|
|
|
|
| 728 |
|
| 729 |
---
|
| 730 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
<p align="center">
|
| 2 |
<img src="./assets/okto_logo.png" alt="OktoScript Banner" width="50%" />
|
| 3 |
</p>
|
|
|
|
| 98 |
|
| 99 |
- 🎯 **OktoSeek IDE** – Visual AI development and experimentation
|
| 100 |
- ⚙️ **OktoEngine** – Core execution and decision engine
|
| 101 |
+
- 🌐 **OktoScript Web Editor** – Online editor with syntax validation and autocomplete ([Try it now →](https://oktoseek.com/editor.php))
|
| 102 |
+
- 🔌 **VS Code Extension** – Code editing + validation (Coming Soon)
|
| 103 |
- 🔄 **Autonomous pipelines** – Training, control, evaluation and inference
|
| 104 |
- 🤖 **AI agents** – Controlled, monitored intelligent systems
|
| 105 |
- 📱 **Flutter / API deployments** – Cross-platform model integration
|
|
|
|
| 310 |
- ✅ **Image + Caption** - Vision datasets
|
| 311 |
- ✅ **Question & Answer (QA)** - Q&A pairs
|
| 312 |
- ✅ **Instruction datasets** - Instruction-following
|
| 313 |
+
- ✅ **Custom Field Names** (v1.2+) - Define `input_field` and `output_field` for any column names
|
| 314 |
- ✅ **Multi-modal** - (future support)
|
| 315 |
|
| 316 |
### Example (JSONL):
|
|
|
|
| 320 |
{"input":"Do you deliver?","output":"Yes, delivery is available in your region."}
|
| 321 |
```
|
| 322 |
|
| 323 |
+
### Custom Field Names (v1.2+)
|
| 324 |
+
|
| 325 |
+
OktoScript now supports custom field names in datasets, allowing you to work with any column names:
|
| 326 |
+
|
| 327 |
+
```okt
|
| 328 |
+
DATASET {
|
| 329 |
+
train: "dataset/train.jsonl"
|
| 330 |
+
input_field: "question" # Custom input column name
|
| 331 |
+
output_field: "answer" # Custom output column name
|
| 332 |
+
}
|
| 333 |
+
```
|
| 334 |
+
|
| 335 |
+
If not specified, OktoEngine automatically detects `input`/`output` or `input`/`target` fields.
|
| 336 |
+
|
| 337 |
+
📖 **[Learn more about custom fields →](./docs/CUSTOM_FIELDS.md)**
|
| 338 |
+
|
| 339 |
---
|
| 340 |
|
| 341 |
## 📊 Supported Metrics
|
|
|
|
| 367 |
|
| 368 |
The OktoEngine CLI is minimal by design. All intelligence lives in the `.okt` file. The terminal is just the execution port.
|
| 369 |
|
| 370 |
+
### 🌐 Web Editor Command
|
| 371 |
+
|
| 372 |
+
**Open OktoScript files in the web editor:**
|
| 373 |
+
|
| 374 |
+
```bash
|
| 375 |
+
# Open editor with a specific file
|
| 376 |
+
okto web --file scripts/train.okt
|
| 377 |
+
|
| 378 |
+
# Open empty editor
|
| 379 |
+
okto web
|
| 380 |
+
```
|
| 381 |
+
|
| 382 |
+
The `okto web` command opens the [OktoScript Web Editor](https://oktoseek.com/editor.php) in your browser. When you provide a file path, it automatically loads the file content for editing. The editor features:
|
| 383 |
+
|
| 384 |
+
- **Smart Autocomplete** – Context-aware suggestions based on the current block (ENV, DATASET, MODEL, TRAIN, etc.)
|
| 385 |
+
- **Real-time Syntax Validation** – Detects errors like nested blocks (e.g., PROJECT inside DATASET) and missing braces
|
| 386 |
+
- **Auto-save to Local** – When you load a file, it saves back to the same location automatically
|
| 387 |
+
- **Full Integration** – Seamlessly connects with OktoEngine for validation and training
|
| 388 |
+
|
| 389 |
+
Perfect for quick edits, syntax testing, and experimenting with OktoScript configurations!
|
| 390 |
+
|
| 391 |
### Core Commands
|
| 392 |
|
| 393 |
**Initialize a project:**
|
|
|
|
| 656 |
- ▶️ **Run / Train buttons** - One-click execution
|
| 657 |
- 🎨 **Visual pipeline builder** - Drag-and-drop workflows
|
| 658 |
|
| 659 |
+
> 💡 **Tip:** While waiting for the VS Code extension, use the [🌐 OktoScript Web Editor](https://oktoseek.com/editor.php) for syntax validation, autocomplete, and real-time error checking. It's fully integrated with the CLI via `okto web` command! The web editor provides the same features you'll find in the VS Code extension, including context-aware autocomplete and real-time syntax validation.
|
| 660 |
+
|
| 661 |
---
|
| 662 |
|
| 663 |
## 📚 Documentation
|
|
|
|
| 740 |
|
| 741 |
## 📄 License
|
| 742 |
|
| 743 |
+
**OktoScript is free to use, but is a proprietary language owned by OktoSeek AI.**
|
| 744 |
+
|
| 745 |
+
OktoScript is available for personal and commercial use at no cost. However, OktoScript is a proprietary language and you may not modify, distribute, clone, fork, or create derivative works of OktoScript.
|
| 746 |
+
|
| 747 |
+
See [OKTOSCRIPT_LICENSE.md](./OKTOSCRIPT_LICENSE.md) for complete license terms.
|
| 748 |
|
| 749 |
---
|
| 750 |
|
| 751 |
## 🤝 Contributing
|
| 752 |
|
| 753 |
+
Contributions are welcome! We welcome bug reports, feature suggestions, documentation improvements, and example contributions. Please see [CONTRIBUTING.md](./CONTRIBUTING.md) for guidelines.
|
| 754 |
+
|
| 755 |
+
**Note:** OktoScript is a proprietary language owned by OktoSeek AI. While we welcome contributions, you may not create derivative works, forks, or competing languages based on OktoScript.
|
| 756 |
|
| 757 |
---
|
| 758 |
|
docs/CONTEXT_FIELDS.md
ADDED
|
@@ -0,0 +1,204 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Campos de Contexto (Context Fields) - v1.2+
|
| 2 |
+
|
| 3 |
+
## Visão Geral
|
| 4 |
+
|
| 5 |
+
Campos de contexto são campos adicionais no seu dataset que contêm informações que devem ser incluídas automaticamente no prompt durante o treinamento, mas não são a entrada principal nem a saída esperada.
|
| 6 |
+
|
| 7 |
+
## Casos de Uso
|
| 8 |
+
|
| 9 |
+
### 1. Chatbots com Contexto Dinâmico
|
| 10 |
+
|
| 11 |
+
Para chatbots que precisam de informações contextuais (menu, drinks, promoções, horários, etc.):
|
| 12 |
+
|
| 13 |
+
```okt
|
| 14 |
+
DATASET {
|
| 15 |
+
train: "dataset/pizzaria.jsonl"
|
| 16 |
+
format: "jsonl"
|
| 17 |
+
input_field: "input"
|
| 18 |
+
output_field: "target"
|
| 19 |
+
context_fields: ["menu", "drinks", "promotions"]
|
| 20 |
+
}
|
| 21 |
+
```
|
| 22 |
+
|
| 23 |
+
**Dataset JSONL:**
|
| 24 |
+
```jsonl
|
| 25 |
+
{"input": "What pizzas do you have?", "target": "We have Margherita, Pepperoni, and Four Cheese.", "menu": "Margherita: $34, Pepperoni: $39, Four Cheese: $45", "drinks": "Coke, Sprite, Water"}
|
| 26 |
+
{"input": "Any promotions?", "target": "Yes! Buy 2 get 1 free on Tuesdays.", "menu": "Margherita: $34, Pepperoni: $39", "promotions": "Buy 2 get 1 free on Tuesdays"}
|
| 27 |
+
```
|
| 28 |
+
|
| 29 |
+
**Prompt gerado automaticamente:**
|
| 30 |
+
```
|
| 31 |
+
menu: Margherita: $34, Pepperoni: $39, Four Cheese: $45 | drinks: Coke, Sprite, Water | What pizzas do you have?
|
| 32 |
+
```
|
| 33 |
+
|
| 34 |
+
### 2. Question Answering com Documentos
|
| 35 |
+
|
| 36 |
+
Para QA que precisa de contexto do documento:
|
| 37 |
+
|
| 38 |
+
```okt
|
| 39 |
+
DATASET {
|
| 40 |
+
train: "dataset/qa.jsonl"
|
| 41 |
+
format: "jsonl"
|
| 42 |
+
input_field: "question"
|
| 43 |
+
output_field: "answer"
|
| 44 |
+
context_fields: ["document", "section"]
|
| 45 |
+
}
|
| 46 |
+
```
|
| 47 |
+
|
| 48 |
+
**Dataset JSONL:**
|
| 49 |
+
```jsonl
|
| 50 |
+
{"question": "What is the capital?", "answer": "Brasília", "document": "Geography of Brazil", "section": "Administrative divisions"}
|
| 51 |
+
```
|
| 52 |
+
|
| 53 |
+
### 3. Tradução com Contexto
|
| 54 |
+
|
| 55 |
+
Para tradução que precisa de contexto adicional:
|
| 56 |
+
|
| 57 |
+
```okt
|
| 58 |
+
DATASET {
|
| 59 |
+
train: "dataset/translation.jsonl"
|
| 60 |
+
format: "jsonl"
|
| 61 |
+
input_field: "source"
|
| 62 |
+
output_field: "target"
|
| 63 |
+
context_fields: ["domain", "style"]
|
| 64 |
+
}
|
| 65 |
+
```
|
| 66 |
+
|
| 67 |
+
## Como Funciona
|
| 68 |
+
|
| 69 |
+
### Formato do Prompt
|
| 70 |
+
|
| 71 |
+
Os campos de contexto são incluídos **antes** do `input_field` no formato:
|
| 72 |
+
|
| 73 |
+
```
|
| 74 |
+
{context_field_1}: {value_1} | {context_field_2}: {value_2} | {input_field}
|
| 75 |
+
```
|
| 76 |
+
|
| 77 |
+
### Ordem dos Campos
|
| 78 |
+
|
| 79 |
+
Os campos são incluídos na **ordem especificada** em `context_fields`:
|
| 80 |
+
|
| 81 |
+
```okt
|
| 82 |
+
context_fields: ["menu", "drinks", "promotions"]
|
| 83 |
+
```
|
| 84 |
+
|
| 85 |
+
Resultado: `menu: ... | drinks: ... | promotions: ... | input`
|
| 86 |
+
|
| 87 |
+
### Campos Vazios
|
| 88 |
+
|
| 89 |
+
Campos vazios são **automaticamente ignorados**:
|
| 90 |
+
|
| 91 |
+
```jsonl
|
| 92 |
+
{"input": "Hello", "target": "Hi", "menu": "", "drinks": "Coke"}
|
| 93 |
+
```
|
| 94 |
+
|
| 95 |
+
Resultado: `drinks: Coke | Hello` (menu vazio foi ignorado)
|
| 96 |
+
|
| 97 |
+
## Sintaxe
|
| 98 |
+
|
| 99 |
+
```okt
|
| 100 |
+
DATASET {
|
| 101 |
+
train: "dataset/train.jsonl"
|
| 102 |
+
validation: "dataset/val.jsonl"
|
| 103 |
+
format: "jsonl"
|
| 104 |
+
|
| 105 |
+
# Campos principais
|
| 106 |
+
input_field: "input"
|
| 107 |
+
output_field: "target"
|
| 108 |
+
|
| 109 |
+
# Campos de contexto (opcional)
|
| 110 |
+
context_fields: ["menu", "drinks", "promotions"]
|
| 111 |
+
}
|
| 112 |
+
```
|
| 113 |
+
|
| 114 |
+
## Exemplo Completo
|
| 115 |
+
|
| 116 |
+
```okt
|
| 117 |
+
# okto_version: "1.2"
|
| 118 |
+
PROJECT "pizzaria_chatbot"
|
| 119 |
+
|
| 120 |
+
DATASET {
|
| 121 |
+
train: "dataset/pizzaria_train.jsonl"
|
| 122 |
+
validation: "dataset/pizzaria_val.jsonl"
|
| 123 |
+
format: "jsonl"
|
| 124 |
+
type: "chat"
|
| 125 |
+
|
| 126 |
+
input_field: "input"
|
| 127 |
+
output_field: "target"
|
| 128 |
+
context_fields: ["menu", "drinks", "promotions", "hours"]
|
| 129 |
+
}
|
| 130 |
+
|
| 131 |
+
MODEL {
|
| 132 |
+
base: "t5-small"
|
| 133 |
+
device: "auto"
|
| 134 |
+
}
|
| 135 |
+
|
| 136 |
+
TRAIN {
|
| 137 |
+
epochs: 3
|
| 138 |
+
batch_size: 8
|
| 139 |
+
learning_rate: 0.0001
|
| 140 |
+
}
|
| 141 |
+
|
| 142 |
+
EXPORT {
|
| 143 |
+
format: ["okm"]
|
| 144 |
+
path: "export/"
|
| 145 |
+
}
|
| 146 |
+
```
|
| 147 |
+
|
| 148 |
+
**Dataset de exemplo:**
|
| 149 |
+
```jsonl
|
| 150 |
+
{"input": "What pizzas do you have?", "target": "We have Margherita ($34), Pepperoni ($39), and Four Cheese ($45).", "menu": "Margherita: $34, Pepperoni: $39, Four Cheese: $45", "drinks": "Coke, Sprite, Water", "promotions": "Buy 2 get 1 free on Tuesdays", "hours": "Open 11am-11pm daily"}
|
| 151 |
+
{"input": "What time do you close?", "target": "We close at 11pm daily.", "menu": "Margherita: $34, Pepperoni: $39", "hours": "Open 11am-11pm daily"}
|
| 152 |
+
```
|
| 153 |
+
|
| 154 |
+
## Dicas e Boas Práticas
|
| 155 |
+
|
| 156 |
+
### ✅ Faça
|
| 157 |
+
|
| 158 |
+
1. **Use nomes descritivos**: `menu`, `drinks`, `promotions` são melhores que `ctx1`, `ctx2`
|
| 159 |
+
2. **Mantenha contexto relevante**: Apenas campos que realmente ajudam o modelo
|
| 160 |
+
3. **Ordene por importância**: Campos mais importantes primeiro
|
| 161 |
+
4. **Use consistentemente**: Mesmos campos em train, validation e test
|
| 162 |
+
|
| 163 |
+
### ❌ Evite
|
| 164 |
+
|
| 165 |
+
1. **Muitos campos**: Mais de 5-6 campos pode confundir o modelo
|
| 166 |
+
2. **Campos muito longos**: Contexto muito extenso pode ultrapassar o limite de tokens
|
| 167 |
+
3. **Informação redundante**: Não repita informação já no input
|
| 168 |
+
4. **Campos não relacionados**: Apenas contexto relevante para a tarefa
|
| 169 |
+
|
| 170 |
+
## Limitações
|
| 171 |
+
|
| 172 |
+
- Campos de contexto são incluídos no prompt, então contam para o limite de tokens
|
| 173 |
+
- A ordem dos campos importa - coloque os mais importantes primeiro
|
| 174 |
+
- Campos vazios são ignorados automaticamente
|
| 175 |
+
- Funciona tanto para modelos Seq2Seq (T5, BART) quanto Causal (GPT)
|
| 176 |
+
|
| 177 |
+
## Troubleshooting
|
| 178 |
+
|
| 179 |
+
### O contexto não está aparecendo no prompt
|
| 180 |
+
|
| 181 |
+
**Causa**: Nome do campo incorreto ou campo não existe no dataset.
|
| 182 |
+
|
| 183 |
+
**Solução**:
|
| 184 |
+
- Verifique os nomes dos campos no dataset
|
| 185 |
+
- Use `okto validate` para verificar a configuração
|
| 186 |
+
- Certifique-se de que os campos existem em todos os exemplos
|
| 187 |
+
|
| 188 |
+
### Prompt muito longo
|
| 189 |
+
|
| 190 |
+
**Causa**: Muitos campos de contexto ou campos muito longos.
|
| 191 |
+
|
| 192 |
+
**Solução**:
|
| 193 |
+
- Reduza o número de campos de contexto
|
| 194 |
+
- Encurte o conteúdo dos campos
|
| 195 |
+
- Aumente `max_length` no tokenizer (se necessário)
|
| 196 |
+
|
| 197 |
+
---
|
| 198 |
+
|
| 199 |
+
**Versão**: 1.2+
|
| 200 |
+
**Última atualização**: 2024
|
| 201 |
+
|
| 202 |
+
|
| 203 |
+
|
| 204 |
+
|
docs/CUSTOM_FIELDS.md
ADDED
|
@@ -0,0 +1,262 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Campos Customizados no Dataset (v1.2+)
|
| 2 |
+
|
| 3 |
+
## Visão Geral
|
| 4 |
+
|
| 5 |
+
A partir da versão 1.2, o OktoScript permite definir campos customizados para input e output no bloco `DATASET`. Além disso, você pode especificar **campos de contexto** que serão automaticamente incluídos no prompt durante o treinamento. Isso oferece flexibilidade total para trabalhar com datasets complexos que incluem informações contextuais (como menu, drinks, promoções, etc.).
|
| 6 |
+
|
| 7 |
+
## Sintaxe
|
| 8 |
+
|
| 9 |
+
```okt
|
| 10 |
+
DATASET {
|
| 11 |
+
train: "dataset/train.jsonl"
|
| 12 |
+
validation: "dataset/val.jsonl"
|
| 13 |
+
format: "jsonl"
|
| 14 |
+
|
| 15 |
+
# Campos customizados (opcional)
|
| 16 |
+
input_field: "input" # Nome da coluna de entrada
|
| 17 |
+
output_field: "target" # Nome da coluna de saída (ou use target_field)
|
| 18 |
+
|
| 19 |
+
# Campos de contexto (opcional) - incluídos automaticamente no prompt
|
| 20 |
+
context_fields: ["menu", "drinks", "promotions"]
|
| 21 |
+
}
|
| 22 |
+
```
|
| 23 |
+
|
| 24 |
+
## Resolução Automática de Campos
|
| 25 |
+
|
| 26 |
+
Se você **não especificar** `input_field` e `output_field`, o OktoEngine tentará encontrar os campos automaticamente na seguinte ordem:
|
| 27 |
+
|
| 28 |
+
### Para modelos Seq2Seq (T5, BART, etc.):
|
| 29 |
+
|
| 30 |
+
1. **`input` + `output`** (padrão mais comum)
|
| 31 |
+
2. **`input` + `target`** (alternativa comum)
|
| 32 |
+
3. **`text`** (campo único, usado para ambos)
|
| 33 |
+
4. **Primeiro campo string encontrado** (fallback)
|
| 34 |
+
|
| 35 |
+
### Para modelos Causal (GPT, etc.):
|
| 36 |
+
|
| 37 |
+
1. **`input` + `output`** (concatenados)
|
| 38 |
+
2. **`input` + `target`** (concatenados)
|
| 39 |
+
3. **`text`** (campo único)
|
| 40 |
+
4. **Primeiro campo string encontrado** (fallback)
|
| 41 |
+
|
| 42 |
+
## Exemplos de Uso
|
| 43 |
+
|
| 44 |
+
### Exemplo 1: Dataset com `input` e `target`
|
| 45 |
+
|
| 46 |
+
```okt
|
| 47 |
+
DATASET {
|
| 48 |
+
train: "dataset/train.jsonl"
|
| 49 |
+
format: "jsonl"
|
| 50 |
+
input_field: "input"
|
| 51 |
+
output_field: "target"
|
| 52 |
+
}
|
| 53 |
+
```
|
| 54 |
+
|
| 55 |
+
**Dataset JSONL:**
|
| 56 |
+
```jsonl
|
| 57 |
+
{"input": "User: Olá", "target": "Assistant: Olá! Como posso ajudar?"}
|
| 58 |
+
{"input": "User: Tudo bem?", "target": "Assistant: Sim, tudo ótimo!"}
|
| 59 |
+
```
|
| 60 |
+
|
| 61 |
+
### Exemplo 2: Dataset com campos diferentes
|
| 62 |
+
|
| 63 |
+
```okt
|
| 64 |
+
DATASET {
|
| 65 |
+
train: "dataset/conversations.jsonl"
|
| 66 |
+
format: "jsonl"
|
| 67 |
+
input_field: "question"
|
| 68 |
+
output_field: "answer"
|
| 69 |
+
}
|
| 70 |
+
```
|
| 71 |
+
|
| 72 |
+
**Dataset JSONL:**
|
| 73 |
+
```jsonl
|
| 74 |
+
{"question": "Qual é a capital do Brasil?", "answer": "Brasília"}
|
| 75 |
+
{"question": "Quem descobriu o Brasil?", "answer": "Pedro Álvares Cabral"}
|
| 76 |
+
```
|
| 77 |
+
|
| 78 |
+
### Exemplo 3: Dataset com nomes em português
|
| 79 |
+
|
| 80 |
+
```okt
|
| 81 |
+
DATASET {
|
| 82 |
+
train: "dataset/treino.jsonl"
|
| 83 |
+
format: "jsonl"
|
| 84 |
+
input_field: "entrada"
|
| 85 |
+
output_field: "saida"
|
| 86 |
+
}
|
| 87 |
+
```
|
| 88 |
+
|
| 89 |
+
**Dataset JSONL:**
|
| 90 |
+
```jsonl
|
| 91 |
+
{"entrada": "Traduza: Hello", "saida": "Olá"}
|
| 92 |
+
{"entrada": "Traduza: Goodbye", "saida": "Adeus"}
|
| 93 |
+
```
|
| 94 |
+
|
| 95 |
+
### Exemplo 4: Sem especificar campos (auto-detecção)
|
| 96 |
+
|
| 97 |
+
```okt
|
| 98 |
+
DATASET {
|
| 99 |
+
train: "dataset/train.jsonl"
|
| 100 |
+
format: "jsonl"
|
| 101 |
+
# input_field e output_field não especificados
|
| 102 |
+
# O engine tentará encontrar automaticamente
|
| 103 |
+
}
|
| 104 |
+
```
|
| 105 |
+
|
| 106 |
+
O engine tentará:
|
| 107 |
+
- `input` + `output` → se não encontrar
|
| 108 |
+
- `input` + `target` → se não encontrar
|
| 109 |
+
- `text` → se não encontrar
|
| 110 |
+
- Primeiro campo string → fallback
|
| 111 |
+
|
| 112 |
+
## Compatibilidade
|
| 113 |
+
|
| 114 |
+
### Retrocompatibilidade
|
| 115 |
+
|
| 116 |
+
Scripts antigos continuam funcionando sem modificação:
|
| 117 |
+
|
| 118 |
+
```okt
|
| 119 |
+
# Script v1.0/v1.1 - funciona perfeitamente
|
| 120 |
+
DATASET {
|
| 121 |
+
train: "dataset/train.jsonl"
|
| 122 |
+
validation: "dataset/val.jsonl"
|
| 123 |
+
}
|
| 124 |
+
```
|
| 125 |
+
|
| 126 |
+
O engine detectará automaticamente `input`/`output` ou `input`/`target`.
|
| 127 |
+
|
| 128 |
+
### Aliases Suportados
|
| 129 |
+
|
| 130 |
+
- `output_field` e `target_field` são equivalentes
|
| 131 |
+
- Ambos podem ser usados para definir o campo de saída
|
| 132 |
+
|
| 133 |
+
```okt
|
| 134 |
+
DATASET {
|
| 135 |
+
train: "dataset/train.jsonl"
|
| 136 |
+
input_field: "input"
|
| 137 |
+
output_field: "target" # ou target_field: "target"
|
| 138 |
+
}
|
| 139 |
+
```
|
| 140 |
+
|
| 141 |
+
## Casos de Uso
|
| 142 |
+
|
| 143 |
+
### 1. Datasets de Terceiros
|
| 144 |
+
|
| 145 |
+
Quando você usa datasets de repositórios públicos que podem ter nomes de colunas diferentes:
|
| 146 |
+
|
| 147 |
+
```okt
|
| 148 |
+
DATASET {
|
| 149 |
+
train: "datasets/alpaca_pt.jsonl"
|
| 150 |
+
input_field: "instruction"
|
| 151 |
+
output_field: "response"
|
| 152 |
+
}
|
| 153 |
+
```
|
| 154 |
+
|
| 155 |
+
### 2. Migração de Formatos
|
| 156 |
+
|
| 157 |
+
Ao migrar de outros frameworks que usam convenções diferentes:
|
| 158 |
+
|
| 159 |
+
```okt
|
| 160 |
+
DATASET {
|
| 161 |
+
train: "dataset/old_format.jsonl"
|
| 162 |
+
input_field: "prompt"
|
| 163 |
+
output_field: "completion"
|
| 164 |
+
}
|
| 165 |
+
```
|
| 166 |
+
|
| 167 |
+
### 3. Datasets Multilíngues
|
| 168 |
+
|
| 169 |
+
Para datasets que misturam idiomas nos nomes das colunas:
|
| 170 |
+
|
| 171 |
+
```okt
|
| 172 |
+
DATASET {
|
| 173 |
+
train: "dataset/mixed.jsonl"
|
| 174 |
+
input_field: "entrada"
|
| 175 |
+
output_field: "saida"
|
| 176 |
+
}
|
| 177 |
+
```
|
| 178 |
+
|
| 179 |
+
## Validação
|
| 180 |
+
|
| 181 |
+
O OktoEngine valida que:
|
| 182 |
+
|
| 183 |
+
- Os campos especificados existem no dataset
|
| 184 |
+
- Os campos contêm dados válidos (strings)
|
| 185 |
+
- O formato do dataset é compatível
|
| 186 |
+
|
| 187 |
+
## Dicas
|
| 188 |
+
|
| 189 |
+
1. **Use campos customizados quando necessário**: Se seu dataset já usa `input`/`output` ou `input`/`target`, não precisa especificar.
|
| 190 |
+
|
| 191 |
+
2. **Teste primeiro**: Use `okto validate` para verificar se os campos estão corretos antes de treinar.
|
| 192 |
+
|
| 193 |
+
3. **Consistência**: Mantenha os mesmos nomes de campos em train, validation e test.
|
| 194 |
+
|
| 195 |
+
4. **Documentação**: Documente os nomes de campos customizados no seu projeto para facilitar colaboração.
|
| 196 |
+
|
| 197 |
+
## Troubleshooting
|
| 198 |
+
|
| 199 |
+
### Erro: "Field 'X' not found in dataset"
|
| 200 |
+
|
| 201 |
+
**Causa**: O campo especificado não existe no dataset.
|
| 202 |
+
|
| 203 |
+
**Solução**:
|
| 204 |
+
- Verifique os nomes das colunas no seu dataset
|
| 205 |
+
- Use `okto validate` para ver quais campos foram detectados
|
| 206 |
+
- Remova `input_field`/`output_field` para usar auto-detecção
|
| 207 |
+
|
| 208 |
+
### Erro: "No input/output fields found"
|
| 209 |
+
|
| 210 |
+
**Causa**: O engine não conseguiu encontrar campos válidos.
|
| 211 |
+
|
| 212 |
+
**Solução**:
|
| 213 |
+
- Especifique explicitamente `input_field` e `output_field`
|
| 214 |
+
- Verifique se o dataset tem pelo menos um campo string
|
| 215 |
+
|
| 216 |
+
### Dataset funciona sem especificar campos, mas falha com campos customizados
|
| 217 |
+
|
| 218 |
+
**Causa**: Nome do campo incorreto ou com espaços/caracteres especiais.
|
| 219 |
+
|
| 220 |
+
**Solução**:
|
| 221 |
+
- Use exatamente o nome da coluna como aparece no JSON
|
| 222 |
+
- Evite espaços ou caracteres especiais nos nomes das colunas
|
| 223 |
+
|
| 224 |
+
## Exemplo Completo
|
| 225 |
+
|
| 226 |
+
```okt
|
| 227 |
+
# okto_version: "1.2"
|
| 228 |
+
PROJECT "custom_fields_example"
|
| 229 |
+
|
| 230 |
+
DATASET {
|
| 231 |
+
train: "dataset/train.jsonl"
|
| 232 |
+
validation: "dataset/val.jsonl"
|
| 233 |
+
format: "jsonl"
|
| 234 |
+
type: "chat"
|
| 235 |
+
|
| 236 |
+
# Campos customizados
|
| 237 |
+
input_field: "user_message"
|
| 238 |
+
output_field: "assistant_response"
|
| 239 |
+
}
|
| 240 |
+
|
| 241 |
+
MODEL {
|
| 242 |
+
base: "t5-small"
|
| 243 |
+
device: "auto"
|
| 244 |
+
}
|
| 245 |
+
|
| 246 |
+
TRAIN {
|
| 247 |
+
epochs: 3
|
| 248 |
+
batch_size: 8
|
| 249 |
+
learning_rate: 0.0001
|
| 250 |
+
}
|
| 251 |
+
|
| 252 |
+
EXPORT {
|
| 253 |
+
format: ["okm"]
|
| 254 |
+
path: "export/"
|
| 255 |
+
}
|
| 256 |
+
```
|
| 257 |
+
|
| 258 |
+
---
|
| 259 |
+
|
| 260 |
+
**Versão**: 1.2+
|
| 261 |
+
**Última atualização**: 2024
|
| 262 |
+
|
docs/PERFORMANCE_TIPS.md
ADDED
|
@@ -0,0 +1,222 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Dicas de Performance para Treinamento
|
| 2 |
+
|
| 3 |
+
## Configuração de Logs
|
| 4 |
+
|
| 5 |
+
### logging_steps
|
| 6 |
+
|
| 7 |
+
Controla com que frequência os logs são exibidos durante o treinamento:
|
| 8 |
+
|
| 9 |
+
```okt
|
| 10 |
+
TRAIN {
|
| 11 |
+
epochs: 3
|
| 12 |
+
batch_size: 8
|
| 13 |
+
learning_rate: 0.0001
|
| 14 |
+
logging_steps: 5 # Log a cada 5 steps (mais frequente)
|
| 15 |
+
# logging_steps: 20 # Log a cada 20 steps (menos frequente)
|
| 16 |
+
}
|
| 17 |
+
```
|
| 18 |
+
|
| 19 |
+
**Valores recomendados:**
|
| 20 |
+
- **Datasets pequenos (< 1000 exemplos)**: `logging_steps: 5` ou `10`
|
| 21 |
+
- **Datasets médios (1000-10000)**: `logging_steps: 10` ou `20`
|
| 22 |
+
- **Datasets grandes (> 10000)**: `logging_steps: 50` ou `100`
|
| 23 |
+
|
| 24 |
+
### save_steps
|
| 25 |
+
|
| 26 |
+
Controla com que frequência os checkpoints são salvos:
|
| 27 |
+
|
| 28 |
+
```okt
|
| 29 |
+
TRAIN {
|
| 30 |
+
epochs: 3
|
| 31 |
+
batch_size: 8
|
| 32 |
+
learning_rate: 0.0001
|
| 33 |
+
save_steps: 100 # Salva checkpoint a cada 100 steps
|
| 34 |
+
# save_steps: 500 # Salva checkpoint a cada 500 steps (padrão)
|
| 35 |
+
}
|
| 36 |
+
```
|
| 37 |
+
|
| 38 |
+
**Dica**: Para datasets pequenos, use `save_steps` menor para não perder progresso.
|
| 39 |
+
|
| 40 |
+
## Otimização de Performance
|
| 41 |
+
|
| 42 |
+
### 1. Use GPU quando disponível
|
| 43 |
+
|
| 44 |
+
```okt
|
| 45 |
+
ENV {
|
| 46 |
+
accelerator: "gpu"
|
| 47 |
+
precision: "fp16" # Usa menos memória e é mais rápido
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
MODEL {
|
| 51 |
+
base: "t5-small"
|
| 52 |
+
device: "cuda" # Força uso de GPU
|
| 53 |
+
}
|
| 54 |
+
```
|
| 55 |
+
|
| 56 |
+
**Problema comum**: Se você tem GPU mas vê "No CUDA", instale:
|
| 57 |
+
```bash
|
| 58 |
+
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
|
| 59 |
+
```
|
| 60 |
+
|
| 61 |
+
### 2. Aumente o batch_size (se tiver memória)
|
| 62 |
+
|
| 63 |
+
```okt
|
| 64 |
+
TRAIN {
|
| 65 |
+
epochs: 3
|
| 66 |
+
batch_size: 16 # Aumente de 8 para 16 ou 32 (se tiver memória)
|
| 67 |
+
learning_rate: 0.0001
|
| 68 |
+
}
|
| 69 |
+
```
|
| 70 |
+
|
| 71 |
+
**Trade-off**:
|
| 72 |
+
- Batch maior = treinamento mais rápido, mas usa mais memória
|
| 73 |
+
- Batch menor = treinamento mais lento, mas usa menos memória
|
| 74 |
+
|
| 75 |
+
### 3. Use gradient_accumulation para simular batch maior
|
| 76 |
+
|
| 77 |
+
Se não tiver memória para batch grande, use gradient accumulation:
|
| 78 |
+
|
| 79 |
+
```okt
|
| 80 |
+
TRAIN {
|
| 81 |
+
epochs: 3
|
| 82 |
+
batch_size: 8
|
| 83 |
+
gradient_accumulation: 4 # Efetivamente batch_size = 8 * 4 = 32
|
| 84 |
+
learning_rate: 0.0001
|
| 85 |
+
}
|
| 86 |
+
```
|
| 87 |
+
|
| 88 |
+
### 4. Reduza o tamanho do input (se possível)
|
| 89 |
+
|
| 90 |
+
Se seus inputs são muito longos (como JSON de menu embutido), considere:
|
| 91 |
+
|
| 92 |
+
- **Usar context_fields**: Mova informações longas para campos de contexto
|
| 93 |
+
- **Truncar inputs**: O tokenizer já faz isso (max_length: 512), mas inputs menores são mais rápidos
|
| 94 |
+
|
| 95 |
+
### 5. Use modelos menores para testes
|
| 96 |
+
|
| 97 |
+
Para desenvolvimento/testes rápidos:
|
| 98 |
+
|
| 99 |
+
```okt
|
| 100 |
+
MODEL {
|
| 101 |
+
base: "t5-small" # Mais rápido
|
| 102 |
+
# base: "t5-base" # Mais lento, mas melhor qualidade
|
| 103 |
+
}
|
| 104 |
+
```
|
| 105 |
+
|
| 106 |
+
### 6. Reduza epochs para testes
|
| 107 |
+
|
| 108 |
+
```okt
|
| 109 |
+
TRAIN {
|
| 110 |
+
epochs: 1 # Para testes rápidos
|
| 111 |
+
# epochs: 3 # Para treinamento real
|
| 112 |
+
batch_size: 8
|
| 113 |
+
}
|
| 114 |
+
```
|
| 115 |
+
|
| 116 |
+
## Análise do Seu Caso
|
| 117 |
+
|
| 118 |
+
Com base no seu dataset (582 exemplos, inputs longos com Menu JSON):
|
| 119 |
+
|
| 120 |
+
### Por que está lento?
|
| 121 |
+
|
| 122 |
+
1. **Sem CUDA**: Você está usando CPU, que é ~10-50x mais lento que GPU
|
| 123 |
+
2. **Batch size pequeno (8)**: Com 582 exemplos e batch 8, são ~73 steps por epoch
|
| 124 |
+
3. **Inputs longos**: O Menu JSON embutido aumenta o tempo de processamento
|
| 125 |
+
4. **Modelo T5**: T5-small é relativamente pesado para CPU
|
| 126 |
+
|
| 127 |
+
### Soluções Imediatas:
|
| 128 |
+
|
| 129 |
+
1. **Instalar CUDA** (se tiver GPU NVIDIA):
|
| 130 |
+
```bash
|
| 131 |
+
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
|
| 132 |
+
```
|
| 133 |
+
|
| 134 |
+
2. **Aumentar batch_size** (se tiver RAM):
|
| 135 |
+
```okt
|
| 136 |
+
TRAIN {
|
| 137 |
+
epochs: 3
|
| 138 |
+
batch_size: 16 # Dobrar o batch_size
|
| 139 |
+
logging_steps: 5 # Logs mais frequentes
|
| 140 |
+
}
|
| 141 |
+
```
|
| 142 |
+
|
| 143 |
+
3. **Usar context_fields** (recomendado):
|
| 144 |
+
```okt
|
| 145 |
+
DATASET {
|
| 146 |
+
train: "dataset/train.jsonl"
|
| 147 |
+
input_field: "input"
|
| 148 |
+
output_field: "target"
|
| 149 |
+
context_fields: ["menu"] # Move Menu para contexto
|
| 150 |
+
}
|
| 151 |
+
```
|
| 152 |
+
|
| 153 |
+
E no dataset, separe o Menu:
|
| 154 |
+
```jsonl
|
| 155 |
+
{"input": "What pizzas do you have?", "target": "...", "menu": "{\"Margherita\":34,...}"}
|
| 156 |
+
```
|
| 157 |
+
|
| 158 |
+
4. **Reduzir epochs para testes**:
|
| 159 |
+
```okt
|
| 160 |
+
TRAIN {
|
| 161 |
+
epochs: 1 # Teste rápido
|
| 162 |
+
batch_size: 16
|
| 163 |
+
logging_steps: 5
|
| 164 |
+
}
|
| 165 |
+
```
|
| 166 |
+
|
| 167 |
+
## Tempo Esperado
|
| 168 |
+
|
| 169 |
+
### CPU (seu caso atual):
|
| 170 |
+
- **582 exemplos, batch 8, 3 epochs**: ~30-60 minutos
|
| 171 |
+
- **Com batch 16**: ~15-30 minutos
|
| 172 |
+
|
| 173 |
+
### GPU (com CUDA):
|
| 174 |
+
- **582 exemplos, batch 8, 3 epochs**: ~3-5 minutos
|
| 175 |
+
- **Com batch 16**: ~2-3 minutos
|
| 176 |
+
|
| 177 |
+
## Exemplo Otimizado
|
| 178 |
+
|
| 179 |
+
```okt
|
| 180 |
+
# okto_version: "1.2"
|
| 181 |
+
PROJECT "pizzaria_optimized"
|
| 182 |
+
|
| 183 |
+
ENV {
|
| 184 |
+
accelerator: "gpu"
|
| 185 |
+
precision: "fp16"
|
| 186 |
+
backend: "oktoseek"
|
| 187 |
+
}
|
| 188 |
+
|
| 189 |
+
DATASET {
|
| 190 |
+
train: "dataset/train.jsonl"
|
| 191 |
+
validation: "dataset/val.jsonl"
|
| 192 |
+
input_field: "input"
|
| 193 |
+
output_field: "target"
|
| 194 |
+
context_fields: ["menu"] # Menu separado como contexto
|
| 195 |
+
}
|
| 196 |
+
|
| 197 |
+
MODEL {
|
| 198 |
+
base: "t5-small"
|
| 199 |
+
device: "cuda"
|
| 200 |
+
}
|
| 201 |
+
|
| 202 |
+
TRAIN {
|
| 203 |
+
epochs: 3
|
| 204 |
+
batch_size: 16 # Aumentado
|
| 205 |
+
learning_rate: 0.0001
|
| 206 |
+
logging_steps: 5 # Logs mais frequentes
|
| 207 |
+
save_steps: 50 # Salva checkpoints mais frequentemente
|
| 208 |
+
}
|
| 209 |
+
|
| 210 |
+
EXPORT {
|
| 211 |
+
format: ["okm"]
|
| 212 |
+
path: "export/"
|
| 213 |
+
}
|
| 214 |
+
```
|
| 215 |
+
|
| 216 |
+
---
|
| 217 |
+
|
| 218 |
+
**Última atualização**: 2024
|
| 219 |
+
|
| 220 |
+
|
| 221 |
+
|
| 222 |
+
|
docs/grammar.md
CHANGED
|
@@ -349,6 +349,8 @@ When OktoEngine encounters an ENV block, it must:
|
|
| 349 |
[<dataset_percent>]
|
| 350 |
[<dataset_sampling>]
|
| 351 |
[<dataset_shuffle>]
|
|
|
|
|
|
|
| 352 |
"}"
|
| 353 |
|
| 354 |
<dataset_train> ::=
|
|
@@ -389,6 +391,15 @@ When OktoEngine encounters an ENV block, it must:
|
|
| 389 |
|
| 390 |
<dataset_shuffle> ::=
|
| 391 |
"shuffle" ":" ("true" | "false")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 392 |
```
|
| 393 |
|
| 394 |
**Allowed augmentation values:**
|
|
@@ -434,6 +445,51 @@ DATASET {
|
|
| 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
|
|
@@ -686,6 +742,8 @@ FT_LORA {
|
|
| 686 |
[<gradient_clip>]
|
| 687 |
[<warmup_steps>]
|
| 688 |
[<save_strategy>]
|
|
|
|
|
|
|
| 689 |
"}"
|
| 690 |
|
| 691 |
<train_epochs> ::=
|
|
@@ -735,6 +793,12 @@ FT_LORA {
|
|
| 735 |
|
| 736 |
<save_strategy> ::=
|
| 737 |
"save_strategy" ":" ("steps" | "epoch" | "no")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 738 |
```
|
| 739 |
|
| 740 |
**Allowed values and constraints:**
|
|
@@ -792,6 +856,8 @@ TRAIN {
|
|
| 792 |
gradient_clip: 1.0
|
| 793 |
warmup_steps: 500
|
| 794 |
save_strategy: "steps"
|
|
|
|
|
|
|
| 795 |
}
|
| 796 |
```
|
| 797 |
|
|
@@ -2563,8 +2629,18 @@ See [`../examples/`](../examples/) for complete working examples:
|
|
| 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
|
|
|
|
| 349 |
[<dataset_percent>]
|
| 350 |
[<dataset_sampling>]
|
| 351 |
[<dataset_shuffle>]
|
| 352 |
+
[<dataset_input_field>]
|
| 353 |
+
[<dataset_output_field>]
|
| 354 |
"}"
|
| 355 |
|
| 356 |
<dataset_train> ::=
|
|
|
|
| 391 |
|
| 392 |
<dataset_shuffle> ::=
|
| 393 |
"shuffle" ":" ("true" | "false")
|
| 394 |
+
|
| 395 |
+
<dataset_input_field> ::=
|
| 396 |
+
"input_field" ":" <string>
|
| 397 |
+
|
| 398 |
+
<dataset_output_field> ::=
|
| 399 |
+
("output_field" | "target_field") ":" <string>
|
| 400 |
+
|
| 401 |
+
<dataset_context_fields> ::=
|
| 402 |
+
"context_fields" ":" "[" <string_list> "]"
|
| 403 |
```
|
| 404 |
|
| 405 |
**Allowed augmentation values:**
|
|
|
|
| 445 |
}
|
| 446 |
```
|
| 447 |
|
| 448 |
+
**Example (v1.2 - Custom Field Names):**
|
| 449 |
+
```okt
|
| 450 |
+
DATASET {
|
| 451 |
+
train: "dataset/train.jsonl"
|
| 452 |
+
validation: "dataset/val.jsonl"
|
| 453 |
+
format: "jsonl"
|
| 454 |
+
type: "chat"
|
| 455 |
+
input_field: "input"
|
| 456 |
+
output_field: "target"
|
| 457 |
+
}
|
| 458 |
+
```
|
| 459 |
+
|
| 460 |
+
**Example (v1.2 - With Context Fields):**
|
| 461 |
+
```okt
|
| 462 |
+
DATASET {
|
| 463 |
+
train: "dataset/pizzaria.jsonl"
|
| 464 |
+
validation: "dataset/val.jsonl"
|
| 465 |
+
format: "jsonl"
|
| 466 |
+
type: "chat"
|
| 467 |
+
input_field: "input"
|
| 468 |
+
output_field: "target"
|
| 469 |
+
context_fields: ["menu", "drinks", "promotions"]
|
| 470 |
+
}
|
| 471 |
+
```
|
| 472 |
+
|
| 473 |
+
**Dataset JSONL with context:**
|
| 474 |
+
```jsonl
|
| 475 |
+
{"input": "What pizzas do you have?", "target": "We have Margherita, Pepperoni, and Four Cheese.", "menu": "Margherita: $34, Pepperoni: $39, Four Cheese: $45", "drinks": "Coke, Sprite, Water"}
|
| 476 |
+
{"input": "Do you have drinks?", "target": "Yes, we have Coke, Sprite, and Water.", "menu": "Margherita: $34, Pepperoni: $39", "drinks": "Coke, Sprite, Water"}
|
| 477 |
+
```
|
| 478 |
+
|
| 479 |
+
The context fields will be automatically included in the prompt:
|
| 480 |
+
- Input: `menu: Margherita: $34, Pepperoni: $39 | drinks: Coke, Sprite, Water | What pizzas do you have?`
|
| 481 |
+
- Target: `We have Margherita, Pepperoni, and Four Cheese.`
|
| 482 |
+
|
| 483 |
+
**Field Name Resolution (v1.2+):**
|
| 484 |
+
- If `input_field` and `output_field` are specified, use those exact field names
|
| 485 |
+
- If not specified, defaults are tried in order:
|
| 486 |
+
1. `"input"` + `"output"` (standard format)
|
| 487 |
+
2. `"input"` + `"target"` (common alternative)
|
| 488 |
+
3. `"text"` (single field, used for both input and output)
|
| 489 |
+
4. First string field in dataset (fallback)
|
| 490 |
+
- `context_fields` are optional and will be included in the prompt if present
|
| 491 |
+
- This ensures backward compatibility while allowing full customization
|
| 492 |
+
|
| 493 |
**Dataset Mixing Rules:**
|
| 494 |
- If `mix_datasets` is specified, it overrides `train`
|
| 495 |
- Total weights in `mix_datasets` must equal 100
|
|
|
|
| 742 |
[<gradient_clip>]
|
| 743 |
[<warmup_steps>]
|
| 744 |
[<save_strategy>]
|
| 745 |
+
[<logging_steps>]
|
| 746 |
+
[<save_steps>]
|
| 747 |
"}"
|
| 748 |
|
| 749 |
<train_epochs> ::=
|
|
|
|
| 793 |
|
| 794 |
<save_strategy> ::=
|
| 795 |
"save_strategy" ":" ("steps" | "epoch" | "no")
|
| 796 |
+
|
| 797 |
+
<logging_steps> ::=
|
| 798 |
+
"logging_steps" ":" <number>
|
| 799 |
+
|
| 800 |
+
<save_steps> ::=
|
| 801 |
+
"save_steps" ":" <number>
|
| 802 |
```
|
| 803 |
|
| 804 |
**Allowed values and constraints:**
|
|
|
|
| 856 |
gradient_clip: 1.0
|
| 857 |
warmup_steps: 500
|
| 858 |
save_strategy: "steps"
|
| 859 |
+
logging_steps: 5 # Log every 5 steps (default: 10)
|
| 860 |
+
save_steps: 500 # Save checkpoint every 500 steps (default: 500)
|
| 861 |
}
|
| 862 |
```
|
| 863 |
|
|
|
|
| 2629 |
|
| 2630 |
**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.
|
| 2631 |
|
| 2632 |
+
### 🌐 OktoScript Web Editor
|
| 2633 |
+
|
| 2634 |
+
Try OktoScript online with the **OktoScript Web Editor** at [https://oktoseek.com/editor.php](https://oktoseek.com/editor.php). The editor features:
|
| 2635 |
+
|
| 2636 |
+
- **Smart Autocomplete** – Context-aware suggestions based on the current block
|
| 2637 |
+
- **Real-time Syntax Validation** – Detects errors like nested blocks and missing braces
|
| 2638 |
+
- **CLI Integration** – Use `okto web` command to open files directly
|
| 2639 |
+
- **Auto-save to Local** – Saves back to the same location when you load a file
|
| 2640 |
+
|
| 2641 |
For more information, visit:
|
| 2642 |
- **Official website:** https://www.oktoseek.com
|
| 2643 |
+
- **Web Editor:** https://oktoseek.com/editor.php
|
| 2644 |
- **GitHub:** https://github.com/oktoseek/oktoscript
|
| 2645 |
- **Hugging Face:** https://huggingface.co/OktoSeek
|
| 2646 |
- **Twitter:** https://x.com/oktoseek
|
examples/MODEL_NAMES.md
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Modelos Válidos no HuggingFace
|
| 2 |
+
|
| 3 |
+
## Modelos T5
|
| 4 |
+
|
| 5 |
+
| Nome no HuggingFace | Tamanho | Descrição |
|
| 6 |
+
|---------------------|---------|-----------|
|
| 7 |
+
| `t5-small` | 60M | T5 pequeno - rápido para testes |
|
| 8 |
+
| `t5-base` | 220M | T5 base - bom equilíbrio |
|
| 9 |
+
| `t5-large` | 770M | T5 grande - melhor qualidade |
|
| 10 |
+
| `google/flan-t5-small` | 60M | Flan-T5 pequeno |
|
| 11 |
+
| `google/flan-t5-base` | 220M | Flan-T5 base |
|
| 12 |
+
| `google/flan-t5-large` | 780M | Flan-T5 grande |
|
| 13 |
+
|
| 14 |
+
## Modelos GPT (Causal LM)
|
| 15 |
+
|
| 16 |
+
| Nome no HuggingFace | Tamanho | Descrição |
|
| 17 |
+
|---------------------|---------|-----------|
|
| 18 |
+
| `gpt2` | 124M | GPT-2 padrão |
|
| 19 |
+
| `distilgpt2` | 82M | GPT-2 destilado - mais rápido |
|
| 20 |
+
| `microsoft/DialoGPT-small` | 117M | DialoGPT pequeno |
|
| 21 |
+
| `EleutherAI/gpt-neo-125M` | 125M | GPT-Neo pequeno |
|
| 22 |
+
| `facebook/opt-125m` | 125M | OPT pequeno |
|
| 23 |
+
|
| 24 |
+
## ⚠️ Erro Comum
|
| 25 |
+
|
| 26 |
+
**❌ ERRADO:**
|
| 27 |
+
```okt
|
| 28 |
+
MODEL {
|
| 29 |
+
base: "google/t5-small" # ❌ Não existe!
|
| 30 |
+
}
|
| 31 |
+
```
|
| 32 |
+
|
| 33 |
+
**✅ CORRETO:**
|
| 34 |
+
```okt
|
| 35 |
+
MODEL {
|
| 36 |
+
base: "t5-small" # ✅ Correto!
|
| 37 |
+
}
|
| 38 |
+
```
|
| 39 |
+
|
| 40 |
+
## Como Verificar se um Modelo Existe
|
| 41 |
+
|
| 42 |
+
1. Acesse: https://huggingface.co/models
|
| 43 |
+
2. Busque pelo nome do modelo
|
| 44 |
+
3. Verifique o nome exato na URL ou na página do modelo
|
| 45 |
+
|
| 46 |
+
## Exemplos de Uso
|
| 47 |
+
|
| 48 |
+
### T5 para Tradução/Sumarização
|
| 49 |
+
```okt
|
| 50 |
+
MODEL {
|
| 51 |
+
base: "t5-small"
|
| 52 |
+
}
|
| 53 |
+
```
|
| 54 |
+
|
| 55 |
+
### Flan-T5 para Chat/Instruções
|
| 56 |
+
```okt
|
| 57 |
+
MODEL {
|
| 58 |
+
base: "google/flan-t5-base"
|
| 59 |
+
}
|
| 60 |
+
```
|
| 61 |
+
|
| 62 |
+
### GPT-2 para Geração de Texto
|
| 63 |
+
```okt
|
| 64 |
+
MODEL {
|
| 65 |
+
base: "gpt2"
|
| 66 |
+
}
|
| 67 |
+
```
|
| 68 |
+
|
| 69 |
+
|
| 70 |
+
|
| 71 |
+
|
examples/QUICK_FIX.md
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# 🔧 Correção Rápida - Erro de Parsing
|
| 2 |
+
|
| 3 |
+
## Problema: "Failed to parse file"
|
| 4 |
+
|
| 5 |
+
### Solução Rápida:
|
| 6 |
+
|
| 7 |
+
1. **Use o comando validate primeiro para ver o erro detalhado:**
|
| 8 |
+
```bash
|
| 9 |
+
okto validate scripts/train.okt
|
| 10 |
+
```
|
| 11 |
+
|
| 12 |
+
2. **Verifique o encoding do arquivo:**
|
| 13 |
+
- No VSCode: veja no canto inferior direito → deve mostrar "UTF-8"
|
| 14 |
+
- Se não for UTF-8, clique e selecione "Save with Encoding" → "UTF-8"
|
| 15 |
+
|
| 16 |
+
3. **Copie um arquivo de exemplo limpo:**
|
| 17 |
+
```bash
|
| 18 |
+
# Copie o exemplo limpo
|
| 19 |
+
cp oktoscript/examples/test-t5-basic-clean.okt scripts/train.okt
|
| 20 |
+
```
|
| 21 |
+
|
| 22 |
+
4. **Ou crie manualmente com este conteúdo mínimo:**
|
| 23 |
+
|
| 24 |
+
```okt
|
| 25 |
+
# okto_version: "1.2"
|
| 26 |
+
|
| 27 |
+
PROJECT "test_t5_basic"
|
| 28 |
+
|
| 29 |
+
ENV {
|
| 30 |
+
accelerator: "gpu"
|
| 31 |
+
min_memory: "4GB"
|
| 32 |
+
install_missing: true
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
DATASET {
|
| 36 |
+
train: "dataset/train.jsonl"
|
| 37 |
+
validation: "dataset/val.jsonl"
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
MODEL {
|
| 41 |
+
base: "google/t5-small"
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
TRAIN {
|
| 45 |
+
epochs: 3
|
| 46 |
+
batch_size: 8
|
| 47 |
+
learning_rate: 0.0001
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
EXPORT {
|
| 51 |
+
format: ["okm"]
|
| 52 |
+
path: "export/"
|
| 53 |
+
}
|
| 54 |
+
```
|
| 55 |
+
|
| 56 |
+
### ⚠️ Problemas Comuns:
|
| 57 |
+
|
| 58 |
+
1. **Bloco de Notas do Windows** adiciona BOM (Byte Order Mark)
|
| 59 |
+
- **Solução:** Use VSCode ou Notepad++
|
| 60 |
+
|
| 61 |
+
2. **Caracteres especiais** em comentários ou strings
|
| 62 |
+
- **Solução:** Use apenas ASCII ou UTF-8 válido
|
| 63 |
+
|
| 64 |
+
3. **Aspas curvas** `"` ou `"` ao invés de retas `"`
|
| 65 |
+
- **Solução:** Use sempre aspas retas
|
| 66 |
+
|
| 67 |
+
4. **Espaços invisíveis** ou caracteres de controle
|
| 68 |
+
- **Solução:** Re-digite o arquivo ou use um editor que mostre caracteres invisíveis
|
| 69 |
+
|
| 70 |
+
### ✅ Teste Rápido:
|
| 71 |
+
|
| 72 |
+
```bash
|
| 73 |
+
# 1. Validar
|
| 74 |
+
okto validate scripts/train.okt
|
| 75 |
+
|
| 76 |
+
# 2. Se validar, treinar
|
| 77 |
+
okto train scripts/train.okt
|
| 78 |
+
```
|
| 79 |
+
|
| 80 |
+
|
| 81 |
+
|
| 82 |
+
|
examples/README.md
CHANGED
|
@@ -38,6 +38,23 @@ These examples are used by:
|
|
| 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 |
|
|
|
|
| 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 |
+
### 🧪 Test Scripts (Recommended for Testing)
|
| 42 |
+
|
| 43 |
+
These scripts are specifically designed for testing different features of OktoScript v1.2:
|
| 44 |
+
|
| 45 |
+
| File | Description | Features Tested |
|
| 46 |
+
|------|-------------|-----------------|
|
| 47 |
+
| [`test-t5-basic.okt`](./test-t5-basic.okt) | Basic training | PROJECT, ENV, DATASET, MODEL, TRAIN, EXPORT |
|
| 48 |
+
| [`test-t5-monitor.okt`](./test-t5-monitor.okt) | Training with MONITOR | Full metrics tracking, notifications |
|
| 49 |
+
| [`test-t5-control.okt`](./test-t5-control.okt) | Training with CONTROL | Automatic decisions, IF/WHEN/EVERY |
|
| 50 |
+
| [`test-flan-t5-complete.okt`](./test-flan-t5-complete.okt) | All advanced blocks | MONITOR, CONTROL, STABILITY together |
|
| 51 |
+
| [`test-flan-t5-inference.okt`](./test-flan-t5-inference.okt) | Inference with governance | BEHAVIOR, GUARD, INFERENCE blocks |
|
| 52 |
+
| [`test-t5-explorer.okt`](./test-t5-explorer.okt) | AutoML with EXPLORER | Hyperparameter search, best model selection |
|
| 53 |
+
|
| 54 |
+
📖 **See [`TESTING_GUIDE.md`](./TESTING_GUIDE.md) for detailed testing instructions.**
|
| 55 |
+
|
| 56 |
+
---
|
| 57 |
+
|
| 58 |
### v1.2 Examples (Advanced Features)
|
| 59 |
|
| 60 |
| File | Description | Use Case |
|
examples/TESTING_GUIDE.md
ADDED
|
@@ -0,0 +1,227 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Guia de Testes - OktoScript v1.2
|
| 2 |
+
|
| 3 |
+
Este guia lista todos os scripts de teste disponíveis e como usá-los para validar diferentes funcionalidades do OktoScript.
|
| 4 |
+
|
| 5 |
+
## 📋 Scripts de Teste Disponíveis
|
| 6 |
+
|
| 7 |
+
### 1. `test-t5-basic.okt` - Treinamento Básico
|
| 8 |
+
**Objetivo:** Testar treinamento simples sem blocos avançados
|
| 9 |
+
|
| 10 |
+
**Modelo:** `google/t5-small`
|
| 11 |
+
|
| 12 |
+
**Blocos usados:**
|
| 13 |
+
- PROJECT
|
| 14 |
+
- ENV
|
| 15 |
+
- DATASET
|
| 16 |
+
- MODEL
|
| 17 |
+
- TRAIN
|
| 18 |
+
- EXPORT
|
| 19 |
+
|
| 20 |
+
**Como testar:**
|
| 21 |
+
```bash
|
| 22 |
+
okto validate examples/test-t5-basic.okt
|
| 23 |
+
okto train examples/test-t5-basic.okt
|
| 24 |
+
```
|
| 25 |
+
|
| 26 |
+
**O que verificar:**
|
| 27 |
+
- ✅ Treinamento inicia sem erros
|
| 28 |
+
- ✅ Modelo é salvo em `runs/test_t5_basic/`
|
| 29 |
+
- ✅ Export funciona para `okm` e `safetensors`
|
| 30 |
+
|
| 31 |
+
---
|
| 32 |
+
|
| 33 |
+
### 2. `test-t5-monitor.okt` - Monitoramento de Métricas
|
| 34 |
+
**Objetivo:** Testar bloco MONITOR com tracking completo
|
| 35 |
+
|
| 36 |
+
**Modelo:** `google/t5-small`
|
| 37 |
+
|
| 38 |
+
**Blocos usados:**
|
| 39 |
+
- MONITOR (completo)
|
| 40 |
+
- Métricas: loss, val_loss, accuracy, perplexity, gpu_usage, ram_usage, throughput, latency
|
| 41 |
+
|
| 42 |
+
**Como testar:**
|
| 43 |
+
```bash
|
| 44 |
+
okto validate examples/test-t5-monitor.okt
|
| 45 |
+
okto train examples/test-t5-monitor.okt
|
| 46 |
+
okto logs test_t5_monitor
|
| 47 |
+
```
|
| 48 |
+
|
| 49 |
+
**O que verificar:**
|
| 50 |
+
- ✅ Métricas são coletadas durante treinamento
|
| 51 |
+
- ✅ Arquivo `logs/training_monitor.log` é criado
|
| 52 |
+
- ✅ Notificações são geradas quando condições são atendidas
|
| 53 |
+
|
| 54 |
+
---
|
| 55 |
+
|
| 56 |
+
### 3. `test-t5-control.okt` - Controle e Decisões
|
| 57 |
+
**Objetivo:** Testar bloco CONTROL com lógica condicional
|
| 58 |
+
|
| 59 |
+
**Modelo:** `google/t5-small`
|
| 60 |
+
|
| 61 |
+
**Blocos usados:**
|
| 62 |
+
- CONTROL (completo)
|
| 63 |
+
- Eventos: on_step_end, on_epoch_end
|
| 64 |
+
- Diretivas: IF, WHEN, EVERY, SET, STOP_TRAINING, DECREASE, SAVE, LOG
|
| 65 |
+
|
| 66 |
+
**Como testar:**
|
| 67 |
+
```bash
|
| 68 |
+
okto validate examples/test-t5-control.okt
|
| 69 |
+
okto train examples/test-t5-control.okt
|
| 70 |
+
okto logs test_t5_control
|
| 71 |
+
```
|
| 72 |
+
|
| 73 |
+
**O que verificar:**
|
| 74 |
+
- ✅ Logs são gerados em cada step/epoch
|
| 75 |
+
- ✅ Learning rate é ajustado automaticamente quando loss > 2.0
|
| 76 |
+
- ✅ Treinamento para quando val_loss > 2.5
|
| 77 |
+
- ✅ Checkpoints são salvos a cada 500 steps
|
| 78 |
+
- ✅ Arquivo `control_decisions.json` é criado em `runs/test_t5_control/`
|
| 79 |
+
|
| 80 |
+
---
|
| 81 |
+
|
| 82 |
+
### 4. `test-flan-t5-complete.okt` - Todos os Blocos
|
| 83 |
+
**Objetivo:** Testar todos os blocos avançados juntos
|
| 84 |
+
|
| 85 |
+
**Modelo:** `google/flan-t5-base`
|
| 86 |
+
|
| 87 |
+
**Blocos usados:**
|
| 88 |
+
- MONITOR (completo)
|
| 89 |
+
- CONTROL (completo com lógica aninhada)
|
| 90 |
+
- STABILITY
|
| 91 |
+
- EXPORT
|
| 92 |
+
|
| 93 |
+
**Como testar:**
|
| 94 |
+
```bash
|
| 95 |
+
okto validate examples/test-flan-t5-complete.okt
|
| 96 |
+
okto train examples/test-flan-t5-complete.okt
|
| 97 |
+
okto logs test_flan_t5_complete
|
| 98 |
+
```
|
| 99 |
+
|
| 100 |
+
**O que verificar:**
|
| 101 |
+
- ✅ Todos os blocos funcionam juntos
|
| 102 |
+
- ✅ Lógica aninhada no CONTROL funciona (IF dentro de on_epoch_end)
|
| 103 |
+
- ✅ STABILITY previne NaN e divergência
|
| 104 |
+
- ✅ Métricas completas são coletadas
|
| 105 |
+
|
| 106 |
+
---
|
| 107 |
+
|
| 108 |
+
### 5. `test-flan-t5-inference.okt` - Inferência com Governança
|
| 109 |
+
**Objetivo:** Testar inferência com BEHAVIOR, GUARD e INFERENCE
|
| 110 |
+
|
| 111 |
+
**Modelo:** `google/flan-t5-base`
|
| 112 |
+
|
| 113 |
+
**Blocos usados:**
|
| 114 |
+
- BEHAVIOR (personality, language, avoid)
|
| 115 |
+
- GUARD (prevent, detect_using, on_violation)
|
| 116 |
+
- INFERENCE (mode, format, params, CONTROL aninhado)
|
| 117 |
+
|
| 118 |
+
**Como testar:**
|
| 119 |
+
```bash
|
| 120 |
+
# Treinar primeiro
|
| 121 |
+
okto train examples/test-flan-t5-inference.okt
|
| 122 |
+
|
| 123 |
+
# Testar inferência
|
| 124 |
+
okto infer --model export/test_flan_t5_inference --text "Olá, como você está?"
|
| 125 |
+
|
| 126 |
+
# Testar chat interativo
|
| 127 |
+
okto chat --model export/test_flan_t5_inference
|
| 128 |
+
```
|
| 129 |
+
|
| 130 |
+
**O que verificar:**
|
| 131 |
+
- ✅ Modelo respeita BEHAVIOR (personality, language)
|
| 132 |
+
- ✅ GUARD bloqueia conteúdo tóxico/inadequado
|
| 133 |
+
- ✅ INFERENCE usa formato correto
|
| 134 |
+
- ✅ CONTROL dentro de INFERENCE funciona (RETRY, REGENERATE)
|
| 135 |
+
|
| 136 |
+
---
|
| 137 |
+
|
| 138 |
+
### 6. `test-t5-explorer.okt` - AutoML Básico
|
| 139 |
+
**Objetivo:** Testar bloco EXPLORER para busca de hiperparâmetros
|
| 140 |
+
|
| 141 |
+
**Modelo:** `google/t5-small`
|
| 142 |
+
|
| 143 |
+
**Blocos usados:**
|
| 144 |
+
- EXPLORER (try, max_tests, pick_best_by)
|
| 145 |
+
- MONITOR
|
| 146 |
+
|
| 147 |
+
**Como testar:**
|
| 148 |
+
```bash
|
| 149 |
+
okto validate examples/test-t5-explorer.okt
|
| 150 |
+
okto train examples/test-t5-explorer.okt
|
| 151 |
+
```
|
| 152 |
+
|
| 153 |
+
**O que verificar:**
|
| 154 |
+
- ✅ Múltiplas combinações de hiperparâmetros são testadas
|
| 155 |
+
- ✅ Melhor modelo é selecionado por val_loss
|
| 156 |
+
- ✅ Logs mostram resultados de cada teste
|
| 157 |
+
|
| 158 |
+
---
|
| 159 |
+
|
| 160 |
+
## 🧪 Sequência Recomendada de Testes
|
| 161 |
+
|
| 162 |
+
### Fase 1: Testes Básicos
|
| 163 |
+
1. `test-t5-basic.okt` - Validar pipeline básico
|
| 164 |
+
2. `test-t5-monitor.okt` - Validar monitoramento
|
| 165 |
+
|
| 166 |
+
### Fase 2: Testes de Controle
|
| 167 |
+
3. `test-t5-control.okt` - Validar decisões automáticas
|
| 168 |
+
4. `test-flan-t5-complete.okt` - Validar integração completa
|
| 169 |
+
|
| 170 |
+
### Fase 3: Testes Avançados
|
| 171 |
+
5. `test-flan-t5-inference.okt` - Validar inferência governada
|
| 172 |
+
6. `test-t5-explorer.okt` - Validar AutoML
|
| 173 |
+
|
| 174 |
+
---
|
| 175 |
+
|
| 176 |
+
## 📊 Checklist de Validação
|
| 177 |
+
|
| 178 |
+
Para cada teste, verifique:
|
| 179 |
+
|
| 180 |
+
- [ ] Script valida sem erros (`okto validate`)
|
| 181 |
+
- [ ] Treinamento inicia corretamente
|
| 182 |
+
- [ ] Blocos específicos funcionam como esperado
|
| 183 |
+
- [ ] Logs são gerados corretamente
|
| 184 |
+
- [ ] Export funciona para formato especificado
|
| 185 |
+
- [ ] Arquivos são salvos nos locais corretos
|
| 186 |
+
|
| 187 |
+
---
|
| 188 |
+
|
| 189 |
+
## 🔍 Comandos Úteis
|
| 190 |
+
|
| 191 |
+
```bash
|
| 192 |
+
# Validar script
|
| 193 |
+
okto validate examples/test-t5-basic.okt
|
| 194 |
+
|
| 195 |
+
# Treinar
|
| 196 |
+
okto train examples/test-t5-basic.okt
|
| 197 |
+
|
| 198 |
+
# Ver logs
|
| 199 |
+
okto logs test_t5_basic
|
| 200 |
+
|
| 201 |
+
# Inferência
|
| 202 |
+
okto infer --model export/test_t5_basic --text "Hello"
|
| 203 |
+
|
| 204 |
+
# Chat interativo
|
| 205 |
+
okto chat --model export/test_t5_basic
|
| 206 |
+
|
| 207 |
+
# Ver conteúdo do script
|
| 208 |
+
okto show examples/test-t5-basic.okt
|
| 209 |
+
```
|
| 210 |
+
|
| 211 |
+
---
|
| 212 |
+
|
| 213 |
+
## 📝 Notas
|
| 214 |
+
|
| 215 |
+
- Todos os testes usam `dataset/train.jsonl` e `dataset/val.jsonl`
|
| 216 |
+
- Certifique-se de ter dados de teste antes de executar
|
| 217 |
+
- Modelos T5 são menores e mais rápidos para testes
|
| 218 |
+
- Modelos Flan-T5 são melhores para inferência e chat
|
| 219 |
+
- Ajuste `batch_size` e `epochs` conforme sua GPU
|
| 220 |
+
|
| 221 |
+
---
|
| 222 |
+
|
| 223 |
+
**Boa sorte com os testes! 🚀**
|
| 224 |
+
|
| 225 |
+
|
| 226 |
+
|
| 227 |
+
|
examples/TROUBLESHOOTING.md
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Troubleshooting - Problemas Comuns
|
| 2 |
+
|
| 3 |
+
## Erro: "Failed to parse file"
|
| 4 |
+
|
| 5 |
+
### Possíveis Causas:
|
| 6 |
+
|
| 7 |
+
1. **Encoding do arquivo**
|
| 8 |
+
- O arquivo deve estar em **UTF-8 sem BOM**
|
| 9 |
+
- Evite salvar no Bloco de Notas do Windows (pode adicionar BOM)
|
| 10 |
+
- Use VSCode, Notepad++, ou outro editor que suporte UTF-8
|
| 11 |
+
|
| 12 |
+
2. **Caracteres invisíveis**
|
| 13 |
+
- Copiar/colar pode adicionar caracteres invisíveis
|
| 14 |
+
- Re-digite o arquivo ou use um editor que mostre caracteres invisíveis
|
| 15 |
+
|
| 16 |
+
3. **Problemas com comentários**
|
| 17 |
+
- Comentários devem começar com `#` no início da linha
|
| 18 |
+
- Evite caracteres especiais em comentários
|
| 19 |
+
|
| 20 |
+
4. **Aspas incorretas**
|
| 21 |
+
- Use aspas retas `"` não aspas curvas `"` ou `"`
|
| 22 |
+
- Verifique se todas as aspas estão fechadas
|
| 23 |
+
|
| 24 |
+
### Soluções:
|
| 25 |
+
|
| 26 |
+
#### 1. Validar o arquivo primeiro:
|
| 27 |
+
```bash
|
| 28 |
+
okto validate scripts/train.okt
|
| 29 |
+
```
|
| 30 |
+
|
| 31 |
+
Isso mostrará erros detalhados.
|
| 32 |
+
|
| 33 |
+
#### 2. Verificar encoding no VSCode:
|
| 34 |
+
- Abra o arquivo no VSCode
|
| 35 |
+
- Veja no canto inferior direito: deve mostrar "UTF-8"
|
| 36 |
+
- Se mostrar outro encoding, clique e selecione "Save with Encoding" → "UTF-8"
|
| 37 |
+
|
| 38 |
+
#### 3. Criar arquivo limpo:
|
| 39 |
+
```bash
|
| 40 |
+
# Copie o conteúdo do exemplo
|
| 41 |
+
cp oktoscript/examples/test-t5-basic.okt scripts/train.okt
|
| 42 |
+
|
| 43 |
+
# Ou crie manualmente
|
| 44 |
+
```
|
| 45 |
+
|
| 46 |
+
#### 4. Verificar sintaxe básica:
|
| 47 |
+
- Todas as strings devem estar entre aspas: `"valor"`
|
| 48 |
+
- Arrays devem usar colchetes: `["okm", "safetensors"]`
|
| 49 |
+
- Blocos devem ter chaves: `{ ... }`
|
| 50 |
+
- Não use vírgulas no final de arrays ou objetos
|
| 51 |
+
|
| 52 |
+
### Exemplo de arquivo correto:
|
| 53 |
+
|
| 54 |
+
```okt
|
| 55 |
+
# okto_version: "1.2"
|
| 56 |
+
|
| 57 |
+
PROJECT "test_t5_basic"
|
| 58 |
+
DESCRIPTION "Teste basico"
|
| 59 |
+
|
| 60 |
+
ENV {
|
| 61 |
+
accelerator: "gpu"
|
| 62 |
+
min_memory: "4GB"
|
| 63 |
+
install_missing: true
|
| 64 |
+
}
|
| 65 |
+
|
| 66 |
+
DATASET {
|
| 67 |
+
train: "dataset/train.jsonl"
|
| 68 |
+
validation: "dataset/val.jsonl"
|
| 69 |
+
}
|
| 70 |
+
|
| 71 |
+
MODEL {
|
| 72 |
+
base: "google/t5-small"
|
| 73 |
+
}
|
| 74 |
+
|
| 75 |
+
TRAIN {
|
| 76 |
+
epochs: 3
|
| 77 |
+
batch_size: 8
|
| 78 |
+
learning_rate: 0.0001
|
| 79 |
+
}
|
| 80 |
+
|
| 81 |
+
EXPORT {
|
| 82 |
+
format: ["okm"]
|
| 83 |
+
path: "export/"
|
| 84 |
+
}
|
| 85 |
+
```
|
| 86 |
+
|
| 87 |
+
### Checklist:
|
| 88 |
+
|
| 89 |
+
- [ ] Arquivo está em UTF-8
|
| 90 |
+
- [ ] Todas as aspas estão fechadas
|
| 91 |
+
- [ ] Não há caracteres especiais invisíveis
|
| 92 |
+
- [ ] Sintaxe está correta (chaves, colchetes, etc.)
|
| 93 |
+
- [ ] `okto validate` passa sem erros
|
| 94 |
+
|
| 95 |
+
### Se ainda não funcionar:
|
| 96 |
+
|
| 97 |
+
1. Execute com `--debug` (se disponível):
|
| 98 |
+
```bash
|
| 99 |
+
okto validate scripts/train.okt --debug
|
| 100 |
+
```
|
| 101 |
+
|
| 102 |
+
2. Verifique o conteúdo do arquivo:
|
| 103 |
+
```bash
|
| 104 |
+
okto show scripts/train.okt
|
| 105 |
+
```
|
| 106 |
+
|
| 107 |
+
3. Compare com um exemplo que funciona:
|
| 108 |
+
```bash
|
| 109 |
+
okto validate oktoscript/examples/test-t5-basic.okt
|
| 110 |
+
```
|
| 111 |
+
|
| 112 |
+
|
| 113 |
+
|
| 114 |
+
|
examples/pizzabot/okt.yaml
CHANGED
|
@@ -10,7 +10,7 @@ structure:
|
|
| 10 |
export_dir: "export/"
|
| 11 |
|
| 12 |
default_language: "en"
|
| 13 |
-
license: "
|
| 14 |
|
| 15 |
|
| 16 |
|
|
|
|
| 10 |
export_dir: "export/"
|
| 11 |
|
| 12 |
default_language: "en"
|
| 13 |
+
license: "OktoScript License 1.0"
|
| 14 |
|
| 15 |
|
| 16 |
|
examples/test-flan-t5-complete.okt
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# okto_version: "1.2"
|
| 2 |
+
|
| 3 |
+
# Teste 4: Flan-T5 Completo - Todos os Blocos
|
| 4 |
+
# Modelo: google/flan-t5-base
|
| 5 |
+
# Objetivo: Testar todos os blocos avançados juntos
|
| 6 |
+
|
| 7 |
+
PROJECT "test_flan_t5_complete"
|
| 8 |
+
DESCRIPTION "Teste completo Flan-T5 com todos os blocos v1.2"
|
| 9 |
+
|
| 10 |
+
ENV {
|
| 11 |
+
accelerator: "gpu"
|
| 12 |
+
min_memory: "8GB"
|
| 13 |
+
precision: "fp16"
|
| 14 |
+
backend: "oktoseek"
|
| 15 |
+
install_missing: true
|
| 16 |
+
}
|
| 17 |
+
|
| 18 |
+
DATASET {
|
| 19 |
+
train: "dataset/train.jsonl"
|
| 20 |
+
validation: "dataset/val.jsonl"
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
MODEL {
|
| 24 |
+
base: "google/flan-t5-base"
|
| 25 |
+
device: "auto"
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
TRAIN {
|
| 29 |
+
epochs: 5
|
| 30 |
+
batch_size: 16
|
| 31 |
+
learning_rate: 0.0001
|
| 32 |
+
device: "auto"
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
MONITOR {
|
| 36 |
+
metrics: [
|
| 37 |
+
"loss",
|
| 38 |
+
"val_loss",
|
| 39 |
+
"accuracy",
|
| 40 |
+
"perplexity",
|
| 41 |
+
"gpu_usage",
|
| 42 |
+
"ram_usage",
|
| 43 |
+
"throughput",
|
| 44 |
+
"latency",
|
| 45 |
+
"confidence"
|
| 46 |
+
]
|
| 47 |
+
notify_if {
|
| 48 |
+
loss > 2.0
|
| 49 |
+
val_loss > 2.5
|
| 50 |
+
gpu_usage > 90%
|
| 51 |
+
ram_usage > 80%
|
| 52 |
+
}
|
| 53 |
+
log_to: "logs/training_complete.log"
|
| 54 |
+
}
|
| 55 |
+
|
| 56 |
+
CONTROL {
|
| 57 |
+
on_step_end {
|
| 58 |
+
LOG loss
|
| 59 |
+
}
|
| 60 |
+
|
| 61 |
+
on_epoch_end {
|
| 62 |
+
SAVE model
|
| 63 |
+
LOG "Epoch completed"
|
| 64 |
+
|
| 65 |
+
IF loss > 1.5 {
|
| 66 |
+
SET LR = 0.00005
|
| 67 |
+
LOG "Loss still high after epoch - reducing LR"
|
| 68 |
+
}
|
| 69 |
+
|
| 70 |
+
IF accuracy > 0.9 {
|
| 71 |
+
SAVE "best_model"
|
| 72 |
+
LOG "High accuracy reached - saving best model"
|
| 73 |
+
}
|
| 74 |
+
}
|
| 75 |
+
|
| 76 |
+
validate_every: 200
|
| 77 |
+
|
| 78 |
+
IF loss > 2.0 {
|
| 79 |
+
SET LR = 0.00005
|
| 80 |
+
LOG "High loss detected"
|
| 81 |
+
}
|
| 82 |
+
|
| 83 |
+
IF val_loss > 2.5 {
|
| 84 |
+
STOP_TRAINING
|
| 85 |
+
LOG "Validation loss too high"
|
| 86 |
+
}
|
| 87 |
+
|
| 88 |
+
WHEN gpu_memory < 12GB {
|
| 89 |
+
SET batch_size = 8
|
| 90 |
+
LOG "Reducing batch size due to GPU pressure"
|
| 91 |
+
}
|
| 92 |
+
|
| 93 |
+
EVERY 1000 steps {
|
| 94 |
+
SAVE checkpoint
|
| 95 |
+
LOG "Periodic checkpoint"
|
| 96 |
+
}
|
| 97 |
+
}
|
| 98 |
+
|
| 99 |
+
STABILITY {
|
| 100 |
+
stop_if_nan: true
|
| 101 |
+
stop_if_diverges: true
|
| 102 |
+
min_improvement: 0.001
|
| 103 |
+
}
|
| 104 |
+
|
| 105 |
+
EXPORT {
|
| 106 |
+
format: ["okm", "safetensors"]
|
| 107 |
+
path: "export/"
|
| 108 |
+
}
|
| 109 |
+
|
| 110 |
+
|
| 111 |
+
|
| 112 |
+
|
examples/test-flan-t5-inference.okt
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# okto_version: "1.2"
|
| 2 |
+
|
| 3 |
+
# Teste 5: Flan-T5 com INFERENCE e BEHAVIOR
|
| 4 |
+
# Modelo: google/flan-t5-base
|
| 5 |
+
# Objetivo: Testar inferência com controle de comportamento
|
| 6 |
+
|
| 7 |
+
PROJECT "test_flan_t5_inference"
|
| 8 |
+
DESCRIPTION "Teste Flan-T5 com INFERENCE, BEHAVIOR e GUARD"
|
| 9 |
+
|
| 10 |
+
ENV {
|
| 11 |
+
accelerator: "gpu"
|
| 12 |
+
min_memory: "8GB"
|
| 13 |
+
precision: "fp16"
|
| 14 |
+
backend: "oktoseek"
|
| 15 |
+
install_missing: true
|
| 16 |
+
}
|
| 17 |
+
|
| 18 |
+
DATASET {
|
| 19 |
+
train: "dataset/train.jsonl"
|
| 20 |
+
validation: "dataset/val.jsonl"
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
MODEL {
|
| 24 |
+
base: "google/flan-t5-base"
|
| 25 |
+
device: "auto"
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
TRAIN {
|
| 29 |
+
epochs: 3
|
| 30 |
+
batch_size: 16
|
| 31 |
+
learning_rate: 0.0001
|
| 32 |
+
device: "auto"
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
BEHAVIOR {
|
| 36 |
+
mode: "chat"
|
| 37 |
+
personality: "friendly"
|
| 38 |
+
verbosity: "medium"
|
| 39 |
+
language: "pt-BR"
|
| 40 |
+
avoid: ["violence", "hate", "politics"]
|
| 41 |
+
fallback: "Como posso ajudar?"
|
| 42 |
+
prompt_style: "User: {input}\nAssistant:"
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
GUARD {
|
| 46 |
+
prevent {
|
| 47 |
+
hallucination
|
| 48 |
+
toxicity
|
| 49 |
+
bias
|
| 50 |
+
data_leak
|
| 51 |
+
}
|
| 52 |
+
detect_using: ["classifier", "regex", "rule_engine"]
|
| 53 |
+
on_violation {
|
| 54 |
+
REPLACE with_message: "Desculpe, essa solicitação não é permitida."
|
| 55 |
+
}
|
| 56 |
+
}
|
| 57 |
+
|
| 58 |
+
INFERENCE {
|
| 59 |
+
mode: "chat"
|
| 60 |
+
format: "User: {input}\nAssistant:"
|
| 61 |
+
exit_command: "/exit"
|
| 62 |
+
params {
|
| 63 |
+
max_length: 120
|
| 64 |
+
temperature: 0.7
|
| 65 |
+
top_p: 0.9
|
| 66 |
+
beams: 2
|
| 67 |
+
do_sample: true
|
| 68 |
+
}
|
| 69 |
+
CONTROL {
|
| 70 |
+
IF confidence < 0.3 {
|
| 71 |
+
RETRY
|
| 72 |
+
LOG "Low confidence - retrying"
|
| 73 |
+
}
|
| 74 |
+
|
| 75 |
+
IF repetition > 3 {
|
| 76 |
+
REGENERATE
|
| 77 |
+
LOG "High repetition detected - regenerating"
|
| 78 |
+
}
|
| 79 |
+
}
|
| 80 |
+
}
|
| 81 |
+
|
| 82 |
+
MONITOR {
|
| 83 |
+
metrics: ["loss", "val_loss", "accuracy", "confidence"]
|
| 84 |
+
log_to: "logs/inference_test.log"
|
| 85 |
+
}
|
| 86 |
+
|
| 87 |
+
EXPORT {
|
| 88 |
+
format: ["okm"]
|
| 89 |
+
path: "export/"
|
| 90 |
+
}
|
| 91 |
+
|
| 92 |
+
|
| 93 |
+
|
| 94 |
+
|
examples/test-pizzaria-context.okt
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# okto_version: "1.2"
|
| 2 |
+
PROJECT "pizzaria_chatbot"
|
| 3 |
+
DESCRIPTION "Chatbot de pizzaria com campos de contexto (menu, drinks, etc.)"
|
| 4 |
+
|
| 5 |
+
ENV {
|
| 6 |
+
accelerator: "gpu"
|
| 7 |
+
min_memory: "4GB"
|
| 8 |
+
precision: "fp16"
|
| 9 |
+
backend: "oktoseek"
|
| 10 |
+
install_missing: true
|
| 11 |
+
}
|
| 12 |
+
|
| 13 |
+
DATASET {
|
| 14 |
+
train: "dataset/train.jsonl"
|
| 15 |
+
validation: "dataset/val.jsonl"
|
| 16 |
+
format: "jsonl"
|
| 17 |
+
type: "chat"
|
| 18 |
+
|
| 19 |
+
# Campos principais
|
| 20 |
+
input_field: "input"
|
| 21 |
+
output_field: "target"
|
| 22 |
+
|
| 23 |
+
# Campos de contexto que serão incluídos automaticamente no prompt
|
| 24 |
+
context_fields: ["menu", "drinks", "promotions"]
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
MODEL {
|
| 28 |
+
base: "t5-small"
|
| 29 |
+
device: "auto"
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
TRAIN {
|
| 33 |
+
epochs: 3
|
| 34 |
+
batch_size: 8
|
| 35 |
+
learning_rate: 0.0001
|
| 36 |
+
device: "auto"
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
EXPORT {
|
| 40 |
+
format: ["okm", "safetensors"]
|
| 41 |
+
path: "export/"
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
|
examples/test-t5-basic-clean.okt
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# okto_version: "1.2"
|
| 2 |
+
|
| 3 |
+
PROJECT "test_t5_basic"
|
| 4 |
+
DESCRIPTION "Teste basico com T5-small - sem blocos avancados"
|
| 5 |
+
|
| 6 |
+
ENV {
|
| 7 |
+
accelerator: "gpu"
|
| 8 |
+
min_memory: "4GB"
|
| 9 |
+
precision: "fp16"
|
| 10 |
+
backend: "oktoseek"
|
| 11 |
+
install_missing: true
|
| 12 |
+
}
|
| 13 |
+
|
| 14 |
+
DATASET {
|
| 15 |
+
train: "dataset/train.jsonl"
|
| 16 |
+
validation: "dataset/val.jsonl"
|
| 17 |
+
}
|
| 18 |
+
|
| 19 |
+
MODEL {
|
| 20 |
+
base: "google/t5-small"
|
| 21 |
+
device: "auto"
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
TRAIN {
|
| 25 |
+
epochs: 3
|
| 26 |
+
batch_size: 8
|
| 27 |
+
learning_rate: 0.0001
|
| 28 |
+
device: "auto"
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
EXPORT {
|
| 32 |
+
format: ["okm", "safetensors"]
|
| 33 |
+
path: "export/"
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
|
examples/test-t5-basic.okt
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# okto_version: "1.2"
|
| 2 |
+
|
| 3 |
+
# Teste 1: T5 Básico - Treinamento Simples
|
| 4 |
+
# Modelo: google/t5-small
|
| 5 |
+
# Objetivo: Testar treinamento básico sem blocos avançados
|
| 6 |
+
|
| 7 |
+
PROJECT "test_t5_basic"
|
| 8 |
+
DESCRIPTION "Teste básico com T5-small - sem blocos avançados"
|
| 9 |
+
|
| 10 |
+
ENV {
|
| 11 |
+
accelerator: "gpu"
|
| 12 |
+
min_memory: "4GB"
|
| 13 |
+
precision: "fp16"
|
| 14 |
+
backend: "oktoseek"
|
| 15 |
+
install_missing: true
|
| 16 |
+
}
|
| 17 |
+
|
| 18 |
+
DATASET {
|
| 19 |
+
train: "dataset/train.jsonl"
|
| 20 |
+
validation: "dataset/val.jsonl"
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
MODEL {
|
| 24 |
+
base: "t5-small"
|
| 25 |
+
device: "auto"
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
TRAIN {
|
| 29 |
+
epochs: 3
|
| 30 |
+
batch_size: 8
|
| 31 |
+
learning_rate: 0.0001
|
| 32 |
+
device: "auto"
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
EXPORT {
|
| 36 |
+
format: ["okm", "safetensors"]
|
| 37 |
+
path: "export/"
|
| 38 |
+
}
|
| 39 |
+
|
examples/test-t5-control.okt
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# okto_version: "1.2"
|
| 2 |
+
|
| 3 |
+
# Teste 3: T5 com CONTROL - Decisões Automáticas
|
| 4 |
+
# Modelo: google/t5-small
|
| 5 |
+
# Objetivo: Testar bloco CONTROL com lógica condicional
|
| 6 |
+
|
| 7 |
+
PROJECT "test_t5_control"
|
| 8 |
+
DESCRIPTION "Teste T5 com bloco CONTROL - decisões automáticas durante treino"
|
| 9 |
+
|
| 10 |
+
ENV {
|
| 11 |
+
accelerator: "gpu"
|
| 12 |
+
min_memory: "4GB"
|
| 13 |
+
precision: "fp16"
|
| 14 |
+
backend: "oktoseek"
|
| 15 |
+
install_missing: true
|
| 16 |
+
}
|
| 17 |
+
|
| 18 |
+
DATASET {
|
| 19 |
+
train: "dataset/train.jsonl"
|
| 20 |
+
validation: "dataset/val.jsonl"
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
MODEL {
|
| 24 |
+
base: "t5-small"
|
| 25 |
+
device: "auto"
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
TRAIN {
|
| 29 |
+
epochs: 5
|
| 30 |
+
batch_size: 8
|
| 31 |
+
learning_rate: 0.0001
|
| 32 |
+
device: "auto"
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
CONTROL {
|
| 36 |
+
on_step_end {
|
| 37 |
+
LOG loss
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
on_epoch_end {
|
| 41 |
+
SAVE model
|
| 42 |
+
LOG "Epoch completed"
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
validate_every: 100
|
| 46 |
+
|
| 47 |
+
IF loss > 2.0 {
|
| 48 |
+
SET LR = 0.00005
|
| 49 |
+
LOG "High loss detected - reducing learning rate"
|
| 50 |
+
}
|
| 51 |
+
|
| 52 |
+
IF val_loss > 2.5 {
|
| 53 |
+
STOP_TRAINING
|
| 54 |
+
LOG "Validation loss too high - stopping training"
|
| 55 |
+
}
|
| 56 |
+
|
| 57 |
+
IF accuracy < 0.4 {
|
| 58 |
+
DECREASE LR BY 0.5
|
| 59 |
+
LOG "Low accuracy - decreasing learning rate by 50%"
|
| 60 |
+
}
|
| 61 |
+
|
| 62 |
+
WHEN gpu_memory < 8GB {
|
| 63 |
+
SET batch_size = 4
|
| 64 |
+
LOG "Low GPU memory - reducing batch size"
|
| 65 |
+
}
|
| 66 |
+
|
| 67 |
+
EVERY 500 steps {
|
| 68 |
+
SAVE checkpoint
|
| 69 |
+
LOG "Checkpoint saved"
|
| 70 |
+
}
|
| 71 |
+
}
|
| 72 |
+
|
| 73 |
+
EXPORT {
|
| 74 |
+
format: ["okm"]
|
| 75 |
+
path: "export/"
|
| 76 |
+
}
|
| 77 |
+
|
examples/test-t5-custom-fields.okt
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# okto_version: "1.2"
|
| 2 |
+
PROJECT "test_t5_custom_fields"
|
| 3 |
+
DESCRIPTION "Exemplo usando campos customizados no dataset (input_field e output_field)"
|
| 4 |
+
|
| 5 |
+
ENV {
|
| 6 |
+
accelerator: "gpu"
|
| 7 |
+
min_memory: "4GB"
|
| 8 |
+
precision: "fp16"
|
| 9 |
+
backend: "oktoseek"
|
| 10 |
+
install_missing: true
|
| 11 |
+
}
|
| 12 |
+
|
| 13 |
+
DATASET {
|
| 14 |
+
train: "dataset/train.jsonl"
|
| 15 |
+
validation: "dataset/val.jsonl"
|
| 16 |
+
format: "jsonl"
|
| 17 |
+
type: "chat"
|
| 18 |
+
# Campos customizados: define quais colunas usar do dataset
|
| 19 |
+
input_field: "input"
|
| 20 |
+
output_field: "target"
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
MODEL {
|
| 24 |
+
base: "t5-small"
|
| 25 |
+
device: "auto"
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
TRAIN {
|
| 29 |
+
epochs: 3
|
| 30 |
+
batch_size: 8
|
| 31 |
+
learning_rate: 0.0001
|
| 32 |
+
device: "auto"
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
EXPORT {
|
| 36 |
+
format: ["okm", "safetensors"]
|
| 37 |
+
path: "export/"
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
|
examples/test-t5-explorer.okt
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# okto_version: "1.2"
|
| 2 |
+
|
| 3 |
+
# Teste 6: T5 com EXPLORER - AutoML Básico
|
| 4 |
+
# Modelo: google/t5-small
|
| 5 |
+
# Objetivo: Testar bloco EXPLORER para busca de hiperparâmetros
|
| 6 |
+
|
| 7 |
+
PROJECT "test_t5_explorer"
|
| 8 |
+
DESCRIPTION "Teste T5 com EXPLORER - busca automática de hiperparâmetros"
|
| 9 |
+
|
| 10 |
+
ENV {
|
| 11 |
+
accelerator: "gpu"
|
| 12 |
+
min_memory: "4GB"
|
| 13 |
+
precision: "fp16"
|
| 14 |
+
backend: "oktoseek"
|
| 15 |
+
install_missing: true
|
| 16 |
+
}
|
| 17 |
+
|
| 18 |
+
DATASET {
|
| 19 |
+
train: "dataset/train.jsonl"
|
| 20 |
+
validation: "dataset/val.jsonl"
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
MODEL {
|
| 24 |
+
base: "t5-small"
|
| 25 |
+
device: "auto"
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
TRAIN {
|
| 29 |
+
epochs: 3
|
| 30 |
+
batch_size: 8
|
| 31 |
+
learning_rate: 0.0001
|
| 32 |
+
device: "auto"
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
EXPLORER {
|
| 36 |
+
try {
|
| 37 |
+
lr: [0.001, 0.0005, 0.0001]
|
| 38 |
+
batch_size: [4, 8, 16]
|
| 39 |
+
optimizer: ["adamw", "sgd"]
|
| 40 |
+
}
|
| 41 |
+
max_tests: 5
|
| 42 |
+
pick_best_by: "val_loss"
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
MONITOR {
|
| 46 |
+
metrics: ["loss", "val_loss", "accuracy"]
|
| 47 |
+
log_to: "logs/explorer_test.log"
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
EXPORT {
|
| 51 |
+
format: ["okm"]
|
| 52 |
+
path: "export/"
|
| 53 |
+
}
|
| 54 |
+
|
examples/test-t5-monitor.okt
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# okto_version: "1.2"
|
| 2 |
+
|
| 3 |
+
# Teste 2: T5 com MONITOR - Métricas Completas
|
| 4 |
+
# Modelo: google/t5-small
|
| 5 |
+
# Objetivo: Testar bloco MONITOR com tracking de métricas
|
| 6 |
+
|
| 7 |
+
PROJECT "test_t5_monitor"
|
| 8 |
+
DESCRIPTION "Teste T5 com bloco MONITOR - tracking completo de métricas"
|
| 9 |
+
|
| 10 |
+
ENV {
|
| 11 |
+
accelerator: "gpu"
|
| 12 |
+
min_memory: "4GB"
|
| 13 |
+
precision: "fp16"
|
| 14 |
+
backend: "oktoseek"
|
| 15 |
+
install_missing: true
|
| 16 |
+
}
|
| 17 |
+
|
| 18 |
+
DATASET {
|
| 19 |
+
train: "dataset/train.jsonl"
|
| 20 |
+
validation: "dataset/val.jsonl"
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
MODEL {
|
| 24 |
+
base: "t5-small"
|
| 25 |
+
device: "auto"
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
TRAIN {
|
| 29 |
+
epochs: 5
|
| 30 |
+
batch_size: 8
|
| 31 |
+
learning_rate: 0.0001
|
| 32 |
+
device: "auto"
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
MONITOR {
|
| 36 |
+
metrics: [
|
| 37 |
+
"loss",
|
| 38 |
+
"val_loss",
|
| 39 |
+
"accuracy",
|
| 40 |
+
"perplexity",
|
| 41 |
+
"gpu_usage",
|
| 42 |
+
"ram_usage",
|
| 43 |
+
"throughput",
|
| 44 |
+
"latency"
|
| 45 |
+
]
|
| 46 |
+
notify_if {
|
| 47 |
+
loss > 2.0
|
| 48 |
+
val_loss > 2.5
|
| 49 |
+
gpu_usage > 90%
|
| 50 |
+
}
|
| 51 |
+
log_to: "logs/training_monitor.log"
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
EXPORT {
|
| 55 |
+
format: ["okm"]
|
| 56 |
+
path: "export/"
|
| 57 |
+
}
|
| 58 |
+
|