GGUF SAFETENSORS
File conversion

Convert GGUF to SAFETENSORS

QUICK ANSWER
Is it possible to convert GGUF to SAFETENSORS?
Yes - GGUF converts to SAFETENSORS.

Run a converter like gguf_to_safetensors or GGUF2Safetensors; it reads the GGUF with the gguf library, upcasts each tensor to F16 (or BF16), and writes .safetensors files. Expect the output to be an approximation of the original weights whenever the GGUF was quantized below F16.

Also to SAFETENSORS: PICKLE

On this page

Tested on macOS, Windows & Linux
Last verified Sep 2026

More free converters

HEIC, PNG, WEBP, MP3 and more - every tool here is free.

Open the toolbox

Why convert GGUF to SAFETENSORS?

Converting .gguf to .safetensors lets you load a model back into Hugging Face Transformers or diffusers, fine-tune it, or re-quantize it differently. GGUF is optimized for llama.cpp inference, while .safetensors is the standard, pickle-free format for the PyTorch/HF ecosystem. Note that very recent GGUF format revisions are not always convertible.

How to convert GGUF to SAFETENSORS

gguf_to_safetensors OPEN-SOURCE

Run python gguf_to_safetensors.py --input model.gguf --output model.safetensors. It defaults to F16; add --bf16 for BF16 output.

GGUF2Safetensors OPEN-SOURCE

Upcasts GGUF weights to PyTorch tensors in memory and writes a Hugging Face folder of .safetensors shards, usable directly with Transformers.

gguf library + safetensors FREE

Load with GGUFReader, call gguf.quants.dequantize() per tensor, then safetensors.torch.save_file(). Full control over dtype and sharding.

About these formats

Quality & what to watch

  • Dequantizing a quantized GGUF (Q4/Q5/etc.) is lossy - the .safetensors will not match the original model bit-for-bit.
  • Newer GGUF format versions may fail to convert because tooling lags behind llama.cpp changes.
  • Output is F16/BF16 (or F32), so file size grows significantly versus the compact quantized GGUF.

Frequently asked questions

Is GGUF-to-safetensors lossless?
Only if the GGUF was stored in F16/F32. Any lower quantization is dequantized approximately and cannot be reversed exactly.
Why did my recent GGUF fail to convert?
GGUF evolves quickly; some converters are pinned to older revisions and can't parse newer files or quant types.
Can I load the result in Hugging Face Transformers?
Yes if you produce a proper HF folder (config plus sharded .safetensors), which GGUF2Safetensors targets.
F16 or BF16 output?
BF16 preserves dynamic range better for large models; F16 is more universally supported. Pick to match your training setup.