[PR #11161] Feature: Model Export and Import #44707

Open
opened 2026-04-25 00:20:36 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/11161
Author: @mikeroySoft
Created: 6/22/2025
Status: 🔄 Open

Base: mainHead: mikeroySoft/model-export-import


📝 Commits (6)

  • 92a6078 Feature/export import models (#1)
  • 45eb99c Removng streaming export for now
  • 40337e2 Improved import-export -- zstd compression, parallel export, better defaults
  • 5b440f8 typo in the ollama import example of the README
  • 8e0749e Cleanup and feature improvement. The feature now follows Ollama's established patterns. I also introduced a safety check to prevent data loss from accidental overwrites, and a --force flag to override.
  • 93c41bb Add comprehensive test suite and documentation for Export/Import feature

📊 Changes

16 files changed (+2591 additions, -2 deletions)

View changed files

📝 README.md (+44 -0)
📝 api/client.go (+38 -0)
📝 api/types.go (+19 -0)
📝 cmd/cmd.go (+175 -0)
cmd/cmd_export_import_test.go (+246 -0)
📝 go.mod (+1 -0)
📝 go.sum (+2 -2)
integration/export_import_test.go (+425 -0)
integration/export_import_utils.go (+173 -0)
server/export.go (+250 -0)
server/export_streaming.go (+236 -0)
server/export_test.go (+76 -0)
server/import.go (+387 -0)
server/import_test.go (+198 -0)
📝 server/routes.go (+83 -0)
server/routes_export_import_test.go (+238 -0)

📄 Description

Added Model Export and Import #features.

Finally had time to revisit this issue: https://github.com/ollama/ollama/issues/335

This feature allows users to easily backup and transfer models between Ollama installations via USB drives or network storage.

  • Added export command to copy models to file/directory
  • Added import command to load models from file/directory
  • Supports directory, tar, and tar.gz formats
  • Includes checksum verification and progress tracking
  • Added --compress flag for export (this is slow, but shaves off around 2% and creates a .tgz or .tar.gz file)
  • Added --force flag for import to override an existing model
  • Added /--insecure flags to skip verification during import

Usage

**Export **

ollama export MODEL DESTINATION [flags]

Flags:
--compress Compress the export as tar.gz or .tgz (slower, slightly smaller file size, single-file export)
-h, --help Help for export

Import
ollama import SOURCE [MODEL_NAME] [flags]

Flags:
--force Overwrite existing model
-h, --help Help for import
--insecure Skip checksum verification


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ollama/ollama/pull/11161 **Author:** [@mikeroySoft](https://github.com/mikeroySoft) **Created:** 6/22/2025 **Status:** 🔄 Open **Base:** `main` ← **Head:** `mikeroySoft/model-export-import` --- ### 📝 Commits (6) - [`92a6078`](https://github.com/ollama/ollama/commit/92a60787b91c7232bef1b98a59e94c504fafd223) Feature/export import models (#1) - [`45eb99c`](https://github.com/ollama/ollama/commit/45eb99c40103ff092759d9fdbb5eb8b07489d8e9) Removng streaming export for now - [`40337e2`](https://github.com/ollama/ollama/commit/40337e22c40f53efc4fb500f94c10469cf38faed) Improved import-export -- zstd compression, parallel export, better defaults - [`5b440f8`](https://github.com/ollama/ollama/commit/5b440f8d2ff104c2638a53c87f55c2d5a976c303) typo in the ollama import example of the README - [`8e0749e`](https://github.com/ollama/ollama/commit/8e0749e031d24a84abe67061283748670c4d8c1a) Cleanup and feature improvement. The feature now follows Ollama's established patterns. I also introduced a safety check to prevent data loss from accidental overwrites, and a --force flag to override. - [`93c41bb`](https://github.com/ollama/ollama/commit/93c41bb8ad62f4e5387fd3cca8e5cf69311e3156) Add comprehensive test suite and documentation for Export/Import feature ### 📊 Changes **16 files changed** (+2591 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `README.md` (+44 -0) 📝 `api/client.go` (+38 -0) 📝 `api/types.go` (+19 -0) 📝 `cmd/cmd.go` (+175 -0) ➕ `cmd/cmd_export_import_test.go` (+246 -0) 📝 `go.mod` (+1 -0) 📝 `go.sum` (+2 -2) ➕ `integration/export_import_test.go` (+425 -0) ➕ `integration/export_import_utils.go` (+173 -0) ➕ `server/export.go` (+250 -0) ➕ `server/export_streaming.go` (+236 -0) ➕ `server/export_test.go` (+76 -0) ➕ `server/import.go` (+387 -0) ➕ `server/import_test.go` (+198 -0) 📝 `server/routes.go` (+83 -0) ➕ `server/routes_export_import_test.go` (+238 -0) </details> ### 📄 Description **Added Model Export and Import #features.** Finally had time to revisit this issue: https://github.com/ollama/ollama/issues/335 This feature allows users to easily backup and transfer models between Ollama installations via USB drives or network storage. - Added `export` command to copy models to file/directory - Added `import` command to load models from file/directory - Supports directory, tar, and tar.gz formats - Includes checksum verification and progress tracking - Added --compress flag for export (this is slow, but shaves off around 2% and creates a .tgz or .tar.gz file) - Added --force flag for import to override an existing model - Added /--insecure flags to skip verification during import **Usage** **Export ** `ollama export MODEL DESTINATION [flags]` Flags: `--compress` Compress the export as tar.gz or .tgz (slower, slightly smaller file size, single-file export) `-h`, `--help` Help for export **Import** `ollama import SOURCE [MODEL_NAME] [flags]` Flags: `--force` Overwrite existing model `-h`, `--help` Help for import `--insecure` Skip checksum verification --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-25 00:20:36 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#44707