mkOllamaModel: add diagnostics to help in packaging new models
This commit is contained in:
@@ -85,6 +85,32 @@ stdenv.mkDerivation {
|
|||||||
runHook postInstall
|
runHook postInstall
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
checkPhase = ''
|
||||||
|
runHook preCheck
|
||||||
|
|
||||||
|
# diagnostics for when packaging models: use the manifestBlob, systemBlob output here in your nix expression
|
||||||
|
echo "manifest:"
|
||||||
|
cat manifest
|
||||||
|
|
||||||
|
printBlob() {
|
||||||
|
local blobType="$1"
|
||||||
|
local blobHash=$(cat manifest | jq ".layers.[] | select(.mediaType == \"application/vnd.ollama.image.$blobType\") | .digest[7:]")
|
||||||
|
if [ -n "$blobHash" ]; then
|
||||||
|
printf " %sBlob = %s;\n" "$blobType" "$blobHash"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "blobs:"
|
||||||
|
printBlob model
|
||||||
|
printBlob params
|
||||||
|
printBlob system
|
||||||
|
printBlob ensureDoesntFailForNonExistentBlob
|
||||||
|
|
||||||
|
runHook postCheck
|
||||||
|
'';
|
||||||
|
|
||||||
|
doCheck = true;
|
||||||
|
|
||||||
env.blobDir = "share/ollama/models/blobs";
|
env.blobDir = "share/ollama/models/blobs";
|
||||||
env.manifestDir = "share/ollama/models/manifests/registry.ollama.ai/library/${modelName}";
|
env.manifestDir = "share/ollama/models/manifests/registry.ollama.ai/library/${modelName}";
|
||||||
env.variant = variant;
|
env.variant = variant;
|
||||||
|
Reference in New Issue
Block a user