File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -60,8 +60,8 @@ llama_kv_cache_recurrent::llama_kv_cache_recurrent(
60
60
return it->second ;
61
61
};
62
62
63
- k_l.reserve (n_layer);
64
- v_l.reserve (n_layer);
63
+ k_l.resize (n_layer);
64
+ v_l.resize (n_layer);
65
65
66
66
for (int i = 0 ; i < n_layer; i++) {
67
67
if (filter && !filter (i)) {
@@ -647,7 +647,9 @@ size_t llama_kv_cache_recurrent::size_k_bytes() const {
647
647
size_t size_k_bytes = 0 ;
648
648
649
649
for (const auto & k : k_l) {
650
- size_k_bytes += ggml_nbytes (k);
650
+ if (k != nullptr ) {
651
+ size_k_bytes += ggml_nbytes (k);
652
+ }
651
653
}
652
654
653
655
return size_k_bytes;
@@ -657,7 +659,9 @@ size_t llama_kv_cache_recurrent::size_v_bytes() const {
657
659
size_t size_v_bytes = 0 ;
658
660
659
661
for (const auto & v : v_l) {
660
- size_v_bytes += ggml_nbytes (v);
662
+ if (v != nullptr ) {
663
+ size_v_bytes += ggml_nbytes (v);
664
+ }
661
665
}
662
666
663
667
return size_v_bytes;
You can’t perform that action at this time.
0 commit comments