Fix transformers 5.9+ compatibility: create_causal_mask kwargs

#6

modeling.py built the bidirectional mask with a hardcoded create_causal_mask(input_embeds=..., cache_position=...) call. That signature drifted across transformers 5.x:

  • input_embeds was renamed to inputs_embeds (~5.2),
  • cache_position became optional (5.6) then was dropped (5.9).

So the old code broke on transformers 5.9+ (unexpected keyword argument 'input_embeds'). Detect the accepted kwargs once at import time and build the call accordingly — the same approach already shipped in pplx-embed-v1-0.6b. PPLXQwen3ContextualModel / encode() are unchanged.

Validated by loading the model across transformers 5.0.0, 5.8.1, 5.9.0 and 5.12.0 — it loads, runs a forward pass, and produces identical output on all of them. Scope: transformers 5.x.

seslami-pplx changed pull request status to merged

Sign up or log in to comment