MCPcopy Create free account
hub / github.com/EverMind-AI/MSA / get_kvcache

Method get_kvcache

src/utils/cache.py:208–220  ·  view source on GitHub ↗

获取指定层的KV缓存(反量化后) Args: layer_idx: 层索引 Returns: Tuple[torch.Tensor, torch.Tensor]: (key_cache, value_cache)

(self, layer_idx)

Source from the content-addressed store, hash-verified

206 self.value_cache = []
207
208 def get_kvcache(self, layer_idx):
209 """
210 获取指定层的KV缓存(反量化后)
211
212 Args:
213 layer_idx: 层索引
214
215 Returns:
216 Tuple[torch.Tensor, torch.Tensor]: (key_cache, value_cache)
217 """
218 dequant_key = self._dequantize(self._quantized_key_cache[layer_idx])
219 dequant_value = self._dequantize(self._quantized_value_cache[layer_idx])
220 return dequant_key, dequant_value
221
222 def update(
223 self,

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected