login256 commited on
Commit
faea2fa
·
verified ·
1 Parent(s): 604d566

The method get_max_length of 'DynamicCache' is deprecated and has been removed in transformer 4.49

Browse files
Files changed (1) hide show
  1. modeling_deepseek.py +1 -1
modeling_deepseek.py CHANGED
@@ -1725,7 +1725,7 @@ class DeepseekV2ForCausalLM(DeepseekV2PreTrainedModel):
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_length()
1729
  else:
1730
  cache_length = past_length = past_key_values[0][0].shape[2]
1731
  max_cache_length = 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]
1731
  max_cache_length = None