llama_cpp 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +2 -0
- data/ext/llama_cpp/src/ggml.c +354 -51
- data/ext/llama_cpp/src/ggml.h +6 -1
- data/ext/llama_cpp/src/llama.cpp +210 -259
- data/ext/llama_cpp/src/llama.h +2 -2
- data/lib/llama_cpp/version.rb +2 -2
- data/lib/llama_cpp.rb +3 -2
- metadata +1 -1
data/ext/llama_cpp/src/llama.h
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
#include <stdbool.h>
|
7
7
|
|
8
8
|
#ifdef LLAMA_SHARED
|
9
|
-
#
|
9
|
+
# if defined(_WIN32) && !defined(__MINGW32__)
|
10
10
|
# ifdef LLAMA_BUILD
|
11
11
|
# define LLAMA_API __declspec(dllexport)
|
12
12
|
# else
|
@@ -20,7 +20,7 @@
|
|
20
20
|
#endif
|
21
21
|
|
22
22
|
#define LLAMA_FILE_VERSION 1
|
23
|
-
#define LLAMA_FILE_MAGIC
|
23
|
+
#define LLAMA_FILE_MAGIC 0x67676a74 // 'ggjt' in hex
|
24
24
|
#define LLAMA_FILE_MAGIC_UNVERSIONED 0x67676d6c // pre-versioned files
|
25
25
|
|
26
26
|
#ifdef __cplusplus
|
data/lib/llama_cpp/version.rb
CHANGED
@@ -3,8 +3,8 @@
|
|
3
3
|
# llama_cpp.rb provides Ruby bindings for the llama.cpp.
|
4
4
|
module LLaMACpp
|
5
5
|
# The version of llama_cpp.rb you install.
|
6
|
-
VERSION = '0.0.
|
6
|
+
VERSION = '0.0.2'
|
7
7
|
|
8
8
|
# The version of llama.cpp bundled with llama_cpp.rb.
|
9
|
-
LLAMA_CPP_VERSION = 'master-
|
9
|
+
LLAMA_CPP_VERSION = 'master-5b70e7d'
|
10
10
|
end
|
data/lib/llama_cpp.rb
CHANGED
@@ -11,8 +11,9 @@ module LLaMACpp
|
|
11
11
|
#
|
12
12
|
# @param context [LLaMACpp::Context]
|
13
13
|
# @param prompt [String]
|
14
|
+
# @parma n_threads [Integer]
|
14
15
|
# @return [String]
|
15
|
-
def generate(context, prompt) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength, Metrics/PerceivedComplexity
|
16
|
+
def generate(context, prompt, n_threads: 1) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength, Metrics/PerceivedComplexity
|
16
17
|
prompt.insert(0, ' ')
|
17
18
|
|
18
19
|
embd_input = context.tokenize(text: prompt, add_bos: true)
|
@@ -36,7 +37,7 @@ module LLaMACpp
|
|
36
37
|
embd.insert(0, last_n_tokens[(n_ctx - (n_left / 2) - embd.size)...-embd.size])
|
37
38
|
end
|
38
39
|
|
39
|
-
context.eval(tokens: embd, n_past: n_past)
|
40
|
+
context.eval(tokens: embd, n_past: n_past, n_threads: n_threads)
|
40
41
|
end
|
41
42
|
|
42
43
|
n_past += embd.size
|