pranay-ar commited on
Commit
8e96720
·
verified ·
1 Parent(s): 03d86d0

Update modeling_molmoe.py

Browse files

Updating `modelling_molmo.py` MolmoE inspired from the fix in https://huggingface.co/allenai/Molmo-7B-D-0924/discussions/41

Files changed (1) hide show
  1. modeling_molmoe.py +1 -2
modeling_molmoe.py CHANGED
@@ -2468,8 +2468,7 @@ class MolmoForCausalLM(PreTrainedModel):
2468
  del model_kwargs["images"]
2469
  del model_kwargs["image_masks"]
2470
  del model_kwargs["image_input_idx"]
2471
- cache_name, cache = super()._extract_past_from_model_output(outputs)
2472
- model_kwargs[cache_name] = cache
2473
  model_kwargs["cache_position"] = model_kwargs["cache_position"][-1:] + num_new_tokens
2474
  return model_kwargs
2475
 
 
2468
  del model_kwargs["images"]
2469
  del model_kwargs["image_masks"]
2470
  del model_kwargs["image_input_idx"]
2471
+ model_kwargs["past_key_values"] = outputs.past_key_values
 
2472
  model_kwargs["cache_position"] = model_kwargs["cache_position"][-1:] + num_new_tokens
2473
  return model_kwargs
2474