Make model compatible with Transformers v4.49.0 (#40)
Browse files- Make model compatible with Transformers v4.49.0 (ede996cf5a63b1dbe1dea0d970c2c12fd1f06dd0)
Co-authored-by: Harry Mellor <[email protected]>
- modeling_minicpm.py +1 -1
modeling_minicpm.py
CHANGED
@@ -1369,7 +1369,7 @@ class MiniCPM3ForCausalLM(MiniCPM3PreTrainedModel):
|
|
1369 |
if isinstance(past_key_values, Cache):
|
1370 |
cache_length = past_key_values.get_seq_length()
|
1371 |
past_length = past_key_values.seen_tokens
|
1372 |
-
max_cache_length = past_key_values.
|
1373 |
else:
|
1374 |
cache_length = past_length = past_key_values[0][0].shape[2]
|
1375 |
max_cache_length = None
|
|
|
1369 |
if isinstance(past_key_values, Cache):
|
1370 |
cache_length = past_key_values.get_seq_length()
|
1371 |
past_length = past_key_values.seen_tokens
|
1372 |
+
max_cache_length = past_key_values.get_max_cache_shape()
|
1373 |
else:
|
1374 |
cache_length = past_length = past_key_values[0][0].shape[2]
|
1375 |
max_cache_length = None
|