Skip to content

Commit 2ccfb8a

Browse files
committed
Bug fix. Added assignment of sequence ranges in PairedActivationCache to ensure proper handling of activation data. This change enhances the functionality by directly linking sequence ranges to the first activation cache, improving data integrity checks during cache operations.
1 parent 658a0ee commit 2ccfb8a

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

dictionary_learning/cache.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -766,6 +766,7 @@ def __init__(self, store_dir_1: str, store_dir_2: str, submodule_name: str = Non
766766
else:
767767
assert len(self.activation_cache_1) == len(self.activation_cache_2), f"Lengths do not match: {len(self.activation_cache_1)} != {len(self.activation_cache_2)}"
768768
self._len = len(self.activation_cache_1)
769+
self._sequence_ranges = self.activation_cache_1.sequence_ranges
769770

770771
if self.activation_cache_1.tokens is not None and self.activation_cache_2.tokens is not None:
771772
assert torch.all(self.activation_cache_1.tokens[:self._len] == self.activation_cache_2.tokens[:self._len]), "Tokens do not match"

0 commit comments

Comments
 (0)