Created
September 25, 2024 19:24
-
-
Save robert-mcdermott/3c3bc088972f3e1d5ecd4061be03741e to your computer and use it in GitHub Desktop.
Build GGUF model library from Ollama manifest
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
base_dir=~/.ollama/models | |
manifest_dir=$base_dir/manifests/registry.ollama.ai | |
blob_dir=$base_dir/blobs | |
publicmodels_dir=~/llm-models | |
find "$publicmodels_dir" -type l -exec rm {} + | |
mkdir -p "$publicmodels_dir" | |
find "$manifest_dir" -type f -mindepth 3 -maxdepth 3 | while IFS= read -r file; do | |
user=$(basename "$(dirname "$(dirname "$file")")" | sed 's/^registry\.ollama\.ai/ollama/') | |
model=$(basename "$(dirname "$file")") | |
tag=$(basename "$file") | |
digest=$(jq -r '.layers[] | select(.mediaType == "application/vnd.ollama.image.model") | .digest' "$file") | |
digest="${digest//:/-}" | |
mkdir -p "$publicmodels_dir/$user/$model/" | |
ln -s "$blob_dir/$digest" "$publicmodels_dir/$user/$model/$model-$tag.gguf" | |
echo "$user - $model:$tag" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment