You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fit: Fix memory allocation for MTP layers - #26605
Fix issue with memory allocation, when MTP model is loaded and --n-cpu-moe=0 options is used.
I tried to load MiMo-V2.5 model and got the next error:
[39535] 0.00.065.618 I cmn common_param: common_params_print_info: verbosity = 3 (adjust with the `-lv N` CLI arg)
[39535] cmd_child_to_router:state:{"state":"loading","payload":{"stages":["text_model"],"current":"text_model","value":0.0}}
[39535] 0.00.522.196 I srv load_model: loading model '/home/.models/AesSedai/MiMo-V2.5-GGUF/MiMo-V2.5-Q4_K_M-00001-of-00005.gguf'
[39535] 0.04.650.599 W load: control-looking token: 128247 '</s>' was not control-type; this is probably a bug in the model. its type will be overridden
[39535] 0.04.689.840 W model has unused tensor blk.48.attn_output.weight (size = 35651584 bytes) -- ignoring
[39535] 0.04.689.843 W model has unused tensor blk.48.attn_norm.weight (size = 16384 bytes) -- ignoring
[39535] 0.04.689.844 W model has unused tensor blk.48.attn_sinks.weight (size = 256 bytes) -- ignoring
[39535] 0.04.689.845 W model has unused tensor blk.48.ffn_norm.weight (size = 16384 bytes) -- ignoring
...
...
[39535] 0.04.689.928 W model has unused tensor blk.50.nextn.eh_proj.weight (size = 35651584 bytes) -- ignoring
[39535] 0.04.689.929 W model has unused tensor blk.50.nextn.enorm.weight (size = 16384 bytes) -- ignoring
[39535] 0.04.689.930 W model has unused tensor blk.50.nextn.hnorm.weight (size = 16384 bytes) -- ignoring
[39535] 0.04.689.931 W model has unused tensor blk.50.layer_output_norm.weight (size = 16384 bytes) -- ignoring
[39535] 0.04.691.073 E ggml_backend_cuda_buffer_type_alloc_buffer: allocating 21456.63 MiB on device 0: cudaMalloc failed: out of memory
[39535] 0.04.691.076 E alloc_tensor_range: failed to allocate CUDA0 buffer of size 22498909440
[39535] 0.04.709.937 E llama_model_load: error loading model: unable to allocate CUDA0 buffer
[39535] 0.04.709.947 E llama_model_load_from_file_impl: failed to load model
[39535] 0.04.709.951 E cmn common_init_: failed to load model '/home/.models/AesSedai/MiMo-V2.5-GGUF/MiMo-V2.5-Q4_K_M-00001-of-00005.gguf'
[39535] 0.04.709.955 E srv load_model: failed to load model, '/home/.models/AesSedai/MiMo-V2.5-GGUF/MiMo-V2.5-Q4_K_M-00001-of-00005.gguf'
[39535] 0.04.709.956 I srv operator(): operator(): cleaning up before exit...
[39535] 0.04.712.567 E srv llama_server: exiting due to model loading error
0.11.854.290 I srv operator(): instance name=MiMo-V2.5-Q4_K_M=128=image=AES exited with status 1
After the fix, everything is loaded without errors:
[47093] 0.00.068.110 I cmn common_param: common_params_print_info: verbosity = 3 (adjust with the `-lv N` CLI arg)
[47093] cmd_child_to_router:state:{"state":"loading","payload":{"stages":["text_model"],"current":"text_model","value":0.0}}
[47093] 0.00.498.106 I srv load_model: loading model '/home/.models/AesSedai/MiMo-V2.5-GGUF/MiMo-V2.5-Q4_K_M-00001-of-00005.gguf'
[47093] 0.04.378.963 W load: control-looking token: 128247 '</s>' was not control-type; this is probably a bug in the model. its type will be overridden
[47093] 0.04.426.445 W model has unused tensor blk.48.attn_qkv.weight (size = 64618496 bytes) -- ignoring
[47093] 0.04.426.454 W model has unused tensor blk.48.attn_output.weight (size = 35651584 bytes) -- ignoring
[47093] 0.04.426.455 W model has unused tensor blk.48.attn_norm.weight (size = 16384 bytes) -- ignoring
[47093] 0.04.426.456 W model has unused tensor blk.48.attn_sinks.weight (size = 256 bytes) -- ignoring
[47093] 0.04.426.457 W model has unused tensor blk.48.ffn_norm.weight (size = 16384 bytes) -- ignoring
[47093] 0.04.426.458 W model has unused tensor blk.48.ffn_gate.weight (size = 71303168 bytes) -- ignoring
[47093] 0.04.426.459 W model has unused tensor blk.48.ffn_down.weight (size = 71303168 bytes) -- ignoring
...
[47093] 0.04.426.504 W model has unused tensor blk.50.ffn_down.weight (size = 71303168 bytes) -- ignoring
[47093] 0.04.426.505 W model has unused tensor blk.50.ffn_up.weight (size = 71303168 bytes) -- ignoring
[47093] 0.04.426.511 W model has unused tensor blk.50.nextn.eh_proj.weight (size = 35651584 bytes) -- ignoring
[47093] 0.04.426.512 W model has unused tensor blk.50.nextn.enorm.weight (size = 16384 bytes) -- ignoring
[47093] 0.04.426.513 W model has unused tensor blk.50.nextn.hnorm.weight (size = 16384 bytes) -- ignoring
[47093] 0.04.426.514 W model has unused tensor blk.50.layer_output_norm.weight (size = 16384 bytes) -- ignoring
[47093] cmd_child_to_router:state:{"state":"loading","payload":{"stages":["text_model"],"current":"text_model","value":0.0}}
[47093] cmd_child_to_router:state:{"state":"loading","payload":{"stages":["text_model"],"current":"text_model","value":0.0012509445659816265}}
[47093] cmd_child_to_router:state:{"state":"loading","payload":{"stages":["text_model"],"current":"text_model","value":0.008544351905584335}}
[47093] cmd_child_to_router:state:{"state":"loading","payload":{"stages":["text_model"],"current":"text_model","value":0.01632601208984852}}
...
[47093] cmd_child_to_router:state:{"state":"loading","payload":{"stages":["text_model"],"current":"text_model","value":0.9843482375144958}}
[47093] cmd_child_to_router:state:{"state":"loading","payload":{"stages":["text_model"],"current":"text_model","value":0.9936332106590271}}
[47093] cmd_child_to_router:state:{"state":"loading","payload":{"stages":["text_model"],"current":"text_model","value":1.0}}
[47093] 3.42.892.845 I srv load_model: initializing, n_slots = 1, n_ctx_slot = 128000, kv_unified = 'false'
[47093] 3.42.910.322 I srv init: chat template supports preserving reasoning, consider enabling it via --reasoning-preserve
[47093] 3.42.910.356 I srv llama_server: model loaded
[47093] 3.42.910.359 I srv llama_server: listening on http://127.0.0.1:47093
[47093] cmd_child_to_router:state:{"state":"ready","payload":{"id":"MiMo-V2.5-Q4_K_M=128=image=AES","aliases":["MiMo-V2.5-Q4_K_M=128=image=AES"],"tags":[],"object":"model","created":1783777142,"owned_by":"llamacpp","meta":{"vocab_type":2,"n_vocab":152576,"n_ctx":128000,"n_ctx_train":1048576,"n_embd":4096,"n_params":309766601088,"size":190777255424,"ftype":"Q8_0"}}}
3.48.582.163 I srv proxy_reques: proxying request to model MiMo-V2.5-Q4_K_M=128=image=AES on port 47093
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
merge readyA maintainer can use this label to indicate that they consider the changes final and ready to merge.
4 participants
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Fix issue with memory allocation, when MTP model is loaded and
--n-cpu-moe=0options is used.I tried to load MiMo-V2.5 model and got the next error:
After the fix, everything is loaded without errors:
The problem was because:
--fitdidn't use Next/MTP layersTENSOR_SKIPwas lost increate_tensor_qkv()Additional information
Tested with model https://huggingface.co/AesSedai/MiMo-V2.5-GGUF
Q4_K_Mwith next options:
Hardware:
4 GPU's with VRAM=140Gb of memory in total
CPU RAM = 220Gb
Requirements
AI was used for: