llama_cpp 0.0.6 → 0.0.7
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 +13 -1
 - data/ext/llama_cpp/extconf.rb +9 -0
 - data/ext/llama_cpp/llama_cpp.cpp +26 -0
 - data/ext/llama_cpp/src/ggml-cuda.h +32 -0
 - data/ext/llama_cpp/src/ggml-opencl.c +216 -0
 - data/ext/llama_cpp/src/ggml-opencl.h +24 -0
 - data/ext/llama_cpp/src/ggml.c +1436 -624
 - data/ext/llama_cpp/src/ggml.h +654 -627
 - data/ext/llama_cpp/src/llama.cpp +212 -29
 - data/ext/llama_cpp/src/llama.h +17 -13
 - data/ext/llama_cpp/src/llama_util.h +15 -2
 - data/lib/llama_cpp/client.rb +151 -0
 - data/lib/llama_cpp/version.rb +2 -2
 - data/lib/llama_cpp.rb +16 -8
 - data/sig/llama_cpp.rbs +16 -1
 - metadata +5 -2
 
    
        data/sig/llama_cpp.rbs
    CHANGED
    
    | 
         @@ -12,9 +12,12 @@ module LLaMACpp 
     | 
|
| 
       12 
12 
     | 
    
         
             
              LLAMA_FTYPE_MOSTLY_Q4_1_SOME_F16: Integer
         
     | 
| 
       13 
13 
     | 
    
         
             
              LLAMA_FTYPE_MOSTLY_Q4_2: Integer
         
     | 
| 
       14 
14 
     | 
    
         
             
              LLAMA_FTYPE_MOSTLY_Q4_3: Integer
         
     | 
| 
      
 15 
     | 
    
         
            +
              LLAMA_FTYPE_MOSTLY_Q8_0: Integer
         
     | 
| 
      
 16 
     | 
    
         
            +
              LLAMA_FTYPE_MOSTLY_Q5_0: Integer
         
     | 
| 
      
 17 
     | 
    
         
            +
              LLAMA_FTYPE_MOSTLY_Q5_1: Integer
         
     | 
| 
       15 
18 
     | 
    
         | 
| 
       16 
19 
     | 
    
         
             
              def self?.model_quantize: (input_path: String, output_path: String, ftype: Integer, ?n_threads: Integer) -> void
         
     | 
| 
       17 
     | 
    
         
            -
              def self?.generate: (::LLaMACpp::Context, String, ?n_threads: Integer) -> String
         
     | 
| 
      
 20 
     | 
    
         
            +
              def self?.generate: (::LLaMACpp::Context, String, ?n_predict: Integer, ?n_threads: Integer) -> String
         
     | 
| 
       18 
21 
     | 
    
         
             
              def self?.print_system_info: () -> void
         
     | 
| 
       19 
22 
     | 
    
         
             
              def self?.token_bos: () -> Integer
         
     | 
| 
       20 
23 
     | 
    
         
             
              def self?.token_eos: () -> Integer
         
     | 
| 
         @@ -27,6 +30,7 @@ module LLaMACpp 
     | 
|
| 
       27 
30 
     | 
    
         
             
                def initialize: (model_path: String, params: ::LLaMACpp::ContextParams) -> void
         
     | 
| 
       28 
31 
     | 
    
         
             
                              | () -> void
         
     | 
| 
       29 
32 
     | 
    
         
             
                def embeddings: () -> Array[Float]
         
     | 
| 
      
 33 
     | 
    
         
            +
                def empty?: () -> bool
         
     | 
| 
       30 
34 
     | 
    
         
             
                def eval: (tokens: Array[Integer], n_past: Integer, ?n_tokens: Integer, ?n_threads: Integer) -> void
         
     | 
| 
       31 
35 
     | 
    
         
             
                def free: () -> void
         
     | 
| 
       32 
36 
     | 
    
         
             
                def load: (model_path: String, params: ::LLaMACpp::ContextParams) -> void
         
     | 
| 
         @@ -59,9 +63,20 @@ module LLaMACpp 
     | 
|
| 
       59 
63 
     | 
    
         
             
                def seed=: (Integer) -> Integer
         
     | 
| 
       60 
64 
     | 
    
         
             
                def use_mlock: () -> bool
         
     | 
| 
       61 
65 
     | 
    
         
             
                def use_mlock=: (bool) -> bool
         
     | 
| 
      
 66 
     | 
    
         
            +
                def use_mmap: () -> bool
         
     | 
| 
      
 67 
     | 
    
         
            +
                def use_mmap=: (bool) -> bool
         
     | 
| 
       62 
68 
     | 
    
         
             
                def vocab_only: () -> bool
         
     | 
| 
       63 
69 
     | 
    
         
             
                def vocab_only=: (bool) -> bool
         
     | 
| 
       64 
70 
     | 
    
         
             
              end
         
     | 
| 
       65 
71 
     | 
    
         | 
| 
       66 
72 
     | 
    
         
             
              class Params = ContextParams
         
     | 
| 
      
 73 
     | 
    
         
            +
             
     | 
| 
      
 74 
     | 
    
         
            +
              class Client
         
     | 
| 
      
 75 
     | 
    
         
            +
                def initialize(model_path: String, ?lora_adapter_path: String, ?lora_base_path: String,
         
     | 
| 
      
 76 
     | 
    
         
            +
                               ?n_ctx: Integer, ?n_parts: Integer, ?memory_f16: bool, ?use_mmap: bool, ?use_mlock: bool,
         
     | 
| 
      
 77 
     | 
    
         
            +
                               ?embedding: bool, ?n_threads: Integer, ?seed: Integer) -> void
         
     | 
| 
      
 78 
     | 
    
         
            +
                def completions(String, ?max_tokens: Integer, ?n_keep: Integer, ?repeat_last_n: Integer, ?n_batch: Integer,
         
     | 
| 
      
 79 
     | 
    
         
            +
                                ?top_k: Integer, ?top_p: Float, ?temperature: Float, ?repeat_penalty: Float) -> String
         
     | 
| 
      
 80 
     | 
    
         
            +
                def embeddings(String) -> Array[Float]
         
     | 
| 
      
 81 
     | 
    
         
            +
              end
         
     | 
| 
       67 
82 
     | 
    
         
             
            end
         
     | 
    
        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.0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.0.7
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - yoshoku
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire:
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: exe
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2023-04- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2023-04-29 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies: []
         
     | 
| 
       13 
13 
     | 
    
         
             
            description: llama_cpp.rb provides Ruby bindings for the llama.cpp.
         
     | 
| 
       14 
14 
     | 
    
         
             
            email:
         
     | 
| 
         @@ -27,12 +27,15 @@ files: 
     | 
|
| 
       27 
27 
     | 
    
         
             
            - ext/llama_cpp/llama_cpp.h
         
     | 
| 
       28 
28 
     | 
    
         
             
            - ext/llama_cpp/src/LICENSE
         
     | 
| 
       29 
29 
     | 
    
         
             
            - ext/llama_cpp/src/ggml-cuda.h
         
     | 
| 
      
 30 
     | 
    
         
            +
            - ext/llama_cpp/src/ggml-opencl.c
         
     | 
| 
      
 31 
     | 
    
         
            +
            - ext/llama_cpp/src/ggml-opencl.h
         
     | 
| 
       30 
32 
     | 
    
         
             
            - ext/llama_cpp/src/ggml.c
         
     | 
| 
       31 
33 
     | 
    
         
             
            - ext/llama_cpp/src/ggml.h
         
     | 
| 
       32 
34 
     | 
    
         
             
            - ext/llama_cpp/src/llama.cpp
         
     | 
| 
       33 
35 
     | 
    
         
             
            - ext/llama_cpp/src/llama.h
         
     | 
| 
       34 
36 
     | 
    
         
             
            - ext/llama_cpp/src/llama_util.h
         
     | 
| 
       35 
37 
     | 
    
         
             
            - lib/llama_cpp.rb
         
     | 
| 
      
 38 
     | 
    
         
            +
            - lib/llama_cpp/client.rb
         
     | 
| 
       36 
39 
     | 
    
         
             
            - lib/llama_cpp/version.rb
         
     | 
| 
       37 
40 
     | 
    
         
             
            - sig/llama_cpp.rbs
         
     | 
| 
       38 
41 
     | 
    
         
             
            homepage: https://github.com/yoshoku/llama_cpp.rb
         
     |