Che cos'è il formato di file GGUF?
Un file .gguf è un file GGML Universal Format, il contenitore binario utilizzato da llama.cpp per memorizzare un modello linguistico di grandi dimensioni. Georgi Gerganov e la comunità ggml lo hanno introdotto nell'agosto 2023 come successore dei vecchi formati GGML, GGMF e GGJT. Un singolo file .gguf contiene i pesi del modello, il tokenizer e ogni iperparametro come metadati chiave-valore tipizzati, quindi non sono necessari file di configurazione separati per caricare ed eseguire il modello.
Il formato è progettato per essere autonomo, estensibile e mappabile in memoria. Poiché i metadati sono memorizzati come coppie chiave-valore con namespace invece di un elenco fisso, è possibile aggiungere nuovi campi senza interrompere i lettori più vecchi. I pesi sono solitamente quantizzati, da 2-bit fino a 8-bit e includendo K-quants come Q4_K_M, il che consente a modelli di dimensioni considerevoli di girare su CPU e GPU consumer. Ogni file inizia con la stringa magica di quattro byte GGUF, seguita da un numero di versione; la versione attuale è la 3.
Sicurezza e incolumità
RISCHIO: LOWGGUF is a data container for model weights and metadata, not an executable, so opening one does not run code by itself. The main practical risks are large file sizes and downloading models from untrusted sources; a malformed file could in theory exploit a bug in the loader, so use up-to-date inference tools and reputable model repositories.
Dettagli del formato
in sintesi- Genome Graphical User Format - Rarely, .gguf has been used ad hoc by hobby projects for GUI layout data, unrelated to the machine-learning format described here.
Programmi che aprono file GGUF
.gguf models through a desktop GUI, with per-model quantization choices. .gguf file via a Modelfile and serve it for chat or API use with one command. .gguf model with llama-cli or llama-server, the reference implementation of the format. .gguf model to the local model folder and chat with it offline. .gguf model for text generation and roleplay with a self-contained executable. .gguf models with Apple Silicon acceleration through a desktop GUI. .gguf model via a Modelfile using Metal acceleration on Apple hardware. .gguf models with CUDA, ROCm or CPU backends via llama-cli and llama-server. .gguf models through the llama.cpp loader in a browser-based interface. .gguf file's metadata, tensor list and quantization in the browser without downloading it. Dettagli tecnici
specifiche approfondite| Encoding | Binary |
| Byte order | Little-endian by default; big-endian supported since version 3 |
| Container | Single-file container holding header, metadata key-value block, tensor info block and raw tensor data |
| Compression | None as a container; weights are stored using GGUF quantization schemes (Q2 through Q8, K-quants such as Q4_K_M, IQ variants, plus F16/BF16/F32) |
| Typical size | Roughly 0.5 GB to over 100 GB depending on parameter count and quantization level |
| Structure | Header (magic, version, tensor count, metadata count) then namespaced key-value metadata, then per-tensor info (name, dimensions, type, offset), then aligned raw tensor data. Default alignment is 32 bytes and must be a multiple of 8. |
| Integrity | No built-in checksum; the metadata block is self-describing and validated at load time |
| Platforms | Windows, macOS, Linux |
| Notes | A GGUF file is self-contained: it bundles the model weights, tokenizer and all hyperparameters as typed metadata, so no separate config files are needed. Metadata keys use lower_snake_case with period-separated namespaces and keys can be up to 65,535 bytes. Over 40 quantization types are supported. Large models can be sharded across multiple .gguf files with llama-gguf-split. |
| Rilasciato | August 2023 |
| Ultima versione | Version 3 |
| Standard aperto | Sì · royalty-free |
| Specifica | github.com |
Conversioni GGUF
Domande e risposte della community
chiesto dagli utentiAncora nessuna domanda - sii il primo a chiedere informazioni sui file GGUF.
Domande frequenti
Come apro un file GGUF?
llama.cpp. Questi strumenti leggono il file .gguf e ti permettono di chattare con il modello. Fare doppio clic sul file non farà nulla di utile da solo.Quale programma crea i file GGUF?
llama.cpp, principalmente convert_hf_to_gguf.py, che trasforma un modello Hugging Face in un .gguf, opzionalmente seguito da llama-quantize per ridurlo a una quantizzazione più piccola come Q4_K_M.Cosa significa Q4_K_M nel nome di un file GGUF?
Posso convertire un file GGUF nel modello originale?
.safetensors o pesi PyTorch con script della comunità, ma poiché la maggior parte dei file GGUF è quantizzata, la conversione è lossy e non ripristina gli esatti pesi originali.Perché il mio file GGUF è così grande?
.gguf contiene ogni peso del modello in un unico file. La dimensione del file scala con il numero di parametri e il livello di quantizzazione, quindi un modello grande ad alta precisione può facilmente superare le decine di gigabyte.