New Tool Radar

Local AI

How to Import a GGUF File into Ollama with a Modelfile

Point a one-line Modelfile at a GGUF file already on your disk, create a named Ollama model from it, and run it.

Schematic diagram with three steps: a GGUF file on disk, a Modelfile with a FROM line pointing at it, then ollama create practice-model and ollama run practice-model.

Most Ollama models arrive with ollama pull, but a model file you already have on disk needs a different route. A GGUF file is a single file holding a model’s weights, and Ollama’s Modelfile reference says the FROM instruction can point at one: the GGUF file location should be given as an absolute path or relative to the Modelfile location. One line in a Modelfile is enough to turn that file into a named model Ollama can run.

When this route is the right one

Use it when the file is already on your computer: a model you downloaded yourself, a file copied from another machine, or a model that is not in Ollama’s library. If the model is published in Ollama’s library, ollama pull is the shorter route, and the file never needs to touch your disk by hand. This guide is only about the file-on-disk case, which is different from the earlier guide that builds a custom model from a model already in Ollama with a system prompt: there the FROM line names a model, here it names a file.

Write the Modelfile and create the model

Put the GGUF file and the Modelfile in the same folder. For a fictional practice file called practice-model-Q4_K_M.gguf, the Modelfile is one line:

FROM ./practice-model-Q4_K_M.gguf

Then create the model, giving it a name of your own. Ollama’s Modelfile reference gives the steps as: save the file as Modelfile, run ollama create choose-a-model-name -f <location of the file e.g. ./Modelfile>, then run ollama run choose-a-model-name. For the practice file:

ollama create practice-model -f ./Modelfile
ollama run practice-model

If the GGUF file is split into several shards, the Modelfile reference says to keep the original split filenames and use a wildcard that matches every shard, or list the shards with separate FROM instructions.

Try it: a three-step import check

Work through the checks below with the practice file and name. The name you choose is local only; it does not publish anything.

Step Command What you should see
1. Create the model ollama create practice-model -f ./Modelfile The command finishes without an error about the file
2. Confirm it is listed ollama list practice-model appears in the list of models
3. Run it ollama run practice-model A chat prompt opens for the new model

If step 1 reports that the file cannot be found, the path in the FROM line does not point at the file: an absolute path removes the question entirely, and a relative path is read relative to where the Modelfile sits. Expected result. We checked Ollama’s Modelfile reference. We did not download or import a GGUF file on this machine.

Limits

The model you import is exactly the file you point at: Ollama does not re-quantize a GGUF file during import, so the size and quality in the file are the size and quality you run. A FROM line that names a file Ollama cannot read, or a model in a format other than GGUF or Safetensors, will not create a working model. The imported model also carries whatever license the file’s publisher attached to it, so check that before sharing it. We did not test any of this ourselves.

Sources

See all