llama_cpp 0.17.10 → 0.18.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/LICENSE.txt +1 -1
- data/README.md +8 -29
- data/ext/llama_cpp/extconf.rb +0 -3
- data/ext/llama_cpp/llama_cpp.c +5157 -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
- data/sig/llama_cpp.rbs +0 -59
- metadata +4 -12
- 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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0a9263eee75a3d91907c711565799fd25820d8d2b0f0ae9818a24a0798b49bf4
|
4
|
+
data.tar.gz: 9f05051e8972baea44c4bd33f63190d5da8a62156c419fc02ec6b96ea3545c31
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2543f1022462d32694649f2226d097537672bd6921af4fe6948687e00ef007b2e0425110abc7a3240d5dceb25131a3641bc9614f0e1117f3a7a40dcc55b23190
|
7
|
+
data.tar.gz: 0c54ea7e7617e99f52b0f005e8f871d5f69423e92d350bc93562ba56b48ff85a88ee6c3f01e1e6a71a0782a1bcf212f4900c7b88229a63935349cbdabee95cfc
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
## [[0.18.0](https://github.com/yoshoku/llama_cpp.rb/compare/v0.17.10...v0.18.0)] - 2025-02-02
|
2
|
+
|
3
|
+
**Breaking Changes**
|
4
|
+
All the native extensions code was rewritten in C. The high-level API has been removed and replaced with a simple bindings library.
|
5
|
+
The fast update speed of llama.cpp makes it difficult to keep up with the creation of this binding library.
|
6
|
+
[As previously noted](https://github.com/yoshoku/llama_cpp.rb/blob/main/CHANGELOG.md#060---2023-09-30),
|
7
|
+
the author has given up on continuing to develop this binding library. Thank you for your understanding.
|
8
|
+
|
1
9
|
## [[0.17.10](https://github.com/yoshoku/llama_cpp.rb/compare/v0.17.9...v0.17.10)] - 2024-09-07
|
2
10
|
|
3
11
|
- 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
@@ -57,41 +57,20 @@ An example of Ruby code that generates sentences with the quantization model is
|
|
57
57
|
```ruby
|
58
58
|
require 'llama_cpp'
|
59
59
|
|
60
|
-
|
61
|
-
model = LLaMACpp::Model.new(model_path: '/home/user/llama.cpp/models/open_llama_7b/ggml-model-q4_0.bin', params: model_params)
|
60
|
+
LlamaCpp.ggml_backend_load_all
|
62
61
|
|
63
|
-
|
64
|
-
|
65
|
-
context = LLaMACpp::Context.new(model: model, params: context_params)
|
62
|
+
model_params = LlamaCpp::LlamaModelParams.new
|
63
|
+
model = LlamaCpp::llama_model_load_from_file('/home/user/llama.cpp/models/open_llama_7b/ggml-model-q4_0.bin', model_params)
|
66
64
|
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
## Examples
|
71
|
-
There is a sample program in the [examples](https://github.com/yoshoku/llama_cpp.rb/tree/main/examples) directory that allow interactvie communication like ChatGPT.
|
72
|
-
|
73
|
-
```sh
|
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
|
-

|
65
|
+
context_params = LlamaCpp::LlamaContextParams.new
|
66
|
+
context = LlamaCpp.llama_init_from_model(model, context_params)
|
85
67
|
|
86
|
-
|
68
|
+
puts LLaMACpp.generate(context, 'Hello, World.')
|
87
69
|
|
88
|
-
|
89
|
-
|
90
|
-
$ ruby chat.rb --model ggml-vicuna-7b-1.1-q4_0.bin --file prompt_jp.txt
|
70
|
+
LlamaCpp.llama_free(context)
|
71
|
+
LlamaCpp.llama_model_free(model)
|
91
72
|
```
|
92
73
|
|
93
|
-

|
94
|
-
|
95
74
|
## Contributing
|
96
75
|
|
97
76
|
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')
|