@@ -150,47 +150,43 @@ class llama_token_data_array(Structure):
150
150
151
151
152
152
# struct llama_context_params {
153
+ # int seed; // RNG seed, -1 for random
153
154
# int n_ctx; // text context
154
155
# int n_batch; // prompt processing batch size
155
156
# int n_gpu_layers; // number of layers to store in VRAM
156
157
# int main_gpu; // the GPU that is used for scratch and small tensors
157
158
# float tensor_split[LLAMA_MAX_DEVICES]; // how to split layers across multiple GPUs
158
- # bool low_vram; // if true, reduce VRAM usage at the cost of performance
159
- # int seed; // RNG seed, -1 for random
159
+ # // called with a progress value between 0 and 1, pass NULL to disable
160
+ # llama_progress_callback progress_callback;
161
+ # // context pointer passed to the progress callback
162
+ # void * progress_callback_user_data;
160
163
164
+ # // Keep the booleans together to avoid misalignment during copy-by-value.
165
+ # bool low_vram; // if true, reduce VRAM usage at the cost of performance
161
166
# bool f16_kv; // use fp16 for KV cache
162
167
# bool logits_all; // the llama_eval() call computes all logits, not just the last one
163
168
# bool vocab_only; // only load the vocabulary, no weights
164
169
# bool use_mmap; // use mmap if possible
165
170
# bool use_mlock; // force system to keep model in RAM
166
171
# bool embedding; // embedding mode only
167
-
168
-
169
- # // called with a progress value between 0 and 1, pass NULL to disable
170
- # llama_progress_callback progress_callback;
171
- # // context pointer passed to the progress callback
172
- # void * progress_callback_user_data;
173
172
# };
174
173
class llama_context_params (Structure ):
175
174
_fields_ = [
175
+ ("seed" , c_int ),
176
176
("n_ctx" , c_int ),
177
177
("n_batch" , c_int ),
178
178
("n_gpu_layers" , c_int ),
179
179
("main_gpu" , c_int ),
180
180
("tensor_split" , c_float * LLAMA_MAX_DEVICES .value ),
181
+ ("progress_callback" , llama_progress_callback ),
182
+ ("progress_callback_user_data" , c_void_p ),
181
183
("low_vram" , c_bool ),
182
- ("seed" , c_int ),
183
184
("f16_kv" , c_bool ),
184
- (
185
- "logits_all" ,
186
- c_bool ,
187
- ),
185
+ ("logits_all" , c_bool ),
188
186
("vocab_only" , c_bool ),
189
187
("use_mmap" , c_bool ),
190
188
("use_mlock" , c_bool ),
191
189
("embedding" , c_bool ),
192
- ("progress_callback" , llama_progress_callback ),
193
- ("progress_callback_user_data" , c_void_p ),
194
190
]
195
191
196
192
0 commit comments