class
ion7.core.Model
Functions
build_model_params
Build a `llama_model_params` cdata from the user-facing options table. Defaults match `llama_model_default_params` ; only the four flags we expose at the Lua level get overridden.
Model.load
Load a GGUF model from disk.
raises — When the file cannot be opened or the model fails to load.
Model.load_splits
Load a sharded GGUF model from an explicit list of paths. Use when the shards do not follow the standard auto-discovery naming (`model-00001-of-NNNN.gguf`). Paths must be in shard order.
raises — When loading fails.
Model.load_from_fd
Load a model from an already-open `FILE*` handle. The caller retains ownership of the FILE — it is NOT closed by this call.
raises — When loading fails.
Model.fit_params
Auto-fit a model's `n_gpu_layers` and `n_ctx` to the available VRAM. Wraps the bridge's `ion7_params_fit`, which itself wraps libcommon's `common_fit_params`. NOT thread-safe — call before any other model load on the same process.
Model:ptr
Return the raw `llama_model*` cdata pointer.
Model:free
Explicitly free the model and release VRAM immediately. After this the Model object is dead — calling any other method on it is undefined. The `ffi.gc` finalizer is disarmed first to avoid a double-free if the GC runs later.
Model:save
Save the (possibly modified) model back to a GGUF file. Useful after applying quantization or merging LoRA adapters.