Update modeling_molmo to work with transformers 4.56.2

#50
by mlopezantequera - opened

Avoid errors like this:

[rank0]:     past_length = past_key_values[0][0].size(-2)
[rank0]: AttributeError: 'NoneType' object has no attribute 'size'

still not work with 4.56.2

output = model.generate_from_batch(
    inputs,
    GenerationConfig(max_new_tokens=1000, stop_strings="<|endoftext|>"),
    tokenizer=processor.tokenizer
)

'NoneType' object has no attribute 'size'

Thanks for the support! This patch worked for me

Ready to merge
This branch is ready to get merged automatically.

Sign up or log in to comment