llama.cpp icon indicating copy to clipboard operation
llama.cpp copied to clipboard

ggml_new_object: not enough space in the context's memory pool (needed 3539648, available 3539280)

Open schmorp opened this issue 10 months ago • 7 comments

I am trying to make an imatrix for https://huggingface.co/mradermacher/Kronos-703B-GGUF

imatrix crashes with a segfault. When I try to use the model with main (e.g. IQ3_XS), I get this before it segfaults:

ggml_new_object: not enough space in the context's memory pool (needed 3539648, available 3539280)

I don't know if this is a problem with the model or not. I used convert-hf-to-gguf.py on the original.

Full output:

$ main -m /gguf/Kronos-703B.IQ3_XS.gguf -p "Hi, I would like to" Log start main: build = 2551 (e5b89a44) main: built with gcc-12 (Debian 12.2.0-14) 12.2.0 for x86_64-linux-gnu main: seed = 1711680584 llama_model_loader: loaded meta data with 22 key-value pairs and 124997 tensors from /gguf/Kronos-703B.IQ3_XS.gguf (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 = phi2 llama_model_loader: - kv 1: general.name str = Phi2 llama_model_loader: - kv 2: phi2.context_length u32 = 2048 llama_model_loader: - kv 3: phi2.embedding_length u32 = 2560 llama_model_loader: - kv 4: phi2.feed_forward_length u32 = 10240 llama_model_loader: - kv 5: phi2.block_count u32 = 8928 llama_model_loader: - kv 6: phi2.attention.head_count u32 = 32 llama_model_loader: - kv 7: phi2.attention.head_count_kv u32 = 32 llama_model_loader: - kv 8: phi2.attention.layer_norm_epsilon f32 = 0.000010 llama_model_loader: - kv 9: phi2.rope.dimension_count u32 = 32 llama_model_loader: - kv 10: general.file_type u32 = 22 llama_model_loader: - kv 11: tokenizer.ggml.add_bos_token bool = false llama_model_loader: - kv 12: tokenizer.ggml.model str = gpt2 llama_model_loader: - kv 13: tokenizer.ggml.tokens arr[str,51200] = ["!", """, "#", "$", "%", "&", "'", ... llama_model_loader: - kv 14: tokenizer.ggml.token_type arr[i32,51200] = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, ... llama_model_loader: - kv 15: tokenizer.ggml.merges arr[str,50000] = ["Ġ t", "Ġ a", "h e", "i n", "r e",... llama_model_loader: - kv 16: tokenizer.ggml.bos_token_id u32 = 50256 llama_model_loader: - kv 17: tokenizer.ggml.eos_token_id u32 = 50256 llama_model_loader: - kv 18: tokenizer.ggml.unknown_token_id u32 = 50256 llama_model_loader: - kv 19: tokenizer.ggml.padding_token_id u32 = 50256 llama_model_loader: - kv 20: tokenizer.chat_template str = {{ bos_token }}{% for message in mess... llama_model_loader: - kv 21: general.quantization_version u32 = 2 llama_model_loader: - type f32: 71427 tensors llama_model_loader: - type f16: 1 tensors llama_model_loader: - type iq3_xxs: 24552 tensors llama_model_loader: - type iq3_s: 29017 tensors llm_load_vocab: mismatch in special tokens definition ( 910/51200 vs 944/51200 ). llm_load_print_meta: format = GGUF V3 (latest) llm_load_print_meta: arch = phi2 llm_load_print_meta: vocab type = BPE llm_load_print_meta: n_vocab = 51200 llm_load_print_meta: n_merges = 50000 llm_load_print_meta: n_ctx_train = 2048 llm_load_print_meta: n_embd = 2560 llm_load_print_meta: n_head = 32 llm_load_print_meta: n_head_kv = 32 llm_load_print_meta: n_layer = 8928 llm_load_print_meta: n_rot = 32 llm_load_print_meta: n_embd_head_k = 80 llm_load_print_meta: n_embd_head_v = 80 llm_load_print_meta: n_gqa = 1 llm_load_print_meta: n_embd_k_gqa = 2560 llm_load_print_meta: n_embd_v_gqa = 2560 llm_load_print_meta: f_norm_eps = 1.0e-05 llm_load_print_meta: f_norm_rms_eps = 0.0e+00 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 = 10240 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 = 10000.0 llm_load_print_meta: freq_scale_train = 1 llm_load_print_meta: n_yarn_orig_ctx = 2048 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: model type = ?B llm_load_print_meta: model ftype = IQ3_XS - 3.3 bpw llm_load_print_meta: model params = 702.64 B llm_load_print_meta: model size = 269.44 GiB (3.29 BPW) llm_load_print_meta: general.name = Phi2 llm_load_print_meta: BOS token = 50256 '<|endoftext|>' llm_load_print_meta: EOS token = 50256 '<|endoftext|>' llm_load_print_meta: UNK token = 50256 '<|endoftext|>' llm_load_print_meta: PAD token = 50256 '<|endoftext|>' llm_load_print_meta: LF token = 128 'Ä' ggml_cuda_init: GGML_CUDA_FORCE_MMQ: yes ggml_cuda_init: CUDA_USE_TENSOR_CORES: no ggml_cuda_init: found 2 CUDA devices: Device 0: NVIDIA GeForce RTX 4090, compute capability 8.9, VMM: yes Device 1: NVIDIA GeForce RTX 4070 Ti, compute capability 8.9, VMM: yes llm_load_tensors: ggml ctx size = 47.68 MiB llm_load_tensors: offloading 0 repeating layers to GPU llm_load_tensors: offloaded 0/8929 layers to GPU llm_load_tensors: CPU buffer size = 275903.61 MiB .................................................................................................... llama_new_context_with_model: n_ctx = 512 llama_new_context_with_model: n_batch = 512 llama_new_context_with_model: n_ubatch = 512 llama_new_context_with_model: freq_base = 10000.0 llama_new_context_with_model: freq_scale = 1 llama_kv_cache_init: CUDA_Host KV buffer size = 44640.00 MiB llama_new_context_with_model: KV self size = 44640.00 MiB, K (f16): 22320.00 MiB, V (f16): 22320.00 MiB llama_new_context_with_model: CUDA_Host output buffer size = 0.20 MiB ggml_new_object: not enough space in the context's memory pool (needed 3539648, available 3539280) Segmentation fault

schmorp avatar Mar 29 '24 03:03 schmorp

You may be able to get it to run by increasing LLAMA_MAX_NODES in llama.cpp.

slaren avatar Mar 29 '24 15:03 slaren

I doubled it, and the numbers in the ggml_new_object message channged, until 1048576, when I got:

GGML_ASSERT: /root/cvs/llama.cpp/ggml-backend.c:1467: i_split < GGML_SCHED_MAX_SPLITS

schmorp avatar Mar 29 '24 22:03 schmorp

You would also need to increase GGML_SCHED_MAX_SPLITS then. But using a build without GPU acceleration would also work.

slaren avatar Mar 31 '24 21:03 slaren

I've got the same error on Mac Ultra M1.

davideuler avatar Apr 07 '24 03:04 davideuler

i can reproduce this on 7593639ce335e8d7f89aa9a54d616951f273af60 with vulkan enabled build (even ngl 0). the model i used is https://huggingface.co/zhengr/MixTAO-7Bx2-MoE-v8.1-GGUF . i tried increase LLAMA_MAX_NODES but still have the same error.

another non moe q8 model works fine. so this error may have relation to moe?

i tried another moe model recently converted. and it dont have any issue. so it may caused by compatibility issus with moe model converted by old llama.cpp ?

rhjdvsgsgks avatar Apr 16 '24 03:04 rhjdvsgsgks

I got this using https://huggingface.co/MaziyarPanahi/DARE_TIES_13B-GGUF with the cpu only through ooba. Here's my output.

21:19:22-759106 INFO llama.cpp weights detected: "models/DARE_TIES_13B.Q6_K.gguf"
llama_model_loader: loaded meta data with 25 key-value pairs and 419 tensors from models/DARE_TIES_13B.Q6_K.gguf (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.name str = hub llama_model_loader: - kv 2: llama.context_length u32 = 32768 llama_model_loader: - kv 3: llama.embedding_length u32 = 4096 llama_model_loader: - kv 4: llama.block_count u32 = 32 llama_model_loader: - kv 5: llama.feed_forward_length u32 = 14336 llama_model_loader: - kv 6: llama.rope.dimension_count u32 = 128 llama_model_loader: - kv 7: llama.attention.head_count u32 = 32 llama_model_loader: - kv 8: llama.attention.head_count_kv u32 = 8 llama_model_loader: - kv 9: llama.expert_count u32 = 2 llama_model_loader: - kv 10: llama.expert_used_count u32 = 2 llama_model_loader: - kv 11: llama.attention.layer_norm_rms_epsilon f32 = 0.000010 llama_model_loader: - kv 12: llama.rope.freq_base f32 = 10000.000000 llama_model_loader: - kv 13: general.file_type u32 = 18 llama_model_loader: - kv 14: tokenizer.ggml.model str = llama llama_model_loader: - kv 15: tokenizer.ggml.tokens arr[str,32000] = ["", "", "", "<0x00>", "<... llama_model_loader: - kv 16: tokenizer.ggml.scores arr[f32,32000] = [-1000.000000, -1000.000000, -1000.00... llama_model_loader: - kv 17: tokenizer.ggml.token_type arr[i32,32000] = [3, 3, 3, 6, 6, 6, 6, 6, 6, 6, 6, 6, ... llama_model_loader: - kv 18: tokenizer.ggml.bos_token_id u32 = 1 llama_model_loader: - kv 19: tokenizer.ggml.eos_token_id u32 = 2 llama_model_loader: - kv 20: tokenizer.ggml.unknown_token_id u32 = 0 llama_model_loader: - kv 21: tokenizer.ggml.padding_token_id u32 = 1 llama_model_loader: - kv 22: tokenizer.ggml.add_bos_token bool = true llama_model_loader: - kv 23: tokenizer.ggml.add_eos_token bool = false llama_model_loader: - kv 24: general.quantization_version u32 = 2 llama_model_loader: - type f32: 65 tensors llama_model_loader: - type f16: 32 tensors llama_model_loader: - type q6_K: 322 tensors llm_load_vocab: special tokens definition check successful ( 259/32000 ). llm_load_print_meta: format = GGUF V3 (latest) llm_load_print_meta: arch = llama llm_load_print_meta: vocab type = SPM llm_load_print_meta: n_vocab = 32000 llm_load_print_meta: n_merges = 0 llm_load_print_meta: n_ctx_train = 32768 llm_load_print_meta: n_embd = 4096 llm_load_print_meta: n_head = 32 llm_load_print_meta: n_head_kv = 8 llm_load_print_meta: n_layer = 32 llm_load_print_meta: n_rot = 128 llm_load_print_meta: n_embd_head_k = 128 llm_load_print_meta: n_embd_head_v = 128 llm_load_print_meta: n_gqa = 4 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 = 14336 llm_load_print_meta: n_expert = 2 llm_load_print_meta: n_expert_used = 2 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 = 10000.0 llm_load_print_meta: freq_scale_train = 1 llm_load_print_meta: n_yarn_orig_ctx = 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: model type = 7B llm_load_print_meta: model ftype = Q6_K llm_load_print_meta: model params = 12.88 B llm_load_print_meta: model size = 9.84 GiB (6.56 BPW) llm_load_print_meta: general.name = hub llm_load_print_meta: BOS token = 1 '' llm_load_print_meta: EOS token = 2 '' llm_load_print_meta: UNK token = 0 '' llm_load_print_meta: PAD token = 1 '' llm_load_print_meta: LF token = 13 '<0x0A>' llm_load_tensors: ggml ctx size = 0.18 MiB ggml_new_object: not enough space in the context's memory pool (needed 193968, available 193600)

JeremyBickel avatar Apr 18 '24 01:04 JeremyBickel

The issue with 2 expert models should be fixed in #6735.

slaren avatar Apr 18 '24 01:04 slaren

This issue was closed because it has been inactive for 14 days since being marked as stale.

github-actions[bot] avatar Jun 02 '24 01:06 github-actions[bot]