basicv8vc commited on
Commit
47946db
·
verified ·
1 Parent(s): 9a27f5d

use seen_tokens in DynamicCache

Browse files
Files changed (1) hide show
  1. modeling_deepseek.py +1 -1
modeling_deepseek.py CHANGED
@@ -1724,7 +1724,7 @@ class DeepseekV2ForCausalLM(DeepseekV2PreTrainedModel):
1724
  if past_key_values is not None:
1725
  if isinstance(past_key_values, Cache):
1726
  cache_length = past_key_values.get_seq_length()
1727
- past_length = past_key_values.cache_position
1728
  max_cache_length = past_key_values.get_max_cache_shape()
1729
  else:
1730
  cache_length = past_length = past_key_values[0][0].shape[2]
 
1724
  if past_key_values is not None:
1725
  if isinstance(past_key_values, Cache):
1726
  cache_length = past_key_values.get_seq_length()
1727
+ past_length = past_key_values.seen_tokens
1728
  max_cache_length = past_key_values.get_max_cache_shape()
1729
  else:
1730
  cache_length = past_length = past_key_values[0][0].shape[2]