Explorar el Código

Update cache_utils.py

Allen hace 1 año
padre
commit
a3e3c913b7
Se han modificado 1 ficheros con 1 adiciones y 1 borrados
  1. 1 1
      research/long-context-llama/H2O/cache_utils.py

+ 1 - 1
research/long-context-llama/H2O/cache_utils.py

@@ -554,7 +554,7 @@ class HHCache(Cache):
         """Converts a cache in the legacy cache format into an equivalent `DynamicCache`."""
         cache = cls(window_length, num_hh_tokens)
         if past_key_values is not None:
-            for layer_idx in range(len(past_key_values)):
+            for layer_idx in range(len(past_key_values) // 3):
                 key_states = past_key_values[layer_idx * 3]
                 value_states = past_key_values[layer_idx * 3 + 1]
                 accumulated_attention_scores = past_key_values[layer_idx * 3 + 2]