mirror of
https://github.com/ollama/ollama.git
synced 2026-05-06 08:02:14 -05:00
[GH-ISSUE #8667] deepseek-r1:671b Q4_K_M: error="model requires more system memory (446.3 GiB) than is available #52127
Closed
opened 2026-04-28 22:12:45 -05:00 by GiteaMirror
·
32 comments
No Branch/Tag Specified
main
parth-mlx-decode-checkpoints
dhiltgen/ci
hoyyeva/editor-config-repair
parth-launch-codex-app
hoyyeva/fix-codex-model-metadata-warning
hoyyeva/qwen
hoyyeva/launch-backup-ux
parth/hide-claude-desktop-till-release
hoyyeva/opencode-image-modality
parth-add-claude-code-autoinstall
release_v0.22.0
pdevine/manifest-list
codex/fix-codex-model-metadata-warning
pdevine/addressable-manifest
brucemacd/launch-fetch-reccomended
jmorganca/llama-compat
launch-copilot-cli
hoyyeva/opencode-thinking
release_v0.20.7
parth-auto-save-backup
parth-test
jmorganca/gemma4-audio-replacements
fix-manifest-digest-on-pull
hoyyeva/vscode-improve
brucemacd/install-server-wait
brucemacd/download-before-remove
parth/update-claude-docs
parth-anthropic-reference-images-path
brucemac/start-ap-install
pdevine/mlx-update
pdevine/qwen35_vision
drifkin/api-show-fallback
mintlify/image-generation-1773352582
hoyyeva/server-context-length-local-config
jmorganca/faster-reptition-penalties
jmorganca/convert-nemotron
parth-pi-thinking
pdevine/sampling-penalties
jmorganca/fix-create-quantization-memory
dongchen/resumable_transfer_fix
pdevine/sampling-cache-error
jessegross/mlx-usage
hoyyeva/openclaw-config
hoyyeva/app-html
pdevine/qwen3next
brucemacd/sign-sh-install
brucemacd/tui-update
brucemacd/usage-api
jmorganca/launch-empty
fix-app-dist-embed
mxyng/mlx-compile
mxyng/mlx-quant
mxyng/mlx-glm4.7
mxyng/mlx
brucemacd/simplify-model-picker
jmorganca/qwen3-concurrent
fix-glm-4.7-flash-mla-config
drifkin/qwen3-coder-opening-tag
brucemacd/usage-cli
fix-cuda12-fattn-shmem
ollama-imagegen-docs
parth/fix-multiline-inputs
brucemacd/config-docs
mxyng/model-files
mxyng/simple-execute
fix-imagegen-ollama-models
mxyng/async-upload
jmorganca/lazy-no-dtype-changes
imagegen-auto-detect-create
parth/decrease-concurrent-download-hf
fix-mlx-quantize-init
jmorganca/x-cleanup
usage
imagegen-readme
jmorganca/glm-image
mlx-gpu-cd
jmorganca/imagegen-modelfile
parth/agent-skills
parth/agent-allowlist
parth/signed-in-offline
parth/agents
parth/fix-context-chopping
improve-cloud-flow
parth/add-models-websearch
parth/prompt-renderer-mcp
jmorganca/native-settings
jmorganca/download-stream-hash
jmorganca/client2-rebased
brucemacd/oai-chat-req-multipart
jessegross/multi_chunk_reserve
grace/additional-omit-empty
grace/mistral-3-large
mxyng/tokenizer2
mxyng/tokenizer
jessegross/flash
hoyyeva/windows-nacked-app
mxyng/cleanup-attention
grace/deepseek-parser
hoyyeva/remember-unsent-prompt
parth/add-lfs-pointer-error-conversion
parth/olmo2-test2
hoyyeva/ollama-launchagent-plist
nicole/olmo-model
parth/olmo-test
mxyng/remove-embedded
parth/render-template
jmorganca/intellect-3
parth/remove-prealloc-linter
jmorganca/cmd-eval
nicole/nomic-embed-text-fix
mxyng/lint-2
hoyyeva/add-gemini-3-pro-preview
hoyyeva/load-model-list
mxyng/expand-path
mxyng/environ-2
hoyyeva/deeplink-json-encoding
parth/improve-tool-calling-tests
hoyyeva/conversation
hoyyeva/assistant-edit-response
hoyyeva/thinking
origin/brucemacd/invalid-char-i-err
parth/improve-tool-calling
jmorganca/required-omitempty
grace/qwen3-vl-tests
mxyng/iter-client
parth/docs-readme
nicole/embed-test
pdevine/integration-benchstat
parth/remove-generate-cmd
parth/add-toolcall-id
mxyng/server-tests
jmorganca/glm-4.6
jmorganca/gin-h-compat
drifkin/stable-tool-args
pdevine/qwen3-more-thinking
parth/add-websearch-client
nicole/websearch_local
jmorganca/qwen3-coder-updates
grace/deepseek-v3-migration-tests
mxyng/fix-create
jmorganca/cloud-errors
pdevine/parser-tidy
revert-12233-parth/simplify-entrypoints-runner
parth/enable-so-gpt-oss
brucemacd/qwen3vl
jmorganca/readme-simplify
parth/gpt-oss-structured-outputs
revert-12039-jmorganca/tools-braces
mxyng/embeddings
mxyng/gguf
mxyng/benchmark
mxyng/types-null
parth/move-parsing
mxyng/gemma2
jmorganca/docs
mxyng/16-bit
mxyng/create-stdin
pdevine/authorizedkeys
mxyng/quant
parth/opt-in-error-context-window
brucemacd/cache-models
brucemacd/runner-completion
jmorganca/llama-update-6
brucemacd/benchmark-list
brucemacd/partial-read-caps
parth/deepseek-r1-tools
mxyng/omit-array
parth/tool-prefix-temp
brucemacd/runner-test
jmorganca/qwen25vl
brucemacd/model-forward-test-ext
parth/python-function-parsing
jmorganca/cuda-compression-none
drifkin/num-parallel
drifkin/chat-truncation-fix
jmorganca/sync
parth/python-tools-calling
drifkin/array-head-count
brucemacd/create-no-loop
parth/server-enable-content-stream-with-tools
qwen25omni
mxyng/v3
brucemacd/ropeconfig
jmorganca/silence-tokenizer
parth/sample-so-test
parth/sampling-structured-outputs
brucemacd/doc-go-engine
parth/constrained-sampling-json
jmorganca/mistral-wip
brucemacd/mistral-small-convert
parth/sample-unmarshal-json-for-params
brucemacd/jomorganca/mistral
pdevine/bfloat16
jmorganca/mistral
brucemacd/mistral
pdevine/logging
parth/sample-correctness-fix
parth/sample-fix-sorting
jmorgan/sample-fix-sorting-extras
jmorganca/temp-0-images
brucemacd/parallel-embed-models
brucemacd/shim-grammar
jmorganca/fix-gguf-error
bmizerany/nameswork
jmorganca/faster-releases
bmizerany/validatenames
brucemacd/err-no-vocab
brucemacd/rope-config
brucemacd/err-hint
brucemacd/qwen2_5
brucemacd/logprobs
brucemacd/new_runner_graph_bench
progress-flicker
brucemacd/forward-test
brucemacd/go_qwen2
pdevine/gemma2
jmorganca/add-missing-symlink-eval
mxyng/next-debug
parth/set-context-size-openai
brucemacd/next-bpe-bench
brucemacd/next-bpe-test
brucemacd/new_runner_e2e
brucemacd/new_runner_qwen2
pdevine/convert-cohere2
brucemacd/convert-cli
parth/log-probs
mxyng/next-mlx
mxyng/cmd-history
parth/templating
parth/tokenize-detokenize
brucemacd/check-key-register
bmizerany/grammar
jmorganca/vendor-081b29bd
mxyng/func-checks
jmorganca/fix-null-format
parth/fix-default-to-warn-json
jmorganca/qwen2vl
jmorganca/no-concat
parth/cmd-cleanup-SO
brucemacd/check-key-register-structured-err
parth/openai-stream-usage
parth/fix-referencing-so
stream-tools-stop
jmorganca/degin-1
brucemacd/install-path-clean
brucemacd/push-name-validation
brucemacd/browser-key-register
jmorganca/openai-fix-first-message
jmorganca/fix-proxy
jessegross/sample
parth/disallow-streaming-tools
dhiltgen/remove_submodule
jmorganca/ga
jmorganca/mllama
pdevine/newlines
pdevine/geems-2b
jmorganca/llama-bump
mxyng/modelname-7
mxyng/gin-slog
mxyng/modelname-6
jyan/convert-prog
jyan/quant5
paligemma-support
pdevine/import-docs
jmorganca/openai-context
jyan/paligemma
jyan/p2
jyan/palitest
bmizerany/embedspeedup
jmorganca/llama-vit
brucemacd/allow-ollama
royh/ep-methods
royh/whisper
mxyng/api-models
mxyng/fix-memory
jyan/q4_4/8
jyan/ollama-v
royh/stream-tools
roy-embed-parallel
bmizerany/hrm
revert-5963-revert-5924-mxyng/llama3.1-rope
royh/embed-viz
jyan/local2
jyan/auth
jyan/local
jyan/parse-temp
jmorganca/template-mistral
jyan/reord-g
royh-openai-suffixdocs
royh-imgembed
royh-embed-parallel
jyan/quant4
royh-precision
jyan/progress
pdevine/fix-template
jyan/quant3
pdevine/ggla
mxyng/update-registry-domain
jmorganca/ggml-static
mxyng/create-context
jyan/v0.146
mxyng/layers-from-files
build_dist
bmizerany/noseek
royh-ls
royh-name
timeout
mxyng/server-timestamp
bmizerany/nosillyggufslurps
royh-params
jmorganca/llama-cpp-7c26775
royh-openai-delete
royh-show-rigid
jmorganca/enable-fa
jmorganca/no-error-template
jyan/format
royh-testdelete
bmizerany/fastverify
language_support
pdevine/ps-glitches
brucemacd/tokenize
bruce/iq-quants
bmizerany/filepathwithcoloninhost
mxyng/split-bin
bmizerany/client-registry
jmorganca/if-none-match
native
jmorganca/native
jmorganca/batch-embeddings
jmorganca/initcmake
jmorganca/mm
pdevine/showggmlinfo
modenameenforcealphanum
bmizerany/modenameenforcealphanum
jmorganca/done-reason
jmorganca/llama-cpp-8960fe8
ollama.com
bmizerany/filepathnobuild
bmizerany/types/model/defaultfix
rmdisplaylong
nogogen
bmizerany/x
modelfile-readme
bmizerany/replacecolon
jmorganca/limit
jmorganca/execstack
jmorganca/replace-assets
mxyng/tune-concurrency
jmorganca/testing
whitespace-detection
jmorganca/options
upgrade-all
scratch
cuda-search
mattw/airenamer
mattw/allmodelsonhuggingface
mattw/quantcontext
mattw/whatneedstorun
brucemacd/llama-mem-calc
mattw/faq-context
mattw/communitylinks
mattw/noprune
mattw/python-functioncalling
rename
mxyng/install
pulse
remove-first
editor
mattw/selfqueryingretrieval
cgo
mattw/howtoquant
api
matt/streamingapi
format-config
mxyng/extra-args
shell
update-nous-hermes
cp-model
upload-progress
fix-unknown-model
fix-model-names
delete-fix
insecure-registry
ls
deletemodels
progressbar
readme-updates
license-layers
skip-list
list-models
modelpath
matt/examplemodelfiles
distribution
go-opts
v0.23.1
v0.23.1-rc0
v0.23.0
v0.23.0-rc0
v0.22.1
v0.22.1-rc1
v0.22.1-rc0
v0.22.0
v0.22.0-rc1
v0.21.3-rc0
v0.21.2-rc1
v0.21.2
v0.21.2-rc0
v0.21.1
v0.21.1-rc1
v0.21.1-rc0
v0.21.0
v0.21.0-rc1
v0.21.0-rc0
v0.20.8-rc0
v0.20.7
v0.20.7-rc1
v0.20.7-rc0
v0.20.6
v0.20.6-rc1
v0.20.6-rc0
v0.20.5
v0.20.5-rc2
v0.20.5-rc1
v0.20.5-rc0
v0.20.4
v0.20.4-rc2
v0.20.4-rc1
v0.20.4-rc0
v0.20.3
v0.20.3-rc0
v0.20.2
v0.20.1
v0.20.1-rc2
v0.20.1-rc1
v0.20.1-rc0
v0.20.0
v0.20.0-rc1
v0.20.0-rc0
v0.19.0
v0.19.0-rc2
v0.19.0-rc1
v0.19.0-rc0
v0.18.4-rc1
v0.18.4-rc0
v0.18.3
v0.18.3-rc2
v0.18.3-rc1
v0.18.3-rc0
v0.18.2
v0.18.2-rc1
v0.18.2-rc0
v0.18.1
v0.18.1-rc1
v0.18.1-rc0
v0.18.0
v0.18.0-rc2
v0.18.0-rc1
v0.18.0-rc0
v0.17.8-rc4
v0.17.8-rc3
v0.17.8-rc2
v0.17.8-rc1
v0.17.8-rc0
v0.17.7
v0.17.7-rc2
v0.17.7-rc1
v0.17.7-rc0
v0.17.6
v0.17.5
v0.17.4
v0.17.3
v0.17.2
v0.17.1
v0.17.1-rc2
v0.17.1-rc1
v0.17.1-rc0
v0.17.0
v0.17.0-rc2
v0.17.0-rc1
v0.17.0-rc0
v0.16.3
v0.16.3-rc2
v0.16.3-rc1
v0.16.3-rc0
v0.16.2
v0.16.2-rc0
v0.16.1
v0.16.0
v0.16.0-rc2
v0.16.0-rc0
v0.16.0-rc1
v0.15.6
v0.15.5
v0.15.5-rc5
v0.15.5-rc4
v0.15.5-rc3
v0.15.5-rc2
v0.15.5-rc1
v0.15.5-rc0
v0.15.4
v0.15.3
v0.15.2
v0.15.1
v0.15.1-rc1
v0.15.1-rc0
v0.15.0-rc6
v0.15.0
v0.15.0-rc5
v0.15.0-rc4
v0.15.0-rc3
v0.15.0-rc2
v0.15.0-rc1
v0.15.0-rc0
v0.14.3
v0.14.3-rc3
v0.14.3-rc2
v0.14.3-rc1
v0.14.3-rc0
v0.14.2
v0.14.2-rc1
v0.14.2-rc0
v0.14.1
v0.14.0-rc11
v0.14.0
v0.14.0-rc10
v0.14.0-rc9
v0.14.0-rc8
v0.14.0-rc7
v0.14.0-rc6
v0.14.0-rc5
v0.14.0-rc4
v0.14.0-rc3
v0.14.0-rc2
v0.14.0-rc1
v0.14.0-rc0
v0.13.5
v0.13.5-rc1
v0.13.5-rc0
v0.13.4-rc2
v0.13.4
v0.13.4-rc1
v0.13.4-rc0
v0.13.3
v0.13.3-rc1
v0.13.3-rc0
v0.13.2
v0.13.2-rc2
v0.13.2-rc1
v0.13.2-rc0
v0.13.1
v0.13.1-rc2
v0.13.1-rc1
v0.13.1-rc0
v0.13.0
v0.13.0-rc0
v0.12.11
v0.12.11-rc1
v0.12.11-rc0
v0.12.10
v0.12.10-rc1
v0.12.10-rc0
v0.12.9-rc0
v0.12.9
v0.12.8
v0.12.8-rc0
v0.12.7
v0.12.7-rc1
v0.12.7-rc0
v0.12.7-citest0
v0.12.6
v0.12.6-rc1
v0.12.6-rc0
v0.12.5
v0.12.5-rc0
v0.12.4
v0.12.4-rc7
v0.12.4-rc6
v0.12.4-rc5
v0.12.4-rc4
v0.12.4-rc3
v0.12.4-rc2
v0.12.4-rc1
v0.12.4-rc0
v0.12.3
v0.12.2
v0.12.2-rc0
v0.12.1
v0.12.1-rc1
v0.12.1-rc2
v0.12.1-rc0
v0.12.0
v0.12.0-rc1
v0.12.0-rc0
v0.11.11
v0.11.11-rc3
v0.11.11-rc2
v0.11.11-rc1
v0.11.11-rc0
v0.11.10
v0.11.9
v0.11.9-rc0
v0.11.8
v0.11.8-rc0
v0.11.7-rc1
v0.11.7-rc0
v0.11.7
v0.11.6
v0.11.6-rc0
v0.11.5-rc4
v0.11.5-rc3
v0.11.5
v0.11.5-rc5
v0.11.5-rc2
v0.11.5-rc1
v0.11.5-rc0
v0.11.4
v0.11.4-rc0
v0.11.3
v0.11.3-rc0
v0.11.2
v0.11.1
v0.11.0-rc0
v0.11.0-rc1
v0.11.0-rc2
v0.11.0
v0.10.2-int1
v0.10.1
v0.10.0
v0.10.0-rc4
v0.10.0-rc3
v0.10.0-rc2
v0.10.0-rc1
v0.10.0-rc0
v0.9.7-rc1
v0.9.7-rc0
v0.9.6
v0.9.6-rc0
v0.9.6-ci0
v0.9.5
v0.9.4-rc5
v0.9.4-rc6
v0.9.4
v0.9.4-rc3
v0.9.4-rc4
v0.9.4-rc1
v0.9.4-rc2
v0.9.4-rc0
v0.9.3
v0.9.3-rc5
v0.9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.27
v0.1.26
v0.1.25
v0.1.24
v0.1.23
v0.1.22
v0.1.21
v0.1.20
v0.1.19
v0.1.18
v0.1.17
v0.1.16
v0.1.15
v0.1.14
v0.1.13
v0.1.12
v0.1.11
v0.1.10
v0.1.9
v0.1.8
v0.1.7
v0.1.6
v0.1.5
v0.1.4
v0.1.3
v0.1.2
v0.1.1
v0.1.0
v0.0.21
v0.0.20
v0.0.19
v0.0.18
v0.0.17
v0.0.16
v0.0.15
v0.0.14
v0.0.13
v0.0.12
v0.0.11
v0.0.10
v0.0.9
v0.0.8
v0.0.7
v0.0.6
v0.0.5
v0.0.4
v0.0.3
v0.0.2
v0.0.1
Labels
Clear labels
amd
api
app
bug
build
cli
cloud
compatibility
context-length
create
docker
documentation
embeddings
feature request
feedback wanted
good first issue
gpt-oss
gpu
harmony
help wanted
image
install
intel
js
launch
linux
macos
memory
mlx
model
needs more info
networking
nvidia
ollama.com
performance
pull-request
python
question
registry
rendering
thinking
tools
top
vulkan
windows
wsl
Mirrored from GitHub Pull Request
No Label
Milestone
No items
No Milestone
Projects
Clear projects
No project
No Assignees
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/ollama#52127
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @philippstoboy on GitHub (Jan 29, 2025).
Original GitHub issue: https://github.com/ollama/ollama/issues/8667
Hey Ollama community,
I’m reaching out for some advice on running the DeepSeek-R1 671B model with Q4 quantization on my current setup, which has 40GB of RAM. I understand that this model employs a Mixture of Experts (MoE) architecture, meaning that during inference, only a subset of the model’s parameters (approximately 37 billion) is active at any given time. This design should, in theory, reduce the immediate memory requirements compared to loading all 671 billion parameters simultaneously. Based on calculations, the active 37B parameters in Q4 quantization should only require around 18.5GB of RAM, with an additional 20–30% memory overhead, resulting in a total memory requirement of ~25–30GB. In contrast, the Q8_0 version (8-bit quantization) would require approximately 37GB + overhead, totaling around 50GB. Even the full 671B parameters in Q4 quantization should only need around 325GB of RAM if loaded entirely, and Q8_0 would need 650GB. Given these figures, my expectation was that loading just the active 37B subset in Q4 should work within reasonable hardware configurations.
However, when I attempt to load the model using Ollama, I encounter an error indicating that the model requires more system memory (446.3 GiB) than is available (37.3 GiB). This is perplexing, given the MoE architecture’s supposed efficiency and the Q4 quantization.
I came across a discussion where a user successfully ran the Q8_0 GGUF version of DeepSeek-R1 671B on a CPU-only system with 256GB of RAM. They noted that with a context length of 32,092 tokens, the system utilized around 220GB of RAM, emphasizing that the KV cache can consume more RAM than the model itself. Reference: https://huggingface.co/deepseek-ai/DeepSeek-R1/discussions/19
Based on this, I would expect that running the Q4 quantized model with a context length of 32,092 tokens would require less memory than the Q8 version, potentially making it feasible to run on a system with 192GB of RAM(What I'm planning to upgrade to). However, the error message I received suggests otherwise, indicating a requirement of 446.3 GiB of system memory.
Thank you for your help.
Error Logs:
@rick-github commented on GitHub (Jan 29, 2025):
MoE reduces the computation required, but the model weights still need to be loaded in order to select the expert. What you are looking for is SwapMoE which, to my knowledge, is not implemented in any mainstream open source inference engine.
You can work around the "more system memory" restriction by creating a bunch of free swap, or tricking ollama into thinking that you have extra resources and relying on mmap to make the model available: https://github.com/ollama/ollama/issues/8654
@philippstoboy commented on GitHub (Jan 29, 2025):
I just did what was mentioned in the linked Thread and now this comes up:
goroutine 22 [running]: github.com/ollama/ollama/llama/runner.(*Server).loadModel(0xc0001441b0, {0x0, 0x0, 0x0, 0x0, {0x0, 0x0, 0x0}, 0xc0001141a0, 0x0}, ...) github.com/ollama/ollama/llama/runner/runner.go:852 +0x3ad created by github.com/ollama/ollama/llama/runner.Execute in goroutine 1 github.com/ollama/ollama/llama/runner/runner.go:970 +0xd0d time=2025-01-29T17:16:31.749Z level=ERROR source=sched.go:455 msg="error loading llama server" error="llama runner process has terminated: error loading model: unable to allocate CPU buffer\nllama_load_model_from_file: failed to load model" [GIN] 2025/01/29 - 17:16:31 | 500 | 1.752744738s | 192.168.178.63 | POST "/api/chat"@rick-github commented on GitHub (Jan 29, 2025):
More context will show how much it tried to allocate and might give some idea of how to work around it.
But I haven't tried that trick myself yet, so I don't know the fine points of getting it to work.
@outis151 commented on GitHub (Jan 29, 2025):
This is what the memory usage looks like when loading DeepSeek-R1 671B Q4 with
mmapand the trick from my issue https://github.com/ollama/ollama/issues/8654. There is a short spike while loading the model, then the memory usage remains less than 12GiB during the generation.Correction: The ram usage remains at that high value during generation. Misinterpreted the data
In any case its less than what ollama calculates
Note that loading the model takes longer using mmap and you may need to adjust the ollama timeout environment variable.
@philippstoboy commented on GitHub (Jan 29, 2025):
Hey, my upgrade of 192GB of Memory just arrived. I'm not quite sure how to correctly implement the things mentioned in Your Issue. Could you go into a bit more detail? I "faked" my memory so that ollama thinks I have 500GB and the only output now is this:
root@bc8941192791:/# ollama run deepseek-r1:671b --verbose Error: llama runner process has terminated: error loading model: unable to allocate CPU buffer llama_load_model_from_file: failed to load model root@bc8941192791:/#I'm confident that the Memory faking worked as this was the output before I did it:
root@bc8941192791:/# ollama run deepseek-r1:671b Error: model requires more system memory (433.6 GiB) than is available (186.6 GiB)As of
mmapI'm not certain if I was able to enable it.Thanks for the help!
@outis151 commented on GitHub (Jan 29, 2025):
confirm you have enabled mmap by trying with a smaller model and checking that it is not loaded into RAM and that only a tiny fraction of RAM is used as compared to without mmap
@philippstoboy commented on GitHub (Jan 29, 2025):
So I ran this command to test with a smaller model with mmap:
curl http://localhost:11434/api/generate -d '{ "model": "llava:latest", "use_mmap": true }'And here is the ram result:
docker is the ollama usage hereNow if I just run
llava:latestwithout mmap:curl http://localhost:11434/api/generate -d '{ "model": "llava:latest" }'Result:
docker is the ollama usage hereAs you can see, it seems to be the same usage. I even have an enviorment Variable :
NVIDIA_VISIBLE_DEVICES=all HOSTNAME=bc8941192791 HOST_CONTAINERNAME=ollama PWD=/ NVIDIA_DRIVER_CAPABILITIES=compute,utility TZ=America/Los_Angeles USE_MMAP=1 HOME=/root LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.webp=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36: OLLAMA_USE_MMAP=1 OLLAMA_TIMEOUT=30000 OLLAMA_ORIGINS=* LESSCLOSE=/usr/bin/lesspipe %s %s OLLAMA_HOST=0.0.0.0 TERM=xterm LESSOPEN=| /usr/bin/lesspipe %s HOST_OS=Unraid SHLVL=1 LD_LIBRARY_PATH=/usr/local/nvidia/lib:/usr/local/nvidia/lib64 PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin HOST_HOSTNAME=Tower OLDPWD=/root _=/usr/bin/printenvNot sure what to do now.
@philippstoboy commented on GitHub (Jan 29, 2025):
And btw this is when I try to run deepseek:
root@bc8941192791:/# curl http://localhost:11434/api/generate -d '{ "model": "deepseek-r1:671b","use_mmap": true }' {"error":"llama runner process has terminated: error loading model: unable to allocate CPU buffer\nllama_load_model_from_file: failed to load model"}root@bc8941192791:/#and this is in the live log:
`llama_model_loader: - kv 34: tokenizer.ggml.bos_token_id u32 = 0
llama_model_loader: - kv 35: tokenizer.ggml.eos_token_id u32 = 1
llama_model_loader: - kv 36: tokenizer.ggml.padding_token_id u32 = 1
llama_model_loader: - kv 37: tokenizer.ggml.add_bos_token bool = true
llama_model_loader: - kv 38: tokenizer.ggml.add_eos_token bool = false
llama_model_loader: - kv 39: tokenizer.chat_template str = {% if not add_generation_prompt is de...
llama_model_loader: - kv 40: general.quantization_version u32 = 2
llama_model_loader: - kv 41: general.file_type u32 = 15
llama_model_loader: - type f32: 361 tensors
llama_model_loader: - type q4_K: 606 tensors
llama_model_loader: - type q6_K: 58 tensors
llm_load_vocab: special_eos_id is not in special_eog_ids - the tokenizer config may be incorrect
llm_load_vocab: special tokens cache size = 818
llm_load_vocab: token to piece cache size = 0.8223 MB
llm_load_print_meta: format = GGUF V3 (latest)
llm_load_print_meta: arch = deepseek2
llm_load_print_meta: vocab type = BPE
llm_load_print_meta: n_vocab = 129280
llm_load_print_meta: n_merges = 127741
llm_load_print_meta: vocab_only = 0
llm_load_print_meta: n_ctx_train = 163840
llm_load_print_meta: n_embd = 7168
llm_load_print_meta: n_layer = 61
llm_load_print_meta: n_head = 128
llm_load_print_meta: n_head_kv = 128
llm_load_print_meta: n_rot = 64
llm_load_print_meta: n_swa = 0
llm_load_print_meta: n_embd_head_k = 192
llm_load_print_meta: n_embd_head_v = 128
llm_load_print_meta: n_gqa = 1
llm_load_print_meta: n_embd_k_gqa = 24576
llm_load_print_meta: n_embd_v_gqa = 16384
llm_load_print_meta: f_norm_eps = 0.0e+00
llm_load_print_meta: f_norm_rms_eps = 1.0e-06
llm_load_print_meta: f_clamp_kqv = 0.0e+00
llm_load_print_meta: f_max_alibi_bias = 0.0e+00
llm_load_print_meta: f_logit_scale = 0.0e+00
llm_load_print_meta: n_ff = 18432
llm_load_print_meta: n_expert = 256
llm_load_print_meta: n_expert_used = 8
llm_load_print_meta: causal attn = 1
llm_load_print_meta: pooling type = 0
llm_load_print_meta: rope type = 0
llm_load_print_meta: rope scaling = yarn
llm_load_print_meta: freq_base_train = 10000.0
llm_load_print_meta: freq_scale_train = 0.025
llm_load_print_meta: n_ctx_orig_yarn = 4096
llm_load_print_meta: rope_finetuned = unknown
llm_load_print_meta: ssm_d_conv = 0
llm_load_print_meta: ssm_d_inner = 0
llm_load_print_meta: ssm_d_state = 0
llm_load_print_meta: ssm_dt_rank = 0
llm_load_print_meta: ssm_dt_b_c_rms = 0
llm_load_print_meta: model type = 671B
llm_load_print_meta: model ftype = Q4_K - Medium
llm_load_print_meta: model params = 671.03 B
llm_load_print_meta: model size = 376.65 GiB (4.82 BPW)
llm_load_print_meta: general.name = n/a
llm_load_print_meta: BOS token = 0 '<|begin▁of▁sentence|>'
llm_load_print_meta: EOS token = 1 '<|end▁of▁sentence|>'
llm_load_print_meta: EOT token = 1 '<|end▁of▁sentence|>'
llm_load_print_meta: PAD token = 1 '<|end▁of▁sentence|>'
llm_load_print_meta: LF token = 131 'Ä'
llm_load_print_meta: FIM PRE token = 128801 '<|fim▁begin|>'
llm_load_print_meta: FIM SUF token = 128800 '<|fim▁hole|>'
llm_load_print_meta: FIM MID token = 128802 '<|fim▁end|>'
llm_load_print_meta: EOG token = 1 '<|end▁of▁sentence|>'
llm_load_print_meta: max token length = 256
llm_load_print_meta: n_layer_dense_lead = 3
llm_load_print_meta: n_lora_q = 1536
llm_load_print_meta: n_lora_kv = 512
llm_load_print_meta: n_ff_exp = 2048
llm_load_print_meta: n_expert_shared = 1
llm_load_print_meta: expert_weights_scale = 2.5
llm_load_print_meta: expert_weights_norm = 1
llm_load_print_meta: expert_gating_func = sigmoid
llm_load_print_meta: rope_yarn_log_mul = 0.1000
ggml_aligned_malloc: insufficient memory (attempted to allocate 385689.62 MB)
ggml_backend_cpu_buffer_type_alloc_buffer: failed to allocate buffer of size 404424884224
llama_model_load: error loading model: unable to allocate CPU buffer
llama_load_model_from_file: failed to load model
panic: unable to load model: /root/.ollama/models/blobs/sha256-9801e7fce27dbf3d0bfb468b7b21f1d132131a546dfc43e50518631b8b1800a9
goroutine 7 [running]:
github.com/ollama/ollama/llama/runner.(*Server).loadModel(0xc0000c41b0, {0x0, 0x0, 0x0, 0x0, {0x0, 0x0, 0x0}, 0xc0000241c0, 0x0}, ...)
github.com/ollama/ollama/llama/runner/runner.go:852 +0x3ad
created by github.com/ollama/ollama/llama/runner.Execute in goroutine 1
github.com/ollama/ollama/llama/runner/runner.go:970 +0xd0d
time=2025-01-29T21:29:13.915Z level=ERROR source=sched.go:455 msg="error loading llama server" error="llama runner process has terminated: error loading model: unable to allocate CPU buffer\nllama_load_model_from_file: failed to load model"
[GIN] 2025/01/29 - 21:29:13 | 500 | 2.021031495s | 127.0.0.1 | POST "/api/generate"
`
@philippstoboy commented on GitHub (Jan 30, 2025):
@outis151 ?
@guiguid commented on GitHub (Feb 1, 2025):
Hi,
Same issue, mmap from SSD is not used with ollama but woks with llama-cli.
And with Ollama :
@sammcj commented on GitHub (Feb 5, 2025):
Have been trying to run R1 with Ollama for the last week or so, came to a similar conclusion as mentioned here:
For example, I have access to a machine with 8x Nvidia H100 with 80GB vRAM each - 640GB of vRAM - and I cannot run an IQ3_XS quant with a reasonably useful context size of 64k from vRAM it will only be able to load 40 of the 62 layers onto the GPUs.
@outis151 commented on GitHub (Feb 5, 2025):
I suggest checking again. For testing purposes I have even managed to load the full deepseek R1 (700 gigabytes) on a machine with just CPU and 16GB of RAM.
@HongZhang-Robotechlab commented on GitHub (Feb 7, 2025):
I'm trying to load full R1 with Ollama on a Windows 11 Home 32GB RAM 800GB SSD Nvidia RTX4060 GPU. It downloaded the model to local drive successfully but when running, it has this same error as below:
Does Windows have similar operation as MMAP enabled?
@rick-github commented on GitHub (Feb 7, 2025):
On windows and linux you currently need to pre-allocate enough swap to hold the model. If https://github.com/ollama/ollama/pull/8895 is approved, all you need to do is set
"use_mmap":true.@philippstoboy commented on GitHub (Feb 9, 2025):
Hello everyone. I managed to make it run on a machine with 192GB on ram. But only 40.5GB Are being used when running the Model. If anyone is interested I could Share you how it's done.
@HongZhang-Robotechlab commented on GitHub (Feb 9, 2025):
@rick-github Thank you for addressing the issue on Windows with the ollama commit. By the way, how to set
"use_mmap":truein Windows command console for ollama?@HongZhang-Robotechlab commented on GitHub (Feb 9, 2025):
Nice! I'm very curious how to make it work.
@rick-github commented on GitHub (Feb 9, 2025):
use_mmapis true by default, ollama only sets it false when it thinks there are not enough resources. You can override with the/set parametercommand.@HongZhang-Robotechlab commented on GitHub (Feb 9, 2025):
Thank you! In my situation, it could the case that ollama thinks there are not enough RAM for 671b, so I can't run "ollama run deepseek-r1:671b". Do I have a way to set it when or before running the command? Or if I got ollama with your code change in https://github.com/ollama/ollama/pull/8895, I will not need to worry about it?
@rick-github commented on GitHub (Feb 9, 2025):
#8895 requires that
use_mmapis explicitly set, so something like the above or setting"options":{"use_mmap":true}in the API call would be required.@glide-the commented on GitHub (Feb 10, 2025):
I tried quantized inference in llama.cpp, and the settings can be started normally.
But it was observed that the modelfile configuration was deleted in ollama.
e54a3c7fcdollama run deepseek-r1:merge1.58
After I tried to configure it in /api/generate, it appeared, success
@rick-github commented on GitHub (Feb 10, 2025):
Set
OLLAMA_LOAD_TIMEOUT.@HongZhang-Robotechlab commented on GitHub (Feb 15, 2025):
It seems that the configuration was still not grasped by ollama.
I tried to download and build ollama by following the Development guide at link https://github.com/ollama/ollama/blob/main/docs/development.md, but don't know what to do after this:

What are the following commands to make it work with deepseek-r1?
@rick-github commented on GitHub (Feb 15, 2025):
#8895 is not merged yet, you need to manually patch it in to the code before you build:
@HongZhang-Robotechlab commented on GitHub (Feb 15, 2025):
Done and rebuild ollama:

Then run "go run . serve" as the development.md instructed:

What shall I do next?
@rick-github commented on GitHub (Feb 15, 2025):
In a different terminal window:
@HongZhang-Robotechlab commented on GitHub (Feb 16, 2025):
This problem is solved!. Thank you for your step-by-step guiding.

However, it still failed with GPU error as below:
With the details from the first terminal window, I can switch to the gear to https://github.com/ollama/ollama/issues/8447
@rick-github commented on GitHub (Feb 16, 2025):
It's trying to allocate memory on the GPU. You only have 6.9G free on the GPU and ollama is trying to offload 3 layers (see
layers.offloadin the log). Reduce the number of layers being offloaded.@HongZhang-Robotechlab commented on GitHub (Feb 16, 2025):
It works now with the log as below:
llm_load_tensors: offloading 2 repeating layers to GPU
llm_load_tensors: offloaded 2/62 layers to GPU
llm_load_tensors: CUDA0 model buffer size = 14213.34 MiB
llm_load_tensors: CPU_Mapped model buffer size = 371476.29 MiB
llama_new_context_with_model: n_seq_max = 4
llama_new_context_with_model: n_ctx = 8192
llama_new_context_with_model: n_ctx_per_seq = 2048
llama_new_context_with_model: n_batch = 2048
llama_new_context_with_model: n_ubatch = 512
llama_new_context_with_model: flash_attn = 0
llama_new_context_with_model: freq_base = 10000.0
llama_new_context_with_model: freq_scale = 0.025
llama_new_context_with_model: n_ctx_per_seq (2048) < n_ctx_train (163840) -- the full capacity of the model will not be utilized
llama_kv_cache_init: kv_size = 8192, offload = 1, type_k = 'f16', type_v = 'f16', n_layer = 61, can_shift = 0
llama_kv_cache_init: CUDA0 KV buffer size = 1280.00 MiB
llama_kv_cache_init: CPU KV buffer size = 37760.00 MiB
llama_new_context_with_model: KV self size = 39040.00 MiB, K (f16): 23424.00 MiB, V (f16): 15616.00 MiB
llama_new_context_with_model: CPU output buffer size = 2.08 MiB
llama_new_context_with_model: CUDA0 compute buffer size = 5039.50 MiB
llama_new_context_with_model: CUDA_Host compute buffer size = 96.01 MiB
llama_new_context_with_model: graph nodes = 5025
llama_new_context_with_model: graph splits = 1110 (with bs=512), 3 (with bs=1)
time=2025-02-16T09:50:46.717-05:00 level=INFO source=server.go:597 msg="llama runner started in 92.49 seconds"
[GIN] 2025/02/16 - 09:50:46 | 200 | 1m32s | 127.0.0.1 | POST "/api/generate"
But looks a little bit slow: Since 9:51 I asked the question until now 12:45. what I got is as below:

The fan of CPU sounds pretty calm. Is it supposed to work this slow to running a big model on basic hardware like my computer?
@rick-github commented on GitHub (Feb 16, 2025):
Only 2 layers of 62 have been offloaded to the GPU. The rest of the model weights are mmap'ed so the bandwidth reading those weights will determine the rate at which tokens can be generated. 317GB of the model weights are mmap'ed. An average SSD can read date at about 550MB/s. So one token takes (317 / 0.55) = 576 seconds to generate. If you have the model on NVMe using PCIe 4.0, you get about 7000MB/s read rate, so one token takes (317 / 7) = 45 seconds. The page cache of the filesystem will help somewhat by having some of the model in RAM. You don't indicate what sort of system you have but you say "basic hardware", so let's assume something with DDR4 RAM. That's about 20GB/s read rate, so if the model was solely in RAM, one token would take (317 / 20) = 16 seconds. So best case speed you will get is 0.0625 tokens/second, worst case is 0.00173611 tokens/second.
Running a model requires VRAM. Running a large model requires a lot of VRAM.
@HongZhang-Robotechlab commented on GitHub (Mar 2, 2025):
Since ollama can detect the available GPU memory and model layer size, could it adjust the value of num_gpu automatically instead manually set it in Modelfile?
@rick-github commented on GitHub (Mar 3, 2025):
It tries to calculate
num_gpuautomatically but it gets it wrong, that's why it's manually overridden in he Modelfile. #9243 to improve the accuracy of thenum_gpuestimation.