Llama.LoadModel
---------------

Load the model from a file.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [Llama](component_Llama.md) | [16.1](newinversion161.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "Llama.LoadModel"; LlamaSession; Path { ; Options } ) 

**MBS**( **"Llama.LoadModel";** /\* Load the model from a file. \*/  
**$LlamaSession**; /\* The session identifier.e.g. $$session \*/   
**$Path**; /\* The native path to the model.e.g. "/Users/cs/gemma-3-1b-it.Q8\_0.gguf" \*/   
**$Options**) /\* Optional; The JSON with parameters.  
Optionally you can pass a number for n\_gpu\_layers or main\_gpu.   
n\_gpu\_layers: number of layers to store in VRAM, a negative value means all layers \*/ 

### Parameters

| Parameter | Description | Example | Flags |
|---|---|---|---|
| LlamaSession | The session identifier. | $$session |  |
| Path | The native path to the model. | "/Users/cs/gemma-3-1b-it.Q8\_0.gguf" |  |
| Options | The JSON with parameters.   Optionally you can pass a number for n\_gpu\_layers or main\_gpu.    n\_gpu\_layers: number of layers to store in VRAM, a negative value means all layers |  | Optional |

### Result

Returns OK or error.

### Description

Load the model from a file.  
If the file is split into multiple parts, the file name must follow this pattern: &lt;name&gt;-%05d-of-%05d.gguf  
e.g. gemma-3-1b-it.Q8\_0.gguf or gpt-oss-20b-Q4\_K\_M.gguf  
### Examples

Load a model on macOS:

 Set Variable \[ $path ; Value: "/Users/cs/gemma-3-1b-it.Q8\_0.gguf" \]  
Set Variable \[ $r ; Value: MBS ("Llama.LoadModel"; $$session ; $path ) \]  
If \[ MBS ("IsError") \]  
 Show Custom Dialog \[ "Failed to load model." ; $r \]  
End If  
Load a model on Windows:

 Set Variable \[ $path ; Value: "C:\\Users\\User\\Modesl\\gemma-3-1b-it.Q8\_0.gguf" \]  
Set Variable \[ $r ; Value: MBS ("Llama.LoadModel"; $$session ; $path ) \]  
If \[ MBS ("IsError") \]  
 Show Custom Dialog \[ "Failed to load model." ; $r \]  
End If  
### See also

- [IsError](IsError.md)
- [Llama.CloseModel](LlamaCloseModel.md)

### Example Databases

- [Llama chat](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Llama%20chat.shtml#10ScriptAnchor_)

### Blog Entries

- [Use Llama.cpp in FileMaker](https://www.mbsplugins.de/archive/2026-02-17/Use_Llamacpp_in_FileMaker/monkeybreadsoftware_blog_filemaker)

Created 10th February 2026 , last changed 16th February 2026

  
[Llama.LoadLibrary](LlamaLoadLibrary.md) - [Llama.Loaded](LlamaLoaded.md)

[HTML Version](LlamaLoadModel.shtml)