File tree Expand file tree Collapse file tree 5 files changed +6
-15
lines changed
Expand file tree Collapse file tree 5 files changed +6
-15
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,6 @@ use std::time::Duration;
1212
1313use anyhow:: { bail, Context , Result } ;
1414use clap:: Parser ;
15- use hf_hub:: api:: sync:: ApiBuilder ;
1615
1716use llama_cpp_2:: context:: params:: { LlamaContextParams , LlamaPoolingType } ;
1817use llama_cpp_2:: context:: LlamaContext ;
@@ -156,7 +155,6 @@ fn main() -> Result<()> {
156155 // } else {
157156 // tokens_lines_list.len()
158157 // };
159- let mut embeddings_stored = 0 ;
160158 let mut max_seq_id_batch = 0 ;
161159 let mut output = Vec :: with_capacity ( tokens_lines_list. len ( ) ) ;
162160
@@ -169,16 +167,10 @@ fn main() -> Result<()> {
169167 & mut ctx,
170168 & mut batch,
171169 max_seq_id_batch,
172- n_embd,
173170 & mut output,
174171 normalise,
175172 pooling. clone ( ) ,
176173 ) ?;
177- embeddings_stored += if pooling == "none" {
178- batch. n_tokens ( )
179- } else {
180- max_seq_id_batch
181- } ;
182174 max_seq_id_batch = 0 ;
183175 batch. clear ( ) ;
184176 }
@@ -191,7 +183,6 @@ fn main() -> Result<()> {
191183 & mut ctx,
192184 & mut batch,
193185 max_seq_id_batch,
194- n_embd,
195186 & mut output,
196187 normalise,
197188 pooling. clone ( ) ,
@@ -243,7 +234,6 @@ fn batch_decode(
243234 ctx : & mut LlamaContext ,
244235 batch : & mut LlamaBatch ,
245236 s_batch : i32 ,
246- n_embd : i32 ,
247237 output : & mut Vec < Vec < f32 > > ,
248238 normalise : bool ,
249239 pooling : String ,
Original file line number Diff line number Diff line change @@ -666,11 +666,11 @@ impl LlamaModel {
666666 /// There is many ways this can fail. See [`LlamaContextLoadError`] for more information.
667667 // we intentionally do not derive Copy on `LlamaContextParams` to allow llama.cpp to change the type to be non-trivially copyable.
668668 #[ allow( clippy:: needless_pass_by_value) ]
669- pub fn new_context (
670- & self ,
669+ pub fn new_context < ' a > (
670+ & ' a self ,
671671 _: & LlamaBackend ,
672672 params : LlamaContextParams ,
673- ) -> Result < LlamaContext , LlamaContextLoadError > {
673+ ) -> Result < LlamaContext < ' a > , LlamaContextLoadError > {
674674 let context_params = params. context_params ;
675675 let context = unsafe {
676676 llama_cpp_sys_2:: llama_new_context_with_model ( self . model . as_ptr ( ) , context_params)
Original file line number Diff line number Diff line change @@ -149,7 +149,7 @@ impl LlamaModelParams {
149149 /// assert_eq!(count, 0);
150150 /// ```
151151 #[ must_use]
152- pub fn kv_overrides ( & self ) -> KvOverrides {
152+ pub fn kv_overrides < ' a > ( & ' a self ) -> KvOverrides < ' a > {
153153 KvOverrides :: new ( self )
154154 }
155155
Original file line number Diff line number Diff line change @@ -78,7 +78,7 @@ pub struct KvOverrides<'a> {
7878}
7979
8080impl KvOverrides < ' _ > {
81- pub ( super ) fn new ( model_params : & LlamaModelParams ) -> KvOverrides {
81+ pub ( super ) fn new < ' a > ( model_params : & ' a LlamaModelParams ) -> KvOverrides < ' a > {
8282 KvOverrides { model_params }
8383 }
8484}
Original file line number Diff line number Diff line change 33#![ allow( non_upper_case_globals) ]
44#![ allow( non_camel_case_types) ]
55#![ allow( non_snake_case) ]
6+ #![ allow( unpredictable_function_pointer_comparisons) ]
67
78include ! ( concat!( env!( "OUT_DIR" ) , "/bindings.rs" ) ) ;
You can’t perform that action at this time.
0 commit comments