Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gpt4all: 2.8.0 -> 3.2.1 #337747

Merged
merged 3 commits into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions maintainers/maintainer-list.nix
Original file line number Diff line number Diff line change
Expand Up @@ -20990,6 +20990,14 @@
github = "tirimia";
githubId = 11174371;
};
titaniumtown = {
email = "[email protected]";
name = "Simon Gardling";
github = "titaniumtown";
githubId = 11786225;
matrix = "@titaniumtown:envs.net";
keys = [ { fingerprint = "D15E 4754 FE1A EDA1 5A6D 4702 9AB2 8AC1 0ECE 533D"; } ];
};
tjni = {
email = "[email protected]";
matrix = "@tni:matrix.org";
Expand Down
50 changes: 50 additions & 0 deletions pkgs/by-name/gp/gpt4all/embedding-local.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
commit 1e8fdf3f90fd142c5ddd63e44ca1e5c172dbfb7f
Author: Simon Gardling <[email protected]>
Date: Tue Aug 27 12:45:14 2024 -0400

use locally downloaded embeddings

index 27f3f5d9..9e25528a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -90,6 +90,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}")
@@ -104,6 +105,7 @@
if (APPLE)
list(APPEND CHAT_EXE_RESOURCES "${LOCAL_EMBEDDING_MODEL_PATH}")
endif()
+]]

qt_add_executable(chat
main.cpp
@@ -383,11 +385,13 @@
endif()
endif()

+#[[
if (NOT APPLE)
install(FILES "${CMAKE_BINARY_DIR}/resources/${LOCAL_EMBEDDING_MODEL}"
DESTINATION resources
COMPONENT ${COMPONENT_NAME_MAIN})
endif()
+]]

set(CPACK_GENERATOR "IFW")
set(CPACK_VERBATIM_VARIABLES YES)
--- a/embllm.cpp
+++ b/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;
}

20 changes: 16 additions & 4 deletions pkgs/by-name/gp/gpt4all/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
, config
, stdenv
, fetchFromGitHub
, fetchurl
, cmake
, qt6
, fmt
Expand All @@ -14,16 +15,25 @@

stdenv.mkDerivation (finalAttrs: {
pname = "gpt4all";
version = "2.8.0";
version = "3.2.1";

src = fetchFromGitHub {
fetchSubmodules = true;
hash = "sha256-aSz37+1K26Xizf4cpV45a2DnSsl959VQok/ppFRk/hs=";
hash = "sha256-h6hcqafTjQsqVlpnqVeohh38A67VSGrW3WrCErjaKIQ=";
owner = "nomic-ai";
repo = "gpt4all";
rev = "v${finalAttrs.version}";
};

embed_model = fetchurl {
url = "https://gpt4all.io/models/gguf/nomic-embed-text-v1.5.f16.gguf";
sha256 = "f7af6f66802f4df86eda10fe9bbcfc75c39562bed48ef6ace719a251cf1c2fdb";
};

patches = [
./embedding-local.patch
];

sourceRoot = "${finalAttrs.src.name}/gpt4all-chat";

nativeBuildInputs = [
Expand All @@ -41,6 +51,7 @@ stdenv.mkDerivation (finalAttrs: {
qt6.qthttpserver
qt6.qtwebengine
qt6.qt5compat
qt6.qttools
shaderc
vulkan-headers
wayland
Expand All @@ -64,8 +75,9 @@ stdenv.mkDerivation (finalAttrs: {
rm -rf $out/include
rm -rf $out/lib/*.a
mv $out/bin/chat $out/bin/${finalAttrs.meta.mainProgram}
install -D ${finalAttrs.embed_model} $out/resources/nomic-embed-text-v1.5.f16.gguf
install -m 444 -D $src/gpt4all-chat/flatpak-manifest/io.gpt4all.gpt4all.desktop $out/share/applications/io.gpt4all.gpt4all.desktop
install -m 444 -D $src/gpt4all-chat/icons/logo.svg $out/share/icons/hicolor/scalable/apps/io.gpt4all.gpt4all.svg
install -m 444 -D $src/gpt4all-chat/icons/nomic_logo.svg $out/share/icons/hicolor/scalable/apps/io.gpt4all.gpt4all.svg
substituteInPlace $out/share/applications/io.gpt4all.gpt4all.desktop \
--replace-fail 'Exec=chat' 'Exec=${finalAttrs.meta.mainProgram}'
'';
Expand All @@ -76,6 +88,6 @@ stdenv.mkDerivation (finalAttrs: {
homepage = "https://github.com/nomic-ai/gpt4all";
license = lib.licenses.mit;
mainProgram = "gpt4all";
maintainers = with lib.maintainers; [ polygon ];
maintainers = with lib.maintainers; [ polygon titaniumtown ];
};
})