소스 검색

Update cache_utils.py

Allen 1 년 전
부모
커밋
a3e3c913b7
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  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]