likelovewant / ollama-for-amd

Get up and running with Llama 3, Mistral, Gemma, and other large language models.by adding more amd gpu support.
https://ollama.com
MIT License
201 stars 13 forks source link

When I try `ollama run llama3.1:70b`, occur error `Error: llama runner process has terminated: error loading model: unable to allocate backend buffer` #17

Closed EC-Sol closed 2 months ago

EC-Sol commented 2 months ago

What is the issue?

When I try ollama run llama3.1:70b, occur error Error: llama runner process has terminated: error loading model: unable to allocate backend buffer

C:\Users\sol>ollama run llama3.1:70b
Error: llama runner process has terminated: error loading model: unable to allocate backend buffer

My Env:

Here is full logs of ollama sever.

2024/09/12 15:40:06 routes.go:1125: INFO server config env="map[CUDA_VISIBLE_DEVICES: GPU_DEVICE_ORDINAL: HIP_VISIBLE_DEVICES: HSA_OVERRIDE_GFX_VERSION: OLLAMA_DEBUG:false OLLAMA_FLASH_ATTENTION:false OLLAMA_GPU_OVERHEAD:0 OLLAMA_HOST:http://127.0.0.1:11434 OLLAMA_INTEL_GPU:false OLLAMA_KEEP_ALIVE:5m0s OLLAMA_LLM_LIBRARY: OLLAMA_LOAD_TIMEOUT:5m0s OLLAMA_MAX_LOADED_MODELS:0 OLLAMA_MAX_QUEUE:512 OLLAMA_MODELS:C:\\Users\\sol\\.ollama\\models OLLAMA_NOHISTORY:false OLLAMA_NOPRUNE:false OLLAMA_NUM_PARALLEL:0 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://*] OLLAMA_RUNNERS_DIR:C:\\Users\\sol\\AppData\\Local\\Programs\\Ollama\\lib\\ollama\\runners OLLAMA_SCHED_SPREAD:false OLLAMA_TMPDIR: ROCR_VISIBLE_DEVICES:]"
time=2024-09-12T15:40:06.276+09:00 level=INFO source=images.go:753 msg="total blobs: 7"
time=2024-09-12T15:40:06.278+09:00 level=INFO source=images.go:760 msg="total unused blobs removed: 0"
time=2024-09-12T15:40:06.279+09:00 level=INFO source=routes.go:1172 msg="Listening on 127.0.0.1:11434 (version 0.3.10-0-g486ae43)"
time=2024-09-12T15:40:06.279+09:00 level=INFO source=payload.go:44 msg="Dynamic LLM libraries [cpu cpu_avx cpu_avx2 cuda_v11 cuda_v12 rocm_v6.1]"
time=2024-09-12T15:40:06.279+09:00 level=INFO source=gpu.go:200 msg="looking for compatible GPUs"
time=2024-09-12T15:40:06.718+09:00 level=INFO source=types.go:107 msg="inference compute" id=0 library=rocm variant="" compute=gfx1103 driver=6.1 name="AMD Radeon 780M Graphics" total="45.7 GiB" available="45.6 GiB"
[GIN] 2024/09/12 - 15:40:39 | 200 |            0s |       127.0.0.1 | HEAD     "/"
[GIN] 2024/09/12 - 15:40:39 | 200 |     14.3471ms |       127.0.0.1 | POST     "/api/show"
time=2024-09-12T15:40:40.105+09:00 level=INFO source=sched.go:185 msg="one or more GPUs detected that are unable to accurately report free memory - disabling default concurrency"
time=2024-09-12T15:40:40.131+09:00 level=INFO source=sched.go:715 msg="new model will fit in available VRAM in single GPU, loading" model=C:\Users\sol\.ollama\models\blobs\sha256-a677b4a4b70c45e702b1d600f7905e367733c53898b8be60e3f29272cf334574 gpu=0 parallel=4 available=48959488000 required="41.2 GiB"
time=2024-09-12T15:40:40.131+09:00 level=INFO source=server.go:101 msg="system memory" total="79.8 GiB" free="64.7 GiB" free_swap="72.0 GiB"
time=2024-09-12T15:40:40.132+09:00 level=INFO source=memory.go:326 msg="offload to rocm" layers.requested=-1 layers.model=81 layers.offload=81 layers.split="" memory.available="[45.6 GiB]" memory.gpu_overhead="0 B" memory.required.full="41.2 GiB" memory.required.partial="41.2 GiB" memory.required.kv="2.5 GiB" memory.required.allocations="[41.2 GiB]" memory.weights.total="38.4 GiB" memory.weights.repeating="37.6 GiB" memory.weights.nonrepeating="822.0 MiB" memory.graph.full="1.1 GiB" memory.graph.partial="1.1 GiB"
time=2024-09-12T15:40:40.142+09:00 level=INFO source=server.go:391 msg="starting llama server" cmd="C:\\Users\\sol\\AppData\\Local\\Programs\\Ollama\\lib\\ollama\\runners\\rocm_v6.1\\ollama_llama_server.exe --model C:\\Users\\sol\\.ollama\\models\\blobs\\sha256-a677b4a4b70c45e702b1d600f7905e367733c53898b8be60e3f29272cf334574 --ctx-size 8192 --batch-size 512 --embedding --log-disable --n-gpu-layers 81 --parallel 4 --port 55173"
time=2024-09-12T15:40:40.171+09:00 level=INFO source=sched.go:450 msg="loaded runners" count=1
time=2024-09-12T15:40:40.171+09:00 level=INFO source=server.go:590 msg="waiting for llama runner to start responding"
time=2024-09-12T15:40:40.172+09:00 level=INFO source=server.go:624 msg="waiting for server to become available" status="llm server error"
INFO [wmain] build info | build=3661 commit="8962422b" tid="5532" timestamp=1726123240
INFO [wmain] system info | n_threads=8 n_threads_batch=8 system_info="AVX = 1 | AVX_VNNI = 0 | AVX2 = 0 | AVX512 = 0 | AVX512_VBMI = 0 | AVX512_VNNI = 0 | AVX512_BF16 = 0 | FMA = 1 | NEON = 0 | SVE = 0 | ARM_FMA = 0 | F16C = 1 | FP16_VA = 0 | WASM_SIMD = 0 | BLAS = 1 | SSE3 = 1 | SSSE3 = 1 | VSX = 0 | MATMUL_INT8 = 0 | LLAMAFILE = 1 | " tid="5532" timestamp=1726123240 total_threads=16
INFO [wmain] HTTP server listening | hostname="127.0.0.1" n_threads_http="15" port="55173" tid="5532" timestamp=1726123240
llama_model_loader: loaded meta data with 29 key-value pairs and 724 tensors from C:\Users\sol\.ollama\models\blobs\sha256-a677b4a4b70c45e702b1d600f7905e367733c53898b8be60e3f29272cf334574 (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              = llama
llama_model_loader: - kv   1:                               general.type str              = model
llama_model_loader: - kv   2:                               general.name str              = Meta Llama 3.1 70B Instruct
llama_model_loader: - kv   3:                           general.finetune str              = Instruct
llama_model_loader: - kv   4:                           general.basename str              = Meta-Llama-3.1
llama_model_loader: - kv   5:                         general.size_label str              = 70B
llama_model_loader: - kv   6:                            general.license str              = llama3.1
llama_model_loader: - kv   7:                               general.tags arr[str,6]       = ["facebook", "meta", "pytorch", "llam...
llama_model_loader: - kv   8:                          general.languages arr[str,8]       = ["en", "de", "fr", "it", "pt", "hi", ...
llama_model_loader: - kv   9:                          llama.block_count u32              = 80
llama_model_loader: - kv  10:                       llama.context_length u32              = 131072
llama_model_loader: - kv  11:                     llama.embedding_length u32              = 8192
llama_model_loader: - kv  12:                  llama.feed_forward_length u32              = 28672
llama_model_loader: - kv  13:                 llama.attention.head_count u32              = 64
llama_model_loader: - kv  14:              llama.attention.head_count_kv u32              = 8
llama_model_loader: - kv  15:                       llama.rope.freq_base f32              = 500000.000000
llama_model_loader: - kv  16:     llama.attention.layer_norm_rms_epsilon f32              = 0.000010
llama_model_loader: - kv  17:                          general.file_type u32              = 2
llama_model_loader: - kv  18:                           llama.vocab_size u32              = 128256
llama_model_loader: - kv  19:                 llama.rope.dimension_count u32              = 128
llama_model_loader: - kv  20:                       tokenizer.ggml.model str              = gpt2
llama_model_loader: - kv  21:                         tokenizer.ggml.pre str              = llama-bpe
llama_model_loader: - kv  22:                      tokenizer.ggml.tokens arr[str,128256]  = ["!", "\"", "#", "$", "%", "&", "'", ...
llama_model_loader: - kv  23:                  tokenizer.ggml.token_type arr[i32,128256]  = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, ...
llama_model_loader: - kv  24:                      tokenizer.ggml.merges arr[str,280147]  = ["Ġ Ġ", "Ġ ĠĠĠ", "ĠĠ ĠĠ", "...
llama_model_loader: - kv  25:                tokenizer.ggml.bos_token_id u32              = 128000
llama_model_loader: - kv  26:                tokenizer.ggml.eos_token_id u32              = 128009
llama_model_loader: - kv  27:                    tokenizer.chat_template str              = {{- bos_token }}\n{%- if custom_tools ...
llama_model_loader: - kv  28:               general.quantization_version u32              = 2
llama_model_loader: - type  f32:  162 tensors
llama_model_loader: - type q4_0:  561 tensors
llama_model_loader: - type q6_K:    1 tensors
time=2024-09-12T15:40:40.436+09:00 level=INFO source=server.go:624 msg="waiting for server to become available" status="llm server loading model"
llm_load_vocab: special tokens cache size = 256
llm_load_vocab: token to piece cache size = 0.7999 MB
llm_load_print_meta: format           = GGUF V3 (latest)
llm_load_print_meta: arch             = llama
llm_load_print_meta: vocab type       = BPE
llm_load_print_meta: n_vocab          = 128256
llm_load_print_meta: n_merges         = 280147
llm_load_print_meta: vocab_only       = 0
llm_load_print_meta: n_ctx_train      = 131072
llm_load_print_meta: n_embd           = 8192
llm_load_print_meta: n_layer          = 80
llm_load_print_meta: n_head           = 64
llm_load_print_meta: n_head_kv        = 8
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            = 8
llm_load_print_meta: n_embd_k_gqa     = 1024
llm_load_print_meta: n_embd_v_gqa     = 1024
llm_load_print_meta: f_norm_eps       = 0.0e+00
llm_load_print_meta: f_norm_rms_eps   = 1.0e-05
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             = 28672
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        = 0
llm_load_print_meta: rope scaling     = linear
llm_load_print_meta: freq_base_train  = 500000.0
llm_load_print_meta: freq_scale_train = 1
llm_load_print_meta: n_ctx_orig_yarn  = 131072
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       = 70B
llm_load_print_meta: model ftype      = Q4_0
llm_load_print_meta: model params     = 70.55 B
llm_load_print_meta: model size       = 37.22 GiB (4.53 BPW) 
llm_load_print_meta: general.name     = Meta Llama 3.1 70B Instruct
llm_load_print_meta: BOS token        = 128000 '<|begin_of_text|>'
llm_load_print_meta: EOS token        = 128009 '<|eot_id|>'
llm_load_print_meta: LF token         = 128 'Ä'
llm_load_print_meta: EOT token        = 128009 '<|eot_id|>'
llm_load_print_meta: max token length = 256
ggml_cuda_init: GGML_CUDA_FORCE_MMQ:    no
ggml_cuda_init: GGML_CUDA_FORCE_CUBLAS: no
ggml_cuda_init: found 1 ROCm devices:
  Device 0: AMD Radeon 780M Graphics, compute capability 11.0, VMM: no
llm_load_tensors: ggml ctx size =    0.68 MiB
ggml_backend_cuda_buffer_type_alloc_buffer: allocating 37547.00 MiB on device 0: cudaMalloc failed: out of memory
llama_model_load: error loading model: unable to allocate backend buffer
llama_load_model_from_file: exception loading model
Exception Code: 0xE06D7363
0x00007FFABE6AC95A, C:\Windows\System32\KERNELBASE.dll(0x00007FFABE5E0000) + 0xCC95A byte(s), RaiseException() + 0x8A byte(s)
0x00007FFA94F83441, C:\Windows\SYSTEM32\VCRUNTIME140.dll(0x00007FFA94F80000) + 0x3441 byte(s), _is_exception_typeof() + 0x2211 byte(s)
0x00007FFAC1023AC6, C:\Windows\SYSTEM32\ntdll.dll(0x00007FFAC0F00000) + 0x123AC6 byte(s), RtlCaptureContext2() + 0x4A6 byte(s)
0x00007FFA4BF32CB4, C:\Users\sol\AppData\Local\Programs\Ollama\lib\ollama\runners\rocm_v6.1\llama.dll(0x00007FFA4BF00000) + 0x32CB4 byte(s), llama_load_model_from_file() + 0x18A4 byte(s)
0x00007FF771FAC136, C:\Users\sol\AppData\Local\Programs\Ollama\lib\ollama\runners\rocm_v6.1\ollama_llama_server.exe(0x00007FF771EA0000) + 0x10C136 byte(s), clip_model_quantize() + 0xE42A6 byte(s)
0x00007FF771F10CC8, C:\Users\sol\AppData\Local\Programs\Ollama\lib\ollama\runners\rocm_v6.1\ollama_llama_server.exe(0x00007FF771EA0000) + 0x70CC8 byte(s), clip_model_quantize() + 0x48E38 byte(s)
0x00007FF771EF0F6F, C:\Users\sol\AppData\Local\Programs\Ollama\lib\ollama\runners\rocm_v6.1\ollama_llama_server.exe(0x00007FF771EA0000) + 0x50F6F byte(s), clip_model_quantize() + 0x290DF byte(s)
0x00007FF77200150C, C:\Users\sol\AppData\Local\Programs\Ollama\lib\ollama\runners\rocm_v6.1\ollama_llama_server.exe(0x00007FF771EA0000) + 0x16150C byte(s), clip_model_quantize() + 0x13967C byte(s)
0x00007FFAC06DDBE7, C:\Windows\System32\KERNEL32.DLL(0x00007FFAC06B0000) + 0x2DBE7 byte(s), BaseThreadInitThunk() + 0x17 byte(s)
0x00007FFAC0FDA94C, C:\Windows\SYSTEM32\ntdll.dll(0x00007FFAC0F00000) + 0xDA94C byte(s), RtlUserThreadStart() + 0x2C byte(s)
time=2024-09-12T15:40:57.660+09:00 level=INFO source=server.go:624 msg="waiting for server to become available" status="llm server error"
time=2024-09-12T15:40:57.911+09:00 level=ERROR source=sched.go:456 msg="error loading llama server" error="llama runner process has terminated: error loading model: unable to allocate backend buffer"
[GIN] 2024/09/12 - 15:40:57 | 500 |   18.2346153s |       127.0.0.1 | POST     "/api/chat"

However ollama run llama3.1:8b works good.

OS

Windows

GPU

AMD

CPU

AMD

Ollama version

0.3.10-0-g486ae43

likelovewant commented 2 months ago

it's simple too large for the models. you may split or offload with gup and cpu manually. as explained here https://github.com/ollama/ollama/issues/6595#issuecomment-2329425060 , however , it's seems this issue from llama.cpp .need fixed by llama.cpp first . you may still try run manually even it's may very slow.