gpt4all stuff

This commit is contained in:
Simon Gardling 2025-02-06 12:37:56 -05:00
parent 7bb0b8a312
commit 27543f41ad
Signed by: titaniumtown
GPG Key ID: 9AB28AC10ECE533D

View File

@ -6,11 +6,12 @@
}: }:
let let
models = [ models = [
{ rec {
name = "DeepSeek-R1-Distill-Qwen-14B-Q4_0.gguf"; name = "DeepSeek-R1-Distill-Qwen-14B-Q4_0";
filename = builtins.elemAt (lib.splitString "?" src.name) 0;
context_length = 32768; context_length = 32768;
gen_length = 8192; gen_length = 8192;
source = pkgs.fetchurl { src = pkgs.fetchurl {
url = "https://huggingface.co/bartowski/DeepSeek-R1-Distill-Qwen-14B-GGUF/resolve/main/DeepSeek-R1-Distill-Qwen-14B-Q4_0.gguf?download=true"; url = "https://huggingface.co/bartowski/DeepSeek-R1-Distill-Qwen-14B-GGUF/resolve/main/DeepSeek-R1-Distill-Qwen-14B-Q4_0.gguf?download=true";
sha256 = "906b3382f2680f4ce845459b4a122e904002b075238080307586bcffcde49eef"; sha256 = "906b3382f2680f4ce845459b4a122e904002b075238080307586bcffcde49eef";
}; };
@ -32,6 +33,8 @@ let
"-mtune=native" "-mtune=native"
] ]
); );
system_prompt = "";
in in
{ {
home.packages = [ home.packages = [
@ -42,9 +45,6 @@ in
lib.recursiveUpdate lib.recursiveUpdate
{ {
".config/nomic.ai/GPT4All.ini".text = ".config/nomic.ai/GPT4All.ini".text =
let
system_prompt = "";
in
'' ''
[General] [General]
chatTheme=Dark chatTheme=Dark
@ -63,20 +63,19 @@ in
[download] [download]
lastVersionStarted=${gpt4all_package.version} lastVersionStarted=${gpt4all_package.version}
'' ''
+ (lib.concatStrings ( + (lib.concatMapStringsSep "\n" (model: ''
map (model: '' [model-${model.name}]
[model-${model.name}] contextLength=${builtins.toString model.context_length}
contextLength=${builtins.toString model.context_length} filename=${model.filename}
filename=${model.name} maxLength=${builtins.toString model.gen_length}
maxLength=${builtins.toString model.gen_length} promptBatchSize=256
promptBatchSize=256 systemMessage="${
systemMessage="${ # replace newlines with the string "\n" for gpt4all to properly parse
# replace newlines with the string "\n" for gpt4all to properly parse builtins.replaceStrings [ "\n" ] [ "\\n" ] system_prompt
builtins.replaceStrings [ "\n" ] [ "\\n" ] system_prompt }"
}\n" '') models)
'') models
))
+ '' + ''
\n
[network] [network]
isActive=true isActive=true
usageStatsActive=true usageStatsActive=true
@ -85,8 +84,8 @@ in
( (
builtins.listToAttrs ( builtins.listToAttrs (
map (f: { map (f: {
name = ".local/share/nomic.ai/GPT4All/${f.name}"; name = ".local/share/nomic.ai/GPT4All/${f.filename}";
value.source = f.source; value.source = f.src;
}) models }) models
) )
); );