File tree 1 file changed +14
-7
lines changed
1 file changed +14
-7
lines changed Original file line number Diff line number Diff line change @@ -1788,30 +1788,37 @@ size_t llama_context::state_read_data(llama_io_read_i & io) {
1788
1788
}
1789
1789
}
1790
1790
1791
- LLAMA_LOG_DEBUG ( " %s: - reading KV self \n " , __func__);
1792
- llama_kv_cache * kv_self = static_cast <llama_kv_cache *>(memory. get () );
1791
+ if (memory) {
1792
+ LLAMA_LOG_DEBUG ( " %s: - reading KV self \n " , __func__ );
1793
1793
1794
- kv_self->state_read (io);
1794
+ llama_kv_cache * kv_self = static_cast <llama_kv_cache *>(memory.get ());
1795
+
1796
+ kv_self->state_read (io);
1797
+ }
1795
1798
1796
1799
return io.n_bytes ();
1797
1800
}
1798
1801
1799
1802
size_t llama_context::state_seq_write_data (llama_io_write_i & io, llama_seq_id seq_id) {
1800
1803
GGML_UNUSED (seq_id);
1801
1804
1802
- llama_kv_cache * kv_self = static_cast <llama_kv_cache *>(memory.get ());
1805
+ if (memory) {
1806
+ llama_kv_cache * kv_self = static_cast <llama_kv_cache *>(memory.get ());
1803
1807
1804
- kv_self->state_write (io, seq_id);
1808
+ kv_self->state_write (io, seq_id);
1809
+ }
1805
1810
1806
1811
return io.n_bytes ();
1807
1812
}
1808
1813
1809
1814
size_t llama_context::state_seq_read_data (llama_io_read_i & io, llama_seq_id seq_id) {
1810
1815
GGML_UNUSED (seq_id);
1811
1816
1812
- llama_kv_cache * kv_self = static_cast <llama_kv_cache *>(memory.get ());
1817
+ if (memory) {
1818
+ llama_kv_cache * kv_self = static_cast <llama_kv_cache *>(memory.get ());
1813
1819
1814
- kv_self->state_read (io, seq_id);
1820
+ kv_self->state_read (io, seq_id);
1821
+ }
1815
1822
1816
1823
return io.n_bytes ();
1817
1824
}
You can’t perform that action at this time.
0 commit comments