← TinyGPT · docs · devlog · roadmap · speedup
source: docs/recipes/mlx-export.md · view on GitHub ↗

MLX Export

Use tinygpt export-mlx when a TinyGPT-trained artifact needs to leave the TinyGPT binary and be loaded from Python MLX, MLX-Swift, or another Mac-local tool.

Full distilled or trained checkpoints:

tinygpt export-mlx path/to/model.tinygpt --out exported-model
python exported-model/mlx_load.py exported-model

Fine-tuned adapters:

tinygpt export-mlx path/to/adapter.lora --out exported-adapter
python exported-adapter/mlx_load.py exported-adapter

The command writes standard safetensors containers plus sidecars:

TinyGPT-native byte-level checkpoints are not marked as mlx-lm compatible. Their tensors are MLX-loadable, but a caller still needs a TinyGPT-aware module class to run a forward pass. HF / MLX model directories copied through export-mlx remain mlx-lm compatible when their original architecture is supported by mlx-lm.

Specialist packages

For trained modules that should be shared or routed in an app, pair the MLX export with a specialist package under specialists/<id>/:

The first package is specialists/qwen3-4b-file-ops-distilled: a real fused Qwen3-4B file-ops specialist stored at ~/.cache/tinygpt/models/mt4b_fused.