-
Notifications
You must be signed in to change notification settings - Fork 0
Script for the ollama export and import models
License
dheroefic/ollama-export-import-models
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
# Ollama Model Export/Import Tool A Python script for backing up and restoring Ollama models, including their templates, parameters, and system messages. ## Features - Export Ollama models with their configurations - Import previously exported models - Automatic detection of Ollama model directories on different platforms - Configuration persistence for backup locations ## Prerequisites - Python 3.x - Ollama installed and configured - Sufficient disk space for model backups ## Installation 1. Clone this repository or download the `ollama-export-import.py` script 2. Ensure you have Ollama installed and running ## Usage Run the script using Python: ```bash python ollama-export-import.py ``` ### First Run On first run, the script will: 1. Try to automatically detect your Ollama models directory 2. If not found, prompt you to enter the Ollama models directory 3. Ask for a backup directory location where models will be exported These settings are saved in `~/.ollama_backup_config.json` for future use. ### Exporting a Model 1. Run the script 2. View the list of available models 3. Enter the number corresponding to the model you want to export 4. The model will be exported to your configured backup directory ### Importing a Model 1. Run the script 2. Enter `0` when prompted for model selection 3. Enter the path to the previously exported model directory 4. The model will be imported into Ollama ## Backup Directory Structure For each exported model, the script creates: - A directory named after the model - A `ModelFile` containing the model's configuration - A `.gguf` file containing the model weights ## Supported Platforms - Linux - macOS - Windows ## Configuration The script stores its configuration in `~/.ollama_backup_config.json` with: - `ollama_folder`: Path to Ollama models directory - `backup_folder`: Path where models will be exported ## Error Handling - The script validates paths and model existence - Provides clear error messages for missing files or invalid selections - Creates backup directories if they don't exist
About
Script for the ollama export and import models
Resources
License
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published