From 17f75cc4a1963ed9c18489b303ba582951e680c7 Mon Sep 17 00:00:00 2001 From: codi Date: Sat, 17 Aug 2024 15:27:24 -0600 Subject: [PATCH 1/2] migrated to latest llama.cpp, now using updated API llama_add_bos_token as bool instead of int --- .swiftpm/configuration/Package.resolved | 32 +++++++++++++++++++++++++ Sources/LLM/LLM.swift | 4 ++-- 2 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 .swiftpm/configuration/Package.resolved diff --git a/.swiftpm/configuration/Package.resolved b/.swiftpm/configuration/Package.resolved new file mode 100644 index 0000000..3ea8289 --- /dev/null +++ b/.swiftpm/configuration/Package.resolved @@ -0,0 +1,32 @@ +{ + "pins" : [ + { + "identity" : "llama.cpp", + "kind" : "remoteSourceControl", + "location" : "https://github.com/ggerganov/llama.cpp/", + "state" : { + "branch" : "master", + "revision" : "2fb9267887d24a431892ce4dccc75c7095b0d54d" + } + }, + { + "identity" : "swift-power-assert", + "kind" : "remoteSourceControl", + "location" : "https://github.com/kishikawakatsumi/swift-power-assert", + "state" : { + "revision" : "2fa10dcbbff807fad73b4e2469b43300a50e9bbc", + "version" : "0.12.0" + } + }, + { + "identity" : "swift-syntax", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-syntax.git", + "state" : { + "revision" : "64889f0c732f210a935a0ad7cda38f77f876262d", + "version" : "509.1.1" + } + } + ], + "version" : 2 +} diff --git a/Sources/LLM/LLM.swift b/Sources/LLM/LLM.swift index d1ca295..41c8b2e 100644 --- a/Sources/LLM/LLM.swift +++ b/Sources/LLM/LLM.swift @@ -379,10 +379,10 @@ extension Model { public func shouldAddBOS() -> Bool { let addBOS = llama_add_bos_token(self); - guard addBOS != -1 else { + guard !addBOS else { return llama_vocab_type(self) == LLAMA_VOCAB_TYPE_SPM } - return addBOS != 0 + return addBOS } public func decodeOnly(_ token: Token) -> String { From 60bb5ecdc2857323648c8ca1dd02588b72d69066 Mon Sep 17 00:00:00 2001 From: eastriver Date: Sun, 18 Aug 2024 14:29:22 +0900 Subject: [PATCH 2/2] Delete .swiftpm/configuration/Package.resolved --- .swiftpm/configuration/Package.resolved | 32 ------------------------- 1 file changed, 32 deletions(-) delete mode 100644 .swiftpm/configuration/Package.resolved diff --git a/.swiftpm/configuration/Package.resolved b/.swiftpm/configuration/Package.resolved deleted file mode 100644 index 3ea8289..0000000 --- a/.swiftpm/configuration/Package.resolved +++ /dev/null @@ -1,32 +0,0 @@ -{ - "pins" : [ - { - "identity" : "llama.cpp", - "kind" : "remoteSourceControl", - "location" : "https://github.com/ggerganov/llama.cpp/", - "state" : { - "branch" : "master", - "revision" : "2fb9267887d24a431892ce4dccc75c7095b0d54d" - } - }, - { - "identity" : "swift-power-assert", - "kind" : "remoteSourceControl", - "location" : "https://github.com/kishikawakatsumi/swift-power-assert", - "state" : { - "revision" : "2fa10dcbbff807fad73b4e2469b43300a50e9bbc", - "version" : "0.12.0" - } - }, - { - "identity" : "swift-syntax", - "kind" : "remoteSourceControl", - "location" : "https://github.com/apple/swift-syntax.git", - "state" : { - "revision" : "64889f0c732f210a935a0ad7cda38f77f876262d", - "version" : "509.1.1" - } - } - ], - "version" : 2 -}