Skip to main content

ftml

MIT License Python 3.10+

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

  1. Create ftml/formats/your_format.py with a YourFormatReader(FormatReader) and YourFormatWriter(FormatWriter)
  2. Register it in ftml/formats/__init__.py by adding entries to _READER_REGISTRY and _WRITER_REGISTRY
  3. Add sample data in tests/sample_data/ and roundtrip tests in tests/test_roundtrip.py

License

MIT

Metadata

Release files for ftml-cli 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ftml-cli 0.1.0
File Size Uploaded
ftml_cli-0.1.0.tar.gz 25.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ftml-cli 0.1.0
File Interpreter ABI Platform
ftml_cli-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 51.9 kB

Release files / ftml_cli-0.1.0.tar.gz

Download URL ftml_cli-0.1.0.tar.gz
Size 25.2 kB
Tags Source
SHA-256 checksum
How to use checksums
9ff51c2118783cd314984e75b948c0cb46dac4f86a9b5cb1281832384b494770
BLAKE2b-256 checksum
How to use checksums
571bd094578b23a10fa3212f7b0664d5f82392d572f25c84fad3856020f6176a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.13

Release files / ftml_cli-0.1.0-py3-none-any.whl

Download URL ftml_cli-0.1.0-py3-none-any.whl
Size 26.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c25ddd472b5739919f17999eb17ccccd3ea79e64d3ff10970840b4aa49f92818
BLAKE2b-256 checksum
How to use checksums
aed6bb34bdda78336940157b6358a7a2149cdf9da0040d5e730504de358a5450
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.13

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page