@@ -290,13 +290,14 @@ def llama_mlock_supported() -> bool:
290
290
291
291
# // TODO: not great API - very likely to change
292
292
# // Initialize the llama + ggml backend
293
+ # // If numa is true, use NUMA optimizations
293
294
# // Call once at the start of the program
294
- # LLAMA_API void llama_init_backend();
295
- def llama_init_backend ():
296
- return _lib .llama_init_backend ()
295
+ # LLAMA_API void llama_init_backend(bool numa );
296
+ def llama_init_backend (numa : c_bool ):
297
+ return _lib .llama_init_backend (numa )
297
298
298
299
299
- _lib .llama_init_backend .argtypes = []
300
+ _lib .llama_init_backend .argtypes = [c_bool ]
300
301
_lib .llama_init_backend .restype = None
301
302
302
303
@@ -565,6 +566,27 @@ def llama_eval(
565
566
_lib .llama_eval .restype = c_int
566
567
567
568
569
+ # // Same as llama_eval, but use float matrix input directly.
570
+ # LLAMA_API int llama_eval_embd(
571
+ # struct llama_context * ctx,
572
+ # const float * embd,
573
+ # int n_tokens,
574
+ # int n_past,
575
+ # int n_threads);
576
+ def llama_eval_embd (
577
+ ctx : llama_context_p ,
578
+ embd , # type: Array[c_float]
579
+ n_tokens : c_int ,
580
+ n_past : c_int ,
581
+ n_threads : c_int ,
582
+ ) -> int :
583
+ return _lib .llama_eval_embd (ctx , embd , n_tokens , n_past , n_threads )
584
+
585
+
586
+ _lib .llama_eval_embd .argtypes = [llama_context_p , c_float_p , c_int , c_int , c_int ]
587
+ _lib .llama_eval_embd .restype = c_int
588
+
589
+
568
590
# Convert the provided text into tokens.
569
591
# The tokens pointer must be large enough to hold the resulting tokens.
570
592
# Returns the number of tokens on success, no more than n_max_tokens
@@ -998,5 +1020,5 @@ def llama_print_system_info() -> bytes:
998
1020
_llama_initialized = False
999
1021
1000
1022
if not _llama_initialized :
1001
- llama_init_backend ()
1023
+ llama_init_backend (c_bool ( False ) )
1002
1024
_llama_initialized = True
0 commit comments