CLI tools to export and import Ollama models (.tar.gz)
Project description
Documentation — ollama-toolkit
ollama-toolkit is a Python CLI utility for exporting and importing Ollama models (.tar.gz) to streamline backups, sharing, or migration across machines.
Designed for developers, researchers, and ML teams looking to package and deploy local Ollama models with ease.
What’s It For?
- Backup a custom model locally with all its layers
- Transfer models to another environment without re-downloading
- Archive models for offline or long-term use
- Recreate a complete Ollama model from a
.tar.gzarchive
Key Features
- Export a model with all necessary files
- Generate a self-contained
.tar.gzarchive - Automatically recreate the model using
ollama create - Built-in progress bar via
tqdm - Compatible with any locally installed Ollama model
Installation
Requirements
- Python ≥ 3.7
- Ollama installed and accessible from your terminal
tqdm(installed automatically)
Install from PyPI or Source
Install via PyPI:
pip install ollama-panongbene
Or install from source:
git clone https://github.com/openDataSenegal/ollama_toolkit.git
cd ollama-toolkit
pip install .
Once installed, two global CLI commands are available:
ollama-export <model_name>
ollama-import <archive.tar.gz> <model_name>
CLI Commands
ollama-export
Exports an Ollama model to a .tar.gz archive including the Modelfile and all binary layers.
ollama-export <model_name> [-o OUTPUT] [-v]
Arguments
| Argument | Description |
|---|---|
model_name |
Name of the model to export (e.g., phi:latest) |
-o, --output |
Optional output filename for the archive (.tar.gz) |
-v, --verbose |
Enable detailed logs (e.g., Modelfile content, layers) |
Example
ollama-export llama3:instruct -o llama3_instruct.tar.gz -v
ollama-import
Imports a model from a .tar.gz archive and recreates it via ollama create.
ollama-import <archive.tar.gz> <model_name>
Arguments
| Argument | Description |
|---|---|
archive.tar.gz |
Path to the archive containing model files |
model_name |
Name to assign to the model (used during model creation) |
Example
ollama-import phi_latest.tar.gz phi:latest
Archive Structure
Each export archive includes:
phi_latest.tar.gz
├── Modelfile
├── layer0.bin
├── layer1.bin
├── ...
This structure allows full offline restoration.
Use Cases
- Seamless model transfers across machines or teams
- Use Ollama in offline or air-gapped environments
- Archive models for reproducibility and long-term access
- Avoid redundant large downloads
- Share custom
Modelfilesetups and binary layers
Can I Store Archives on External Drives or Git?
Yes — archives are fully portable. You can version them using Git LFS or store them on external media for future reuse.
Are Custom or Private Models Supported?
Absolutely.
As long as the model is installed locally in Ollama, you can export and re-import it — including custom layers and any Modelfile configuration.
Author
- Developed and maintained by Panongbene Sawadogo
- Contact: amet1900@gmail.com
License
MIT License — Free for commercial and educational use.
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 ollama_panongbene-0.1.0.tar.gz.
File metadata
- Download URL: ollama_panongbene-0.1.0.tar.gz
- Upload date:
- Size: 9.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0627013aa217215b04307330b2a4ac629aade3664d28898d43e61f1b81f83fc3
|
|
| MD5 |
20c732f1b85e05f51be39fee8f77d88c
|
|
| BLAKE2b-256 |
57121f1c5c91e61d0a2acc9ca748f9e9e5fcd18272684efaafdbe0178151eb6b
|
File details
Details for the file ollama_panongbene-0.1.0-py3-none-any.whl.
File metadata
- Download URL: ollama_panongbene-0.1.0-py3-none-any.whl
- Upload date:
- Size: 11.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
57c9e8868d44fa1a65a5ce2863760154ba90f0bf12bb0c95d2e133ab137d5b32
|
|
| MD5 |
c6dd3c15104e8178c0f6055813570899
|
|
| BLAKE2b-256 |
bc1c121734b94984269a6758e337cde3cfe3d7beedfa6d6ce50007ee6b9b9aa3
|