Transformers
Installation
You need to install llama-cpp-python to use this in blendsql.
I used this command to install it on Ubuntu 25.10:
CMAKE_ARGS="-DGGML_CUDA=ON -DLLAMA_LLAVA=OFF -DLLAVA_BUILD=OFF" uv pip install llama-cpp-python --upgrade --force-reinstall --no-cache-dir
LlamaCpp
Bases: ConstrainedModel
Class for LlamaCpp local Model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filename
|
str
|
Specific .gguf file (local or on HuggingFace) to load |
required |
model_name_or_path
|
Optional[str]
|
Optional path to the model on HuggingFace |
None
|
caching
|
bool
|
Bool determining whether we access the model's cache |
True
|
config
|
Optional[dict]
|
Additional parameters to pass to the |
None
|
Examples:
from blendsql.models import LlamaCpp
model = LlamaCpp(
filename="google_gemma-3-12b-it-Q6_K.gguf",
model_name_or_path="bartowski/google_gemma-3-12b-it-GGUF",
config={"n_gpu_layers": -1, "n_ctx": 8000, "seed": 100, "n_threads": 16},
)
Source code in blendsql/models/constrained/guidance.py
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 | |