GGUF is a single file format for language models. It holds the weights, the tokenizer, and the settings, all in one file. It's used by llama dot c p p, a fast engine written in C plus plus. And the weights are usually quantized, to four or five bits, to make them small.
Here are the steps. First, a script from the llama dot c p p project converts our merged model to GGUF. Then llama quantize shrinks it to four bits. Then a model file tells Ollama which file to use, with our system message, and temperature zero. Finally, ollama create builds the model, and ollama run chats with it.
commands.shbash
# 1. convert the merged model to GGUF (script from the llama.cpp project)python convert_hf_to_gguf.py upload/merged --outfile tickets-f16.gguf# 2. quantize it to 4 bitsllama-quantize tickets-f16.gguf tickets-q4.gguf Q4_K_M# 3. describe it for Ollama, then create and run itcat > Modelfile <<'END'FROM ./tickets-q4.ggufSYSTEM "Read the customer's message. Reply with JSON: the intent and the book."PARAMETER temperature 0ENDollama create tickets -f Modelfileollama run tickets 'Is Dune in stock?'
Two things to remember. Merge the adapter first, because GGUF conversion needs a full model. And always use the same system message, and chat template, that you trained with. Then test the quantized model with your scorer, because four bits can lose some accuracy.
Let's recap. GGUF is one file, for llama dot c p p. Merge, convert, and quantize. Ollama runs it with a simple model file. And re-test after quantizing. Next, making inference faster.