Make Phi4MMForCausalLM.forward's num_logits_to_keep actually optional

#20
by phh - opened

Fixes:

  File "/home/phh/.cache/huggingface/modules/transformers_modules/microsoft/Phi-4-multimodal-instruct/a11e830f953efbce02a57d3b672f84c5140e3f94/modeling_phi4mm.py", line 2137, in forward
    logits = self.lm_head(hidden_states[:, -num_logits_to_keep:, :])
                                           ^^^^^^^^^^^^^^^^^^^
TypeError: bad operand type for unary -: 'NoneType'

Hey, I have the same issue when using transformers==4.49.0 is it also your case ?
If it is the case, I recommend you using transformers==4.48.2 and wait the transformers integration

+1

Downgrading transformers indeed fixed the issue.

nguyenbh changed pull request status to closed

Sign up or log in to comment