ctranslate2-4you commited on
Commit
aede51a
·
verified ·
1 Parent(s): a5fc16a

compatibility with transformers 4.49+

Browse files
Files changed (1) hide show
  1. modeling_molmo.py +3 -2
modeling_molmo.py CHANGED
@@ -2526,8 +2526,9 @@ class MolmoForCausalLM(PreTrainedModel):
2526
  del model_kwargs["images"]
2527
  del model_kwargs["image_masks"]
2528
  del model_kwargs["image_input_idx"]
2529
- cache_name, cache = super()._extract_past_from_model_output(outputs)
2530
- model_kwargs[cache_name] = cache
 
2531
  model_kwargs["cache_position"] = model_kwargs["cache_position"][-1:] + num_new_tokens
2532
  return model_kwargs
2533
 
 
2526
  del model_kwargs["images"]
2527
  del model_kwargs["image_masks"]
2528
  del model_kwargs["image_input_idx"]
2529
+
2530
+ model_kwargs["past_key_values"] = outputs.past_key_values
2531
+
2532
  model_kwargs["cache_position"] = model_kwargs["cache_position"][-1:] + num_new_tokens
2533
  return model_kwargs
2534