transformers
8d410c61 - perf(feature_extraction_sequence): skip re-splitting already-batched numpy arrays in pad() (#46329)

Commit
33 days ago
perf(feature_extraction_sequence): skip re-splitting already-batched numpy arrays in pad() (#46329) When pad() receives a value that is already a numpy array, the existing code rebuilds it as a Python list of per-element arrays via [to_numpy(v) for v in value]. For large inputs (e.g. long audio) this iteration and per-row copy is very slow and serves no purpose: the downstream truncate/pad logic indexes value[i] identically for both a list of arrays and a batched ndarray. Skip the conversion when value is already an ndarray. The common list-of-arrays path is unchanged. Fixes #46328
Author
Parents
Loading