Main CLI entry point.
flattune [OPTIONS] COMMAND [ARGS]...| Option | Description |
|---|---|
--version |
Show version |
--help |
Show help |
| Command | Description |
|---|---|
build |
Extract data and generate dataset with intelligent planning |
train |
Train a model using the dataset |
merge |
Merge LoRA adapter with base model |
export |
Export model to target format (GGUF/MLX/HF) |
benchmark |
Benchmark the model |
report |
Generate training and benchmark report |
run |
Run the full pipeline |
teach |
Knowledge & Skill Compiler (teach framework) |
Extract data and generate dataset with intelligent planning.
flattune build CONFIG_FILE [OPTIONS]Options:
| Option | Description |
|---|---|
-y, --yes |
Skip interactive approval, use suggested types |
--source TEXT |
Source file/directory (overrides config) |
-t, --types TEXT |
Dataset types to generate (can specify multiple) |
Examples:
# Non-interactive (auto-accept suggested types)
flattune build configs/earthquake-qa.yml --yes
# Explicit dataset types
flattune build configs/earthquake-qa.yml --types facts --types context_qa
# Interactive mode
flattune build configs/earthquake-qa.ymlTrain a model using the dataset.
flattune train CONFIG_FILEExample:
flattune train configs/my_project.ymlMerge LoRA adapter with base model.
flattune merge CONFIG_FILEExample:
flattune merge configs/my_project.ymlExport model to target format (GGUF/MLX/HF).
flattune export CONFIG_FILEExample:
flattune export configs/my_project.ymlBenchmark the model using LM Studio, Ollama, or Transformers.
flattune benchmark CONFIG_FILEExample:
flattune benchmark configs/my_project.ymlGenerate training and benchmark report.
flattune report CONFIG_FILEExample:
flattune report configs/my_project.ymlRun the full pipeline: extract → generate → train → merge → export → benchmark → report.
flattune run CONFIG_FILEExample:
flattune run configs/my_project.ymlThe teach command group provides the Knowledge & Skill Compiler functionality.
flattune teach [OPTIONS] COMMAND [ARGS]...Teach from documents (Markdown, TXT, PDF, HTML, CSV, JSON, FlatSeek).
flattune teach knowledge SOURCES... [OPTIONS]Options:
| Option | Description |
|---|---|
--distill |
Use template-based generation (no LLM) |
--teacher {openai,anthropic,ollama} |
LLM teacher for generation |
--model TEXT |
Teacher model name (default: gpt-4o-mini) |
--output, -o FILE |
Output file |
--sample-types, -s TEXT |
Sample types to generate |
--max-samples N |
Maximum samples to generate |
Examples:
# Distill mode (no LLM required)
flattune teach knowledge ./docs/*.md --distill -o dataset.jsonl
# With OpenAI teacher
flattune teach knowledge ./docs/*.md --teacher openai -o dataset.jsonl
# With Ollama (local)
flattune teach knowledge ./docs/*.md --teacher ollama --model llama3.2 -o dataset.jsonlTeach from OpenAPI/Swagger specifications.
flattune teach openapi SPEC [OPTIONS]Options:
| Option | Description |
|---|---|
--distill |
Use template-based generation |
--teacher TEXT |
LLM teacher for generation |
--output, -o FILE |
Output file |
Example:
flattune teach openapi api.json --distill -o api_dataset.jsonlTeach from database schemas.
flattune teach database SCHEMA [OPTIONS]Options:
| Option | Description |
|---|---|
--distill |
Use template-based generation |
--teacher TEXT |
LLM teacher for generation |
--output, -o FILE |
Output file |
Example:
flattune teach database schema.sql --distill -o sql_dataset.jsonlTeach from software APIs and tools.
flattune teach software SOURCES... [OPTIONS]Options:
| Option | Description |
|---|---|
--distill |
Use template-based generation |
--teacher TEXT |
LLM teacher for generation |
--sample-types, -s TEXT |
Sample types to generate |
Teach from MCP server definitions.
flattune teach mcp SERVER [OPTIONS]Options:
| Option | Description |
|---|---|
--distill |
Use template-based generation |
--teacher TEXT |
LLM teacher for generation |
--output, -o FILE |
Output file |
List available parsers.
flattune teach list-parsersList available teacher models.
flattune teach list-teachersList available generators.
flattune teach list-generatorsmake help # Show help
make install # Install dependencies (pip install -e .)
make build # Extract + generate dataset
make train # Train model
make merge # Merge LoRA
make export # Export model
make benchmark # Run benchmarks
make report # Generate report
make run # Full pipeline
make test # Run pytest
make lint # Run ruff linter
make clean # Clean outputs# Documents → dataset (no LLM)
flattune teach knowledge ./docs/*.md --distill -o dataset.jsonl
# OpenAPI → tool-calling dataset
flattune teach openapi api.json --distill -o api_dataset.jsonl
# SQL schema → NL-to-SQL dataset
flattune teach database schema.sql --distill -o sql_dataset.jsonl
# With LLM teacher
flattune teach knowledge ./docs/*.md --teacher openai -o dataset.jsonl# Non-interactive with auto-detection
flattune build configs/earthquake-qa.yml --yes
# Explicit types
flattune build configs/earthquake-qa.yml --types facts --types context_qa
# Interactive planning
flattune build configs/earthquake-qa.yml# Run full pipeline
flattune run configs/my_project.yml
# Or step by step
flattune build configs/my_project.yml
flattune train configs/my_project.yml
flattune merge configs/my_project.yml
flattune export configs/my_project.yml
flattune benchmark configs/my_project.yml
flattune report configs/my_project.yml