Loading page

Download a GGUF text model

After building llama.cpp, download a text model to run inference on.

Use a small GGUF text model such as the Qwen2.5 0.5B Instruct Q4_0 GGUF file . Using a small model allows you to focus on application bring-up. The Qwen2.5 0.5B Instruct GGUF file is available under an Apache-2.0 license.

Choose the model location

Use the work filesystem. Make sure that it still has room for a temporary download and the complete model:

    

        
        
LP2_MODEL_DIR="$LP2_WORK_DIR/models"
mkdir -p "$LP2_MODEL_DIR"
df -h "$LP2_MODEL_DIR"
LP2_MODEL_FILE="$LP2_MODEL_DIR/qwen2.5-0.5b-instruct-q4_0.gguf"

    

The output is similar to:

    

        
        Filesystem      Size  Used Avail Use% Mounted on
/dev/root        28G  2.9G   23G  12% /

        
    

These figures describe the guest before the model download.

Obtain the fixed model file

If the guest can reach Hugging Face, download the file from the fixed repository revision:

    

        
        
LP2_MODEL_REV=6dd44a1fb35d11b5d1b28902876ce3cc9e882d0e
wget -q -O "$LP2_MODEL_FILE" \
    "https://huggingface.co/Qwen/Qwen2.5-0.5B-Instruct-GGUF/resolve/$LP2_MODEL_REV/qwen2.5-0.5b-instruct-q4_0.gguf?download=true"
printf 'Download exit status: %s\n' "$?"

    

The output is similar to:

    

        
        Download exit status: 0

        
    

Continue only if the download exit status is 0.

Check the file identity

A successful download command doesn’t establish that the file has the expected contents.

Compare the downloaded or transferred file with the published SHA-256 for this Q4_0 file:

    

        
        
LP2_MODEL_SHA256=7671c0c304e6ce5a7fc577bcb12aba01e2c155cc2efd29b2213c95b18edaf6ed
test -s "$LP2_MODEL_FILE" && wc -c "$LP2_MODEL_FILE"
printf '%s  %s\n' "$LP2_MODEL_SHA256" "$LP2_MODEL_FILE" | sha256sum -c -
printf 'Hash check exit status: %s\n' "$?"

    

The output is similar to:

    

        
        428730208 /root/zena-llamacpp/models/qwen2.5-0.5b-instruct-q4_0.gguf
/root/zena-llamacpp/models/qwen2.5-0.5b-instruct-q4_0.gguf: OK
Hash check exit status: 0

        
    

If your check fails, stop before inference. Investigate the file source, revision, partial download, or expected hash.

What you’ve accomplished and what’s next

You’ve downloaded and identified a model artifact separate from the runtime binary. Keep LP2_MODEL_FILE available in the same guest shell for inference.

Next, you’ll run inference on the Zena CSS virtual platform and inspect the result.