[GH-ISSUE #8509] Can I force the GPU to be used? #67540

Closed
opened 2026-05-04 10:43:46 -05:00 by GiteaMirror · 11 comments
Owner

Originally created by @NGC13009 on GitHub (Jan 20, 2025).
Original GitHub issue: https://github.com/ollama/ollama/issues/8509

I would like to force the models to be loaded onto the GPU instead of automatically deploying some parts within the cpu. I'm pretty sure I have enough VRAM, but ollama always deploys some parts of the model to the cpu device by itself. I didn't find any proper way to force the models to be fixedly deployed to the gpu, and I'd like to confirm if this feature exists? If it doesn't exist, could consider adding this?

Originally created by @NGC13009 on GitHub (Jan 20, 2025). Original GitHub issue: https://github.com/ollama/ollama/issues/8509 I would like to force the models to be loaded onto the GPU instead of automatically deploying some parts within the cpu. I'm pretty sure I have enough VRAM, but ollama always deploys some parts of the model to the cpu device by itself. I didn't find any proper way to force the models to be fixedly deployed to the gpu, and I'd like to confirm if this feature exists? If it doesn't exist, could consider adding this?
GiteaMirror added the feature request label 2026-05-04 10:43:46 -05:00
Author
Owner

@ajunyo commented on GitHub (Jan 21, 2025):

me too

<!-- gh-comment-id:2603409835 --> @ajunyo commented on GitHub (Jan 21, 2025): me too
Author
Owner

@rick-github commented on GitHub (Jan 21, 2025):

ollama will load as much of the model in to VRAM as it thinks will fit. There are ways to override it, but it may lead to performance degradation or crashing. If you provide server logs it may aid in providing a solution.

<!-- gh-comment-id:2603935467 --> @rick-github commented on GitHub (Jan 21, 2025): ollama will load as much of the model in to VRAM as it thinks will fit. There are ways to override it, but it may lead to performance degradation or crashing. If you provide [server logs](https://github.com/ollama/ollama/blob/main/docs/troubleshooting.md#how-to-troubleshoot-issues) it may aid in providing a solution.
Author
Owner

@NGC13009 commented on GitHub (Jan 21, 2025):

ollama will load as much of the model in to VRAM as it thinks will fit. There are ways to override it, but it may lead to performance degradation or crashing. If you provide server logs it may aid in providing a solution.

The server logs only show very common records. I can explain my situation here: my models loaded in and were 100% GPU in the beginning. but when I opened multiple web pages, as the web pages took up VRAM, then ollama let 7% of the models go to the CPU. however, I would like the models to prioritize the video memory, which in fact never eats up the full memory. Currently on Windows CUDA etc, should support shared video memory, I don't want ollama to move some of the model to cpu for execution in this case.

Also, I've gone through a series of experiments to determine how big a model my local machine can run, so I'd prefer to just crash and report an error when the video memory demanded by ollama isn't big enough, rather than move it to the cpu.

If I can't keep the model fixed to the GPU, then there may be frequent additional performance impacts due to the model constantly being moved back and forth because the usage is close to the video memory boundary. I would like the model to be able to run inside VRAM all the time, thus forcing other video card operations (such as web browsing) to automatically use shared video memory. However, right now it looks like ollama seems to be setting itself as the last priority.

I'll provide the server log below, but there may not be relevant information here

2025/01/20 22:06:17 routes.go:1187: INFO server config env="map[CUDA_VISIBLE_DEVICES: GPU_DEVICE_ORDINAL: HIP_VISIBLE_DEVICES: HSA_OVERRIDE_GFX_VERSION: HTTPS_PROXY: HTTP_PROXY: NO_PROXY: OLLAMA_DEBUG:false OLLAMA_FLASH_ATTENTION:true OLLAMA_GPU_OVERHEAD:0 OLLAMA_HOST:http://127.0.0.1:11434 OLLAMA_INTEL_GPU:false OLLAMA_KEEP_ALIVE:2562047h47m16.854775807s OLLAMA_KV_CACHE_TYPE: OLLAMA_LLM_LIBRARY: OLLAMA_LOAD_TIMEOUT:5m0s OLLAMA_MAX_LOADED_MODELS:0 OLLAMA_MAX_QUEUE:512 OLLAMA_MODELS:F:\\LLM\\ollama_models OLLAMA_MULTIUSER_CACHE:false OLLAMA_NOHISTORY:false OLLAMA_NOPRUNE:false OLLAMA_NUM_PARALLEL:1 OLLAMA_ORIGINS:[http://localhost https://localhost http://localhost:* https://localhost:* http://127.0.0.1 https://127.0.0.1 http://127.0.0.1:* https://127.0.0.1:* http://0.0.0.0 https://0.0.0.0 http://0.0.0.0:* https://0.0.0.0:* app://* file://* tauri://* vscode-webview://*] OLLAMA_SCHED_SPREAD:false ROCR_VISIBLE_DEVICES:]"
time=2025-01-20T22:06:17.082+08:00 level=INFO source=images.go:432 msg="total blobs: 8"
time=2025-01-20T22:06:17.083+08:00 level=INFO source=images.go:439 msg="total unused blobs removed: 0"
time=2025-01-20T22:06:17.084+08:00 level=INFO source=routes.go:1238 msg="Listening on 127.0.0.1:11434 (version 0.5.7)"
time=2025-01-20T22:06:17.086+08:00 level=INFO source=routes.go:1267 msg="Dynamic LLM libraries" runners="[cpu_avx2 cuda_v11_avx cuda_v12_avx rocm_avx cpu cpu_avx]"
time=2025-01-20T22:06:17.088+08:00 level=INFO source=gpu.go:226 msg="looking for compatible GPUs"
time=2025-01-20T22:06:17.088+08:00 level=INFO source=gpu_windows.go:167 msg=packages count=1
time=2025-01-20T22:06:17.088+08:00 level=INFO source=gpu_windows.go:183 msg="efficiency cores detected" maxEfficiencyClass=1
time=2025-01-20T22:06:17.088+08:00 level=INFO source=gpu_windows.go:214 msg="" package=0 cores=24 efficiency=16 threads=32
time=2025-01-20T22:06:17.298+08:00 level=INFO source=types.go:131 msg="inference compute" id=GPU-8731b7bb-dfeb-5d18-2333-712f9521ad1c library=cuda variant=v12 compute=8.9 driver=12.7 name="NVIDIA GeForce RTX 4060 Laptop GPU" total="8.0 GiB" available="6.9 GiB"
[GIN] 2025/01/20 - 22:06:21 | 200 |     82.3383ms |       127.0.0.1 | POST     "/api/show"
[GIN] 2025/01/20 - 22:06:21 | 200 |     79.7085ms |       127.0.0.1 | POST     "/api/show"
[GIN] 2025/01/20 - 22:06:21 | 200 |     80.8803ms |       127.0.0.1 | POST     "/api/show"
[GIN] 2025/01/20 - 22:06:21 | 200 |     85.9126ms |       127.0.0.1 | POST     "/api/show"
[GIN] 2025/01/20 - 22:06:21 | 200 |     91.5334ms |       127.0.0.1 | POST     "/api/show"
[GIN] 2025/01/20 - 22:06:21 | 200 |    106.1917ms |       127.0.0.1 | POST     "/api/show"
[GIN] 2025/01/20 - 22:06:21 | 200 |    107.0281ms |       127.0.0.1 | POST     "/api/show"
[GIN] 2025/01/20 - 22:06:21 | 200 |     108.148ms |       127.0.0.1 | POST     "/api/show"
time=2025-01-20T22:07:18.435+08:00 level=INFO source=server.go:104 msg="system memory" total="63.7 GiB" free="50.0 GiB" free_swap="46.6 GiB"
time=2025-01-20T22:07:18.453+08:00 level=INFO source=memory.go:356 msg="offload to cuda" layers.requested=-1 layers.model=29 layers.offload=28 layers.split="" memory.available="[5.9 GiB]" memory.gpu_overhead="0 B" memory.required.full="6.2 GiB" memory.required.partial="5.8 GiB" memory.required.kv="672.0 MiB" memory.required.allocations="[5.8 GiB]" memory.weights.total="4.3 GiB" memory.weights.repeating="3.9 GiB" memory.weights.nonrepeating="426.4 MiB" memory.graph.full="710.0 MiB" memory.graph.partial="878.0 MiB"
time=2025-01-20T22:07:18.457+08:00 level=INFO source=server.go:223 msg="enabling flash attention"
time=2025-01-20T22:07:18.457+08:00 level=WARN source=server.go:231 msg="kv cache type not supported by model" type=""
time=2025-01-20T22:07:18.488+08:00 level=INFO source=server.go:376 msg="starting llama server" cmd="C:\\Users\\ngc13\\AppData\\Local\\Programs\\Ollama\\lib\\ollama\\runners\\cuda_v12_avx\\ollama_llama_server.exe runner --model F:\\LLM\\ollama_models\\blobs\\sha256-60e05f2100071479f596b964f89f510f057ce397ea22f2833a0cfe029bfc2463 --ctx-size 12288 --batch-size 512 --n-gpu-layers 28 --threads 4 --flash-attn --no-mmap --parallel 1 --port 55752"
time=2025-01-20T22:07:19.078+08:00 level=INFO source=sched.go:449 msg="loaded runners" count=1
time=2025-01-20T22:07:19.087+08:00 level=INFO source=server.go:555 msg="waiting for llama runner to start responding"
time=2025-01-20T22:07:19.088+08:00 level=WARN source=server.go:562 msg="client connection closed before server finished loading, aborting load"
time=2025-01-20T22:07:19.089+08:00 level=ERROR source=sched.go:455 msg="error loading llama server" error="timed out waiting for llama runner to start: context canceled"
[GIN] 2025/01/20 - 22:07:19 | 499 |    838.8804ms |       127.0.0.1 | POST     "/api/generate"
time=2025-01-20T22:07:24.113+08:00 level=WARN source=sched.go:646 msg="gpu VRAM usage didn't recover within timeout" seconds=5.0214395 model=F:\LLM\ollama_models\blobs\sha256-60e05f2100071479f596b964f89f510f057ce397ea22f2833a0cfe029bfc2463
time=2025-01-20T22:07:24.302+08:00 level=INFO source=server.go:104 msg="system memory" total="63.7 GiB" free="50.0 GiB" free_swap="46.6 GiB"
time=2025-01-20T22:07:24.319+08:00 level=INFO source=memory.go:356 msg="offload to cuda" layers.requested=-1 layers.model=29 layers.offload=28 layers.split="" memory.available="[6.0 GiB]" memory.gpu_overhead="0 B" memory.required.full="6.2 GiB" memory.required.partial="5.8 GiB" memory.required.kv="672.0 MiB" memory.required.allocations="[5.8 GiB]" memory.weights.total="4.3 GiB" memory.weights.repeating="3.9 GiB" memory.weights.nonrepeating="426.4 MiB" memory.graph.full="710.0 MiB" memory.graph.partial="878.0 MiB"
time=2025-01-20T22:07:24.322+08:00 level=INFO source=server.go:223 msg="enabling flash attention"
time=2025-01-20T22:07:24.322+08:00 level=WARN source=server.go:231 msg="kv cache type not supported by model" type=""
time=2025-01-20T22:07:24.344+08:00 level=INFO source=server.go:376 msg="starting llama server" cmd="C:\\Users\\ngc13\\AppData\\Local\\Programs\\Ollama\\lib\\ollama\\runners\\cuda_v12_avx\\ollama_llama_server.exe runner --model F:\\LLM\\ollama_models\\blobs\\sha256-60e05f2100071479f596b964f89f510f057ce397ea22f2833a0cfe029bfc2463 --ctx-size 12288 --batch-size 512 --n-gpu-layers 28 --threads 4 --flash-attn --no-mmap --parallel 1 --port 55769"
time=2025-01-20T22:07:24.351+08:00 level=INFO source=sched.go:449 msg="loaded runners" count=1
time=2025-01-20T22:07:24.351+08:00 level=INFO source=server.go:555 msg="waiting for llama runner to start responding"
time=2025-01-20T22:07:24.351+08:00 level=WARN source=server.go:562 msg="client connection closed before server finished loading, aborting load"
time=2025-01-20T22:07:24.351+08:00 level=ERROR source=sched.go:455 msg="error loading llama server" error="timed out waiting for llama runner to start: context canceled"
[GIN] 2025/01/20 - 22:07:24 | 499 |    5.5230363s |       127.0.0.1 | POST     "/api/generate"
time=2025-01-20T22:07:24.363+08:00 level=WARN source=sched.go:646 msg="gpu VRAM usage didn't recover within timeout" seconds=5.2716372 model=F:\LLM\ollama_models\blobs\sha256-60e05f2100071479f596b964f89f510f057ce397ea22f2833a0cfe029bfc2463
time=2025-01-20T22:07:24.613+08:00 level=WARN source=sched.go:646 msg="gpu VRAM usage didn't recover within timeout" seconds=5.5219729 model=F:\LLM\ollama_models\blobs\sha256-60e05f2100071479f596b964f89f510f057ce397ea22f2833a0cfe029bfc2463
time=2025-01-20T22:07:29.380+08:00 level=WARN source=sched.go:646 msg="gpu VRAM usage didn't recover within timeout" seconds=5.026924 model=F:\LLM\ollama_models\blobs\sha256-60e05f2100071479f596b964f89f510f057ce397ea22f2833a0cfe029bfc2463
time=2025-01-20T22:07:29.565+08:00 level=INFO source=server.go:104 msg="system memory" total="63.7 GiB" free="50.0 GiB" free_swap="46.8 GiB"
time=2025-01-20T22:07:29.580+08:00 level=INFO source=memory.go:356 msg="offload to cuda" layers.requested=-1 layers.model=29 layers.offload=28 layers.split="" memory.available="[6.0 GiB]" memory.gpu_overhead="0 B" memory.required.full="6.2 GiB" memory.required.partial="5.8 GiB" memory.required.kv="672.0 MiB" memory.required.allocations="[5.8 GiB]" memory.weights.total="4.3 GiB" memory.weights.repeating="3.9 GiB" memory.weights.nonrepeating="426.4 MiB" memory.graph.full="710.0 MiB" memory.graph.partial="878.0 MiB"
time=2025-01-20T22:07:29.582+08:00 level=INFO source=server.go:223 msg="enabling flash attention"
time=2025-01-20T22:07:29.582+08:00 level=WARN source=server.go:231 msg="kv cache type not supported by model" type=""
time=2025-01-20T22:07:29.601+08:00 level=INFO source=server.go:376 msg="starting llama server" cmd="C:\\Users\\ngc13\\AppData\\Local\\Programs\\Ollama\\lib\\ollama\\runners\\cuda_v12_avx\\ollama_llama_server.exe runner --model F:\\LLM\\ollama_models\\blobs\\sha256-60e05f2100071479f596b964f89f510f057ce397ea22f2833a0cfe029bfc2463 --ctx-size 12288 --batch-size 512 --n-gpu-layers 28 --threads 4 --flash-attn --no-mmap --parallel 1 --port 55777"
time=2025-01-20T22:07:29.608+08:00 level=INFO source=sched.go:449 msg="loaded runners" count=1
time=2025-01-20T22:07:29.608+08:00 level=INFO source=server.go:555 msg="waiting for llama runner to start responding"
time=2025-01-20T22:07:29.608+08:00 level=INFO source=server.go:589 msg="waiting for server to become available" status="llm server error"
time=2025-01-20T22:07:29.630+08:00 level=WARN source=sched.go:646 msg="gpu VRAM usage didn't recover within timeout" seconds=5.2769003 model=F:\LLM\ollama_models\blobs\sha256-60e05f2100071479f596b964f89f510f057ce397ea22f2833a0cfe029bfc2463
time=2025-01-20T22:07:29.833+08:00 level=INFO source=runner.go:936 msg="starting go runner"
ggml_cuda_init: GGML_CUDA_FORCE_MMQ:    no
ggml_cuda_init: GGML_CUDA_FORCE_CUBLAS: no
ggml_cuda_init: found 1 CUDA devices:
  Device 0: NVIDIA GeForce RTX 4060 Laptop GPU, compute capability 8.9, VMM: yes
time=2025-01-20T22:07:29.855+08:00 level=INFO source=runner.go:937 msg=system info="CUDA : ARCHS = 600,610,620,700,720,750,800,860,870,890,900 | USE_GRAPHS = 1 | PEER_MAX_BATCH_SIZE = 128 | CPU : SSE3 = 1 | SSSE3 = 1 | AVX = 1 | LLAMAFILE = 1 | AARCH64_REPACK = 1 | cgo(clang)" threads=4
time=2025-01-20T22:07:29.856+08:00 level=INFO source=.:0 msg="Server listening on 127.0.0.1:55777"
time=2025-01-20T22:07:29.860+08:00 level=INFO source=server.go:589 msg="waiting for server to become available" status="llm server loading model"
time=2025-01-20T22:07:29.880+08:00 level=WARN source=sched.go:646 msg="gpu VRAM usage didn't recover within timeout" seconds=5.5266502 model=F:\LLM\ollama_models\blobs\sha256-60e05f2100071479f596b964f89f510f057ce397ea22f2833a0cfe029bfc2463
llama_load_model_from_file: using device CUDA0 (NVIDIA GeForce RTX 4060 Laptop GPU) - 7099 MiB free
llama_model_loader: loaded meta data with 34 key-value pairs and 339 tensors from F:\LLM\ollama_models\blobs\sha256-60e05f2100071479f596b964f89f510f057ce397ea22f2833a0cfe029bfc2463 (version GGUF V3 (latest))
llama_model_loader: Dumping metadata keys/values. Note: KV overrides do not apply in this output.
llama_model_loader: - kv   0:                       general.architecture str              = qwen2
llama_model_loader: - kv   1:                               general.type str              = model
llama_model_loader: - kv   2:                               general.name str              = Qwen2.5 Coder 7B Instruct
llama_model_loader: - kv   3:                           general.finetune str              = Instruct
llama_model_loader: - kv   4:                           general.basename str              = Qwen2.5-Coder
llama_model_loader: - kv   5:                         general.size_label str              = 7B
llama_model_loader: - kv   6:                            general.license str              = apache-2.0
llama_model_loader: - kv   7:                       general.license.link str              = https://huggingface.co/Qwen/Qwen2.5-C...
llama_model_loader: - kv   8:                   general.base_model.count u32              = 1
llama_model_loader: - kv   9:                  general.base_model.0.name str              = Qwen2.5 Coder 7B
llama_model_loader: - kv  10:          general.base_model.0.organization str              = Qwen
llama_model_loader: - kv  11:              general.base_model.0.repo_url str              = https://huggingface.co/Qwen/Qwen2.5-C...
llama_model_loader: - kv  12:                               general.tags arr[str,6]       = ["code", "codeqwen", "chat", "qwen", ...
llama_model_loader: - kv  13:                          general.languages arr[str,1]       = ["en"]
llama_model_loader: - kv  14:                          qwen2.block_count u32              = 28
llama_model_loader: - kv  15:                       qwen2.context_length u32              = 32768
llama_model_loader: - kv  16:                     qwen2.embedding_length u32              = 3584
llama_model_loader: - kv  17:                  qwen2.feed_forward_length u32              = 18944
llama_model_loader: - kv  18:                 qwen2.attention.head_count u32              = 28
llama_model_loader: - kv  19:              qwen2.attention.head_count_kv u32              = 4
llama_model_loader: - kv  20:                       qwen2.rope.freq_base f32              = 1000000.000000
llama_model_loader: - kv  21:     qwen2.attention.layer_norm_rms_epsilon f32              = 0.000001
llama_model_loader: - kv  22:                          general.file_type u32              = 15
llama_model_loader: - kv  23:                       tokenizer.ggml.model str              = gpt2
llama_model_loader: - kv  24:                         tokenizer.ggml.pre str              = qwen2
llama_model_loader: - kv  25:                      tokenizer.ggml.tokens arr[str,152064]  = ["!", "\"", "#", "$", "%", "&", "'", ...
llama_model_loader: - kv  26:                  tokenizer.ggml.token_type arr[i32,152064]  = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, ...
llama_model_loader: - kv  27:                      tokenizer.ggml.merges arr[str,151387]  = ["Ġ Ġ", "ĠĠ ĠĠ", "i n", "Ġ t",...
llama_model_loader: - kv  28:                tokenizer.ggml.eos_token_id u32              = 151645
llama_model_loader: - kv  29:            tokenizer.ggml.padding_token_id u32              = 151643
llama_model_loader: - kv  30:                tokenizer.ggml.bos_token_id u32              = 151643
llama_model_loader: - kv  31:               tokenizer.ggml.add_bos_token bool             = false
llama_model_loader: - kv  32:                    tokenizer.chat_template str              = {%- if tools %}\n    {{- '<|im_start|>...
llama_model_loader: - kv  33:               general.quantization_version u32              = 2
llama_model_loader: - type  f32:  141 tensors
llama_model_loader: - type q4_K:  169 tensors
llama_model_loader: - type q6_K:   29 tensors
llm_load_vocab: special tokens cache size = 22
llm_load_vocab: token to piece cache size = 0.9310 MB
llm_load_print_meta: format           = GGUF V3 (latest)
llm_load_print_meta: arch             = qwen2
llm_load_print_meta: vocab type       = BPE
llm_load_print_meta: n_vocab          = 152064
llm_load_print_meta: n_merges         = 151387
llm_load_print_meta: vocab_only       = 0
llm_load_print_meta: n_ctx_train      = 32768
llm_load_print_meta: n_embd           = 3584
llm_load_print_meta: n_layer          = 28
llm_load_print_meta: n_head           = 28
llm_load_print_meta: n_head_kv        = 4
llm_load_print_meta: n_rot            = 128
llm_load_print_meta: n_swa            = 0
llm_load_print_meta: n_embd_head_k    = 128
llm_load_print_meta: n_embd_head_v    = 128
llm_load_print_meta: n_gqa            = 7
llm_load_print_meta: n_embd_k_gqa     = 512
llm_load_print_meta: n_embd_v_gqa     = 512
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             = 18944
llm_load_print_meta: n_expert         = 0
llm_load_print_meta: n_expert_used    = 0
llm_load_print_meta: causal attn      = 1
llm_load_print_meta: pooling type     = 0
llm_load_print_meta: rope type        = 2
llm_load_print_meta: rope scaling     = linear
llm_load_print_meta: freq_base_train  = 1000000.0
llm_load_print_meta: freq_scale_train = 1
llm_load_print_meta: n_ctx_orig_yarn  = 32768
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       = 7B
llm_load_print_meta: model ftype      = Q4_K - Medium
llm_load_print_meta: model params     = 7.62 B
llm_load_print_meta: model size       = 4.36 GiB (4.91 BPW) 
llm_load_print_meta: general.name     = Qwen2.5 Coder 7B Instruct
llm_load_print_meta: BOS token        = 151643 '<|endoftext|>'
llm_load_print_meta: EOS token        = 151645 '<|im_end|>'
llm_load_print_meta: EOT token        = 151645 '<|im_end|>'
llm_load_print_meta: PAD token        = 151643 '<|endoftext|>'
llm_load_print_meta: LF token         = 148848 'ÄĬ'
llm_load_print_meta: FIM PRE token    = 151659 '<|fim_prefix|>'
llm_load_print_meta: FIM SUF token    = 151661 '<|fim_suffix|>'
llm_load_print_meta: FIM MID token    = 151660 '<|fim_middle|>'
llm_load_print_meta: FIM PAD token    = 151662 '<|fim_pad|>'
llm_load_print_meta: FIM REP token    = 151663 '<|repo_name|>'
llm_load_print_meta: FIM SEP token    = 151664 '<|file_sep|>'
llm_load_print_meta: EOG token        = 151643 '<|endoftext|>'
llm_load_print_meta: EOG token        = 151645 '<|im_end|>'
llm_load_print_meta: EOG token        = 151662 '<|fim_pad|>'
llm_load_print_meta: EOG token        = 151663 '<|repo_name|>'
llm_load_print_meta: EOG token        = 151664 '<|file_sep|>'
llm_load_print_meta: max token length = 256
llm_load_tensors: offloading 28 repeating layers to GPU
llm_load_tensors: offloaded 28/29 layers to GPU
llm_load_tensors:          CPU model buffer size =   292.36 MiB
llm_load_tensors:    CUDA_Host model buffer size =   426.37 MiB
llm_load_tensors:        CUDA0 model buffer size =  3741.72 MiB
llama_new_context_with_model: n_seq_max     = 1
llama_new_context_with_model: n_ctx         = 12288
llama_new_context_with_model: n_ctx_per_seq = 12288
llama_new_context_with_model: n_batch       = 512
llama_new_context_with_model: n_ubatch      = 512
llama_new_context_with_model: flash_attn    = 1
llama_new_context_with_model: freq_base     = 1000000.0
llama_new_context_with_model: freq_scale    = 1
llama_new_context_with_model: n_ctx_per_seq (12288) < n_ctx_train (32768) -- the full capacity of the model will not be utilized
llama_kv_cache_init: kv_size = 12288, offload = 1, type_k = 'f16', type_v = 'f16', n_layer = 28, can_shift = 1
llama_kv_cache_init:      CUDA0 KV buffer size =   672.00 MiB
llama_new_context_with_model: KV self size  =  672.00 MiB, K (f16):  336.00 MiB, V (f16):  336.00 MiB
llama_new_context_with_model:        CPU  output buffer size =     0.59 MiB
llama_new_context_with_model:      CUDA0 compute buffer size =   730.36 MiB
llama_new_context_with_model:  CUDA_Host compute buffer size =    31.01 MiB
llama_new_context_with_model: graph nodes  = 875
llama_new_context_with_model: graph splits = 4 (with bs=512), 3 (with bs=1)
time=2025-01-20T22:07:32.619+08:00 level=INFO source=server.go:594 msg="llama runner started in 3.01 seconds"
llama_model_loader: loaded meta data with 34 key-value pairs and 339 tensors from F:\LLM\ollama_models\blobs\sha256-60e05f2100071479f596b964f89f510f057ce397ea22f2833a0cfe029bfc2463 (version GGUF V3 (latest))
llama_model_loader: Dumping metadata keys/values. Note: KV overrides do not apply in this output.
llama_model_loader: - kv   0:                       general.architecture str              = qwen2
llama_model_loader: - kv   1:                               general.type str              = model
llama_model_loader: - kv   2:                               general.name str              = Qwen2.5 Coder 7B Instruct
llama_model_loader: - kv   3:                           general.finetune str              = Instruct
llama_model_loader: - kv   4:                           general.basename str              = Qwen2.5-Coder
llama_model_loader: - kv   5:                         general.size_label str              = 7B
llama_model_loader: - kv   6:                            general.license str              = apache-2.0
llama_model_loader: - kv   7:                       general.license.link str              = https://huggingface.co/Qwen/Qwen2.5-C...
llama_model_loader: - kv   8:                   general.base_model.count u32              = 1
llama_model_loader: - kv   9:                  general.base_model.0.name str              = Qwen2.5 Coder 7B
llama_model_loader: - kv  10:          general.base_model.0.organization str              = Qwen
llama_model_loader: - kv  11:              general.base_model.0.repo_url str              = https://huggingface.co/Qwen/Qwen2.5-C...
llama_model_loader: - kv  12:                               general.tags arr[str,6]       = ["code", "codeqwen", "chat", "qwen", ...
llama_model_loader: - kv  13:                          general.languages arr[str,1]       = ["en"]
llama_model_loader: - kv  14:                          qwen2.block_count u32              = 28
llama_model_loader: - kv  15:                       qwen2.context_length u32              = 32768
llama_model_loader: - kv  16:                     qwen2.embedding_length u32              = 3584
llama_model_loader: - kv  17:                  qwen2.feed_forward_length u32              = 18944
llama_model_loader: - kv  18:                 qwen2.attention.head_count u32              = 28
llama_model_loader: - kv  19:              qwen2.attention.head_count_kv u32              = 4
llama_model_loader: - kv  20:                       qwen2.rope.freq_base f32              = 1000000.000000
llama_model_loader: - kv  21:     qwen2.attention.layer_norm_rms_epsilon f32              = 0.000001
llama_model_loader: - kv  22:                          general.file_type u32              = 15
llama_model_loader: - kv  23:                       tokenizer.ggml.model str              = gpt2
llama_model_loader: - kv  24:                         tokenizer.ggml.pre str              = qwen2
llama_model_loader: - kv  25:                      tokenizer.ggml.tokens arr[str,152064]  = ["!", "\"", "#", "$", "%", "&", "'", ...
llama_model_loader: - kv  26:                  tokenizer.ggml.token_type arr[i32,152064]  = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, ...
llama_model_loader: - kv  27:                      tokenizer.ggml.merges arr[str,151387]  = ["Ġ Ġ", "ĠĠ ĠĠ", "i n", "Ġ t",...
llama_model_loader: - kv  28:                tokenizer.ggml.eos_token_id u32              = 151645
llama_model_loader: - kv  29:            tokenizer.ggml.padding_token_id u32              = 151643
llama_model_loader: - kv  30:                tokenizer.ggml.bos_token_id u32              = 151643
llama_model_loader: - kv  31:               tokenizer.ggml.add_bos_token bool             = false
llama_model_loader: - kv  32:                    tokenizer.chat_template str              = {%- if tools %}\n    {{- '<|im_start|>...
llama_model_loader: - kv  33:               general.quantization_version u32              = 2
llama_model_loader: - type  f32:  141 tensors
llama_model_loader: - type q4_K:  169 tensors
llama_model_loader: - type q6_K:   29 tensors
llm_load_vocab: special tokens cache size = 22
llm_load_vocab: token to piece cache size = 0.9310 MB
llm_load_print_meta: format           = GGUF V3 (latest)
llm_load_print_meta: arch             = qwen2
llm_load_print_meta: vocab type       = BPE
llm_load_print_meta: n_vocab          = 152064
llm_load_print_meta: n_merges         = 151387
llm_load_print_meta: vocab_only       = 1
llm_load_print_meta: model type       = ?B
llm_load_print_meta: model ftype      = all F32
llm_load_print_meta: model params     = 7.62 B
llm_load_print_meta: model size       = 4.36 GiB (4.91 BPW) 
llm_load_print_meta: general.name     = Qwen2.5 Coder 7B Instruct
llm_load_print_meta: BOS token        = 151643 '<|endoftext|>'
llm_load_print_meta: EOS token        = 151645 '<|im_end|>'
llm_load_print_meta: EOT token        = 151645 '<|im_end|>'
llm_load_print_meta: PAD token        = 151643 '<|endoftext|>'
llm_load_print_meta: LF token         = 148848 'ÄĬ'
llm_load_print_meta: FIM PRE token    = 151659 '<|fim_prefix|>'
llm_load_print_meta: FIM SUF token    = 151661 '<|fim_suffix|>'
llm_load_print_meta: FIM MID token    = 151660 '<|fim_middle|>'
llm_load_print_meta: FIM PAD token    = 151662 '<|fim_pad|>'
llm_load_print_meta: FIM REP token    = 151663 '<|repo_name|>'
llm_load_print_meta: FIM SEP token    = 151664 '<|file_sep|>'
llm_load_print_meta: EOG token        = 151643 '<|endoftext|>'
llm_load_print_meta: EOG token        = 151645 '<|im_end|>'
llm_load_print_meta: EOG token        = 151662 '<|fim_pad|>'
llm_load_print_meta: EOG token        = 151663 '<|repo_name|>'
llm_load_print_meta: EOG token        = 151664 '<|file_sep|>'
llm_load_print_meta: max token length = 256
llama_model_load: vocab only - skipping tensors
[GIN] 2025/01/20 - 22:07:37 | 200 |   17.5463901s |       127.0.0.1 | POST     "/api/generate"
[GIN] 2025/01/21 - 00:04:22 | 200 |            0s |       127.0.0.1 | HEAD     "/"
[GIN] 2025/01/21 - 00:04:22 | 200 |            0s |       127.0.0.1 | GET      "/api/ps"
[GIN] 2025/01/21 - 00:04:33 | 200 |       526.5µs |       127.0.0.1 | HEAD     "/"
[GIN] 2025/01/21 - 00:04:33 | 200 |            0s |       127.0.0.1 | GET      "/api/ps"
[GIN] 2025/01/21 - 00:04:34 | 200 |            0s |       127.0.0.1 | HEAD     "/"
[GIN] 2025/01/21 - 00:04:34 | 200 |            0s |       127.0.0.1 | GET      "/api/ps"

<!-- gh-comment-id:2604495291 --> @NGC13009 commented on GitHub (Jan 21, 2025): > ollama will load as much of the model in to VRAM as it thinks will fit. There are ways to override it, but it may lead to performance degradation or crashing. If you provide [server logs](https://github.com/ollama/ollama/blob/main/docs/troubleshooting.md#how-to-troubleshoot-issues) it may aid in providing a solution. The server logs only show very common records. I can explain my situation here: my models loaded in and were 100% GPU in the beginning. but when I opened multiple web pages, as the web pages took up VRAM, then ollama let 7% of the models go to the CPU. however, I would like the models to prioritize the video memory, which in fact never eats up the full memory. Currently on Windows CUDA etc, should support shared video memory, I don't want ollama to move some of the model to cpu for execution in this case. Also, I've gone through a series of experiments to determine how big a model my local machine can run, so I'd prefer to just crash and report an error when the video memory demanded by ollama isn't big enough, rather than move it to the cpu. If I can't keep the model fixed to the GPU, then there may be frequent additional performance impacts due to the model constantly being moved back and forth because the usage is close to the video memory boundary. I would like the model to be able to run inside VRAM all the time, thus forcing other video card operations (such as web browsing) to automatically use shared video memory. However, right now it looks like ollama seems to be setting itself as the last priority. I'll provide the server log below, but there may not be relevant information here ```log 2025/01/20 22:06:17 routes.go:1187: INFO server config env="map[CUDA_VISIBLE_DEVICES: GPU_DEVICE_ORDINAL: HIP_VISIBLE_DEVICES: HSA_OVERRIDE_GFX_VERSION: HTTPS_PROXY: HTTP_PROXY: NO_PROXY: OLLAMA_DEBUG:false OLLAMA_FLASH_ATTENTION:true OLLAMA_GPU_OVERHEAD:0 OLLAMA_HOST:http://127.0.0.1:11434 OLLAMA_INTEL_GPU:false OLLAMA_KEEP_ALIVE:2562047h47m16.854775807s OLLAMA_KV_CACHE_TYPE: OLLAMA_LLM_LIBRARY: OLLAMA_LOAD_TIMEOUT:5m0s OLLAMA_MAX_LOADED_MODELS:0 OLLAMA_MAX_QUEUE:512 OLLAMA_MODELS:F:\\LLM\\ollama_models OLLAMA_MULTIUSER_CACHE:false OLLAMA_NOHISTORY:false OLLAMA_NOPRUNE:false OLLAMA_NUM_PARALLEL:1 OLLAMA_ORIGINS:[http://localhost https://localhost http://localhost:* https://localhost:* http://127.0.0.1 https://127.0.0.1 http://127.0.0.1:* https://127.0.0.1:* http://0.0.0.0 https://0.0.0.0 http://0.0.0.0:* https://0.0.0.0:* app://* file://* tauri://* vscode-webview://*] OLLAMA_SCHED_SPREAD:false ROCR_VISIBLE_DEVICES:]" time=2025-01-20T22:06:17.082+08:00 level=INFO source=images.go:432 msg="total blobs: 8" time=2025-01-20T22:06:17.083+08:00 level=INFO source=images.go:439 msg="total unused blobs removed: 0" time=2025-01-20T22:06:17.084+08:00 level=INFO source=routes.go:1238 msg="Listening on 127.0.0.1:11434 (version 0.5.7)" time=2025-01-20T22:06:17.086+08:00 level=INFO source=routes.go:1267 msg="Dynamic LLM libraries" runners="[cpu_avx2 cuda_v11_avx cuda_v12_avx rocm_avx cpu cpu_avx]" time=2025-01-20T22:06:17.088+08:00 level=INFO source=gpu.go:226 msg="looking for compatible GPUs" time=2025-01-20T22:06:17.088+08:00 level=INFO source=gpu_windows.go:167 msg=packages count=1 time=2025-01-20T22:06:17.088+08:00 level=INFO source=gpu_windows.go:183 msg="efficiency cores detected" maxEfficiencyClass=1 time=2025-01-20T22:06:17.088+08:00 level=INFO source=gpu_windows.go:214 msg="" package=0 cores=24 efficiency=16 threads=32 time=2025-01-20T22:06:17.298+08:00 level=INFO source=types.go:131 msg="inference compute" id=GPU-8731b7bb-dfeb-5d18-2333-712f9521ad1c library=cuda variant=v12 compute=8.9 driver=12.7 name="NVIDIA GeForce RTX 4060 Laptop GPU" total="8.0 GiB" available="6.9 GiB" [GIN] 2025/01/20 - 22:06:21 | 200 | 82.3383ms | 127.0.0.1 | POST "/api/show" [GIN] 2025/01/20 - 22:06:21 | 200 | 79.7085ms | 127.0.0.1 | POST "/api/show" [GIN] 2025/01/20 - 22:06:21 | 200 | 80.8803ms | 127.0.0.1 | POST "/api/show" [GIN] 2025/01/20 - 22:06:21 | 200 | 85.9126ms | 127.0.0.1 | POST "/api/show" [GIN] 2025/01/20 - 22:06:21 | 200 | 91.5334ms | 127.0.0.1 | POST "/api/show" [GIN] 2025/01/20 - 22:06:21 | 200 | 106.1917ms | 127.0.0.1 | POST "/api/show" [GIN] 2025/01/20 - 22:06:21 | 200 | 107.0281ms | 127.0.0.1 | POST "/api/show" [GIN] 2025/01/20 - 22:06:21 | 200 | 108.148ms | 127.0.0.1 | POST "/api/show" time=2025-01-20T22:07:18.435+08:00 level=INFO source=server.go:104 msg="system memory" total="63.7 GiB" free="50.0 GiB" free_swap="46.6 GiB" time=2025-01-20T22:07:18.453+08:00 level=INFO source=memory.go:356 msg="offload to cuda" layers.requested=-1 layers.model=29 layers.offload=28 layers.split="" memory.available="[5.9 GiB]" memory.gpu_overhead="0 B" memory.required.full="6.2 GiB" memory.required.partial="5.8 GiB" memory.required.kv="672.0 MiB" memory.required.allocations="[5.8 GiB]" memory.weights.total="4.3 GiB" memory.weights.repeating="3.9 GiB" memory.weights.nonrepeating="426.4 MiB" memory.graph.full="710.0 MiB" memory.graph.partial="878.0 MiB" time=2025-01-20T22:07:18.457+08:00 level=INFO source=server.go:223 msg="enabling flash attention" time=2025-01-20T22:07:18.457+08:00 level=WARN source=server.go:231 msg="kv cache type not supported by model" type="" time=2025-01-20T22:07:18.488+08:00 level=INFO source=server.go:376 msg="starting llama server" cmd="C:\\Users\\ngc13\\AppData\\Local\\Programs\\Ollama\\lib\\ollama\\runners\\cuda_v12_avx\\ollama_llama_server.exe runner --model F:\\LLM\\ollama_models\\blobs\\sha256-60e05f2100071479f596b964f89f510f057ce397ea22f2833a0cfe029bfc2463 --ctx-size 12288 --batch-size 512 --n-gpu-layers 28 --threads 4 --flash-attn --no-mmap --parallel 1 --port 55752" time=2025-01-20T22:07:19.078+08:00 level=INFO source=sched.go:449 msg="loaded runners" count=1 time=2025-01-20T22:07:19.087+08:00 level=INFO source=server.go:555 msg="waiting for llama runner to start responding" time=2025-01-20T22:07:19.088+08:00 level=WARN source=server.go:562 msg="client connection closed before server finished loading, aborting load" time=2025-01-20T22:07:19.089+08:00 level=ERROR source=sched.go:455 msg="error loading llama server" error="timed out waiting for llama runner to start: context canceled" [GIN] 2025/01/20 - 22:07:19 | 499 | 838.8804ms | 127.0.0.1 | POST "/api/generate" time=2025-01-20T22:07:24.113+08:00 level=WARN source=sched.go:646 msg="gpu VRAM usage didn't recover within timeout" seconds=5.0214395 model=F:\LLM\ollama_models\blobs\sha256-60e05f2100071479f596b964f89f510f057ce397ea22f2833a0cfe029bfc2463 time=2025-01-20T22:07:24.302+08:00 level=INFO source=server.go:104 msg="system memory" total="63.7 GiB" free="50.0 GiB" free_swap="46.6 GiB" time=2025-01-20T22:07:24.319+08:00 level=INFO source=memory.go:356 msg="offload to cuda" layers.requested=-1 layers.model=29 layers.offload=28 layers.split="" memory.available="[6.0 GiB]" memory.gpu_overhead="0 B" memory.required.full="6.2 GiB" memory.required.partial="5.8 GiB" memory.required.kv="672.0 MiB" memory.required.allocations="[5.8 GiB]" memory.weights.total="4.3 GiB" memory.weights.repeating="3.9 GiB" memory.weights.nonrepeating="426.4 MiB" memory.graph.full="710.0 MiB" memory.graph.partial="878.0 MiB" time=2025-01-20T22:07:24.322+08:00 level=INFO source=server.go:223 msg="enabling flash attention" time=2025-01-20T22:07:24.322+08:00 level=WARN source=server.go:231 msg="kv cache type not supported by model" type="" time=2025-01-20T22:07:24.344+08:00 level=INFO source=server.go:376 msg="starting llama server" cmd="C:\\Users\\ngc13\\AppData\\Local\\Programs\\Ollama\\lib\\ollama\\runners\\cuda_v12_avx\\ollama_llama_server.exe runner --model F:\\LLM\\ollama_models\\blobs\\sha256-60e05f2100071479f596b964f89f510f057ce397ea22f2833a0cfe029bfc2463 --ctx-size 12288 --batch-size 512 --n-gpu-layers 28 --threads 4 --flash-attn --no-mmap --parallel 1 --port 55769" time=2025-01-20T22:07:24.351+08:00 level=INFO source=sched.go:449 msg="loaded runners" count=1 time=2025-01-20T22:07:24.351+08:00 level=INFO source=server.go:555 msg="waiting for llama runner to start responding" time=2025-01-20T22:07:24.351+08:00 level=WARN source=server.go:562 msg="client connection closed before server finished loading, aborting load" time=2025-01-20T22:07:24.351+08:00 level=ERROR source=sched.go:455 msg="error loading llama server" error="timed out waiting for llama runner to start: context canceled" [GIN] 2025/01/20 - 22:07:24 | 499 | 5.5230363s | 127.0.0.1 | POST "/api/generate" time=2025-01-20T22:07:24.363+08:00 level=WARN source=sched.go:646 msg="gpu VRAM usage didn't recover within timeout" seconds=5.2716372 model=F:\LLM\ollama_models\blobs\sha256-60e05f2100071479f596b964f89f510f057ce397ea22f2833a0cfe029bfc2463 time=2025-01-20T22:07:24.613+08:00 level=WARN source=sched.go:646 msg="gpu VRAM usage didn't recover within timeout" seconds=5.5219729 model=F:\LLM\ollama_models\blobs\sha256-60e05f2100071479f596b964f89f510f057ce397ea22f2833a0cfe029bfc2463 time=2025-01-20T22:07:29.380+08:00 level=WARN source=sched.go:646 msg="gpu VRAM usage didn't recover within timeout" seconds=5.026924 model=F:\LLM\ollama_models\blobs\sha256-60e05f2100071479f596b964f89f510f057ce397ea22f2833a0cfe029bfc2463 time=2025-01-20T22:07:29.565+08:00 level=INFO source=server.go:104 msg="system memory" total="63.7 GiB" free="50.0 GiB" free_swap="46.8 GiB" time=2025-01-20T22:07:29.580+08:00 level=INFO source=memory.go:356 msg="offload to cuda" layers.requested=-1 layers.model=29 layers.offload=28 layers.split="" memory.available="[6.0 GiB]" memory.gpu_overhead="0 B" memory.required.full="6.2 GiB" memory.required.partial="5.8 GiB" memory.required.kv="672.0 MiB" memory.required.allocations="[5.8 GiB]" memory.weights.total="4.3 GiB" memory.weights.repeating="3.9 GiB" memory.weights.nonrepeating="426.4 MiB" memory.graph.full="710.0 MiB" memory.graph.partial="878.0 MiB" time=2025-01-20T22:07:29.582+08:00 level=INFO source=server.go:223 msg="enabling flash attention" time=2025-01-20T22:07:29.582+08:00 level=WARN source=server.go:231 msg="kv cache type not supported by model" type="" time=2025-01-20T22:07:29.601+08:00 level=INFO source=server.go:376 msg="starting llama server" cmd="C:\\Users\\ngc13\\AppData\\Local\\Programs\\Ollama\\lib\\ollama\\runners\\cuda_v12_avx\\ollama_llama_server.exe runner --model F:\\LLM\\ollama_models\\blobs\\sha256-60e05f2100071479f596b964f89f510f057ce397ea22f2833a0cfe029bfc2463 --ctx-size 12288 --batch-size 512 --n-gpu-layers 28 --threads 4 --flash-attn --no-mmap --parallel 1 --port 55777" time=2025-01-20T22:07:29.608+08:00 level=INFO source=sched.go:449 msg="loaded runners" count=1 time=2025-01-20T22:07:29.608+08:00 level=INFO source=server.go:555 msg="waiting for llama runner to start responding" time=2025-01-20T22:07:29.608+08:00 level=INFO source=server.go:589 msg="waiting for server to become available" status="llm server error" time=2025-01-20T22:07:29.630+08:00 level=WARN source=sched.go:646 msg="gpu VRAM usage didn't recover within timeout" seconds=5.2769003 model=F:\LLM\ollama_models\blobs\sha256-60e05f2100071479f596b964f89f510f057ce397ea22f2833a0cfe029bfc2463 time=2025-01-20T22:07:29.833+08:00 level=INFO source=runner.go:936 msg="starting go runner" ggml_cuda_init: GGML_CUDA_FORCE_MMQ: no ggml_cuda_init: GGML_CUDA_FORCE_CUBLAS: no ggml_cuda_init: found 1 CUDA devices: Device 0: NVIDIA GeForce RTX 4060 Laptop GPU, compute capability 8.9, VMM: yes time=2025-01-20T22:07:29.855+08:00 level=INFO source=runner.go:937 msg=system info="CUDA : ARCHS = 600,610,620,700,720,750,800,860,870,890,900 | USE_GRAPHS = 1 | PEER_MAX_BATCH_SIZE = 128 | CPU : SSE3 = 1 | SSSE3 = 1 | AVX = 1 | LLAMAFILE = 1 | AARCH64_REPACK = 1 | cgo(clang)" threads=4 time=2025-01-20T22:07:29.856+08:00 level=INFO source=.:0 msg="Server listening on 127.0.0.1:55777" time=2025-01-20T22:07:29.860+08:00 level=INFO source=server.go:589 msg="waiting for server to become available" status="llm server loading model" time=2025-01-20T22:07:29.880+08:00 level=WARN source=sched.go:646 msg="gpu VRAM usage didn't recover within timeout" seconds=5.5266502 model=F:\LLM\ollama_models\blobs\sha256-60e05f2100071479f596b964f89f510f057ce397ea22f2833a0cfe029bfc2463 llama_load_model_from_file: using device CUDA0 (NVIDIA GeForce RTX 4060 Laptop GPU) - 7099 MiB free llama_model_loader: loaded meta data with 34 key-value pairs and 339 tensors from F:\LLM\ollama_models\blobs\sha256-60e05f2100071479f596b964f89f510f057ce397ea22f2833a0cfe029bfc2463 (version GGUF V3 (latest)) llama_model_loader: Dumping metadata keys/values. Note: KV overrides do not apply in this output. llama_model_loader: - kv 0: general.architecture str = qwen2 llama_model_loader: - kv 1: general.type str = model llama_model_loader: - kv 2: general.name str = Qwen2.5 Coder 7B Instruct llama_model_loader: - kv 3: general.finetune str = Instruct llama_model_loader: - kv 4: general.basename str = Qwen2.5-Coder llama_model_loader: - kv 5: general.size_label str = 7B llama_model_loader: - kv 6: general.license str = apache-2.0 llama_model_loader: - kv 7: general.license.link str = https://huggingface.co/Qwen/Qwen2.5-C... llama_model_loader: - kv 8: general.base_model.count u32 = 1 llama_model_loader: - kv 9: general.base_model.0.name str = Qwen2.5 Coder 7B llama_model_loader: - kv 10: general.base_model.0.organization str = Qwen llama_model_loader: - kv 11: general.base_model.0.repo_url str = https://huggingface.co/Qwen/Qwen2.5-C... llama_model_loader: - kv 12: general.tags arr[str,6] = ["code", "codeqwen", "chat", "qwen", ... llama_model_loader: - kv 13: general.languages arr[str,1] = ["en"] llama_model_loader: - kv 14: qwen2.block_count u32 = 28 llama_model_loader: - kv 15: qwen2.context_length u32 = 32768 llama_model_loader: - kv 16: qwen2.embedding_length u32 = 3584 llama_model_loader: - kv 17: qwen2.feed_forward_length u32 = 18944 llama_model_loader: - kv 18: qwen2.attention.head_count u32 = 28 llama_model_loader: - kv 19: qwen2.attention.head_count_kv u32 = 4 llama_model_loader: - kv 20: qwen2.rope.freq_base f32 = 1000000.000000 llama_model_loader: - kv 21: qwen2.attention.layer_norm_rms_epsilon f32 = 0.000001 llama_model_loader: - kv 22: general.file_type u32 = 15 llama_model_loader: - kv 23: tokenizer.ggml.model str = gpt2 llama_model_loader: - kv 24: tokenizer.ggml.pre str = qwen2 llama_model_loader: - kv 25: tokenizer.ggml.tokens arr[str,152064] = ["!", "\"", "#", "$", "%", "&", "'", ... llama_model_loader: - kv 26: tokenizer.ggml.token_type arr[i32,152064] = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, ... llama_model_loader: - kv 27: tokenizer.ggml.merges arr[str,151387] = ["Ġ Ġ", "ĠĠ ĠĠ", "i n", "Ġ t",... llama_model_loader: - kv 28: tokenizer.ggml.eos_token_id u32 = 151645 llama_model_loader: - kv 29: tokenizer.ggml.padding_token_id u32 = 151643 llama_model_loader: - kv 30: tokenizer.ggml.bos_token_id u32 = 151643 llama_model_loader: - kv 31: tokenizer.ggml.add_bos_token bool = false llama_model_loader: - kv 32: tokenizer.chat_template str = {%- if tools %}\n {{- '<|im_start|>... llama_model_loader: - kv 33: general.quantization_version u32 = 2 llama_model_loader: - type f32: 141 tensors llama_model_loader: - type q4_K: 169 tensors llama_model_loader: - type q6_K: 29 tensors llm_load_vocab: special tokens cache size = 22 llm_load_vocab: token to piece cache size = 0.9310 MB llm_load_print_meta: format = GGUF V3 (latest) llm_load_print_meta: arch = qwen2 llm_load_print_meta: vocab type = BPE llm_load_print_meta: n_vocab = 152064 llm_load_print_meta: n_merges = 151387 llm_load_print_meta: vocab_only = 0 llm_load_print_meta: n_ctx_train = 32768 llm_load_print_meta: n_embd = 3584 llm_load_print_meta: n_layer = 28 llm_load_print_meta: n_head = 28 llm_load_print_meta: n_head_kv = 4 llm_load_print_meta: n_rot = 128 llm_load_print_meta: n_swa = 0 llm_load_print_meta: n_embd_head_k = 128 llm_load_print_meta: n_embd_head_v = 128 llm_load_print_meta: n_gqa = 7 llm_load_print_meta: n_embd_k_gqa = 512 llm_load_print_meta: n_embd_v_gqa = 512 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 = 18944 llm_load_print_meta: n_expert = 0 llm_load_print_meta: n_expert_used = 0 llm_load_print_meta: causal attn = 1 llm_load_print_meta: pooling type = 0 llm_load_print_meta: rope type = 2 llm_load_print_meta: rope scaling = linear llm_load_print_meta: freq_base_train = 1000000.0 llm_load_print_meta: freq_scale_train = 1 llm_load_print_meta: n_ctx_orig_yarn = 32768 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 = 7B llm_load_print_meta: model ftype = Q4_K - Medium llm_load_print_meta: model params = 7.62 B llm_load_print_meta: model size = 4.36 GiB (4.91 BPW) llm_load_print_meta: general.name = Qwen2.5 Coder 7B Instruct llm_load_print_meta: BOS token = 151643 '<|endoftext|>' llm_load_print_meta: EOS token = 151645 '<|im_end|>' llm_load_print_meta: EOT token = 151645 '<|im_end|>' llm_load_print_meta: PAD token = 151643 '<|endoftext|>' llm_load_print_meta: LF token = 148848 'ÄĬ' llm_load_print_meta: FIM PRE token = 151659 '<|fim_prefix|>' llm_load_print_meta: FIM SUF token = 151661 '<|fim_suffix|>' llm_load_print_meta: FIM MID token = 151660 '<|fim_middle|>' llm_load_print_meta: FIM PAD token = 151662 '<|fim_pad|>' llm_load_print_meta: FIM REP token = 151663 '<|repo_name|>' llm_load_print_meta: FIM SEP token = 151664 '<|file_sep|>' llm_load_print_meta: EOG token = 151643 '<|endoftext|>' llm_load_print_meta: EOG token = 151645 '<|im_end|>' llm_load_print_meta: EOG token = 151662 '<|fim_pad|>' llm_load_print_meta: EOG token = 151663 '<|repo_name|>' llm_load_print_meta: EOG token = 151664 '<|file_sep|>' llm_load_print_meta: max token length = 256 llm_load_tensors: offloading 28 repeating layers to GPU llm_load_tensors: offloaded 28/29 layers to GPU llm_load_tensors: CPU model buffer size = 292.36 MiB llm_load_tensors: CUDA_Host model buffer size = 426.37 MiB llm_load_tensors: CUDA0 model buffer size = 3741.72 MiB llama_new_context_with_model: n_seq_max = 1 llama_new_context_with_model: n_ctx = 12288 llama_new_context_with_model: n_ctx_per_seq = 12288 llama_new_context_with_model: n_batch = 512 llama_new_context_with_model: n_ubatch = 512 llama_new_context_with_model: flash_attn = 1 llama_new_context_with_model: freq_base = 1000000.0 llama_new_context_with_model: freq_scale = 1 llama_new_context_with_model: n_ctx_per_seq (12288) < n_ctx_train (32768) -- the full capacity of the model will not be utilized llama_kv_cache_init: kv_size = 12288, offload = 1, type_k = 'f16', type_v = 'f16', n_layer = 28, can_shift = 1 llama_kv_cache_init: CUDA0 KV buffer size = 672.00 MiB llama_new_context_with_model: KV self size = 672.00 MiB, K (f16): 336.00 MiB, V (f16): 336.00 MiB llama_new_context_with_model: CPU output buffer size = 0.59 MiB llama_new_context_with_model: CUDA0 compute buffer size = 730.36 MiB llama_new_context_with_model: CUDA_Host compute buffer size = 31.01 MiB llama_new_context_with_model: graph nodes = 875 llama_new_context_with_model: graph splits = 4 (with bs=512), 3 (with bs=1) time=2025-01-20T22:07:32.619+08:00 level=INFO source=server.go:594 msg="llama runner started in 3.01 seconds" llama_model_loader: loaded meta data with 34 key-value pairs and 339 tensors from F:\LLM\ollama_models\blobs\sha256-60e05f2100071479f596b964f89f510f057ce397ea22f2833a0cfe029bfc2463 (version GGUF V3 (latest)) llama_model_loader: Dumping metadata keys/values. Note: KV overrides do not apply in this output. llama_model_loader: - kv 0: general.architecture str = qwen2 llama_model_loader: - kv 1: general.type str = model llama_model_loader: - kv 2: general.name str = Qwen2.5 Coder 7B Instruct llama_model_loader: - kv 3: general.finetune str = Instruct llama_model_loader: - kv 4: general.basename str = Qwen2.5-Coder llama_model_loader: - kv 5: general.size_label str = 7B llama_model_loader: - kv 6: general.license str = apache-2.0 llama_model_loader: - kv 7: general.license.link str = https://huggingface.co/Qwen/Qwen2.5-C... llama_model_loader: - kv 8: general.base_model.count u32 = 1 llama_model_loader: - kv 9: general.base_model.0.name str = Qwen2.5 Coder 7B llama_model_loader: - kv 10: general.base_model.0.organization str = Qwen llama_model_loader: - kv 11: general.base_model.0.repo_url str = https://huggingface.co/Qwen/Qwen2.5-C... llama_model_loader: - kv 12: general.tags arr[str,6] = ["code", "codeqwen", "chat", "qwen", ... llama_model_loader: - kv 13: general.languages arr[str,1] = ["en"] llama_model_loader: - kv 14: qwen2.block_count u32 = 28 llama_model_loader: - kv 15: qwen2.context_length u32 = 32768 llama_model_loader: - kv 16: qwen2.embedding_length u32 = 3584 llama_model_loader: - kv 17: qwen2.feed_forward_length u32 = 18944 llama_model_loader: - kv 18: qwen2.attention.head_count u32 = 28 llama_model_loader: - kv 19: qwen2.attention.head_count_kv u32 = 4 llama_model_loader: - kv 20: qwen2.rope.freq_base f32 = 1000000.000000 llama_model_loader: - kv 21: qwen2.attention.layer_norm_rms_epsilon f32 = 0.000001 llama_model_loader: - kv 22: general.file_type u32 = 15 llama_model_loader: - kv 23: tokenizer.ggml.model str = gpt2 llama_model_loader: - kv 24: tokenizer.ggml.pre str = qwen2 llama_model_loader: - kv 25: tokenizer.ggml.tokens arr[str,152064] = ["!", "\"", "#", "$", "%", "&", "'", ... llama_model_loader: - kv 26: tokenizer.ggml.token_type arr[i32,152064] = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, ... llama_model_loader: - kv 27: tokenizer.ggml.merges arr[str,151387] = ["Ġ Ġ", "ĠĠ ĠĠ", "i n", "Ġ t",... llama_model_loader: - kv 28: tokenizer.ggml.eos_token_id u32 = 151645 llama_model_loader: - kv 29: tokenizer.ggml.padding_token_id u32 = 151643 llama_model_loader: - kv 30: tokenizer.ggml.bos_token_id u32 = 151643 llama_model_loader: - kv 31: tokenizer.ggml.add_bos_token bool = false llama_model_loader: - kv 32: tokenizer.chat_template str = {%- if tools %}\n {{- '<|im_start|>... llama_model_loader: - kv 33: general.quantization_version u32 = 2 llama_model_loader: - type f32: 141 tensors llama_model_loader: - type q4_K: 169 tensors llama_model_loader: - type q6_K: 29 tensors llm_load_vocab: special tokens cache size = 22 llm_load_vocab: token to piece cache size = 0.9310 MB llm_load_print_meta: format = GGUF V3 (latest) llm_load_print_meta: arch = qwen2 llm_load_print_meta: vocab type = BPE llm_load_print_meta: n_vocab = 152064 llm_load_print_meta: n_merges = 151387 llm_load_print_meta: vocab_only = 1 llm_load_print_meta: model type = ?B llm_load_print_meta: model ftype = all F32 llm_load_print_meta: model params = 7.62 B llm_load_print_meta: model size = 4.36 GiB (4.91 BPW) llm_load_print_meta: general.name = Qwen2.5 Coder 7B Instruct llm_load_print_meta: BOS token = 151643 '<|endoftext|>' llm_load_print_meta: EOS token = 151645 '<|im_end|>' llm_load_print_meta: EOT token = 151645 '<|im_end|>' llm_load_print_meta: PAD token = 151643 '<|endoftext|>' llm_load_print_meta: LF token = 148848 'ÄĬ' llm_load_print_meta: FIM PRE token = 151659 '<|fim_prefix|>' llm_load_print_meta: FIM SUF token = 151661 '<|fim_suffix|>' llm_load_print_meta: FIM MID token = 151660 '<|fim_middle|>' llm_load_print_meta: FIM PAD token = 151662 '<|fim_pad|>' llm_load_print_meta: FIM REP token = 151663 '<|repo_name|>' llm_load_print_meta: FIM SEP token = 151664 '<|file_sep|>' llm_load_print_meta: EOG token = 151643 '<|endoftext|>' llm_load_print_meta: EOG token = 151645 '<|im_end|>' llm_load_print_meta: EOG token = 151662 '<|fim_pad|>' llm_load_print_meta: EOG token = 151663 '<|repo_name|>' llm_load_print_meta: EOG token = 151664 '<|file_sep|>' llm_load_print_meta: max token length = 256 llama_model_load: vocab only - skipping tensors [GIN] 2025/01/20 - 22:07:37 | 200 | 17.5463901s | 127.0.0.1 | POST "/api/generate" [GIN] 2025/01/21 - 00:04:22 | 200 | 0s | 127.0.0.1 | HEAD "/" [GIN] 2025/01/21 - 00:04:22 | 200 | 0s | 127.0.0.1 | GET "/api/ps" [GIN] 2025/01/21 - 00:04:33 | 200 | 526.5µs | 127.0.0.1 | HEAD "/" [GIN] 2025/01/21 - 00:04:33 | 200 | 0s | 127.0.0.1 | GET "/api/ps" [GIN] 2025/01/21 - 00:04:34 | 200 | 0s | 127.0.0.1 | HEAD "/" [GIN] 2025/01/21 - 00:04:34 | 200 | 0s | 127.0.0.1 | GET "/api/ps" ```
Author
Owner

@rick-github commented on GitHub (Jan 21, 2025):

ollama doesn't dynamically move a model between RAM/VRAM. What's shown in the logs is a couple of failed loads because the client quit, and then a successful load. A model may be unloaded due to a change in some parameters (eg num_ctx) or for a new model load, but ollama will not reload a model to accommodate growth in VRAM usage.

time=2025-01-20T22:07:18.453+08:00 level=INFO source=memory.go:356 msg="offload to cuda" layers.requested=-1 layers.model=29 layers.offload=28 layers.split="" memory.available="[5.9 GiB]" memory.gpu_overhead="0 B" memory.required.full="6.2 GiB" memory.required.partial="5.8 GiB" memory.required.kv="672.0 MiB" memory.required.allocations="[5.8 GiB]" memory.weights.total="4.3 GiB" memory.weights.repeating="3.9 GiB" memory.weights.nonrepeating="426.4 MiB" memory.graph.full="710.0 MiB" memory.graph.partial="878.0 MiB"

Currently ollama calculates that the model needs 6.2G to be hosted in VRAM, and only 5.9G is available, so it offloads 28 of 29 layers, ie 1 layer is hosted in system RAM. Since you have shared memory, you can override ollama's calculations and force all layers to be processed by GPU, most in VRAM and maybe a little in system RAM. There can be a performance penalty but in this case it is likely to be small because of the small amount of model in shared memory.

To override, you can either set num_gpu in the API call, or create a model with with the override:

$ ollama show --modelfile qwen2.5-coder:latest > Modelfile
$ echo PARAMETER num_gpu 999 >> Modelfile
$ ollama create qwen2.5-coder:gpu

Then use the model name qwen2.5-coder:gpu with the client.

<!-- gh-comment-id:2604552357 --> @rick-github commented on GitHub (Jan 21, 2025): ollama doesn't dynamically move a model between RAM/VRAM. What's shown in the logs is a couple of failed loads because the client quit, and then a successful load. A model may be unloaded due to a change in some parameters (eg `num_ctx`) or for a new model load, but ollama will not reload a model to accommodate growth in VRAM usage. ``` time=2025-01-20T22:07:18.453+08:00 level=INFO source=memory.go:356 msg="offload to cuda" layers.requested=-1 layers.model=29 layers.offload=28 layers.split="" memory.available="[5.9 GiB]" memory.gpu_overhead="0 B" memory.required.full="6.2 GiB" memory.required.partial="5.8 GiB" memory.required.kv="672.0 MiB" memory.required.allocations="[5.8 GiB]" memory.weights.total="4.3 GiB" memory.weights.repeating="3.9 GiB" memory.weights.nonrepeating="426.4 MiB" memory.graph.full="710.0 MiB" memory.graph.partial="878.0 MiB" ``` Currently ollama calculates that the model needs 6.2G to be hosted in VRAM, and only 5.9G is available, so it offloads 28 of 29 layers, ie 1 layer is hosted in system RAM. Since you have shared memory, you can override ollama's calculations and force all layers to be processed by GPU, most in VRAM and maybe a little in system RAM. There can be a [performance penalty](https://github.com/ollama/ollama/issues/7584#issuecomment-2466715900) but in this case it is likely to be small because of the small amount of model in shared memory. To override, you can either set `num_gpu` in the API call, or create a model with with the override: ```console $ ollama show --modelfile qwen2.5-coder:latest > Modelfile $ echo PARAMETER num_gpu 999 >> Modelfile $ ollama create qwen2.5-coder:gpu ``` Then use the model name `qwen2.5-coder:gpu` with the client.
Author
Owner

@NGC13009 commented on GitHub (Jan 21, 2025):

ollama doesn't dynamically move a model between RAM/VRAM. What's shown in the logs is a couple of failed loads because the client quit, and then a successful load. A model may be unloaded due to a change in some parameters (eg num_ctx) or for a new model load, but ollama will not reload a model to accommodate growth in VRAM usage.

time=2025-01-20T22:07:18.453+08:00 level=INFO source=memory.go:356 msg="offload to cuda" layers.requested=-1 layers.model=29 layers.offload=28 layers.split="" memory.available="[5.9 GiB]" memory.gpu_overhead="0 B" memory.required.full="6.2 GiB" memory.required.partial="5.8 GiB" memory.required.kv="672.0 MiB" memory.required.allocations="[5.8 GiB]" memory.weights.total="4.3 GiB" memory.weights.repeating="3.9 GiB" memory.weights.nonrepeating="426.4 MiB" memory.graph.full="710.0 MiB" memory.graph.partial="878.0 MiB"

Currently ollama calculates that the model needs 6.2G to be hosted in VRAM, and only 5.9G is available, so it offloads 28 of 29 layers, ie 1 layer is hosted in system RAM. Since you have shared memory, you can override ollama's calculations and force all layers to be processed by GPU, most in VRAM and maybe a little in system RAM. There can be a performance penalty but in this case it is likely to be small because of the small amount of model in shared memory.

To override, you can either set num_gpu in the API call, or create a model with with the override:

$ ollama show --modelfile qwen2.5-coder:latest > Modelfile
$ echo PARAMETER num_gpu 999 >> Modelfile
$ ollama create qwen2.5-coder:gpu
Then use the model name qwen2.5-coder:gpu with the client.

Thank you very much, this is exactly the solution I was looking for.

<!-- gh-comment-id:2604915546 --> @NGC13009 commented on GitHub (Jan 21, 2025): > ollama doesn't dynamically move a model between RAM/VRAM. What's shown in the logs is a couple of failed loads because the client quit, and then a successful load. A model may be unloaded due to a change in some parameters (eg `num_ctx`) or for a new model load, but ollama will not reload a model to accommodate growth in VRAM usage. > > ``` > time=2025-01-20T22:07:18.453+08:00 level=INFO source=memory.go:356 msg="offload to cuda" layers.requested=-1 layers.model=29 layers.offload=28 layers.split="" memory.available="[5.9 GiB]" memory.gpu_overhead="0 B" memory.required.full="6.2 GiB" memory.required.partial="5.8 GiB" memory.required.kv="672.0 MiB" memory.required.allocations="[5.8 GiB]" memory.weights.total="4.3 GiB" memory.weights.repeating="3.9 GiB" memory.weights.nonrepeating="426.4 MiB" memory.graph.full="710.0 MiB" memory.graph.partial="878.0 MiB" > ``` > > Currently ollama calculates that the model needs 6.2G to be hosted in VRAM, and only 5.9G is available, so it offloads 28 of 29 layers, ie 1 layer is hosted in system RAM. Since you have shared memory, you can override ollama's calculations and force all layers to be processed by GPU, most in VRAM and maybe a little in system RAM. There can be a [performance penalty](https://github.com/ollama/ollama/issues/7584#issuecomment-2466715900) but in this case it is likely to be small because of the small amount of model in shared memory. > > To override, you can either set `num_gpu` in the API call, or create a model with with the override: > > $ ollama show --modelfile qwen2.5-coder:latest > Modelfile > $ echo PARAMETER num_gpu 999 >> Modelfile > $ ollama create qwen2.5-coder:gpu > Then use the model name `qwen2.5-coder:gpu` with the client. Thank you very much, this is exactly the solution I was looking for.
Author
Owner

@NGC13009 commented on GitHub (Feb 9, 2025):

This issue has resurfaced today. I have set PARAMETER num_gpu 999 and saved it as a new model as described above, yet I use the ollama ps command to see that 7% of the model is being deployed to the cpu instead of prioritizing shared video memory. Is there another way to make this setting work?

The following should be the server log when this happens

time=2025-02-07T20:01:24.318+08:00 level=WARN source=types.go:512 msg="invalid option provided" option=tfs_z
time=2025-02-07T20:01:24.711+08:00 level=INFO source=sched.go:507 msg="updated VRAM based on existing loaded models" gpu=GPU-8731b7bb-dfeb-5d18-2333-712f9521ad1c library=cuda total="8.0 GiB" available="5.0 GiB"
time=2025-02-07T20:01:25.203+08:00 level=INFO source=server.go:104 msg="system memory" total="63.7 GiB" free="51.2 GiB" free_swap="48.4 GiB"
time=2025-02-07T20:01:25.219+08:00 level=INFO source=memory.go:356 msg="offload to cuda" layers.requested=9999 layers.model=29 layers.offload=28 layers.split="" memory.available="[5.6 GiB]" memory.gpu_overhead="0 B" memory.required.full="5.7 GiB" memory.required.partial="5.3 GiB" memory.required.kv="336.0 MiB" memory.required.allocations="[5.3 GiB]" memory.weights.total="4.0 GiB" memory.weights.repeating="3.6 GiB" memory.weights.nonrepeating="426.4 MiB" memory.graph.full="362.0 MiB" memory.graph.partial="730.4 MiB"
time=2025-02-07T20:01:25.222+08:00 level=INFO source=server.go:223 msg="enabling flash attention"
time=2025-02-07T20:01:25.222+08:00 level=WARN source=server.go:231 msg="kv cache type not supported by model" type=""
time=2025-02-07T20:01:25.224+08:00 level=INFO source=server.go:376 msg="starting llama server" cmd="C:\\Users\\ngc13\\AppData\\Local\\Programs\\Ollama\\lib\\ollama\\runners\\cuda_v12_avx\\ollama_llama_server.exe runner --model F:\\LLM\\ollama_models\\blobs\\sha256-60e05f2100071479f596b964f89f510f057ce397ea22f2833a0cfe029bfc2463 --ctx-size 6144 --batch-size 512 --n-gpu-layers 9999 --threads 16 --flash-attn --no-mmap --mlock --parallel 1 --port 64362"
time=2025-02-07T20:01:25.229+08:00 level=INFO source=sched.go:449 msg="loaded runners" count=1
time=2025-02-07T20:01:25.229+08:00 level=INFO source=server.go:555 msg="waiting for llama runner to start responding"
time=2025-02-07T20:01:25.230+08:00 level=INFO source=server.go:589 msg="waiting for server to become available" status="llm server error"
time=2025-02-07T20:01:25.295+08:00 level=INFO source=runner.go:936 msg="starting go runner"
ggml_cuda_init: GGML_CUDA_FORCE_MMQ:    no
ggml_cuda_init: GGML_CUDA_FORCE_CUBLAS: no
ggml_cuda_init: found 1 CUDA devices:
  Device 0: NVIDIA GeForce RTX 4060 Laptop GPU, compute capability 8.9, VMM: yes
time=2025-02-07T20:01:25.320+08:00 level=INFO source=runner.go:937 msg=system info="CUDA : ARCHS = 600,610,620,700,720,750,800,860,870,890,900 | USE_GRAPHS = 1 | PEER_MAX_BATCH_SIZE = 128 | CPU : SSE3 = 1 | SSSE3 = 1 | AVX = 1 | LLAMAFILE = 1 | AARCH64_REPACK = 1 | cgo(clang)" threads=16
time=2025-02-07T20:01:25.320+08:00 level=INFO source=.:0 msg="Server listening on 127.0.0.1:64362"
llama_load_model_from_file: using device CUDA0 (NVIDIA GeForce RTX 4060 Laptop GPU) - 7099 MiB free
llama_model_loader: loaded meta data with 34 key-value pairs and 339 tensors from F:\LLM\ollama_models\blobs\sha256-60e05f2100071479f596b964f89f510f057ce397ea22f2833a0cfe029bfc2463 (version GGUF V3 (latest))
llama_model_loader: Dumping metadata keys/values. Note: KV overrides do not apply in this output.
llama_model_loader: - kv   0:                       general.architecture str              = qwen2
llama_model_loader: - kv   1:                               general.type str              = model
llama_model_loader: - kv   2:                               general.name str              = Qwen2.5 Coder 7B Instruct
llama_model_loader: - kv   3:                           general.finetune str              = Instruct
llama_model_loader: - kv   4:                           general.basename str              = Qwen2.5-Coder
llama_model_loader: - kv   5:                         general.size_label str              = 7B
llama_model_loader: - kv   6:                            general.license str              = apache-2.0
llama_model_loader: - kv   7:                       general.license.link str              = https://huggingface.co/Qwen/Qwen2.5-C...
llama_model_loader: - kv   8:                   general.base_model.count u32              = 1
llama_model_loader: - kv   9:                  general.base_model.0.name str              = Qwen2.5 Coder 7B
llama_model_loader: - kv  10:          general.base_model.0.organization str              = Qwen
llama_model_loader: - kv  11:              general.base_model.0.repo_url str              = https://huggingface.co/Qwen/Qwen2.5-C...
llama_model_loader: - kv  12:                               general.tags arr[str,6]       = ["code", "codeqwen", "chat", "qwen", ...
llama_model_loader: - kv  13:                          general.languages arr[str,1]       = ["en"]
llama_model_loader: - kv  14:                          qwen2.block_count u32              = 28
llama_model_loader: - kv  15:                       qwen2.context_length u32              = 32768
llama_model_loader: - kv  16:                     qwen2.embedding_length u32              = 3584
llama_model_loader: - kv  17:                  qwen2.feed_forward_length u32              = 18944
llama_model_loader: - kv  18:                 qwen2.attention.head_count u32              = 28
llama_model_loader: - kv  19:              qwen2.attention.head_count_kv u32              = 4
llama_model_loader: - kv  20:                       qwen2.rope.freq_base f32              = 1000000.000000
llama_model_loader: - kv  21:     qwen2.attention.layer_norm_rms_epsilon f32              = 0.000001
llama_model_loader: - kv  22:                          general.file_type u32              = 15
llama_model_loader: - kv  23:                       tokenizer.ggml.model str              = gpt2
llama_model_loader: - kv  24:                         tokenizer.ggml.pre str              = qwen2
llama_model_loader: - kv  25:                      tokenizer.ggml.tokens arr[str,152064]  = ["!", "\"", "#", "$", "%", "&", "'", ...
llama_model_loader: - kv  26:                  tokenizer.ggml.token_type arr[i32,152064]  = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, ...
llama_model_loader: - kv  27:                      tokenizer.ggml.merges arr[str,151387]  = ["Ġ Ġ", "ĠĠ ĠĠ", "i n", "Ġ t",...
llama_model_loader: - kv  28:                tokenizer.ggml.eos_token_id u32              = 151645
llama_model_loader: - kv  29:            tokenizer.ggml.padding_token_id u32              = 151643
llama_model_loader: - kv  30:                tokenizer.ggml.bos_token_id u32              = 151643
llama_model_loader: - kv  31:               tokenizer.ggml.add_bos_token bool             = false
llama_model_loader: - kv  32:                    tokenizer.chat_template str              = {%- if tools %}\n    {{- '<|im_start|>...
llama_model_loader: - kv  33:               general.quantization_version u32              = 2
llama_model_loader: - type  f32:  141 tensors
llama_model_loader: - type q4_K:  169 tensors
llama_model_loader: - type q6_K:   29 tensors
time=2025-02-07T20:01:25.482+08:00 level=INFO source=server.go:589 msg="waiting for server to become available" status="llm server loading model"
llm_load_vocab: special tokens cache size = 22
llm_load_vocab: token to piece cache size = 0.9310 MB
llm_load_print_meta: format           = GGUF V3 (latest)
llm_load_print_meta: arch             = qwen2
llm_load_print_meta: vocab type       = BPE
llm_load_print_meta: n_vocab          = 152064
llm_load_print_meta: n_merges         = 151387
llm_load_print_meta: vocab_only       = 0
llm_load_print_meta: n_ctx_train      = 32768
llm_load_print_meta: n_embd           = 3584
llm_load_print_meta: n_layer          = 28
llm_load_print_meta: n_head           = 28
llm_load_print_meta: n_head_kv        = 4
llm_load_print_meta: n_rot            = 128
llm_load_print_meta: n_swa            = 0
llm_load_print_meta: n_embd_head_k    = 128
llm_load_print_meta: n_embd_head_v    = 128
llm_load_print_meta: n_gqa            = 7
llm_load_print_meta: n_embd_k_gqa     = 512
llm_load_print_meta: n_embd_v_gqa     = 512
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             = 18944
llm_load_print_meta: n_expert         = 0
llm_load_print_meta: n_expert_used    = 0
llm_load_print_meta: causal attn      = 1
llm_load_print_meta: pooling type     = 0
llm_load_print_meta: rope type        = 2
llm_load_print_meta: rope scaling     = linear
llm_load_print_meta: freq_base_train  = 1000000.0
llm_load_print_meta: freq_scale_train = 1
llm_load_print_meta: n_ctx_orig_yarn  = 32768
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       = 7B
llm_load_print_meta: model ftype      = Q4_K - Medium
llm_load_print_meta: model params     = 7.62 B
llm_load_print_meta: model size       = 4.36 GiB (4.91 BPW) 
llm_load_print_meta: general.name     = Qwen2.5 Coder 7B Instruct
llm_load_print_meta: BOS token        = 151643 '<|endoftext|>'
llm_load_print_meta: EOS token        = 151645 '<|im_end|>'
llm_load_print_meta: EOT token        = 151645 '<|im_end|>'
llm_load_print_meta: PAD token        = 151643 '<|endoftext|>'
llm_load_print_meta: LF token         = 148848 'ÄĬ'
llm_load_print_meta: FIM PRE token    = 151659 '<|fim_prefix|>'
llm_load_print_meta: FIM SUF token    = 151661 '<|fim_suffix|>'
llm_load_print_meta: FIM MID token    = 151660 '<|fim_middle|>'
llm_load_print_meta: FIM PAD token    = 151662 '<|fim_pad|>'
llm_load_print_meta: FIM REP token    = 151663 '<|repo_name|>'
llm_load_print_meta: FIM SEP token    = 151664 '<|file_sep|>'
llm_load_print_meta: EOG token        = 151643 '<|endoftext|>'
llm_load_print_meta: EOG token        = 151645 '<|im_end|>'
llm_load_print_meta: EOG token        = 151662 '<|fim_pad|>'
llm_load_print_meta: EOG token        = 151663 '<|repo_name|>'
llm_load_print_meta: EOG token        = 151664 '<|file_sep|>'
llm_load_print_meta: max token length = 256
llm_load_tensors: offloading 28 repeating layers to GPU
llm_load_tensors: offloading output layer to GPU
llm_load_tensors: offloaded 29/29 layers to GPU
llm_load_tensors:          CPU model buffer size =   292.36 MiB
llm_load_tensors:        CUDA0 model buffer size =  4168.09 MiB
llama_new_context_with_model: n_seq_max     = 1
llama_new_context_with_model: n_ctx         = 6144
llama_new_context_with_model: n_ctx_per_seq = 6144
llama_new_context_with_model: n_batch       = 512
llama_new_context_with_model: n_ubatch      = 512
llama_new_context_with_model: flash_attn    = 1
llama_new_context_with_model: freq_base     = 1000000.0
llama_new_context_with_model: freq_scale    = 1
llama_new_context_with_model: n_ctx_per_seq (6144) < n_ctx_train (32768) -- the full capacity of the model will not be utilized
llama_kv_cache_init: kv_size = 6144, offload = 1, type_k = 'f16', type_v = 'f16', n_layer = 28, can_shift = 1
llama_kv_cache_init:      CUDA0 KV buffer size =   336.00 MiB
llama_new_context_with_model: KV self size  =  336.00 MiB, K (f16):  168.00 MiB, V (f16):  168.00 MiB
llama_new_context_with_model:  CUDA_Host  output buffer size =     0.59 MiB
llama_new_context_with_model:      CUDA0 compute buffer size =   304.00 MiB
llama_new_context_with_model:  CUDA_Host compute buffer size =    19.01 MiB
llama_new_context_with_model: graph nodes  = 875
llama_new_context_with_model: graph splits = 2
time=2025-02-07T20:01:26.486+08:00 level=INFO source=server.go:594 msg="llama runner started in 1.26 seconds"
llama_model_loader: loaded meta data with 34 key-value pairs and 339 tensors from F:\LLM\ollama_models\blobs\sha256-60e05f2100071479f596b964f89f510f057ce397ea22f2833a0cfe029bfc2463 (version GGUF V3 (latest))
llama_model_loader: Dumping metadata keys/values. Note: KV overrides do not apply in this output.
llama_model_loader: - kv   0:                       general.architecture str              = qwen2
llama_model_loader: - kv   1:                               general.type str              = model
llama_model_loader: - kv   2:                               general.name str              = Qwen2.5 Coder 7B Instruct
llama_model_loader: - kv   3:                           general.finetune str              = Instruct
llama_model_loader: - kv   4:                           general.basename str              = Qwen2.5-Coder
llama_model_loader: - kv   5:                         general.size_label str              = 7B
llama_model_loader: - kv   6:                            general.license str              = apache-2.0
llama_model_loader: - kv   7:                       general.license.link str              = https://huggingface.co/Qwen/Qwen2.5-C...
llama_model_loader: - kv   8:                   general.base_model.count u32              = 1
llama_model_loader: - kv   9:                  general.base_model.0.name str              = Qwen2.5 Coder 7B
llama_model_loader: - kv  10:          general.base_model.0.organization str              = Qwen
llama_model_loader: - kv  11:              general.base_model.0.repo_url str              = https://huggingface.co/Qwen/Qwen2.5-C...
llama_model_loader: - kv  12:                               general.tags arr[str,6]       = ["code", "codeqwen", "chat", "qwen", ...
llama_model_loader: - kv  13:                          general.languages arr[str,1]       = ["en"]
llama_model_loader: - kv  14:                          qwen2.block_count u32              = 28
llama_model_loader: - kv  15:                       qwen2.context_length u32              = 32768
llama_model_loader: - kv  16:                     qwen2.embedding_length u32              = 3584
llama_model_loader: - kv  17:                  qwen2.feed_forward_length u32              = 18944
llama_model_loader: - kv  18:                 qwen2.attention.head_count u32              = 28
llama_model_loader: - kv  19:              qwen2.attention.head_count_kv u32              = 4
llama_model_loader: - kv  20:                       qwen2.rope.freq_base f32              = 1000000.000000
llama_model_loader: - kv  21:     qwen2.attention.layer_norm_rms_epsilon f32              = 0.000001
llama_model_loader: - kv  22:                          general.file_type u32              = 15
llama_model_loader: - kv  23:                       tokenizer.ggml.model str              = gpt2
llama_model_loader: - kv  24:                         tokenizer.ggml.pre str              = qwen2
llama_model_loader: - kv  25:                      tokenizer.ggml.tokens arr[str,152064]  = ["!", "\"", "#", "$", "%", "&", "'", ...
llama_model_loader: - kv  26:                  tokenizer.ggml.token_type arr[i32,152064]  = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, ...
llama_model_loader: - kv  27:                      tokenizer.ggml.merges arr[str,151387]  = ["Ġ Ġ", "ĠĠ ĠĠ", "i n", "Ġ t",...
llama_model_loader: - kv  28:                tokenizer.ggml.eos_token_id u32              = 151645
llama_model_loader: - kv  29:            tokenizer.ggml.padding_token_id u32              = 151643
llama_model_loader: - kv  30:                tokenizer.ggml.bos_token_id u32              = 151643
llama_model_loader: - kv  31:               tokenizer.ggml.add_bos_token bool             = false
llama_model_loader: - kv  32:                    tokenizer.chat_template str              = {%- if tools %}\n    {{- '<|im_start|>...
llama_model_loader: - kv  33:               general.quantization_version u32              = 2
llama_model_loader: - type  f32:  141 tensors
llama_model_loader: - type q4_K:  169 tensors
llama_model_loader: - type q6_K:   29 tensors
llm_load_vocab: special tokens cache size = 22
llm_load_vocab: token to piece cache size = 0.9310 MB
llm_load_print_meta: format           = GGUF V3 (latest)
llm_load_print_meta: arch             = qwen2
llm_load_print_meta: vocab type       = BPE
llm_load_print_meta: n_vocab          = 152064
llm_load_print_meta: n_merges         = 151387
llm_load_print_meta: vocab_only       = 1
llm_load_print_meta: model type       = ?B
llm_load_print_meta: model ftype      = all F32
llm_load_print_meta: model params     = 7.62 B
llm_load_print_meta: model size       = 4.36 GiB (4.91 BPW) 
llm_load_print_meta: general.name     = Qwen2.5 Coder 7B Instruct
llm_load_print_meta: BOS token        = 151643 '<|endoftext|>'
llm_load_print_meta: EOS token        = 151645 '<|im_end|>'
llm_load_print_meta: EOT token        = 151645 '<|im_end|>'
llm_load_print_meta: PAD token        = 151643 '<|endoftext|>'
llm_load_print_meta: LF token         = 148848 'ÄĬ'
llm_load_print_meta: FIM PRE token    = 151659 '<|fim_prefix|>'
llm_load_print_meta: FIM SUF token    = 151661 '<|fim_suffix|>'
llm_load_print_meta: FIM MID token    = 151660 '<|fim_middle|>'
llm_load_print_meta: FIM PAD token    = 151662 '<|fim_pad|>'
llm_load_print_meta: FIM REP token    = 151663 '<|repo_name|>'
llm_load_print_meta: FIM SEP token    = 151664 '<|file_sep|>'
llm_load_print_meta: EOG token        = 151643 '<|endoftext|>'
llm_load_print_meta: EOG token        = 151645 '<|im_end|>'
llm_load_print_meta: EOG token        = 151662 '<|fim_pad|>'
llm_load_print_meta: EOG token        = 151663 '<|repo_name|>'
llm_load_print_meta: EOG token        = 151664 '<|file_sep|>'
llm_load_print_meta: max token length = 256
llama_model_load: vocab only - skipping tensors
[GIN] 2025/02/07 - 20:01:28 | 200 |    4.2865115s |       127.0.0.1 | POST     "/api/chat"
<!-- gh-comment-id:2646205813 --> @NGC13009 commented on GitHub (Feb 9, 2025): This issue has resurfaced today. I have set `PARAMETER num_gpu 999` and saved it as a new model as described above, yet I use the `ollama ps` command to see that 7% of the model is being deployed to the cpu instead of prioritizing shared video memory. Is there another way to make this setting work? The following should be the server log when this happens ```text time=2025-02-07T20:01:24.318+08:00 level=WARN source=types.go:512 msg="invalid option provided" option=tfs_z time=2025-02-07T20:01:24.711+08:00 level=INFO source=sched.go:507 msg="updated VRAM based on existing loaded models" gpu=GPU-8731b7bb-dfeb-5d18-2333-712f9521ad1c library=cuda total="8.0 GiB" available="5.0 GiB" time=2025-02-07T20:01:25.203+08:00 level=INFO source=server.go:104 msg="system memory" total="63.7 GiB" free="51.2 GiB" free_swap="48.4 GiB" time=2025-02-07T20:01:25.219+08:00 level=INFO source=memory.go:356 msg="offload to cuda" layers.requested=9999 layers.model=29 layers.offload=28 layers.split="" memory.available="[5.6 GiB]" memory.gpu_overhead="0 B" memory.required.full="5.7 GiB" memory.required.partial="5.3 GiB" memory.required.kv="336.0 MiB" memory.required.allocations="[5.3 GiB]" memory.weights.total="4.0 GiB" memory.weights.repeating="3.6 GiB" memory.weights.nonrepeating="426.4 MiB" memory.graph.full="362.0 MiB" memory.graph.partial="730.4 MiB" time=2025-02-07T20:01:25.222+08:00 level=INFO source=server.go:223 msg="enabling flash attention" time=2025-02-07T20:01:25.222+08:00 level=WARN source=server.go:231 msg="kv cache type not supported by model" type="" time=2025-02-07T20:01:25.224+08:00 level=INFO source=server.go:376 msg="starting llama server" cmd="C:\\Users\\ngc13\\AppData\\Local\\Programs\\Ollama\\lib\\ollama\\runners\\cuda_v12_avx\\ollama_llama_server.exe runner --model F:\\LLM\\ollama_models\\blobs\\sha256-60e05f2100071479f596b964f89f510f057ce397ea22f2833a0cfe029bfc2463 --ctx-size 6144 --batch-size 512 --n-gpu-layers 9999 --threads 16 --flash-attn --no-mmap --mlock --parallel 1 --port 64362" time=2025-02-07T20:01:25.229+08:00 level=INFO source=sched.go:449 msg="loaded runners" count=1 time=2025-02-07T20:01:25.229+08:00 level=INFO source=server.go:555 msg="waiting for llama runner to start responding" time=2025-02-07T20:01:25.230+08:00 level=INFO source=server.go:589 msg="waiting for server to become available" status="llm server error" time=2025-02-07T20:01:25.295+08:00 level=INFO source=runner.go:936 msg="starting go runner" ggml_cuda_init: GGML_CUDA_FORCE_MMQ: no ggml_cuda_init: GGML_CUDA_FORCE_CUBLAS: no ggml_cuda_init: found 1 CUDA devices: Device 0: NVIDIA GeForce RTX 4060 Laptop GPU, compute capability 8.9, VMM: yes time=2025-02-07T20:01:25.320+08:00 level=INFO source=runner.go:937 msg=system info="CUDA : ARCHS = 600,610,620,700,720,750,800,860,870,890,900 | USE_GRAPHS = 1 | PEER_MAX_BATCH_SIZE = 128 | CPU : SSE3 = 1 | SSSE3 = 1 | AVX = 1 | LLAMAFILE = 1 | AARCH64_REPACK = 1 | cgo(clang)" threads=16 time=2025-02-07T20:01:25.320+08:00 level=INFO source=.:0 msg="Server listening on 127.0.0.1:64362" llama_load_model_from_file: using device CUDA0 (NVIDIA GeForce RTX 4060 Laptop GPU) - 7099 MiB free llama_model_loader: loaded meta data with 34 key-value pairs and 339 tensors from F:\LLM\ollama_models\blobs\sha256-60e05f2100071479f596b964f89f510f057ce397ea22f2833a0cfe029bfc2463 (version GGUF V3 (latest)) llama_model_loader: Dumping metadata keys/values. Note: KV overrides do not apply in this output. llama_model_loader: - kv 0: general.architecture str = qwen2 llama_model_loader: - kv 1: general.type str = model llama_model_loader: - kv 2: general.name str = Qwen2.5 Coder 7B Instruct llama_model_loader: - kv 3: general.finetune str = Instruct llama_model_loader: - kv 4: general.basename str = Qwen2.5-Coder llama_model_loader: - kv 5: general.size_label str = 7B llama_model_loader: - kv 6: general.license str = apache-2.0 llama_model_loader: - kv 7: general.license.link str = https://huggingface.co/Qwen/Qwen2.5-C... llama_model_loader: - kv 8: general.base_model.count u32 = 1 llama_model_loader: - kv 9: general.base_model.0.name str = Qwen2.5 Coder 7B llama_model_loader: - kv 10: general.base_model.0.organization str = Qwen llama_model_loader: - kv 11: general.base_model.0.repo_url str = https://huggingface.co/Qwen/Qwen2.5-C... llama_model_loader: - kv 12: general.tags arr[str,6] = ["code", "codeqwen", "chat", "qwen", ... llama_model_loader: - kv 13: general.languages arr[str,1] = ["en"] llama_model_loader: - kv 14: qwen2.block_count u32 = 28 llama_model_loader: - kv 15: qwen2.context_length u32 = 32768 llama_model_loader: - kv 16: qwen2.embedding_length u32 = 3584 llama_model_loader: - kv 17: qwen2.feed_forward_length u32 = 18944 llama_model_loader: - kv 18: qwen2.attention.head_count u32 = 28 llama_model_loader: - kv 19: qwen2.attention.head_count_kv u32 = 4 llama_model_loader: - kv 20: qwen2.rope.freq_base f32 = 1000000.000000 llama_model_loader: - kv 21: qwen2.attention.layer_norm_rms_epsilon f32 = 0.000001 llama_model_loader: - kv 22: general.file_type u32 = 15 llama_model_loader: - kv 23: tokenizer.ggml.model str = gpt2 llama_model_loader: - kv 24: tokenizer.ggml.pre str = qwen2 llama_model_loader: - kv 25: tokenizer.ggml.tokens arr[str,152064] = ["!", "\"", "#", "$", "%", "&", "'", ... llama_model_loader: - kv 26: tokenizer.ggml.token_type arr[i32,152064] = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, ... llama_model_loader: - kv 27: tokenizer.ggml.merges arr[str,151387] = ["Ġ Ġ", "ĠĠ ĠĠ", "i n", "Ġ t",... llama_model_loader: - kv 28: tokenizer.ggml.eos_token_id u32 = 151645 llama_model_loader: - kv 29: tokenizer.ggml.padding_token_id u32 = 151643 llama_model_loader: - kv 30: tokenizer.ggml.bos_token_id u32 = 151643 llama_model_loader: - kv 31: tokenizer.ggml.add_bos_token bool = false llama_model_loader: - kv 32: tokenizer.chat_template str = {%- if tools %}\n {{- '<|im_start|>... llama_model_loader: - kv 33: general.quantization_version u32 = 2 llama_model_loader: - type f32: 141 tensors llama_model_loader: - type q4_K: 169 tensors llama_model_loader: - type q6_K: 29 tensors time=2025-02-07T20:01:25.482+08:00 level=INFO source=server.go:589 msg="waiting for server to become available" status="llm server loading model" llm_load_vocab: special tokens cache size = 22 llm_load_vocab: token to piece cache size = 0.9310 MB llm_load_print_meta: format = GGUF V3 (latest) llm_load_print_meta: arch = qwen2 llm_load_print_meta: vocab type = BPE llm_load_print_meta: n_vocab = 152064 llm_load_print_meta: n_merges = 151387 llm_load_print_meta: vocab_only = 0 llm_load_print_meta: n_ctx_train = 32768 llm_load_print_meta: n_embd = 3584 llm_load_print_meta: n_layer = 28 llm_load_print_meta: n_head = 28 llm_load_print_meta: n_head_kv = 4 llm_load_print_meta: n_rot = 128 llm_load_print_meta: n_swa = 0 llm_load_print_meta: n_embd_head_k = 128 llm_load_print_meta: n_embd_head_v = 128 llm_load_print_meta: n_gqa = 7 llm_load_print_meta: n_embd_k_gqa = 512 llm_load_print_meta: n_embd_v_gqa = 512 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 = 18944 llm_load_print_meta: n_expert = 0 llm_load_print_meta: n_expert_used = 0 llm_load_print_meta: causal attn = 1 llm_load_print_meta: pooling type = 0 llm_load_print_meta: rope type = 2 llm_load_print_meta: rope scaling = linear llm_load_print_meta: freq_base_train = 1000000.0 llm_load_print_meta: freq_scale_train = 1 llm_load_print_meta: n_ctx_orig_yarn = 32768 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 = 7B llm_load_print_meta: model ftype = Q4_K - Medium llm_load_print_meta: model params = 7.62 B llm_load_print_meta: model size = 4.36 GiB (4.91 BPW) llm_load_print_meta: general.name = Qwen2.5 Coder 7B Instruct llm_load_print_meta: BOS token = 151643 '<|endoftext|>' llm_load_print_meta: EOS token = 151645 '<|im_end|>' llm_load_print_meta: EOT token = 151645 '<|im_end|>' llm_load_print_meta: PAD token = 151643 '<|endoftext|>' llm_load_print_meta: LF token = 148848 'ÄĬ' llm_load_print_meta: FIM PRE token = 151659 '<|fim_prefix|>' llm_load_print_meta: FIM SUF token = 151661 '<|fim_suffix|>' llm_load_print_meta: FIM MID token = 151660 '<|fim_middle|>' llm_load_print_meta: FIM PAD token = 151662 '<|fim_pad|>' llm_load_print_meta: FIM REP token = 151663 '<|repo_name|>' llm_load_print_meta: FIM SEP token = 151664 '<|file_sep|>' llm_load_print_meta: EOG token = 151643 '<|endoftext|>' llm_load_print_meta: EOG token = 151645 '<|im_end|>' llm_load_print_meta: EOG token = 151662 '<|fim_pad|>' llm_load_print_meta: EOG token = 151663 '<|repo_name|>' llm_load_print_meta: EOG token = 151664 '<|file_sep|>' llm_load_print_meta: max token length = 256 llm_load_tensors: offloading 28 repeating layers to GPU llm_load_tensors: offloading output layer to GPU llm_load_tensors: offloaded 29/29 layers to GPU llm_load_tensors: CPU model buffer size = 292.36 MiB llm_load_tensors: CUDA0 model buffer size = 4168.09 MiB llama_new_context_with_model: n_seq_max = 1 llama_new_context_with_model: n_ctx = 6144 llama_new_context_with_model: n_ctx_per_seq = 6144 llama_new_context_with_model: n_batch = 512 llama_new_context_with_model: n_ubatch = 512 llama_new_context_with_model: flash_attn = 1 llama_new_context_with_model: freq_base = 1000000.0 llama_new_context_with_model: freq_scale = 1 llama_new_context_with_model: n_ctx_per_seq (6144) < n_ctx_train (32768) -- the full capacity of the model will not be utilized llama_kv_cache_init: kv_size = 6144, offload = 1, type_k = 'f16', type_v = 'f16', n_layer = 28, can_shift = 1 llama_kv_cache_init: CUDA0 KV buffer size = 336.00 MiB llama_new_context_with_model: KV self size = 336.00 MiB, K (f16): 168.00 MiB, V (f16): 168.00 MiB llama_new_context_with_model: CUDA_Host output buffer size = 0.59 MiB llama_new_context_with_model: CUDA0 compute buffer size = 304.00 MiB llama_new_context_with_model: CUDA_Host compute buffer size = 19.01 MiB llama_new_context_with_model: graph nodes = 875 llama_new_context_with_model: graph splits = 2 time=2025-02-07T20:01:26.486+08:00 level=INFO source=server.go:594 msg="llama runner started in 1.26 seconds" llama_model_loader: loaded meta data with 34 key-value pairs and 339 tensors from F:\LLM\ollama_models\blobs\sha256-60e05f2100071479f596b964f89f510f057ce397ea22f2833a0cfe029bfc2463 (version GGUF V3 (latest)) llama_model_loader: Dumping metadata keys/values. Note: KV overrides do not apply in this output. llama_model_loader: - kv 0: general.architecture str = qwen2 llama_model_loader: - kv 1: general.type str = model llama_model_loader: - kv 2: general.name str = Qwen2.5 Coder 7B Instruct llama_model_loader: - kv 3: general.finetune str = Instruct llama_model_loader: - kv 4: general.basename str = Qwen2.5-Coder llama_model_loader: - kv 5: general.size_label str = 7B llama_model_loader: - kv 6: general.license str = apache-2.0 llama_model_loader: - kv 7: general.license.link str = https://huggingface.co/Qwen/Qwen2.5-C... llama_model_loader: - kv 8: general.base_model.count u32 = 1 llama_model_loader: - kv 9: general.base_model.0.name str = Qwen2.5 Coder 7B llama_model_loader: - kv 10: general.base_model.0.organization str = Qwen llama_model_loader: - kv 11: general.base_model.0.repo_url str = https://huggingface.co/Qwen/Qwen2.5-C... llama_model_loader: - kv 12: general.tags arr[str,6] = ["code", "codeqwen", "chat", "qwen", ... llama_model_loader: - kv 13: general.languages arr[str,1] = ["en"] llama_model_loader: - kv 14: qwen2.block_count u32 = 28 llama_model_loader: - kv 15: qwen2.context_length u32 = 32768 llama_model_loader: - kv 16: qwen2.embedding_length u32 = 3584 llama_model_loader: - kv 17: qwen2.feed_forward_length u32 = 18944 llama_model_loader: - kv 18: qwen2.attention.head_count u32 = 28 llama_model_loader: - kv 19: qwen2.attention.head_count_kv u32 = 4 llama_model_loader: - kv 20: qwen2.rope.freq_base f32 = 1000000.000000 llama_model_loader: - kv 21: qwen2.attention.layer_norm_rms_epsilon f32 = 0.000001 llama_model_loader: - kv 22: general.file_type u32 = 15 llama_model_loader: - kv 23: tokenizer.ggml.model str = gpt2 llama_model_loader: - kv 24: tokenizer.ggml.pre str = qwen2 llama_model_loader: - kv 25: tokenizer.ggml.tokens arr[str,152064] = ["!", "\"", "#", "$", "%", "&", "'", ... llama_model_loader: - kv 26: tokenizer.ggml.token_type arr[i32,152064] = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, ... llama_model_loader: - kv 27: tokenizer.ggml.merges arr[str,151387] = ["Ġ Ġ", "ĠĠ ĠĠ", "i n", "Ġ t",... llama_model_loader: - kv 28: tokenizer.ggml.eos_token_id u32 = 151645 llama_model_loader: - kv 29: tokenizer.ggml.padding_token_id u32 = 151643 llama_model_loader: - kv 30: tokenizer.ggml.bos_token_id u32 = 151643 llama_model_loader: - kv 31: tokenizer.ggml.add_bos_token bool = false llama_model_loader: - kv 32: tokenizer.chat_template str = {%- if tools %}\n {{- '<|im_start|>... llama_model_loader: - kv 33: general.quantization_version u32 = 2 llama_model_loader: - type f32: 141 tensors llama_model_loader: - type q4_K: 169 tensors llama_model_loader: - type q6_K: 29 tensors llm_load_vocab: special tokens cache size = 22 llm_load_vocab: token to piece cache size = 0.9310 MB llm_load_print_meta: format = GGUF V3 (latest) llm_load_print_meta: arch = qwen2 llm_load_print_meta: vocab type = BPE llm_load_print_meta: n_vocab = 152064 llm_load_print_meta: n_merges = 151387 llm_load_print_meta: vocab_only = 1 llm_load_print_meta: model type = ?B llm_load_print_meta: model ftype = all F32 llm_load_print_meta: model params = 7.62 B llm_load_print_meta: model size = 4.36 GiB (4.91 BPW) llm_load_print_meta: general.name = Qwen2.5 Coder 7B Instruct llm_load_print_meta: BOS token = 151643 '<|endoftext|>' llm_load_print_meta: EOS token = 151645 '<|im_end|>' llm_load_print_meta: EOT token = 151645 '<|im_end|>' llm_load_print_meta: PAD token = 151643 '<|endoftext|>' llm_load_print_meta: LF token = 148848 'ÄĬ' llm_load_print_meta: FIM PRE token = 151659 '<|fim_prefix|>' llm_load_print_meta: FIM SUF token = 151661 '<|fim_suffix|>' llm_load_print_meta: FIM MID token = 151660 '<|fim_middle|>' llm_load_print_meta: FIM PAD token = 151662 '<|fim_pad|>' llm_load_print_meta: FIM REP token = 151663 '<|repo_name|>' llm_load_print_meta: FIM SEP token = 151664 '<|file_sep|>' llm_load_print_meta: EOG token = 151643 '<|endoftext|>' llm_load_print_meta: EOG token = 151645 '<|im_end|>' llm_load_print_meta: EOG token = 151662 '<|fim_pad|>' llm_load_print_meta: EOG token = 151663 '<|repo_name|>' llm_load_print_meta: EOG token = 151664 '<|file_sep|>' llm_load_print_meta: max token length = 256 llama_model_load: vocab only - skipping tensors [GIN] 2025/02/07 - 20:01:28 | 200 | 4.2865115s | 127.0.0.1 | POST "/api/chat" ```
Author
Owner

@rick-github commented on GitHub (Feb 9, 2025):

llm_load_tensors: offloaded 29/29 layers to GPU
llm_load_tensors:          CPU model buffer size =   292.36 MiB
llm_load_tensors:        CUDA0 model buffer size =  4168.09 MiB

ollama offloaded all of the model layers to GPU. The 7% was calculated before the offloading was overridden, it is incorrect.

<!-- gh-comment-id:2646207266 --> @rick-github commented on GitHub (Feb 9, 2025): ``` llm_load_tensors: offloaded 29/29 layers to GPU llm_load_tensors: CPU model buffer size = 292.36 MiB llm_load_tensors: CUDA0 model buffer size = 4168.09 MiB ``` ollama offloaded all of the model layers to GPU. The 7% was calculated before the offloading was overridden, it is incorrect.
Author
Owner

@NGC13009 commented on GitHub (Feb 9, 2025):

llm_load_tensors: offloaded 29/29 layers to GPU
llm_load_tensors:          CPU model buffer size =   292.36 MiB
llm_load_tensors:        CUDA0 model buffer size =  4168.09 MiB

ollama offloaded all of the model layers to GPU. The 7% was calculated before the offloading was overridden, it is incorrect.

which means that what ollama ps sees is not necessarily true?

<!-- gh-comment-id:2646217900 --> @NGC13009 commented on GitHub (Feb 9, 2025): > ``` > llm_load_tensors: offloaded 29/29 layers to GPU > llm_load_tensors: CPU model buffer size = 292.36 MiB > llm_load_tensors: CUDA0 model buffer size = 4168.09 MiB > ``` > > ollama offloaded all of the model layers to GPU. The 7% was calculated before the offloading was overridden, it is incorrect. which means that what `ollama ps` sees is not necessarily true?
Author
Owner

@NGC13009 commented on GitHub (Feb 9, 2025):

Image

This is an experiment I re-run. I used PARAMETER num_gpu 999 for the configuration model and deliberately used a long context to call it, allowing the model to require more video memory than the total amount of video memory on my graphics card. The log file looks the same as the log file above, without any hint of the model being unloaded, and with all the layers inside the GPU, just as the

llm_load_tensors: offloaded 29/29 layers to GPU

However, the shared video memory usage is not visible within the task manager. However, I noticed that the graphics card is near full when reasoning, and the cpu usage is about the same as when the video memory isn't full. Does this prove that the model is indeed reasoning within the graphics card? I'm very confused about this.😭

My results using ollama ps are as follows:

(base)PS C:\Users\ngc13> ollama ps
NAME                    ID              SIZE      PROCESSOR          UNTIL
qwen2.5-coder:7b6144    1362ec8352f3    8.5 GB    27%/73% CPU/GPU    Forever

So where does the model actually actually run?

<!-- gh-comment-id:2646264259 --> @NGC13009 commented on GitHub (Feb 9, 2025): ![Image](https://github.com/user-attachments/assets/d4a339ba-fe24-4b4f-9305-889b48775218) This is an experiment I re-run. I used `PARAMETER num_gpu 999 ` for the configuration model and deliberately used a long context to call it, allowing the model to require more video memory than the total amount of video memory on my graphics card. The log file looks the same as the log file above, without any hint of the model being unloaded, and with all the layers inside the GPU, just as the ```text llm_load_tensors: offloaded 29/29 layers to GPU ``` However, the shared video memory usage is not visible within the task manager. However, I noticed that the graphics card is near full when reasoning, and the cpu usage is about the same as when the video memory isn't full. Does this prove that the model is indeed reasoning within the graphics card? I'm very confused about this.😭 My results using `ollama ps` are as follows: ```text (base)PS C:\Users\ngc13> ollama ps NAME ID SIZE PROCESSOR UNTIL qwen2.5-coder:7b6144 1362ec8352f3 8.5 GB 27%/73% CPU/GPU Forever ``` So where does the model actually actually run?
Author
Owner

@rick-github commented on GitHub (Feb 9, 2025):

which means that what ollama ps sees is not necessarily true?

The value that ollama ps shows is calculated before the num_gpu value is overriden and is incorrect.

So where does the model actually actually run?

llm_load_tensors: offloaded 29/29 layers to GPU

Some of the model resides in system RAM but all of the model is processed by the GPU. There will continue to be some CPU usage as it receives results and sends instructions.

<!-- gh-comment-id:2646306164 --> @rick-github commented on GitHub (Feb 9, 2025): > which means that what ollama ps sees is not necessarily true? The value that `ollama ps` shows is calculated before the `num_gpu` value is overriden and is incorrect. > So where does the model actually actually run? ``` llm_load_tensors: offloaded 29/29 layers to GPU ``` Some of the model resides in system RAM but all of the model is processed by the GPU. There will continue to be some CPU usage as it receives results and sends instructions.
Author
Owner

@NGC13009 commented on GitHub (Feb 9, 2025):

which means that what ollama ps sees is not necessarily true?

The value that ollama ps shows is calculated before the num_gpu value is overriden and is incorrect.

So where does the model actually actually run?

llm_load_tensors: offloaded 29/29 layers to GPU

Some of the model resides in system RAM but all of the model is processed by the GPU. There will continue to be some CPU usage as it receives results and sends instructions.

thank you very much!

I just confirmed it through a set of experiments and it should be correct.

windows task manager and ollama ps both are incorrect. the windows task manager not show the correct shared VRAM value.

<!-- gh-comment-id:2646313009 --> @NGC13009 commented on GitHub (Feb 9, 2025): > > which means that what ollama ps sees is not necessarily true? > > The value that `ollama ps` shows is calculated before the `num_gpu` value is overriden and is incorrect. > > > So where does the model actually actually run? > > ``` > llm_load_tensors: offloaded 29/29 layers to GPU > ``` > > Some of the model resides in system RAM but all of the model is processed by the GPU. There will continue to be some CPU usage as it receives results and sends instructions. thank you very much! I just confirmed it through a set of experiments and it should be correct. windows task manager and `ollama ps` both are incorrect. the windows task manager not show the correct shared VRAM value.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#67540