llama_cpp 0.17.10 → 0.18.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +16 -0
- data/LICENSE.txt +1 -1
- data/README.md +8 -31
- data/ext/llama_cpp/extconf.rb +0 -3
- data/ext/llama_cpp/llama_cpp.c +5174 -0
- data/ext/llama_cpp/llama_cpp.h +0 -5
- data/lib/llama_cpp/version.rb +3 -3
- data/lib/llama_cpp.rb +38 -83
- metadata +4 -13
- data/examples/README.md +0 -92
- data/examples/chat.rb +0 -198
- data/examples/embedding.rb +0 -42
- data/examples/prompt_jp.txt +0 -8
- data/examples/simple.rb +0 -96
- data/ext/llama_cpp/llama_cpp.cpp +0 -3764
- data/sig/llama_cpp.rbs +0 -425
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 66599243db8e088ab250be615f142cc0c3d63ee0f7661e8300dbd569fd100ac5
|
4
|
+
data.tar.gz: 2bfdbc95133df7939276547dbae237c5ccd2175a1a8cee2e81cc3579bf3fa00a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 365cad9872ed2601700de4a4a4fc7ef5a13c307e4b8ba199f0b3b2c567dd252e402661fd9161f663c3b5dd2fff70f2c935e333b904a0923de0e8aa9955319b63
|
7
|
+
data.tar.gz: 4b5275081819595983bb9681951b7c25e1764e7039951368624fc8dc5bdbee9848136f0f98624f1cc07575a76d09e63bf3b2f88effd1ea1c0edd098dd0bb050f
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,19 @@
|
|
1
|
+
|
2
|
+
## [[0.18.1](https://github.com/yoshoku/llama_cpp.rb/compare/v0.18.0...v0.18.1)] - 2025-02-15
|
3
|
+
|
4
|
+
- Change supported llama.cpp version to b4713
|
5
|
+
- Add `llama_sampler_init_top_n_sigma` module function.
|
6
|
+
- Remove old type declaration file.
|
7
|
+
|
8
|
+
## [[0.18.0](https://github.com/yoshoku/llama_cpp.rb/compare/v0.17.10...v0.18.0)] - 2025-02-02
|
9
|
+
|
10
|
+
**Breaking Changes**
|
11
|
+
|
12
|
+
All the native extensions code was rewritten in C. The high-level API has been removed and replaced with a simple bindings library.
|
13
|
+
The fast update speed of llama.cpp makes it difficult to keep up with the creation of this binding library.
|
14
|
+
[As previously noted](https://github.com/yoshoku/llama_cpp.rb/blob/main/CHANGELOG.md#060---2023-09-30),
|
15
|
+
the author has given up on continuing to develop this binding library. Thank you for your understanding.
|
16
|
+
|
1
17
|
## [[0.17.10](https://github.com/yoshoku/llama_cpp.rb/compare/v0.17.9...v0.17.10)] - 2024-09-07
|
2
18
|
|
3
19
|
- Change supported llama.cpp version to b3676.
|
data/LICENSE.txt
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
The MIT License (MIT)
|
2
2
|
|
3
|
-
Copyright (c) 2023-
|
3
|
+
Copyright (c) 2023-2025 Atsushi Tatsuma
|
4
4
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
data/README.md
CHANGED
@@ -6,8 +6,6 @@
|
|
6
6
|
|
7
7
|
llama_cpp.rb provides Ruby bindings for the [llama.cpp](https://github.com/ggerganov/llama.cpp).
|
8
8
|
|
9
|
-
This gem is still under development and may undergo many changes in the future.
|
10
|
-
|
11
9
|
## Installation
|
12
10
|
|
13
11
|
Install the llama.cpp. If you use homebrew, install it by executing:
|
@@ -57,41 +55,20 @@ An example of Ruby code that generates sentences with the quantization model is
|
|
57
55
|
```ruby
|
58
56
|
require 'llama_cpp'
|
59
57
|
|
60
|
-
|
61
|
-
model = LLaMACpp::Model.new(model_path: '/home/user/llama.cpp/models/open_llama_7b/ggml-model-q4_0.bin', params: model_params)
|
62
|
-
|
63
|
-
context_params = LLaMACpp::ContextParams.new
|
64
|
-
context_params.seed = 42
|
65
|
-
context = LLaMACpp::Context.new(model: model, params: context_params)
|
58
|
+
LlamaCpp.ggml_backend_load_all
|
66
59
|
|
67
|
-
|
68
|
-
|
60
|
+
model_params = LlamaCpp::LlamaModelParams.new
|
61
|
+
model = LlamaCpp::llama_model_load_from_file('/home/user/llama.cpp/models/open_llama_7b/ggml-model-q4_0.bin', model_params)
|
69
62
|
|
70
|
-
|
71
|
-
|
63
|
+
context_params = LlamaCpp::LlamaContextParams.new
|
64
|
+
context = LlamaCpp.llama_init_from_model(model, context_params)
|
72
65
|
|
73
|
-
|
74
|
-
$ git clone https://github.com/yoshoku/llama_cpp.rb.git
|
75
|
-
$ cd examples
|
76
|
-
$ bundle install
|
77
|
-
$ ruby chat.rb --model /home/user/llama.cpp/models/open_llama_7b/ggml-model-q4_0.bin --seed 2023
|
78
|
-
...
|
79
|
-
User: Who is the originator of the Ruby programming language?
|
80
|
-
Bob: The originator of the Ruby programming language is Mr. Yukihiro Matsumoto.
|
81
|
-
User:
|
82
|
-
```
|
83
|
-
|
84
|
-

|
85
|
-
|
86
|
-
Japanse chat is also possible using the [Vicuna model on Hugging Face](https://huggingface.co/CRD716/ggml-vicuna-1.1-quantized).
|
66
|
+
puts LLaMACpp.generate(context, 'Hello, World.')
|
87
67
|
|
88
|
-
|
89
|
-
|
90
|
-
$ ruby chat.rb --model ggml-vicuna-7b-1.1-q4_0.bin --file prompt_jp.txt
|
68
|
+
LlamaCpp.llama_free(context)
|
69
|
+
LlamaCpp.llama_model_free(model)
|
91
70
|
```
|
92
71
|
|
93
|
-

|
94
|
-
|
95
72
|
## Contributing
|
96
73
|
|
97
74
|
Bug reports and pull requests are welcome on GitHub at https://github.com/yoshoku/llama_cpp.rb.
|
data/ext/llama_cpp/extconf.rb
CHANGED
@@ -2,10 +2,7 @@
|
|
2
2
|
|
3
3
|
require 'mkmf'
|
4
4
|
|
5
|
-
abort('libstdc++ is not found.') unless have_library('stdc++')
|
6
5
|
abort('libllama is not found.') unless have_library('llama')
|
7
6
|
abort('llama.h is not found.') unless have_header('llama.h')
|
8
7
|
|
9
|
-
$CXXFLAGS << ' -std=c++11'
|
10
|
-
|
11
8
|
create_makefile('llama_cpp/llama_cpp')
|