audio icon indicating copy to clipboard operation
audio copied to clipboard

MelScale should retain n_stft as an attribute

Open sammlapp opened this issue 2 months ago • 2 comments

🐛 Describe the bug

The issue with not retaining this argument as an attribute is that it makes an identical object difficult to recreate from the object's attributes. Setting self.n_stft=n_stft during __init__ will make it so that the same object could be re-initialized from the object's attributes (for instance, if we seralize the object to json)

Versions

Collecting environment information... PyTorch version: 2.8.0 Is debug build: False CUDA used to build PyTorch: None ROCM used to build PyTorch: N/A

OS: macOS 15.1 (arm64) GCC version: Could not collect Clang version: 16.0.0 (clang-1600.0.26.4) CMake version: Could not collect Libc version: N/A

Python version: 3.13.5 | packaged by Anaconda, Inc. | (main, Jun 12 2025, 11:23:37) [Clang 14.0.6 ] (64-bit runtime) Python platform: macOS-15.1-arm64-arm-64bit-Mach-O Is CUDA available: False CUDA runtime version: No CUDA CUDA_MODULE_LOADING set to: N/A GPU models and configuration: No CUDA Nvidia driver version: No CUDA cuDNN version: No CUDA Is XPU available: False HIP runtime version: N/A MIOpen runtime version: N/A Is XNNPACK available: True

CPU: Apple M1 Pro

Versions of relevant libraries: [pip3] mypy_extensions==1.1.0 [pip3] numpy==2.2.0 [pip3] onnx==1.19.1 [pip3] onnx-ir==0.1.11 [pip3] onnxruntime==1.23.2 [pip3] onnxscript==0.5.4 [pip3] pytorch-lightning==2.5.2 [pip3] torch==2.8.0 [pip3] torchaudio==2.8.0 [pip3] torchmetrics==1.8.0 [pip3] torchvision==0.23.0 [conda] numpy 2.2.0 pypi_0 pypi [conda] pytorch-lightning 2.5.2 pypi_0 pypi [conda] torch 2.8.0 pypi_0 pypi [conda] torchaudio 2.8.0 pypi_0 pypi [conda] torchmetrics 1.8.0 pypi_0 pypi [conda] torchvision 0.23.0 pypi_0 pypi

sammlapp avatar Oct 24 '25 18:10 sammlapp

Makes sense. Would you like to create a PR fixing this issue?

pearu avatar Oct 31 '25 12:10 pearu

Sure, I opened a PR. This is my first time contributing to torchaudio so let me know if I should be making to a PR to a different branch or doing something differently. Thanks

sammlapp avatar Nov 04 '25 01:11 sammlapp