Fix create_causal_mask call for transformers 4.54 - 5.9

#14
Perplexity org

Same fix as perplexity-ai/pplx-embed-v1-0.6b#13. The two repos share the same modeling.py, so they share the same bug:

TypeError: create_causal_mask() got an unexpected keyword argument 'input_embeds'

on transformers 5.9. This change detects the create_causal_mask signature at import time and adjusts the kwargs accordingly:

  • input_embeds (singular, transformers <= 5.1) vs inputs_embeds (>= 5.2)
  • cache_position (required positional <= 5.3, kept-for-BC 5.6 - 5.8, removed in 5.9)
maximilian-schall-ppx changed pull request status to merged

Sign up or log in to comment