aaa?
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
diff --git a/main.qml b/main.qml
|
||||
index 1e685385..7c747eba 100644
|
||||
--- a/main.qml
|
||||
+++ b/main.qml
|
||||
@@ -72,12 +72,14 @@ Window {
|
||||
return;
|
||||
}
|
||||
|
||||
+ /*
|
||||
// check if we have access to settings and if not show an error
|
||||
if (!hasShownSettingsAccess && !LLM.hasSettingsAccess()) {
|
||||
errorSettingsAccess.open();
|
||||
hasShownSettingsAccess = true;
|
||||
return;
|
||||
}
|
||||
+ */
|
||||
|
||||
// check for first time start of this version
|
||||
if (!hasCheckedFirstStart) {
|
||||
@@ -0,0 +1,53 @@
|
||||
commit 425b33877c819dd88f3692aae37452c767371f6b
|
||||
Author: Simon Gardling <titaniumtown@proton.me>
|
||||
Date: Thu Sep 19 10:00:39 2024 -0400
|
||||
|
||||
use locally downloaded embeddings
|
||||
|
||||
diff --git a/gpt4all-chat/CMakeLists.txt b/gpt4all-chat/CMakeLists.txt
|
||||
index 900307ae..802fc31a 100644
|
||||
--- a//CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -120,6 +120,7 @@ elseif (APPLE)
|
||||
endif()
|
||||
|
||||
# Embedding model
|
||||
+#[[
|
||||
set(LOCAL_EMBEDDING_MODEL "nomic-embed-text-v1.5.f16.gguf")
|
||||
set(LOCAL_EMBEDDING_MODEL_MD5 "a5401e7f7e46ed9fcaed5b60a281d547")
|
||||
set(LOCAL_EMBEDDING_MODEL_PATH "${CMAKE_BINARY_DIR}/resources/${LOCAL_EMBEDDING_MODEL}")
|
||||
@@ -134,6 +135,7 @@ message(STATUS "Embedding model downloaded to ${LOCAL_EMBEDDING_MODEL_PATH}")
|
||||
if (APPLE)
|
||||
list(APPEND CHAT_EXE_RESOURCES "${LOCAL_EMBEDDING_MODEL_PATH}")
|
||||
endif()
|
||||
+]]
|
||||
|
||||
set(QAPPLICATION_CLASS QGuiApplication)
|
||||
add_subdirectory(deps/SingleApplication)
|
||||
@@ -348,11 +350,13 @@ if (LLMODEL_CUDA)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
+#[[
|
||||
if (NOT APPLE)
|
||||
install(FILES "${LOCAL_EMBEDDING_MODEL_PATH}"
|
||||
DESTINATION resources
|
||||
COMPONENT ${COMPONENT_NAME_MAIN})
|
||||
endif()
|
||||
+]]
|
||||
|
||||
set(CPACK_GENERATOR "IFW")
|
||||
set(CPACK_VERBATIM_VARIABLES YES)
|
||||
diff --git a/gpt4all-chat/src/embllm.cpp b/gpt4all-chat/src/embllm.cpp
|
||||
index 81b1e9e1..e3266cc7 100644
|
||||
--- a/src/embllm.cpp
|
||||
+++ b/src/embllm.cpp
|
||||
@@ -84,7 +84,7 @@ bool EmbeddingLLMWorker::loadModel()
|
||||
|
||||
QString filePath = embPathFmt.arg(QCoreApplication::applicationDirPath(), LOCAL_EMBEDDING_MODEL);
|
||||
if (!QFileInfo::exists(filePath)) {
|
||||
- qWarning() << "embllm WARNING: Local embedding model not found";
|
||||
+ qWarning() << "embllm WARNING: Local embedding model not found: " << filePath;
|
||||
return false;
|
||||
}
|
||||
|
||||
124
nix/home-manager/progs/gpt4all/gpt4all.nix
Normal file
124
nix/home-manager/progs/gpt4all/gpt4all.nix
Normal file
@@ -0,0 +1,124 @@
|
||||
{ pkgs, lib, ... }:
|
||||
let
|
||||
models = [
|
||||
{
|
||||
name = "Qwen2.5-14B-Instruct-Q4_K_S.gguf";
|
||||
context_length = "32768";
|
||||
gen_length = "8192";
|
||||
source = pkgs.fetchurl {
|
||||
url = "https://huggingface.co/bartowski/Qwen2.5-14B-Instruct-GGUF/resolve/main/Qwen2.5-14B-Instruct-Q4_K_S.gguf?download=true";
|
||||
sha256 = "E1CmWUhMMbTXEjIRczzA3rSrVuR8qOL8BLagw7LiyZk=";
|
||||
};
|
||||
}
|
||||
{
|
||||
name = "Qwen2.5-7B-Instruct-Q6_K_L.gguf";
|
||||
context_length = "32768";
|
||||
gen_length = "8192";
|
||||
source = pkgs.fetchurl {
|
||||
url = "https://huggingface.co/bartowski/Qwen2.5-7B-Instruct-GGUF/resolve/main/Qwen2.5-7B-Instruct-Q6_K_L.gguf?download=true";
|
||||
sha256 = "thEXN06T/UVGfzdB83jlgpG7kuTzZtz1ZUAdupAnErM=";
|
||||
};
|
||||
}
|
||||
];
|
||||
|
||||
# stolen from: https://stackoverflow.com/a/42398526
|
||||
optimizeWithFlags =
|
||||
pkg: flags:
|
||||
pkgs.lib.overrideDerivation pkg (
|
||||
old:
|
||||
let
|
||||
newflags = pkgs.lib.foldl' (acc: x: "${acc} ${x}") "" flags;
|
||||
oldflags = if (pkgs.lib.hasAttr "NIX_CFLAGS_COMPILE" old) then "${old.NIX_CFLAGS_COMPILE}" else "";
|
||||
in
|
||||
{
|
||||
NIX_CFLAGS_COMPILE = "${oldflags} ${newflags}";
|
||||
stdenv = pkgs.clangStdenv;
|
||||
}
|
||||
);
|
||||
|
||||
model_files = builtins.listToAttrs (
|
||||
map (f: {
|
||||
name = ".local/share/nomic.ai/GPT4All/${f.name}";
|
||||
value = {
|
||||
source = f.source;
|
||||
};
|
||||
}) models
|
||||
);
|
||||
|
||||
gpt4all_package = (
|
||||
optimizeWithFlags
|
||||
(pkgs.gpt4all.overrideAttrs (old: {
|
||||
# https://github.com/NixOS/nixpkgs/pull/344001 3.2.1 -> 3.3.0
|
||||
version = "3.3.0";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
fetchSubmodules = true;
|
||||
owner = "nomic-ai";
|
||||
repo = "gpt4all";
|
||||
rev = "HEAD";
|
||||
sha256 = "RDYf+VaI5pl46Cd04ADvvi4ygNfYa4fY9rTv9Ui3qUk=";
|
||||
};
|
||||
|
||||
patches = [
|
||||
./gpt4all-HEAD-embeddings-model.patch
|
||||
./gpt4all-HEAD-disable-settings-err.patch
|
||||
];
|
||||
}))
|
||||
# compile flags
|
||||
[
|
||||
"-Ofast"
|
||||
"-march=native"
|
||||
"-mtune=native"
|
||||
"-fno-protect-parens"
|
||||
"-fno-finite-math-only" # https://github.com/ggerganov/llama.cpp/pull/7154#issuecomment-2143844461
|
||||
]
|
||||
);
|
||||
|
||||
in
|
||||
{
|
||||
home.packages = [
|
||||
gpt4all_package
|
||||
];
|
||||
|
||||
home.file = lib.recursiveUpdate {
|
||||
".config/nomic.ai/GPT4All.ini".text =
|
||||
let
|
||||
system_prompt = "You are an expert AI assistant who is thoughtful and works step-by-step from first principles derive an answer to the user's prompt. For each step, provide a title that describes what you're doing in that step, along with the content. Decide if you need another step or if you're ready to provide your answer to the user, make sure to exhaust ALL POSSIBILITIES before providing a response to the user. While your reasoning is not shown to the user, it is under high levels of scrutiny to ensure high-quality reasoning. WHEN YOU DETERMINE THAT YOU ARE READY TO GIVE A FINAL ANSWER TO THE USER GIVEN YOUR REASONING AND STEP-BY-STEP WORK. ONLY TEXT WRITTEN AFTER A SECTION NAMED \"Final Answer\" WILL BE SHOWN TO THE USER. ASSUME THAT NO REASONING STEPS ARE SHOWN TO THE USER. DO NOT THINK THAT THE USER CAN SEE YOUR INTERNAL REASONING STEPS.
|
||||
USE AS MANY REASONING STEPS AS POSSIBLE. AT LEAST 3. BE AWARE OF YOUR LIMITATIONS AS AN LLM AND WHAT YOU CAN AND CANNOT DO. EXPLORE ALTERNATE ANSWERS AND CONSIDER THAT YOUR ANSWER MAY BE WRONG. IDENTIFY POSSIBLE ERRORS IN YOUR REASONING AND WHERE SUCH ERRORS MAY BE. FULLY TEST ALL OTHER POSSIBILITIES. YOU CAN BE WRONG. WHEN YOU SAY YOU ARE RE-EXAMINING, ACTUALLY RE-EXAMINE, AND USE ANOTHER APPROACH TO DO SO. DO NOT JUST SAY YOU ARE RE-EXAMINING. SHOW ALL YOUR WORK. USE AT LEAST 3 METHODS TO DERIVE THE ANSWER. USE BEST PRACTICES. WORK FROM FIRST PRINCIPLES TO CREATE YOUR ANSWER.";
|
||||
in
|
||||
''
|
||||
[General]
|
||||
chatTheme=Dark
|
||||
height=940
|
||||
suggestionMode=Off
|
||||
threadCount=8
|
||||
uniqueId=7096f2d2-448d-4272-a132-d37e77f8a781
|
||||
userDefaultModel=${(builtins.elemAt models 0).name}
|
||||
width=1472
|
||||
x=0
|
||||
y=0
|
||||
|
||||
[download]
|
||||
lastVersionStarted=${gpt4all_package.version}
|
||||
''
|
||||
+ (lib.concatStrings (
|
||||
map (model: ''
|
||||
[model-${model.name}]
|
||||
contextLength=${model.context_length}
|
||||
filename=${model.name}
|
||||
maxLength=${model.gen_length}
|
||||
promptBatchSize=256
|
||||
promptTemplate=<|im_start|>user\n%1<|im_end|>\n<|im_start|>assistant\n
|
||||
systemPrompt="<|im_start|>system\n${
|
||||
# replace newlines with the string "\n" for gpt4all to properly parse
|
||||
builtins.replaceStrings [ "\n" ] [ "\\n" ] system_prompt
|
||||
}<|im_end|>
|
||||
\n"
|
||||
'') models
|
||||
))
|
||||
+ ''
|
||||
[network]
|
||||
isActive=true
|
||||
usageStatsActive=true
|
||||
'';
|
||||
} model_files;
|
||||
}
|
||||
Reference in New Issue
Block a user