@@ -521,15 +521,17 @@ def _warn_deprecated(symbol: str, hint: str) -> None:
521521
522522
523523# enum llama_load_mode {
524- # LLAMA_LOAD_MODE_NONE = 0, // no special loading mode
525- # LLAMA_LOAD_MODE_MMAP = 1, // memory map the model
526- # LLAMA_LOAD_MODE_MLOCK = 2, // mmap + force system to keep model in RAM rather than swapping or compressing
527- # LLAMA_LOAD_MODE_DIRECT_IO = 3, // use direct I/O if available
524+ # LLAMA_LOAD_MODE_NONE = 0, // no special loading mode
525+ # LLAMA_LOAD_MODE_MMAP = 1, // memory map the model
526+ # LLAMA_LOAD_MODE_MLOCK = 2, // force system to keep model in RAM rather than swapping or compressing
527+ # LLAMA_LOAD_MODE_MMAP_MLOCK = 3, // mmap + force system to keep model in RAM rather than swapping or compressing
528+ # LLAMA_LOAD_MODE_DIRECT_IO = 4, // use direct I/O if available
528529# };
529530LLAMA_LOAD_MODE_NONE = 0
530531LLAMA_LOAD_MODE_MMAP = 1
531532LLAMA_LOAD_MODE_MLOCK = 2
532- LLAMA_LOAD_MODE_DIRECT_IO = 3
533+ LLAMA_LOAD_MODE_MMAP_MLOCK = 3
534+ LLAMA_LOAD_MODE_DIRECT_IO = 4
533535
534536
535537# enum llama_context_type {
@@ -829,6 +831,7 @@ class llama_model_imatrix_data(ctypes.Structure):
829831# bool use_extra_bufts; // use extra buffer types (used for weight repacking)
830832# bool no_host; // bypass host buffer allowing extra buffers to be used
831833# bool no_alloc; // only load metadata and simulate memory allocations
834+ # bool load_mtp; // whether to load MTP layers
832835# };
833836class llama_model_params (ctypes .Structure ):
834837 """Parameters for llama_model
@@ -848,7 +851,8 @@ class llama_model_params(ctypes.Structure):
848851 check_tensors (bool): validate model tensor data
849852 use_extra_bufts (bool): use extra buffer types (used for weight repacking)
850853 no_host (bool): bypass host buffer allowing extra buffers to be used
851- no_alloc (bool): only load metadata and simulate memory allocations"""
854+ no_alloc (bool): only load metadata and simulate memory allocations
855+ load_mtp (bool): whether to load MTP layers"""
852856
853857 if TYPE_CHECKING :
854858 devices : CtypesArray [ctypes .c_void_p ] # NOTE: unused
@@ -868,6 +872,7 @@ class llama_model_params(ctypes.Structure):
868872 use_extra_bufts : bool
869873 no_host : bool
870874 no_alloc : bool
875+ load_mtp : bool
871876
872877 _fields_ = [
873878 ("devices" , ctypes .c_void_p ), # NOTE: unnused
@@ -885,6 +890,7 @@ class llama_model_params(ctypes.Structure):
885890 ("use_extra_bufts" , ctypes .c_bool ),
886891 ("no_host" , ctypes .c_bool ),
887892 ("no_alloc" , ctypes .c_bool ),
893+ ("load_mtp" , ctypes .c_bool ),
888894 ]
889895
890896
@@ -3549,6 +3555,20 @@ def llama_vocab_get_add_eos(vocab: llama_vocab_p, /) -> bool: ...
35493555def llama_vocab_get_add_sep (vocab : llama_vocab_p , / ) -> bool : ...
35503556
35513557
3558+ # // model-specific suppress tokens (gguf key: tokenizer.ggml.suppress_tokens)
3559+ # LLAMA_API const llama_token * llama_vocab_get_suppress_tokens(const struct llama_vocab * vocab, int32_t * n_suppress_tokens);
3560+ @ctypes_function (
3561+ "llama_vocab_get_suppress_tokens" ,
3562+ [llama_vocab_p_ctypes , ctypes .POINTER (ctypes .c_int32 )],
3563+ ctypes .POINTER (llama_token ),
3564+ )
3565+ def llama_vocab_get_suppress_tokens (
3566+ vocab : llama_vocab_p ,
3567+ n_suppress_tokens : CtypesPointer [ctypes .c_int32 ],
3568+ / ,
3569+ ) -> Optional [CtypesPointer [llama_token ]]: ...
3570+
3571+
35523572# LLAMA_API llama_token llama_vocab_fim_pre(const struct llama_vocab * vocab);
35533573@ctypes_function (
35543574 "llama_vocab_fim_pre" ,
0 commit comments