MCPcopy Create free account
hub / github.com/ModelTC/LightX2V / k_cache

Method k_cache

lightx2v/common/kvcache/fifo.py:104–110  ·  view source on GitHub ↗
(self, layer_id: int, attn_start: int | None = None, local_end: int | None = None)

Source from the content-addressed store, hash-verified

102 return slots
103
104 def k_cache(self, layer_id: int, attn_start: int | None = None, local_end: int | None = None) -> torch.Tensor:
105 valid = self._valid_slots(layer_id)
106 if attn_start is not None or local_end is not None:
107 attn_start = 0 if attn_start is None else int(attn_start)
108 local_end = valid.numel() if local_end is None else int(local_end)
109 valid = valid[attn_start:local_end]
110 return self._k_buffer[layer_id, valid]
111
112 def v_cache(self, layer_id: int, attn_start: int | None = None, local_end: int | None = None) -> torch.Tensor:
113 valid = self._valid_slots(layer_id)

Callers

nothing calls this directly

Calls 1

_valid_slotsMethod · 0.95

Tested by

no test coverage detected