Understanding How Ollama Stores Models
AI Summary
Olama Model Storage Summary
- Common Questions:
- Location of Olama model storage is confusing.
- Directory contents are unclear without the Olama Manifest.
- Platform Availability:
- Linux:
/user/share/olama/olama/models
- Mac:
/user/root/olama/models
- Windows support is in progress.
- Manifest Directory:
- Organized by registry, organization, then model.
- Currently, a single registry at
ol.
is available.- Official models are under the
Library
directory.- Model Directories:
- Example:
llama 2
model directory contains files for each tag pulled.- Manifest File Structure:
- Schema version is set to two, related to Docker, not Olama.
- Media type:
application/vnd.docker.distribution.manifest.v1+json
- Config and layers sections contain media type, digest, and size.
- Layers:
- First layer usually has the largest size and a unique SHA-256 digest.
- Digests serve as fingerprints and match file names in the
blobs
directory.- File Types:
- Model files are large and identified by SHA-256 digests.
- License files have their own media type and digest.
- Template files also have unique digests, shared across models.
- Model Management:
- Pulling a new model downloads the manifest and required blobs.
- Copying a model retains the same model digest.
- Creating a new model from an existing one uses the same digest.
- Deleting a model does not remove the blob if it’s still referenced.
- Blobs are reused across models to save space.
- Conclusion:
- Models are stored in specific directories based on the platform.
- Model names are not straightforward without referencing the manifest.
- Deleting models may not free up space if blobs are shared.
- The system maintains a single copy of each blob for efficiency.