llama_cpp 0.19.5 → 0.20.0
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 +17 -0
- data/ext/llama_cpp/llama_cpp.c +101 -267
- data/lib/llama_cpp/version.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 33d3b46593a1ee0950c7f86ffe802f5841e8e065bc2bdf7d9679dcff37dbe06b
|
4
|
+
data.tar.gz: 117eba5fa85437e8cd0bb8767090bf63b4e72e523f96e8cf539a9ddf2cd15195
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '0825dfa498b5a6616bebacb1b7aeec03db58b2ea992cafeebf4fc3e7553fbd2d30c6d14fda80caee8d303b84dfe447429a720add1c028eac17a16778c311d218'
|
7
|
+
data.tar.gz: 3b29add60fe63985974daa34b2e1d6a198688d83b495e6fe5381ca97074752f526a2900ae0e85c298a89d80f723c662d685fdefd74814ef956bd54567ef83c5b
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,20 @@
|
|
1
|
+
## [[0.20.0](https://github.com/yoshoku/llama_cpp.rb/compare/v0.19.6...v0.20.0)] - 2025-05-23
|
2
|
+
|
3
|
+
- Change supported llama.cpp version to b5460
|
4
|
+
- Remove `LlamaKvChacheViewCell` class.
|
5
|
+
- Remove `deprecated LlamaKvCacheView` class.
|
6
|
+
- Remove `llama_kv_self_n_tokens` module function.
|
7
|
+
- Remove `llama_kv_self_used_cells` module function.
|
8
|
+
- Add `swa_full` accessor to `LlamaContextParams`.
|
9
|
+
- Add `llama_kv_self_seq_pos_min` module function.
|
10
|
+
|
11
|
+
## [[0.19.6](https://github.com/yoshoku/llama_cpp.rb/compare/v0.19.5...v0.19.6)] - 2025-05-17
|
12
|
+
|
13
|
+
- Change supported llama.cpp version to b5410
|
14
|
+
- Add `LLAMA_VOCAB_PRE_TYPE_SEED_CODER` constant.
|
15
|
+
- Add `op_offload` accessor to `LlamaContextParams`.
|
16
|
+
- Add `llama_model_save_to_file` module function.
|
17
|
+
|
1
18
|
## [[0.19.5](https://github.com/yoshoku/llama_cpp.rb/compare/v0.19.4...v0.19.5)] - 2025-05-10
|
2
19
|
|
3
20
|
- Change supported llama.cpp version to b5320
|
data/ext/llama_cpp/llama_cpp.c
CHANGED
@@ -11,7 +11,6 @@ VALUE rb_cLlamaModelQuantizeParams;
|
|
11
11
|
VALUE rb_cLlamaLogitBias;
|
12
12
|
VALUE rb_cLlamaAdapterLora;
|
13
13
|
VALUE rb_cLlamaKvCache;
|
14
|
-
VALUE rb_cLlamaKvCacheView;
|
15
14
|
VALUE rb_cLlamaTokenDataArray;
|
16
15
|
VALUE rb_cLlamaBatch;
|
17
16
|
VALUE rb_cLlamaSampler;
|
@@ -816,6 +815,28 @@ static VALUE llama_context_params_set_no_perf(VALUE self, VALUE no_perf) {
|
|
816
815
|
return no_perf;
|
817
816
|
}
|
818
817
|
|
818
|
+
static VALUE llama_context_params_get_op_offload(VALUE self) {
|
819
|
+
struct llama_context_params* data = get_llama_context_params(self);
|
820
|
+
return data->op_offload ? Qtrue : Qfalse;
|
821
|
+
}
|
822
|
+
|
823
|
+
static VALUE llama_context_params_set_op_offload(VALUE self, VALUE op_offload) {
|
824
|
+
struct llama_context_params* data = get_llama_context_params(self);
|
825
|
+
data->op_offload = RTEST(op_offload) ? true : false;
|
826
|
+
return op_offload;
|
827
|
+
}
|
828
|
+
|
829
|
+
static VALUE llama_context_params_get_swa_full(VALUE self) {
|
830
|
+
struct llama_context_params* data = get_llama_context_params(self);
|
831
|
+
return data->swa_full ? Qtrue : Qfalse;
|
832
|
+
}
|
833
|
+
|
834
|
+
static VALUE llama_context_params_set_swa_full(VALUE self, VALUE swa_full) {
|
835
|
+
struct llama_context_params* data = get_llama_context_params(self);
|
836
|
+
data->swa_full = RTEST(swa_full) ? true : false;
|
837
|
+
return swa_full;
|
838
|
+
}
|
839
|
+
|
819
840
|
/* llama_model_quantize_params */
|
820
841
|
static void llama_model_quantize_params_free(void *ptr) {
|
821
842
|
if (ptr) {
|
@@ -1220,6 +1241,29 @@ static VALUE rb_llama_model_load_from_splits(VALUE self, VALUE paths, VALUE para
|
|
1220
1241
|
return TypedData_Wrap_Struct(rb_cLlamaModel, &llama_model_wrapper_data_type, model_wrapper);
|
1221
1242
|
}
|
1222
1243
|
|
1244
|
+
/**
|
1245
|
+
* @overload llama_model_save_to_file(model, path_model)
|
1246
|
+
* @param [LlamaModel] model
|
1247
|
+
* @param [String] path_model
|
1248
|
+
* @return [NilClass]
|
1249
|
+
*/
|
1250
|
+
static VALUE rb_llama_model_save_to_file(VALUE self, VALUE model, VALUE path_model) {
|
1251
|
+
if (!rb_obj_is_kind_of(model, rb_cLlamaModel)) {
|
1252
|
+
rb_raise(rb_eArgError, "model must be a LlamaModel");
|
1253
|
+
return Qnil;
|
1254
|
+
}
|
1255
|
+
if (!RB_TYPE_P(path_model, T_STRING)) {
|
1256
|
+
rb_raise(rb_eArgError, "path_model must be a String");
|
1257
|
+
return Qnil;
|
1258
|
+
}
|
1259
|
+
llama_model_wrapper* model_wrapper = get_llama_model_wrapper(model);
|
1260
|
+
const char* path_model_ = StringValueCStr(path_model);
|
1261
|
+
llama_model_save_to_file(model_wrapper->model, path_model_);
|
1262
|
+
RB_GC_GUARD(model);
|
1263
|
+
RB_GC_GUARD(path_model);
|
1264
|
+
return Qnil;
|
1265
|
+
}
|
1266
|
+
|
1223
1267
|
/**
|
1224
1268
|
* @overload llama_init_from_model(model, params)
|
1225
1269
|
* @param [LlamaModel] model
|
@@ -1855,208 +1899,6 @@ static VALUE rb_llama_get_kv_self(VALUE self, VALUE ctx) {
|
|
1855
1899
|
return TypedData_Wrap_Struct(rb_cLlamaKvCache, &llama_kv_cache_wrapper_data_type, kv_cache_wrapper);
|
1856
1900
|
}
|
1857
1901
|
|
1858
|
-
/* struct llama_kv_cache_view_cell */
|
1859
|
-
static void llama_kv_cache_view_cell_free(void *ptr) {
|
1860
|
-
ruby_xfree(ptr);
|
1861
|
-
}
|
1862
|
-
|
1863
|
-
static size_t llama_kv_cache_view_cell_size(const void *ptr) {
|
1864
|
-
return sizeof(*((struct llama_kv_cache_view_cell*)ptr));
|
1865
|
-
}
|
1866
|
-
|
1867
|
-
static rb_data_type_t llama_kv_cache_view_cell_type = {
|
1868
|
-
"LlamaKvCacheViewCell",
|
1869
|
-
{ NULL,
|
1870
|
-
llama_kv_cache_view_cell_free,
|
1871
|
-
llama_kv_cache_view_cell_size },
|
1872
|
-
NULL,
|
1873
|
-
NULL,
|
1874
|
-
RUBY_TYPED_FREE_IMMEDIATELY
|
1875
|
-
};
|
1876
|
-
|
1877
|
-
static VALUE llama_kv_cache_view_cell_alloc(VALUE self) {
|
1878
|
-
struct llama_kv_cache_view_cell* data = (struct llama_kv_cache_view_cell*)ruby_xmalloc(sizeof(struct llama_kv_cache_view_cell));
|
1879
|
-
data->pos = 0;
|
1880
|
-
return TypedData_Wrap_Struct(self, &llama_kv_cache_view_cell_type, data);
|
1881
|
-
}
|
1882
|
-
|
1883
|
-
static struct llama_kv_cache_view_cell* get_llama_kv_cache_view_cell(VALUE self) {
|
1884
|
-
struct llama_kv_cache_view_cell* data = NULL;
|
1885
|
-
TypedData_Get_Struct(self, struct llama_kv_cache_view_cell, &llama_kv_cache_view_cell_type, data);
|
1886
|
-
return data;
|
1887
|
-
}
|
1888
|
-
|
1889
|
-
static VALUE llama_kv_cache_view_cell_get_pos(VALUE self) {
|
1890
|
-
struct llama_kv_cache_view_cell* data = get_llama_kv_cache_view_cell(self);
|
1891
|
-
return INT2NUM(data->pos);
|
1892
|
-
}
|
1893
|
-
|
1894
|
-
/* struct llama_kv_cache_view */
|
1895
|
-
static void llama_kv_cache_view_free_(void *ptr) {
|
1896
|
-
if (ptr != NULL) {
|
1897
|
-
ruby_xfree(ptr);
|
1898
|
-
}
|
1899
|
-
}
|
1900
|
-
|
1901
|
-
static size_t llama_kv_cache_view_size(const void *ptr) {
|
1902
|
-
return sizeof(*((struct llama_kv_cache_view*)ptr));
|
1903
|
-
}
|
1904
|
-
|
1905
|
-
static rb_data_type_t llama_kv_cache_view_type = {
|
1906
|
-
"LlamaKvCacheView",
|
1907
|
-
{ NULL,
|
1908
|
-
llama_kv_cache_view_free_,
|
1909
|
-
llama_kv_cache_view_size },
|
1910
|
-
NULL,
|
1911
|
-
NULL,
|
1912
|
-
RUBY_TYPED_FREE_IMMEDIATELY
|
1913
|
-
};
|
1914
|
-
|
1915
|
-
static VALUE llama_kv_cache_view_alloc(VALUE self) {
|
1916
|
-
struct llama_kv_cache_view* data = (struct llama_kv_cache_view*)ruby_xmalloc(sizeof(struct llama_kv_cache_view));
|
1917
|
-
data->n_cells = 0;
|
1918
|
-
data->n_seq_max = 0;
|
1919
|
-
data->token_count = 0;
|
1920
|
-
data->used_cells = 0;
|
1921
|
-
data->max_contiguous = 0;
|
1922
|
-
data->max_contiguous_idx = 0;
|
1923
|
-
data->cells = NULL;
|
1924
|
-
data->cells_sequences = NULL;
|
1925
|
-
return TypedData_Wrap_Struct(self, &llama_kv_cache_view_type, data);
|
1926
|
-
}
|
1927
|
-
|
1928
|
-
static struct llama_kv_cache_view* get_llama_kv_cache_view(VALUE self) {
|
1929
|
-
struct llama_kv_cache_view* data = NULL;
|
1930
|
-
TypedData_Get_Struct(self, struct llama_kv_cache_view, &llama_kv_cache_view_type, data);
|
1931
|
-
return data;
|
1932
|
-
}
|
1933
|
-
|
1934
|
-
static VALUE llama_kv_cache_view_get_n_cells(VALUE self) {
|
1935
|
-
struct llama_kv_cache_view* data = get_llama_kv_cache_view(self);
|
1936
|
-
return INT2NUM(data->n_cells);
|
1937
|
-
}
|
1938
|
-
|
1939
|
-
static VALUE llama_kv_cache_view_get_n_seq_max(VALUE self) {
|
1940
|
-
struct llama_kv_cache_view* data = get_llama_kv_cache_view(self);
|
1941
|
-
return INT2NUM(data->n_seq_max);
|
1942
|
-
}
|
1943
|
-
|
1944
|
-
static VALUE llama_kv_cache_view_get_token_count(VALUE self) {
|
1945
|
-
struct llama_kv_cache_view* data = get_llama_kv_cache_view(self);
|
1946
|
-
return INT2NUM(data->token_count);
|
1947
|
-
}
|
1948
|
-
|
1949
|
-
static VALUE llama_kv_cache_view_get_used_cells(VALUE self) {
|
1950
|
-
struct llama_kv_cache_view* data = get_llama_kv_cache_view(self);
|
1951
|
-
return INT2NUM(data->used_cells);
|
1952
|
-
}
|
1953
|
-
|
1954
|
-
static VALUE llama_kv_cache_view_get_max_contiguous(VALUE self) {
|
1955
|
-
struct llama_kv_cache_view* data = get_llama_kv_cache_view(self);
|
1956
|
-
return INT2NUM(data->max_contiguous);
|
1957
|
-
}
|
1958
|
-
|
1959
|
-
static VALUE llama_kv_cache_view_get_max_contiguous_idx(VALUE self) {
|
1960
|
-
struct llama_kv_cache_view* data = get_llama_kv_cache_view(self);
|
1961
|
-
return INT2NUM(data->max_contiguous_idx);
|
1962
|
-
}
|
1963
|
-
/* TODO: struct llama_kv_cache_view_cell * cells; */
|
1964
|
-
/* TODO: llama_seq_id * cells_sequences; */
|
1965
|
-
|
1966
|
-
/**
|
1967
|
-
* @overload llama_kv_cache_view_init(context, n_seq_max)
|
1968
|
-
* @param [LlamaContext] context
|
1969
|
-
* @param [Integer] n_seq_max
|
1970
|
-
* @return [LlamaKvCacheView]
|
1971
|
-
*/
|
1972
|
-
static VALUE rb_llama_kv_cache_view_init(VALUE self, VALUE ctx, VALUE n_seq_max) {
|
1973
|
-
if (!rb_obj_is_kind_of(ctx, rb_cLlamaContext)) {
|
1974
|
-
rb_raise(rb_eArgError, "ctx must be a LlamaContext");
|
1975
|
-
return Qnil;
|
1976
|
-
}
|
1977
|
-
if (!RB_INTEGER_TYPE_P(n_seq_max)) {
|
1978
|
-
rb_raise(rb_eArgError, "n_seq_max must be an Integer");
|
1979
|
-
return Qnil;
|
1980
|
-
}
|
1981
|
-
llama_context_wrapper* context_wrapper = get_llama_context_wrapper(ctx);
|
1982
|
-
struct llama_kv_cache_view* data = (struct llama_kv_cache_view*)ruby_xmalloc(sizeof(struct llama_kv_cache_view));
|
1983
|
-
*data = llama_kv_cache_view_init(context_wrapper->context, NUM2UINT(n_seq_max));
|
1984
|
-
RB_GC_GUARD(ctx);
|
1985
|
-
return TypedData_Wrap_Struct(rb_cLlamaKvCacheView, &llama_kv_cache_view_type, data);
|
1986
|
-
}
|
1987
|
-
|
1988
|
-
/**
|
1989
|
-
* @overload llama_kv_cache_view_free(view)
|
1990
|
-
* @param [LlamaKvCacheView] view
|
1991
|
-
* @return [NilClass]
|
1992
|
-
*/
|
1993
|
-
static VALUE rb_llama_kv_cache_view_free(VALUE self, VALUE view) {
|
1994
|
-
if (!rb_obj_is_kind_of(view, rb_cLlamaKvCacheView)) {
|
1995
|
-
rb_raise(rb_eArgError, "view must be a LlamaKvCacheView");
|
1996
|
-
return Qnil;
|
1997
|
-
}
|
1998
|
-
struct llama_kv_cache_view* view_ = get_llama_kv_cache_view(view);
|
1999
|
-
llama_kv_cache_view_free(view_);
|
2000
|
-
view_ = NULL;
|
2001
|
-
RB_GC_GUARD(view);
|
2002
|
-
return Qnil;
|
2003
|
-
}
|
2004
|
-
|
2005
|
-
/**
|
2006
|
-
* @overload llama_kv_cache_view_update(context, view)
|
2007
|
-
* @param [LlamaContext] context
|
2008
|
-
* @param [LlamaKvCacheView] view
|
2009
|
-
* @return [NilClass]
|
2010
|
-
*/
|
2011
|
-
static VALUE rb_llama_kv_cache_view_update(VALUE self, VALUE ctx, VALUE view) {
|
2012
|
-
if (!rb_obj_is_kind_of(ctx, rb_cLlamaContext)) {
|
2013
|
-
rb_raise(rb_eArgError, "ctx must be a LlamaContext");
|
2014
|
-
return Qnil;
|
2015
|
-
}
|
2016
|
-
if (!rb_obj_is_kind_of(view, rb_cLlamaKvCacheView)) {
|
2017
|
-
rb_raise(rb_eArgError, "view must be a LlamaKvCacheView");
|
2018
|
-
return Qnil;
|
2019
|
-
}
|
2020
|
-
llama_context_wrapper* context_wrapper = get_llama_context_wrapper(ctx);
|
2021
|
-
struct llama_kv_cache_view* view_ = get_llama_kv_cache_view(view);
|
2022
|
-
llama_kv_cache_view_update(context_wrapper->context, view_);
|
2023
|
-
RB_GC_GUARD(ctx);
|
2024
|
-
RB_GC_GUARD(view);
|
2025
|
-
return Qnil;
|
2026
|
-
}
|
2027
|
-
|
2028
|
-
/**
|
2029
|
-
* @overload llama_kv_self_n_tokens(context)
|
2030
|
-
* @param [LlamaContext] context
|
2031
|
-
* @return [Integer]
|
2032
|
-
*/
|
2033
|
-
static VALUE rb_llama_kv_self_n_tokens(VALUE self, VALUE ctx) {
|
2034
|
-
if (!rb_obj_is_kind_of(ctx, rb_cLlamaContext)) {
|
2035
|
-
rb_raise(rb_eArgError, "ctx must be a LlamaContext");
|
2036
|
-
return Qnil;
|
2037
|
-
}
|
2038
|
-
llama_context_wrapper* context_wrapper = get_llama_context_wrapper(ctx);
|
2039
|
-
const int32_t n_tokens_kv_self = llama_kv_self_n_tokens(context_wrapper->context);
|
2040
|
-
RB_GC_GUARD(ctx);
|
2041
|
-
return INT2NUM(n_tokens_kv_self);
|
2042
|
-
}
|
2043
|
-
|
2044
|
-
/**
|
2045
|
-
* @overload llama_kv_self_used_cells(context)
|
2046
|
-
* @param [LlamaContext] context
|
2047
|
-
* @return [Integer]
|
2048
|
-
*/
|
2049
|
-
static VALUE rb_llama_kv_self_used_cells(VALUE self, VALUE ctx) {
|
2050
|
-
if (!rb_obj_is_kind_of(ctx, rb_cLlamaContext)) {
|
2051
|
-
rb_raise(rb_eArgError, "ctx must be a LlamaContext");
|
2052
|
-
return Qnil;
|
2053
|
-
}
|
2054
|
-
llama_context_wrapper* context_wrapper = get_llama_context_wrapper(ctx);
|
2055
|
-
const int32_t n_used_kv_cells = llama_kv_self_used_cells(context_wrapper->context);
|
2056
|
-
RB_GC_GUARD(ctx);
|
2057
|
-
return INT2NUM(n_used_kv_cells);
|
2058
|
-
}
|
2059
|
-
|
2060
1902
|
/**
|
2061
1903
|
* @overload llama_kv_self_clear(context)
|
2062
1904
|
* @param [LlamaContext] context
|
@@ -2233,6 +2075,27 @@ static VALUE rb_llama_kv_self_seq_div(VALUE self, VALUE ctx, VALUE seq_id, VALUE
|
|
2233
2075
|
return Qnil;
|
2234
2076
|
}
|
2235
2077
|
|
2078
|
+
/**
|
2079
|
+
* @overload llama_kv_self_seq_pos_min(context, seq_id)
|
2080
|
+
* @param [LlamaContext] context
|
2081
|
+
* @param [Integer] seq_id
|
2082
|
+
* @return [Integer]
|
2083
|
+
*/
|
2084
|
+
static VALUE rb_llama_kv_self_seq_pos_min(VALUE self, VALUE ctx, VALUE seq_id) {
|
2085
|
+
if (!rb_obj_is_kind_of(ctx, rb_cLlamaContext)) {
|
2086
|
+
rb_raise(rb_eArgError, "ctx must be a LlamaContext");
|
2087
|
+
return Qnil;
|
2088
|
+
}
|
2089
|
+
if (!RB_INTEGER_TYPE_P(seq_id)) {
|
2090
|
+
rb_raise(rb_eArgError, "seq_id must be an Integer");
|
2091
|
+
return Qnil;
|
2092
|
+
}
|
2093
|
+
llama_context_wrapper* context_wrapper = get_llama_context_wrapper(ctx);
|
2094
|
+
const int32_t pos_max = llama_kv_self_seq_pos_min(context_wrapper->context, NUM2INT(seq_id));
|
2095
|
+
RB_GC_GUARD(ctx);
|
2096
|
+
return INT2NUM(pos_max);
|
2097
|
+
}
|
2098
|
+
|
2236
2099
|
/**
|
2237
2100
|
* @overload llama_kv_self_seq_pos_max(context, seq_id)
|
2238
2101
|
* @param [LlamaContext] context
|
@@ -4021,6 +3884,7 @@ void Init_llama_cpp(void) {
|
|
4021
3884
|
rb_define_const(rb_mLlamaCpp, "LLAMA_VOCAB_PRE_TYPE_BAILINGMOE", INT2NUM(LLAMA_VOCAB_PRE_TYPE_BAILINGMOE));
|
4022
3885
|
rb_define_const(rb_mLlamaCpp, "LLAMA_VOCAB_PRE_TYPE_LLAMA4", INT2NUM(LLAMA_VOCAB_PRE_TYPE_LLAMA4));
|
4023
3886
|
rb_define_const(rb_mLlamaCpp, "LLAMA_VOCAB_PRE_TYPE_PIXTRAL", INT2NUM(LLAMA_VOCAB_PRE_TYPE_PIXTRAL));
|
3887
|
+
rb_define_const(rb_mLlamaCpp, "LLAMA_VOCAB_PRE_TYPE_SEED_CODER", INT2NUM(LLAMA_VOCAB_PRE_TYPE_SEED_CODER));
|
4024
3888
|
/* llama_rope_type */
|
4025
3889
|
/* Document-const: LlamaCpp::LLAMA_ROPE_TYPE_NONE */
|
4026
3890
|
rb_define_const(rb_mLlamaCpp, "LLAMA_ROPE_TYPE_NONE", INT2NUM(LLAMA_ROPE_TYPE_NONE));
|
@@ -4591,6 +4455,28 @@ void Init_llama_cpp(void) {
|
|
4591
4455
|
* @return [Boolean]
|
4592
4456
|
*/
|
4593
4457
|
rb_define_method(rb_cLlamaContextParams, "no_perf=", RUBY_METHOD_FUNC(llama_context_params_set_no_perf), 1);
|
4458
|
+
/**
|
4459
|
+
* Document-method: op_offload
|
4460
|
+
* @return [Boolean]
|
4461
|
+
*/
|
4462
|
+
rb_define_method(rb_cLlamaContextParams, "op_offload", RUBY_METHOD_FUNC(llama_context_params_get_op_offload), 0);
|
4463
|
+
/**
|
4464
|
+
* Document-method: op_offload=
|
4465
|
+
* @param [Boolean] op_offload
|
4466
|
+
* @return [Boolean]
|
4467
|
+
*/
|
4468
|
+
rb_define_method(rb_cLlamaContextParams, "op_offload=", RUBY_METHOD_FUNC(llama_context_params_set_op_offload), 1);
|
4469
|
+
/**
|
4470
|
+
* Document-method: swa_full
|
4471
|
+
* @return [Boolean]
|
4472
|
+
*/
|
4473
|
+
rb_define_method(rb_cLlamaContextParams, "swa_full", RUBY_METHOD_FUNC(llama_context_params_get_swa_full), 0);
|
4474
|
+
/**
|
4475
|
+
* Document-method: swa_full=
|
4476
|
+
* @param [Boolean] swa_full
|
4477
|
+
* @return [Boolean]
|
4478
|
+
*/
|
4479
|
+
rb_define_method(rb_cLlamaContextParams, "swa_full=", RUBY_METHOD_FUNC(llama_context_params_set_swa_full), 1);
|
4594
4480
|
/* TODO: ggml_abort_callback abort_callback */
|
4595
4481
|
/* TODO: void* abort_callback_data */
|
4596
4482
|
|
@@ -4780,6 +4666,9 @@ void Init_llama_cpp(void) {
|
|
4780
4666
|
/* llama_model_load_from_splits */
|
4781
4667
|
rb_define_module_function(rb_mLlamaCpp, "llama_model_load_from_splits", rb_llama_model_load_from_splits, 2);
|
4782
4668
|
|
4669
|
+
/* llama_model_save_to_file */
|
4670
|
+
rb_define_module_function(rb_mLlamaCpp, "llama_model_save_to_file", rb_llama_model_save_to_file, 2);
|
4671
|
+
|
4783
4672
|
/* llama_model_free */
|
4784
4673
|
rb_define_module_function(rb_mLlamaCpp, "llama_model_free", rb_llama_model_free, 1);
|
4785
4674
|
|
@@ -4907,18 +4796,6 @@ void Init_llama_cpp(void) {
|
|
4907
4796
|
|
4908
4797
|
/* TODO: llama_apply_adapter_cvec */
|
4909
4798
|
|
4910
|
-
/**
|
4911
|
-
* Document-class: LlamaCpp::LlamaKvCacheViewCell
|
4912
|
-
* "struct llama_kv_cache_view_cell" wrapper class
|
4913
|
-
*/
|
4914
|
-
VALUE rb_cLlamaKvCacheViewCell = rb_define_class_under(rb_mLlamaCpp, "LlamaKvCacheViewCell", rb_cObject);
|
4915
|
-
rb_define_alloc_func(rb_cLlamaKvCacheViewCell, llama_kv_cache_view_cell_alloc);
|
4916
|
-
/**
|
4917
|
-
* Document-method: pos
|
4918
|
-
* @return [Integer]
|
4919
|
-
*/
|
4920
|
-
rb_define_method(rb_cLlamaKvCacheViewCell, "pos", RUBY_METHOD_FUNC(llama_kv_cache_view_cell_get_pos), 0);
|
4921
|
-
|
4922
4799
|
/**
|
4923
4800
|
* Document-class: LlamaCpp::LlamaKvCache
|
4924
4801
|
* "struct llama_kv_cache" wrapper class
|
@@ -4926,58 +4803,6 @@ void Init_llama_cpp(void) {
|
|
4926
4803
|
rb_cLlamaKvCache = rb_define_class_under(rb_mLlamaCpp, "LlamaKvCache", rb_cObject);
|
4927
4804
|
rb_define_alloc_func(rb_cLlamaKvCache, llama_kv_cache_wrapper_alloc);
|
4928
4805
|
|
4929
|
-
/**
|
4930
|
-
* Document-class: LlamaCpp::LlamaKvCacheView
|
4931
|
-
* "struct llama_kv_cache_view" wrapper class
|
4932
|
-
*/
|
4933
|
-
rb_cLlamaKvCacheView = rb_define_class_under(rb_mLlamaCpp, "LlamaKvCacheView", rb_cObject);
|
4934
|
-
rb_define_alloc_func(rb_cLlamaKvCacheView, llama_kv_cache_view_alloc);
|
4935
|
-
/**
|
4936
|
-
* Document-method: n_cells
|
4937
|
-
* @return [Integer]
|
4938
|
-
*/
|
4939
|
-
rb_define_method(rb_cLlamaKvCacheView, "n_cells", RUBY_METHOD_FUNC(llama_kv_cache_view_get_n_cells), 0);
|
4940
|
-
/**
|
4941
|
-
* Document-method: n_seq_max
|
4942
|
-
* @return [Integer]
|
4943
|
-
*/
|
4944
|
-
rb_define_method(rb_cLlamaKvCacheView, "n_seq_max", RUBY_METHOD_FUNC(llama_kv_cache_view_get_n_seq_max), 0);
|
4945
|
-
/**
|
4946
|
-
* Document-method: token_count
|
4947
|
-
* @return [Integer]
|
4948
|
-
*/
|
4949
|
-
rb_define_method(rb_cLlamaKvCacheView, "token_count", RUBY_METHOD_FUNC(llama_kv_cache_view_get_token_count), 0);
|
4950
|
-
/**
|
4951
|
-
* Document-method: used_cells
|
4952
|
-
* @return [Integer]
|
4953
|
-
*/
|
4954
|
-
rb_define_method(rb_cLlamaKvCacheView, "used_cells", RUBY_METHOD_FUNC(llama_kv_cache_view_get_used_cells), 0);
|
4955
|
-
/**
|
4956
|
-
* Document-method: max_contiguous
|
4957
|
-
* @return [Integer]
|
4958
|
-
*/
|
4959
|
-
rb_define_method(rb_cLlamaKvCacheView, "max_contiguous", RUBY_METHOD_FUNC(llama_kv_cache_view_get_max_contiguous), 0);
|
4960
|
-
/**
|
4961
|
-
* Document-method: max_contiguous_idx
|
4962
|
-
* @return [Integer]
|
4963
|
-
*/
|
4964
|
-
rb_define_method(rb_cLlamaKvCacheView, "max_contiguous_idx", RUBY_METHOD_FUNC(llama_kv_cache_view_get_max_contiguous_idx), 0);
|
4965
|
-
|
4966
|
-
/* llama_kv_cache_view_init */
|
4967
|
-
rb_define_module_function(rb_mLlamaCpp, "llama_kv_cache_view_init", rb_llama_kv_cache_view_init, 2);
|
4968
|
-
|
4969
|
-
/* llama_kv_cache_view_free */
|
4970
|
-
rb_define_module_function(rb_mLlamaCpp, "llama_kv_cache_view_free", rb_llama_kv_cache_view_free, 1);
|
4971
|
-
|
4972
|
-
/* llama_kv_cache_view_update */
|
4973
|
-
rb_define_module_function(rb_mLlamaCpp, "llama_kv_cache_view_update", rb_llama_kv_cache_view_update, 2);
|
4974
|
-
|
4975
|
-
/* llama_kv_self_n_tokens */
|
4976
|
-
rb_define_module_function(rb_mLlamaCpp, "llama_kv_self_n_tokens", rb_llama_kv_self_n_tokens, 1);
|
4977
|
-
|
4978
|
-
/* llama_kv_self_used_cells */
|
4979
|
-
rb_define_module_function(rb_mLlamaCpp, "llama_kv_self_used_cells", rb_llama_kv_self_used_cells, 1);
|
4980
|
-
|
4981
4806
|
/* llama_kv_self_clear */
|
4982
4807
|
rb_define_module_function(rb_mLlamaCpp, "llama_kv_self_clear", rb_llama_kv_self_clear, 1);
|
4983
4808
|
|
@@ -4996,6 +4821,9 @@ void Init_llama_cpp(void) {
|
|
4996
4821
|
/* llama_kv_self_seq_div */
|
4997
4822
|
rb_define_module_function(rb_mLlamaCpp, "llama_kv_self_seq_div", rb_llama_kv_self_seq_div, 5);
|
4998
4823
|
|
4824
|
+
/* llama_kv_self_seq_pos_min */
|
4825
|
+
rb_define_module_function(rb_mLlamaCpp, "llama_kv_self_seq_pos_min", rb_llama_kv_self_seq_pos_min, 2);
|
4826
|
+
|
4999
4827
|
/* llama_kv_self_seq_pos_max */
|
5000
4828
|
rb_define_module_function(rb_mLlamaCpp, "llama_kv_self_seq_pos_max", rb_llama_kv_self_seq_pos_max, 2);
|
5001
4829
|
|
@@ -5316,4 +5144,10 @@ void Init_llama_cpp(void) {
|
|
5316
5144
|
|
5317
5145
|
/* llama_perf_sampler_reset */
|
5318
5146
|
rb_define_module_function(rb_mLlamaCpp, "llama_perf_sampler_reset", rb_llama_perf_sampler_reset, 1);
|
5147
|
+
|
5148
|
+
/* TODO: typedef bool (*llama_opt_param_filter) */
|
5149
|
+
/* TODO: bool llama_opt_param_filter_all */
|
5150
|
+
/* TODO: struct llama_opt_params */
|
5151
|
+
/* TODO: void llama_opt_init */
|
5152
|
+
/* TODO: void llama_opt_epoch */
|
5319
5153
|
}
|
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.
|
6
|
+
VERSION = '0.20.0'
|
7
7
|
|
8
8
|
# The supported version of llama.cpp.
|
9
|
-
LLAMA_CPP_VERSION = '
|
9
|
+
LLAMA_CPP_VERSION = 'b5460'
|
10
10
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: llama_cpp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.20.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- yoshoku
|
@@ -49,7 +49,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
49
49
|
- !ruby/object:Gem::Version
|
50
50
|
version: '0'
|
51
51
|
requirements: []
|
52
|
-
rubygems_version: 3.6.
|
52
|
+
rubygems_version: 3.6.9
|
53
53
|
specification_version: 4
|
54
54
|
summary: Ruby bindings for the llama.cpp.
|
55
55
|
test_files: []
|