ollamaPackages.mistral: init
This commit is contained in:
12
pkgs/by-name/ollamaPackages/mistral.nix
Normal file
12
pkgs/by-name/ollamaPackages/mistral.nix
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
mkOllamaModel
|
||||
}:
|
||||
mkOllamaModel {
|
||||
modelName = "mistral";
|
||||
variant = "7b";
|
||||
manifestHash = "sha256-O45li3MlGdY+tk0vj3N5CS/RGoLGKE4KZZKiyAVEZC4=";
|
||||
modelBlob = "ff82381e2bea77d91c1b824c7afb83f6fb73e9f7de9dda631bcdbca564aa5435";
|
||||
modelBlobHash = "sha256-/4I4Hivqd9kcG4JMevuD9vtz6ffendpjG828pWSqVDU=";
|
||||
paramsBlob = "ed11eda7790d05b49395598a42b155812b17e263214292f7b87d15e14003d337";
|
||||
paramsBlobHash = "sha256-7RHtp3kNBbSTlVmKQrFVgSsX4mMhQpL3uH0V4UAD0zc=";
|
||||
}
|
@@ -1,16 +1,19 @@
|
||||
{
|
||||
fetchurl,
|
||||
jq,
|
||||
lib,
|
||||
stdenv,
|
||||
}:
|
||||
{
|
||||
manifestHash ? "",
|
||||
modelBlob,
|
||||
modelBlobHash ? "",
|
||||
paramsBlob,
|
||||
paramsBlobHash ? "",
|
||||
modelName,
|
||||
variant,
|
||||
manifestHash ? "",
|
||||
# grab the modelBlob and paramsBlob from the manifest (trim the `sha256:` prefix).
|
||||
# the manifest can be acquired by providing just the above parameters and building this package, then viewing the output
|
||||
modelBlob ? null,
|
||||
modelBlobHash ? "",
|
||||
paramsBlob ? null,
|
||||
paramsBlobHash ? "",
|
||||
}:
|
||||
stdenv.mkDerivation {
|
||||
name = modelName;
|
||||
@@ -19,10 +22,12 @@ stdenv.mkDerivation {
|
||||
url = "https://registry.ollama.ai/v2/library/${modelName}/manifests/${variant}";
|
||||
hash = manifestHash;
|
||||
})
|
||||
] ++ lib.optionals (modelBlob != null) [
|
||||
(fetchurl {
|
||||
url = "https://registry.ollama.ai/v2/llama/${modelName}:${variant}/blobs/sha256-${modelBlob}";
|
||||
hash = modelBlobHash;
|
||||
})
|
||||
] ++ lib.optionals (paramsBlob != null) [
|
||||
(fetchurl {
|
||||
url = "https://registry.ollama.ai/v2/llama/${modelName}:${variant}/blobs/sha256-${paramsBlob}";
|
||||
hash = paramsBlobHash;
|
||||
@@ -48,7 +53,9 @@ stdenv.mkDerivation {
|
||||
runHook preBuild
|
||||
|
||||
mkdir blobs
|
||||
mv sha256-* blobs
|
||||
for _src in sha256-*; do
|
||||
mv "$_src" blobs
|
||||
done
|
||||
|
||||
# lots of fields are not required by ollama,
|
||||
# and removing them allows to also remove the files (hashes) they reference
|
||||
@@ -63,9 +70,9 @@ stdenv.mkDerivation {
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
mkdir -p $out/$manifestDir $out/$blobDir
|
||||
mkdir -p $out/$manifestDir $(dirname $out/$blobDir)
|
||||
cp manifest $out/$manifestDir/latest
|
||||
cp -R blobs/* $out/$blobDir
|
||||
cp -R blobs $out/$blobDir
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
@@ -10,4 +10,5 @@ lib.recurseIntoAttrs (lib.makeScope newScope (self: with self; {
|
||||
mkOllamaModel = callPackage ./mkOllamaModel.nix { };
|
||||
|
||||
llama3_2_3b = callPackage ./llama3_2_3b.nix { };
|
||||
mistral = callPackage ./mistral.nix { };
|
||||
}))
|
||||
|
Reference in New Issue
Block a user