@@ -79,6 +79,7 @@ def __init__(
7979 n_ctx : int = 512 ,
8080 n_batch : int = 512 ,
8181 n_ubatch : int = 512 ,
82+ n_seq_max : int = 1 ,
8283 n_threads : Optional [int ] = None ,
8384 n_threads_batch : Optional [int ] = None ,
8485 rope_scaling_type : Optional [
@@ -95,13 +96,13 @@ def __init__(
9596 yarn_beta_slow : float = 1.0 ,
9697 yarn_orig_ctx : int = 0 ,
9798 logits_all : bool = False ,
98- embedding : bool = False ,
99+ embeddings : bool = False ,
99100 offload_kqv : bool = True ,
101+ no_perf : bool = False ,
100102 op_offload : Optional [bool ] = None ,
101103 swa_full : Optional [bool ] = None ,
102104 kv_unified : Optional [bool ] = None ,
103105 # Sampling Params
104- no_perf : bool = False ,
105106 last_n_tokens_size : int = 64 ,
106107 # LoRA Params
107108 lora_base : Optional [str ] = None ,
@@ -168,6 +169,7 @@ def __init__(
168169 n_ctx: Text context, 0 = from model
169170 n_batch: Prompt processing maximum batch size
170171 n_ubatch: Physical batch size
172+ n_seq_max: max number of sequences (i.e. distinct states for recurrent models)
171173 n_threads: Number of threads to use for generation
172174 n_threads_batch: Number of threads to use for batch processing
173175 rope_scaling_type: RoPE scaling type, from `enum llama_rope_scaling_type`. ref: https://github.com/ggml-org/llama.cpp/pull/2054
@@ -182,12 +184,12 @@ def __init__(
182184 yarn_beta_slow: YaRN high correction dim
183185 yarn_orig_ctx: YaRN original context size
184186 logits_all: Return logits for all tokens, not just the last token. Must be True for completion to return logprobs.
185- embedding : Embedding mode only.
187+ embeddings : Embedding mode only. if true, extract embeddings (together with logits)
186188 offload_kqv: Offload K, Q, V to GPU.
189+ no_perf: Measure performance timings.
187190 op_offload: whether to offload host tensor operations to device
188191 swa_full: whether to use full-size SWA cache
189192 kv_unified: use single unified KV buffer for the KV cache of all sequences
190- no_perf: Measure performance timings.
191193 last_n_tokens_size: Maximum number of tokens to keep in the last_n_tokens deque.
192194 lora_base: Optional path to base model, useful if using a quantized base model and you want to apply LoRA to an f16 model.
193195 lora_path: Path to a LoRA file to apply to the model.
@@ -314,6 +316,7 @@ def __init__(
314316 self .model_params .kv_overrides = self ._kv_overrides_array
315317
316318 self .n_batch = min (n_ctx , n_batch ) # ???
319+ self .n_seq_max = n_seq_max
317320 self .n_threads = n_threads or max (multiprocessing .cpu_count () // 2 , 1 )
318321 self .n_threads_batch = n_threads_batch or multiprocessing .cpu_count ()
319322
@@ -325,6 +328,7 @@ def __init__(
325328 self .context_params .n_ctx = n_ctx
326329 self .context_params .n_batch = self .n_batch
327330 self .context_params .n_ubatch = min (self .n_batch , n_ubatch )
331+ self .context_params .n_seq_max = self .n_seq_max
328332 self .context_params .n_threads = self .n_threads
329333 self .context_params .n_threads_batch = self .n_threads_batch
330334 self .context_params .rope_scaling_type = (
@@ -366,10 +370,15 @@ def __init__(
366370 yarn_beta_slow if yarn_beta_slow != 0.0 else 0
367371 )
368372 self .context_params .yarn_orig_ctx = yarn_orig_ctx if yarn_orig_ctx != 0 else 0
373+
369374 self ._logits_all = logits_all if draft_model is None else True
370- self .context_params .embeddings = embedding # TODO: Rename to embeddings
375+
376+ self .context_params .embeddings = embeddings
371377 self .context_params .offload_kqv = offload_kqv
372378
379+ if no_perf is not None :
380+ self .context_params .no_perf = no_perf
381+
373382 if op_offload is not None :
374383 self .context_params .op_offload = op_offload
375384
0 commit comments