JonasGeiping commited on
Commit
4fcf360
·
verified ·
1 Parent(s): 92fda69

Update raven_modeling_minimal.py

Browse files

Update to support 4.48 cache changes.

Files changed (1) hide show
  1. raven_modeling_minimal.py +2 -2
raven_modeling_minimal.py CHANGED
@@ -1,4 +1,4 @@
1
- """Minimal modeling.py file for HF compatibility and funny zero-shot experiments. Use only for inference."""
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) == DynamicCache:
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()