Skip to content

Instantly share code, notes, and snippets.

@patharanordev
Last active July 26, 2026 15:58
Show Gist options
  • Select an option

  • Save patharanordev/ef9a699ed0daf2355928f831ace1219d to your computer and use it in GitHub Desktop.

Select an option

Save patharanordev/ef9a699ed0daf2355928f831ace1219d to your computer and use it in GitHub Desktop.
reuse model in gguf format from ollama to llama.cpp
MODEL="qwen2.5"
PARAMS="7b"
# Get the manifest path and extract the digest for the 'model' layer
# Then print the final blob path
MODEL_PATH=$(find ~/.ollama/models/manifests -name "${MODEL//:/_}" | head -n 1)
DIGEST=$(jq -r '.layers[] | select(.mediaType == "application/vnd.ollama.image.model") | .digest' "$MODEL_PATH/$PARAMS")
BLOB_PATH="$HOME/.ollama/models/blobs/${DIGEST/:/-}"
echo "Model path: $MODEL_PATH"
echo "Blob Path: $BLOB_PATH"
NEW_MODEL_PATH="$HOME/.cache/huggingface/hub/models--custom--$MODEL-$PARAMS/snapshots"
mkdir -p "$NEW_MODEL_PATH"
ln -s $BLOB_PATH "$NEW_MODEL_PATH/$MODEL-$PARAMS.gguf"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment