llama_cpp 0.5.0 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +14 -2
- data/examples/prompt_jp.txt +1 -1
- data/ext/llama_cpp/extconf.rb +1 -1
- data/ext/llama_cpp/llama_cpp.cpp +30 -0
- data/ext/llama_cpp/src/ggml-alloc.c +101 -24
- data/ext/llama_cpp/src/ggml-cuda.cu +1094 -678
- data/ext/llama_cpp/src/ggml-metal.m +89 -23
- data/ext/llama_cpp/src/ggml-metal.metal +398 -211
- data/ext/llama_cpp/src/ggml-opencl.cpp +7 -7
- data/ext/llama_cpp/src/ggml.c +32 -56
- data/ext/llama_cpp/src/ggml.h +1 -1
- data/ext/llama_cpp/src/k_quants.c +49 -13
- data/ext/llama_cpp/src/llama.cpp +833 -281
- data/ext/llama_cpp/src/llama.h +11 -6
- data/lib/llama_cpp/version.rb +2 -2
- data/lib/llama_cpp.rb +1 -1
- data/sig/llama_cpp.rbs +4 -0
- metadata +2 -2
data/ext/llama_cpp/src/llama.h
CHANGED
@@ -164,6 +164,7 @@ extern "C" {
|
|
164
164
|
enum llama_ftype ftype; // quantize to this llama_ftype
|
165
165
|
bool allow_requantize; // allow quantizing non-f32/f16 tensors
|
166
166
|
bool quantize_output_tensor; // quantize output.weight
|
167
|
+
bool only_copy; // only copy tensors - ftype, allow_requantize and quantize_output_tensor are ignored
|
167
168
|
} llama_model_quantize_params;
|
168
169
|
|
169
170
|
// grammar types
|
@@ -244,15 +245,17 @@ extern "C" {
|
|
244
245
|
LLAMA_API bool llama_mmap_supported (void);
|
245
246
|
LLAMA_API bool llama_mlock_supported(void);
|
246
247
|
|
247
|
-
LLAMA_API int llama_n_vocab(const struct llama_context * ctx);
|
248
|
-
LLAMA_API int llama_n_ctx
|
249
|
-
LLAMA_API int
|
248
|
+
LLAMA_API int llama_n_vocab (const struct llama_context * ctx);
|
249
|
+
LLAMA_API int llama_n_ctx (const struct llama_context * ctx);
|
250
|
+
LLAMA_API int llama_n_ctx_train(const struct llama_context * ctx);
|
251
|
+
LLAMA_API int llama_n_embd (const struct llama_context * ctx);
|
250
252
|
|
251
253
|
LLAMA_API enum llama_vocab_type llama_vocab_type(const struct llama_context * ctx);
|
252
254
|
|
253
|
-
LLAMA_API int llama_model_n_vocab(const struct llama_model * model);
|
254
|
-
LLAMA_API int llama_model_n_ctx
|
255
|
-
LLAMA_API int
|
255
|
+
LLAMA_API int llama_model_n_vocab (const struct llama_model * model);
|
256
|
+
LLAMA_API int llama_model_n_ctx (const struct llama_model * model);
|
257
|
+
LLAMA_API int llama_model_n_ctx_train(const struct llama_model * model);
|
258
|
+
LLAMA_API int llama_model_n_embd (const struct llama_model * model);
|
256
259
|
|
257
260
|
// Get a string describing the model type
|
258
261
|
LLAMA_API int llama_model_desc(const struct llama_model * model, char * buf, size_t buf_size);
|
@@ -409,6 +412,8 @@ extern "C" {
|
|
409
412
|
|
410
413
|
LLAMA_API void llama_grammar_free(struct llama_grammar * grammar);
|
411
414
|
|
415
|
+
LLAMA_API struct llama_grammar * llama_grammar_copy(const struct llama_grammar * grammar);
|
416
|
+
|
412
417
|
//
|
413
418
|
// Sampling functions
|
414
419
|
//
|
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.5.
|
6
|
+
VERSION = '0.5.2'
|
7
7
|
|
8
8
|
# The version of llama.cpp bundled with llama_cpp.rb.
|
9
|
-
LLAMA_CPP_VERSION = '
|
9
|
+
LLAMA_CPP_VERSION = 'b1'
|
10
10
|
end
|
data/lib/llama_cpp.rb
CHANGED
data/sig/llama_cpp.rbs
CHANGED
@@ -75,6 +75,7 @@ module LLaMACpp
|
|
75
75
|
def apply_lora_from_file: (lora_path: String, ?base_model_path: String, ?n_threads: Integer) -> void
|
76
76
|
def n_vocab: () -> Integer
|
77
77
|
def n_ctx: () -> Integer
|
78
|
+
def n_ctx_train: () -> Integer
|
78
79
|
def n_embd: () -> Integer
|
79
80
|
def token_to_piece: (Integer) -> String
|
80
81
|
def tokenize: (text: String, ?n_max_tokens: Integer, ?add_bos: bool) -> Array[Integer]
|
@@ -113,6 +114,7 @@ module LLaMACpp
|
|
113
114
|
def eval_export: (String) -> bool
|
114
115
|
def logits: () -> Array[Float]
|
115
116
|
def n_ctx: () -> Integer
|
117
|
+
def n_ctx_train: () -> Integer
|
116
118
|
def n_embd: () -> Integer
|
117
119
|
def n_vocab: () -> Integer
|
118
120
|
def timings: () -> ::LLaMACpp::Timings
|
@@ -188,6 +190,8 @@ module LLaMACpp
|
|
188
190
|
def allow_quantization=: (bool) -> bool
|
189
191
|
def quantize_output_tensor: () -> bool
|
190
192
|
def quantize_output_tensor=: (bool) -> bool
|
193
|
+
def only_copy: () -> bool
|
194
|
+
def only_copy=: (bool) -> bool
|
191
195
|
end
|
192
196
|
|
193
197
|
class Params = ContextParams
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: llama_cpp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- yoshoku
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-09-
|
11
|
+
date: 2023-09-16 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: llama_cpp.rb provides Ruby bindings for the llama.cpp.
|
14
14
|
email:
|