Skip to content

Kyojin: open-source engine that runs 100 GB-class open models (GLM-5.3, Qwen3.8, DeepSeek V4.1) on one desktop machine. AMD Strix Halo, NVIDIA RTX and Apple Mac. OpenAI API, built on ExLlamaV3.

Fix prompt-cache restore for PLE layers: copy the saved token context

YanissAmze9588ac2f647
diff --git a/exllamav3/modules/ple.py b/exllamav3/modules/ple.py
index 924716a..f3ff065 100644
--- a/exllamav3/modules/ple.py
+++ b/exllamav3/modules/ple.py
@@ -107,7 +107,9 @@ class PLELayerState:
self.id_state[slot, :self.ctx].copy_(temp)
def stash(self, slot, position: int = 0):
- return (self.conv_state[slot, :, :self.win].cpu(), self.id_state[slot, :self.ctx].cpu())
+ # id_state lives on the CPU: .cpu() would return a view of the live slot, so a stashed checkpoint
+ # changes whenever the slot advances; clone it
+ return (self.conv_state[slot, :, :self.win].cpu(), self.id_state[slot, :self.ctx].cpu().clone())
def unstash(self, slot, stashed, position: int = 0):
self.conv_state[slot, :, :self.win].copy_(stashed[0])