Update raven_modeling_minimal.py
Browse filesUpdate to support 4.48 cache changes.
raven_modeling_minimal.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
"""Minimal modeling.py file for HF compatibility and funny zero-shot experiments.
|
2 |
|
3 |
import torch
|
4 |
import math
|
@@ -627,7 +627,7 @@ class RavenForCausalLM(RavenPreTrainedModel, GenerationMixin):
|
|
627 |
model_inputs["cache_position"] = cache_position
|
628 |
current_input_length = input_ids.shape[1]
|
629 |
if past_key_values is not None:
|
630 |
-
if type(past_key_values)
|
631 |
# Need to use custom cache, detect and replace HF dynamic cache if generate injects it
|
632 |
assert past_key_values.get_seq_length() == 0
|
633 |
past_key_values = HuginnDynamicCache()
|
|
|
1 |
+
"""Minimal modeling.py file for HF compatibility and funny zero-shot experiments. Best used for inference, finetuning should work, but is untested with this implementation."""
|
2 |
|
3 |
import torch
|
4 |
import math
|
|
|
627 |
model_inputs["cache_position"] = cache_position
|
628 |
current_input_length = input_ids.shape[1]
|
629 |
if past_key_values is not None:
|
630 |
+
if type(past_key_values) != HuginnDynamicCache:
|
631 |
# Need to use custom cache, detect and replace HF dynamic cache if generate injects it
|
632 |
assert past_key_values.get_seq_length() == 0
|
633 |
past_key_values = HuginnDynamicCache()
|