Views
No views yet
main branch of llama.cpp you'll see an error like this:load_tensors: loading model tensors, this can take a while... (mmap = true)
llama_model_load: error loading model: done_getting_tensors: wrong number of tensors; expected 1147, got 1025
llama_model_load_from_file_impl: failed to load model
common_init_from_params: failed to load model '/mount/checkpoints/DeepSeek-R1-11446-Q2_K-00001-of-00030.gguf'
srv load_model: failed to load model, '/mount/checkpoints/DeepSeek-R1-11446-Q2_K-00001-of-00030.gguf'
srv operator(): operator(): cleaning up before exit...
main: exiting due to model loading error
terminate called without an active exception
Aborted (core dumped)1export WORK_DIR=$(pwd)
2python3 -m venv venv
3source venv/bin/activate
4pip3 install -U "huggingface_hub[cli]"
5
6# the fp8 checkpoints are around 700GB
7mkdir checkpoints
8huggingface-cli download --resume-download --local-dir checkpoints/DeepSeek-R1 deepseek-ai/DeepSeek-R1
9
10# my fork of llama.cpp including pr #11446 and some changes to allow converting fp8 hf to bf16 gguf directly using triton(-cpu) without the need of intermediate checkpoints
11git clone https://github.com/evshiron/llama.cpp --recursive
12pushd llama.cpp
13pip3 install -r requirements/requirements-convert_hf_to_gguf.txt
14cmake -B build
15cmake --build build --config Release
16popd
17
18# install triton-cpu for cpu-only dequant
19git clone https://github.com/triton-lang/triton-cpu --recursive
20pushd triton-cpu
21pip3 install ninja cmake wheel pybind11
22MAX_JOBS=32 pip3 install -e python
23popd
24
25# hopefully it should work, takes an hour or more depending on your hardware, the bf16 checkpoints are around 1.3TB
26# the dequant process may take more than 64GB RAM, but should be doable within 360GB RAM
27python3 llama.cpp/convert_hf_to_gguf.py --outtype bf16 --split-max-size 50G checkpoints/DeepSeek-R1
28
29# removing the fp8 checkpoints gives us 700GB back
30mkdir checkpoints/DeepSeek-R1-BF16
31mv checkpoints/DeepSeek-R1/*.gguf checkpoints/DeepSeek-R1-BF16
32rm -r checkpoints/DeepSeek-R1
33
34# then use llama-quantize to make the quants you want, Q4_K_M should be around 400GB?
35./llama.cpp/build/bin/llama-quantize --keep-split checkpoints/DeepSeek-R1-BF16/<THE_FIRST_OF_DeepSeek-R1-BF16_GGUF>.gguf Q4_K_M