The universal format converter and validator for LLM fine-tuning datasets
Project description
ftml
The missing ffmpeg for LLM fine-tuning data.
Convert, validate, and fix LLM training datasets between any format — alpaca, sharegpt, openai-chat, chatml, csv — with a single command.
Install
pip install ftml
Quick Start
# Convert alpaca to OpenAI format
ftml convert data.jsonl --from alpaca --to openai-chat
# Auto-detect format, fix issues, validate for OpenAI
ftml convert data.jsonl --to openai-chat --validate --fix --platform openai
# Validate a dataset
ftml validate data.jsonl --platform openai
# Auto-detect format
ftml detect data.jsonl
# View dataset stats
ftml stats data.jsonl
Supported Formats
| Format | Direction | Key Fields | Used By |
|---|---|---|---|
alpaca |
input/output | instruction, input, output |
Stanford Alpaca, Dolly |
sharegpt |
input/output | conversations[{from, value}] |
ShareGPT, FastChat, Vicuna |
openai-chat |
input/output | messages[{role, content}] |
OpenAI Fine-tuning API |
chatml |
input/output | <|im_start|>role\ncontent<|im_end|> |
ChatML, Qwen, Yi |
csv |
input only | instruction, input, output columns |
Spreadsheets, custom |
together |
output only | messages[{role, content}] |
Together AI API |
Platform Rules
| Platform | Accepted Formats | Min Examples | Max Tokens | Notes |
|---|---|---|---|---|
openai |
openai-chat | 10 | 16,384 | Requires user + assistant roles |
together |
openai-chat | 1 | 8,192 | System prompt optional |
axolotl |
alpaca, sharegpt, openai-chat | 1 | - | System prompt recommended |
unsloth |
alpaca, openai-chat | 1 | 4,096 (warn) | Default 4k context |
huggingface |
any | 1 | - | Validates JSONL + Unicode |
CLI Reference
ftml convert
ftml convert <input_file> [OPTIONS]
Options:
--from FORMAT Source format (auto-detect if omitted)
--to FORMAT Target format (default: openai-chat)
--output, -o PATH Output file path
--validate Validate after converting
--fix Auto-fix fixable issues
--platform PLATFORM Platform-specific validation
--token-model MODEL Tokenizer (default: cl100k_base)
--max-tokens INT Max tokens per example
--split FLOAT Train/eval split ratio (e.g., 0.9)
--quiet, -q Suppress rich output
--dry-run Parse and validate only
ftml validate
ftml validate <input_file> [OPTIONS]
Options:
--format FORMAT Declare format explicitly
--platform PLATFORM Platform-specific rules
--token-model MODEL Tokenizer model
--max-tokens INT Per-example token limit
--strict Treat warnings as errors
ftml detect
ftml detect <input_file>
ftml stats
ftml stats <input_file> [OPTIONS]
Options:
--format FORMAT Declare format explicitly
--token-model MODEL Tokenizer model
ftml formats
Prints a table of all supported formats and platform rules.
Contributing
Adding a New Format
- Create
ftml/formats/your_format.pywith aYourFormatReader(FormatReader)andYourFormatWriter(FormatWriter) - Register it in
ftml/formats/__init__.pyby adding entries to_READER_REGISTRYand_WRITER_REGISTRY - Add sample data in
tests/sample_data/and roundtrip tests intests/test_roundtrip.py
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ftml_cli-0.1.0.tar.gz.
File metadata
- Download URL: ftml_cli-0.1.0.tar.gz
- Upload date:
- Size: 25.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9ff51c2118783cd314984e75b948c0cb46dac4f86a9b5cb1281832384b494770
|
|
| MD5 |
8607a4a834d94b99d5609e7757f78ca8
|
|
| BLAKE2b-256 |
571bd094578b23a10fa3212f7b0664d5f82392d572f25c84fad3856020f6176a
|
File details
Details for the file ftml_cli-0.1.0-py3-none-any.whl.
File metadata
- Download URL: ftml_cli-0.1.0-py3-none-any.whl
- Upload date:
- Size: 26.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c25ddd472b5739919f17999eb17ccccd3ea79e64d3ff10970840b4aa49f92818
|
|
| MD5 |
a52ef4c7ad0366ac577f8d864e31a10b
|
|
| BLAKE2b-256 |
aed6bb34bdda78336940157b6358a7a2149cdf9da0040d5e730504de358a5450
|