sylwia-kuros commited on
Commit
5edc21d
·
verified ·
1 Parent(s): 277e139

Update modeling_phi3.py

Browse files
Files changed (1) hide show
  1. modeling_phi3.py +1 -1
modeling_phi3.py CHANGED
@@ -1296,7 +1296,7 @@ class Phi3ForCausalLM(Phi3PreTrainedModel):
1296
  if isinstance(past_key_values, Cache):
1297
  cache_length = past_key_values.get_seq_length()
1298
  past_length = past_key_values.seen_tokens
1299
- max_cache_length = past_key_values.get_max_length()
1300
  else:
1301
  cache_length = past_length = past_key_values[0][0].shape[2]
1302
  max_cache_length = None
 
1296
  if isinstance(past_key_values, Cache):
1297
  cache_length = past_key_values.get_seq_length()
1298
  past_length = past_key_values.seen_tokens
1299
+ max_cache_length = past_key_values.get_max_length() if hasattr(past_key_values, "get_max_length") else past_key_values.get_max_cache_shape()
1300
  else:
1301
  cache_length = past_length = past_key_values[0][0].shape[2]
1302
  max_cache_length = None