-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
370bab9
commit 41a1bc0
Showing
4 changed files
with
91 additions
and
89 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
{ fetchurl | ||
, models | ||
}: | ||
|
||
let | ||
|
||
inherit (builtins) attrNames foldl' replaceStrings; | ||
|
||
fetchHuggingFaceModel = { owner, repo, commit, model, hash }: | ||
fetchurl { | ||
url = "https://huggingface.co/${owner}/${repo}/resolve/${commit}/${model}?download=true"; | ||
inherit hash; | ||
}; | ||
|
||
# HuggingFace model list (objects with parameters for fetchHuggingFaceModel function) | ||
hf-model-list = | ||
foldl' | ||
(acc: owner: acc ++ | ||
(foldl' | ||
(acc: repo: acc ++ | ||
(foldl' | ||
(acc: model: acc ++ [ | ||
{ | ||
inherit owner repo model; | ||
commit = models.HF.${owner}."${repo}".commit; | ||
hash = models.HF.${owner}."${repo}".models."${model}"; | ||
} | ||
]) | ||
[ ] | ||
(attrNames models.HF.${owner}.${repo}.models) | ||
) | ||
) | ||
[ ] | ||
(attrNames models.HF.${owner}) | ||
) | ||
) | ||
[ ] | ||
(attrNames models.HF); | ||
|
||
# HuggingFace model packages | ||
hf-model-packages = | ||
foldl' | ||
(acc: pkg: acc // (with pkg; | ||
let | ||
repoStr = replaceStrings [ "." ] [ "_" ] repo; | ||
modelStr = replaceStrings [ "." ] [ "_" ] model; | ||
in | ||
{ | ||
"HF__${owner}__${repoStr}__${modelStr}" = fetchHuggingFaceModel { | ||
inherit owner repo model; | ||
commit = models.HF.${owner}.${repo}.commit; | ||
hash = models.HF.${owner}.${repo}.models."${model}"; | ||
}; | ||
} | ||
)) | ||
{ } | ||
hf-model-list; | ||
|
||
packages = hf-model-packages; | ||
|
||
in | ||
|
||
packages |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,90 +1,27 @@ | ||
{ fetchurl | ||
}: | ||
|
||
let | ||
|
||
inherit (builtins) attrNames foldl' replaceStrings; | ||
|
||
fetchHuggingFaceModel = { owner, repo, commit, model, hash }: | ||
fetchurl { | ||
url = "https://huggingface.co/${owner}/${repo}/resolve/${commit}/${model}?download=true"; | ||
inherit hash; | ||
}; | ||
|
||
models = { | ||
# HuggingFace | ||
HF = { | ||
TheBloke = { | ||
"CapybaraHermes-2.5-Mistral-7B-GGUF" = { | ||
commit = "8bea614edd9a2d5d9985a6e6c1ecc166261cacb8"; | ||
models = { | ||
"capybarahermes-2.5-mistral-7b.Q4_K_M.gguf" = "sha256-68zLv7A+UIiM14B0XdYcHz2gLTheeNvCxQYtzcWlycg="; | ||
}; | ||
{ | ||
# HuggingFace | ||
HF = { | ||
TheBloke = { | ||
"CapybaraHermes-2.5-Mistral-7B-GGUF" = { | ||
commit = "8bea614edd9a2d5d9985a6e6c1ecc166261cacb8"; | ||
models = { | ||
"capybarahermes-2.5-mistral-7b.Q4_K_M.gguf" = "sha256-68zLv7A+UIiM14B0XdYcHz2gLTheeNvCxQYtzcWlycg="; | ||
}; | ||
"Llama-2-7B-Chat-GGUF" = { | ||
commit = "191239b3e26b2882fb562ffccdd1cf0f65402adb"; | ||
models = { | ||
"llama-2-7b-chat.Q2_K.gguf" = "sha256-wN0wTXYejgXQgswpAtdiSn+HhY/fqk7wmDMP/nZ/8NM="; | ||
"llama-2-7b-chat.Q4_K_M.gguf" = "sha256-CKVWbWHXy2tCDD5Dh6OeAHjh8v5fBV86A4hzhTBNS/o="; | ||
"llama-2-7b-chat.Q5_K_M.gguf" = "sha256-4LmZIM9HuUx40vsGoezrnteVF236P3/qxkYp8bUrmX8="; | ||
}; | ||
}; | ||
"Llama-2-7B-Chat-GGUF" = { | ||
commit = "191239b3e26b2882fb562ffccdd1cf0f65402adb"; | ||
models = { | ||
"llama-2-7b-chat.Q2_K.gguf" = "sha256-wN0wTXYejgXQgswpAtdiSn+HhY/fqk7wmDMP/nZ/8NM="; | ||
"llama-2-7b-chat.Q4_K_M.gguf" = "sha256-CKVWbWHXy2tCDD5Dh6OeAHjh8v5fBV86A4hzhTBNS/o="; | ||
"llama-2-7b-chat.Q5_K_M.gguf" = "sha256-4LmZIM9HuUx40vsGoezrnteVF236P3/qxkYp8bUrmX8="; | ||
}; | ||
"Llama-2-13B-chat-GGUF" = { | ||
commit = "4458acc949de0a9914c3eab623904d4fe999050a"; | ||
models = { | ||
"llama-2-13b-chat.Q5_K_M.gguf" = "sha256-7zbgkCQAQPlzJXWMGtjiPzgBRmqO7OOp6sLSLZQvVIo="; | ||
}; | ||
}; | ||
"Llama-2-13B-chat-GGUF" = { | ||
commit = "4458acc949de0a9914c3eab623904d4fe999050a"; | ||
models = { | ||
"llama-2-13b-chat.Q5_K_M.gguf" = "sha256-7zbgkCQAQPlzJXWMGtjiPzgBRmqO7OOp6sLSLZQvVIo="; | ||
}; | ||
}; | ||
}; | ||
}; | ||
|
||
# # HuggingFace model list (objects with parameters for fetchHuggingFaceModel function) | ||
hfModelList = | ||
foldl' | ||
(acc: owner: acc ++ | ||
(foldl' | ||
(acc: repo: acc ++ | ||
(foldl' | ||
(acc: model: acc ++ [ | ||
{ | ||
inherit owner repo model; | ||
commit = models.HF.${owner}."${repo}".commit; | ||
hash = models.HF.${owner}."${repo}".models."${model}"; | ||
} | ||
]) | ||
[ ] | ||
(attrNames models.HF.${owner}.${repo}.models) | ||
) | ||
) | ||
[ ] | ||
(attrNames models.HF.${owner}) | ||
) | ||
) | ||
[ ] | ||
(attrNames models.HF); | ||
|
||
# HuggingFace model packages | ||
hfModelPackages = | ||
foldl' | ||
(acc: pkg: acc // (with pkg; | ||
let | ||
repoStr = replaceStrings [ "." ] [ "_" ] repo; | ||
modelStr = replaceStrings [ "." ] [ "_" ] model; | ||
in | ||
{ | ||
"HF__${owner}__${repoStr}__${modelStr}" = fetchHuggingFaceModel { | ||
inherit owner repo model; | ||
commit = models.HF.${owner}.${repo}.commit; | ||
hash = models.HF.${owner}.${repo}.models."${model}"; | ||
}; | ||
} | ||
)) | ||
{ } | ||
hfModelList; | ||
|
||
packages = hfModelPackages; | ||
|
||
in | ||
|
||
packages | ||
} |