Update modeling_deepseekv2.py
Browse files- modeling_deepseekv2.py +1 -1
modeling_deepseekv2.py
CHANGED
|
@@ -1786,7 +1786,7 @@ class DeepseekV2ForCausalLM(DeepseekV2PreTrainedModel):
|
|
| 1786 |
if past_key_values is not None:
|
| 1787 |
if isinstance(past_key_values, Cache):
|
| 1788 |
cache_length = past_key_values.get_seq_length()
|
| 1789 |
-
past_length = past_key_values
|
| 1790 |
max_cache_length = past_key_values.get_max_length()
|
| 1791 |
else:
|
| 1792 |
cache_length = past_length = past_key_values[0][0].shape[2]
|
|
|
|
| 1786 |
if past_key_values is not None:
|
| 1787 |
if isinstance(past_key_values, Cache):
|
| 1788 |
cache_length = past_key_values.get_seq_length()
|
| 1789 |
+
past_length = getattr(past_key_values, "seen_tokens", cache_length)
|
| 1790 |
max_cache_length = past_key_values.get_max_length()
|
| 1791 |
else:
|
| 1792 |
cache_length = past_length = past_key_values[0][0].shape[2]
|