coremltools icon indicating copy to clipboard operation
coremltools copied to clipboard

torch stft op conversion is broken for torch-2.7.0

Open atiorh opened this issue 7 months ago • 1 comments

🐞Describing the bug

torch stft op conversion is broken due to torch op signature drift from torch-2.5.0 to torch-2.7.0 (coremltools warns that 2.5.0 is the latest tested version of torch for coremltools-8.3 so the quick workaround is to downgrade torch temporarily). To be clear this exact line surfaces the issue.

Stack Trace

  File ".../lib/python3.11/site-packages/coremltools/converters/mil/frontend/torch/ops.py", line 173, in convert_single_node
    add_op(context, node)
  File ".../lib/python3.11/site-packages/coremltools/converters/mil/frontend/torch/ops.py", line 8455, in stft
    input_data, n_fft, hop_length, win_length, window, normalized, onesided, _ = _get_inputs(context, node, min_expected=2)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: too many values to unpack (expected 8)

System environment (please complete the following information):

  • coremltools version: 8.3
  • OS (e.g. MacOS version or Linux type): macOS15
  • PyTorch: 2.7.0

atiorh avatar May 06 '25 15:05 atiorh

This should be fixed in our next release.

TobyRoseman avatar May 06 '25 21:05 TobyRoseman