Create optimized quants by using similar GGUFs as templates
Project description
"I can't believe it's not Unsloth!"
— Grandma
GGUF Clone
Create optimized GGUF quantizations by cloning from any GGUF of the same architecture.
Whether you just fine-tuned your own model or stumbled upon a new hidden gem on Hugging Face, this tool allows you to quickly quantize it with the same settings as an existing, high-quality quant.
In theory, fine-tunes should benefit from the same imatrix data and optimizations. In practice... it's hard to tell for sure. But at least it's now dead simple to try.
Key Features
- Simple YAML config
- Use any Hugging Face GGUF as template (model to copy from)
- Use any Hugging Face model as target (model to quantize)
- Optionally copy GGUF metatdata and loose files (mmproj, etc)
- Run multiple quantizations from the same template
- Use split GGUFs as template input and/or target output
- Works with your existing Hugging Face cache and llama.cpp install
Prerequisites
- Python 3.9+ (developed on 3.12, not thoroughly tested on others)
- The following llama.cpp tools in
PATHor built underGGUF_CLONE_LLAMA_CPP(see below):llama-quantizellama-gguf-split
Installation + Usage
# Recommended
uvx gguf-clone # assumes config.yml in current dir
uvx gguf-clone path/to/config.yml
# Or
pip install gguf-clone
gguf-clone
gguf-clone path/to/config.yml
# Verbose output
gguf-clone --verbose
# Non-interactive modes to skip prompts when outputs already exist
gguf-clone --use-existing
gguf-clone --overwrite
gguf-clone --cancel
Outputs are generated alongside the config file by default:
converted/*.gguf- Target model converted into a GGUF for llama.cppparams/*.json-llama-quantizeparamaters extracted from template GGUF(s)quantized/*.gguf- Final quantized outputs
Configuration
This tool uses Hugging Face under-the-hood for convience. Use the ORG/MODEL labels to designate the template and target models. All matched original files will be downloaded to your local Hugging Face cache.
Minimal example (only required fields):
template:
repo: unsloth/Qwen3-0.6B-GGUF
imatrix: "*imatrix*"
ggufs: "*UD-IQ1_M*.gguf"
target:
repo: Qwen/Qwen3-0.6B
All options:
template:
repo: unsloth/Qwen3-0.6B-GGUF
imatrix: "*imatrix*"
# List multiple patterns to create multiple quantizations
ggufs:
- "*UD-IQ1_M*.gguf"
- "*UD-Q2_K_XL*.gguf"
# Copy GGUF metadata (from the 1st shard if split)
copy_metadata:
- tokenizer.chat_template
# Copy matched files
copy_files:
- "*mmproj*"
target:
repo: unsloth/Qwen3-0.6B
output:
# Output model is named PREFIX-ORG-MODEL
prefix: not-unsloth
# Add or edit GGUF metadata
apply_metadata:
general.quantized_by: "https://github.com/spicyneuron/gguf-clone"
# Split output if greater than this size (unit can be M or G)
split: 50G
# Output directories (relative to config.yml location)
converted_dir: converted
params_dir: params
quantized_dir: quantized
Environment Variables
If you don't have llama.cpp tools on your PATH, point gguf-clone at a local llama.cpp repo:
GGUF_CLONE_LLAMA_CPP="path/to/llama.cpp/repo"
If GGUF_CLONE_LLAMA_CPP is set, gguf-clone will prefer that its scripts and tools over the PATH and vendored copies.
Hugging Face environment variables can be used to change your download cache location.
Technical Notes
- Cloning accuracy: The tool uses heuristics to determine quantization parameters from template GGUFs (most common tensor type as default, ignore lists for non-quantized tensors). For identical tensor names and shapes, results should be functionally equivalent.
- Vendored dependencies:
gguf-py/ggufis vendored from llama.cpp because the published version on PyPI is out of date with recentllama.cppversions.convert_hf_to_gguf.pyis also vendered so conversion behavior stays aligned.
Gratitude
All credit goes to the Unsloth and llama.cpp teams for their hard work and responsiveness. This is merely a wrapper around their genius.
This project was originally inspired by quant_clone. It didn't actually work, unfortunately, but pointed me in the right direction.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gguf_clone-0.1.0.tar.gz.
File metadata
- Download URL: gguf_clone-0.1.0.tar.gz
- Upload date:
- Size: 216.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
abf16c96640b6eadd5f04357a32e851ff4817660a8ec5dfe6416c76d5865b277
|
|
| MD5 |
7000a6728732270d239a02417202c291
|
|
| BLAKE2b-256 |
1bb126bee50d26553e3a98175a831bcb53f5bfc5dc790a0c75d0e9e6f98496fb
|
Provenance
The following attestation bundles were made for gguf_clone-0.1.0.tar.gz:
Publisher:
publish.yml on spicyneuron/gguf-clone
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gguf_clone-0.1.0.tar.gz -
Subject digest:
abf16c96640b6eadd5f04357a32e851ff4817660a8ec5dfe6416c76d5865b277 - Sigstore transparency entry: 833569967
- Sigstore integration time:
-
Permalink:
spicyneuron/gguf-clone@ed08595302ada9f129bc38ce1464a896a3d5faf3 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/spicyneuron
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@ed08595302ada9f129bc38ce1464a896a3d5faf3 -
Trigger Event:
release
-
Statement type:
File details
Details for the file gguf_clone-0.1.0-py3-none-any.whl.
File metadata
- Download URL: gguf_clone-0.1.0-py3-none-any.whl
- Upload date:
- Size: 228.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5ebe237e57d7118d2fb2887e26115ddb131458a035ccec00f6b30791d8b9ecb0
|
|
| MD5 |
faa6a22d069d7d1eb5902420552bddb3
|
|
| BLAKE2b-256 |
30eaa1af8b4d817d1a147367b44e71e1de30e786085fd7ab0bb05ae83758974b
|
Provenance
The following attestation bundles were made for gguf_clone-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on spicyneuron/gguf-clone
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gguf_clone-0.1.0-py3-none-any.whl -
Subject digest:
5ebe237e57d7118d2fb2887e26115ddb131458a035ccec00f6b30791d8b9ecb0 - Sigstore transparency entry: 833569969
- Sigstore integration time:
-
Permalink:
spicyneuron/gguf-clone@ed08595302ada9f129bc38ce1464a896a3d5faf3 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/spicyneuron
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@ed08595302ada9f129bc38ce1464a896a3d5faf3 -
Trigger Event:
release
-
Statement type: