Update modeling_deepseekocr.py
Browse files- modeling_deepseekocr.py +1 -1
modeling_deepseekocr.py
CHANGED
|
@@ -620,7 +620,7 @@ class DeepseekOCRForCausalLM(DeepseekV2ForCausalLM):
|
|
| 620 |
if past_key_values is not None:
|
| 621 |
if isinstance(past_key_values, Cache):
|
| 622 |
cache_length = past_key_values.get_seq_length()
|
| 623 |
-
past_length = past_key_values
|
| 624 |
max_cache_length = past_key_values.get_max_length()
|
| 625 |
else:
|
| 626 |
cache_length = past_length = past_key_values[0][0].shape[2]
|
|
|
|
| 620 |
if past_key_values is not None:
|
| 621 |
if isinstance(past_key_values, Cache):
|
| 622 |
cache_length = past_key_values.get_seq_length()
|
| 623 |
+
past_length = getattr(past_key_values, "seen_tokens", cache_length)
|
| 624 |
max_cache_length = past_key_values.get_max_length()
|
| 625 |
else:
|
| 626 |
cache_length = past_length = past_key_values[0][0].shape[2]
|