Skip to content

Loosen torchaudio version in requirements_minimal.txt - #9

Open
samuelbradshaw wants to merge 2 commits into
adefossez:mainfrom
samuelbradshaw:main
Open

Loosen torchaudio version in requirements_minimal.txt#9
samuelbradshaw wants to merge 2 commits into
adefossez:mainfrom
samuelbradshaw:main

Conversation

@samuelbradshaw

@samuelbradshaw samuelbradshaw commented Aug 15, 2025

Copy link
Copy Markdown

Hi! This pull request loosens the dependency version for torchaudio in requirements_minimal.txt.

If I understand the README correctly, there are two sets of dependencies:

  • requirements_minimal.txt for simple stem separation. This is what's used when installing via pip install demucs.
  • requirements.txt or environment-[cpu|cuda].yml. This is for training.

Training requires torchaudio<2.2, but stem separation appears to work correctly with later versions of torchaudio (see #7). Therefore, I think the dependencies in requirements_minimal.txt can be safely loosened to allow later torchaudio versions. I have tested stem separation with torchaudio 2.8.0 and everything appears to work correctly.

gselgiReply added a commit to gselgiReply/demucs that referenced this pull request Sep 12, 2025
@akx

akx commented Dec 1, 2025

Copy link
Copy Markdown

Yep, this works great for inference.

@DaveParr

DaveParr commented Dec 29, 2025

Copy link
Copy Markdown

I wonder if >2.9 might cause problems? uv tool install demucs --with torchcodec failed to run uvx demucs /home/dave/Development/stems/tmp.wav with:

uvx demucs /home/dave/Development/stems/tmp.wav
Important: the default model was recently changed to `htdemucs` the latest Hybrid Transformer Demucs model. In some cases, this model can actually perform worse than previous models. To get back the old default model use `-n mdx_extra_q`.
Selected model is a bag of 1 models. You will see that many progress bars per track.
Separated tracks will be stored in /home/dave/separated/htdemucs
Namespace(tracks=[PosixPath('/home/dave/Development/stems/tmp.wav')], sig=None, name='htdemucs', repo=None, verbose=False, out=PosixPath('separated'), filename='{track}/{stem}.{ext}', device='cuda', shifts=1, overlap=0.25, split=True, segment=None, stem=None, int24=False, float32=False, clip_mode='rescale', flac=False, mp3=False, mp3_bitrate=320, mp3_preset=2, jobs=0)
Separating track /home/dave/Development/stems/tmp.wav
100%|██████████████████████████████████████████████████████████████████████| 204.75/204.75 [00:08<00:00, 24.41seconds/s]
/home/dave/.local/share/uv/tools/demucs/lib/python3.12/site-packages/torchaudio/__init__.py:178: UserWarning: The 'encoding' parameter is not fully supported by TorchCodec AudioEncoder.
  return save_with_torchcodec(
/home/dave/.local/share/uv/tools/demucs/lib/python3.12/site-packages/torchaudio/__init__.py:178: UserWarning: The 'bits_per_sample' parameter is not directly supported by TorchCodec AudioEncoder.
  return save_with_torchcodec(

in environment:


Resolved 43 packages in 192ms
Installed 43 packages in 162ms
 + antlr4-python3-runtime==4.9.3
 + cloudpickle==3.1.2
 + demucs==4.0.1
 + dora-search==0.1.12
 + einops==0.8.1
 + filelock==3.20.1
 + fsspec==2025.12.0
 + jinja2==3.1.6
 + julius==0.2.7
 + lameenc==1.8.1
 + markupsafe==3.0.3
 + mpmath==1.3.0
 + networkx==3.6.1
 + numpy==2.4.0
 + nvidia-cublas-cu12==12.8.4.1
 + nvidia-cuda-cupti-cu12==12.8.90
 + nvidia-cuda-nvrtc-cu12==12.8.93
 + nvidia-cuda-runtime-cu12==12.8.90
 + nvidia-cudnn-cu12==9.10.2.21
 + nvidia-cufft-cu12==11.3.3.83
 + nvidia-cufile-cu12==1.13.1.3
 + nvidia-curand-cu12==10.3.9.90
 + nvidia-cusolver-cu12==11.7.3.90
 + nvidia-cusparse-cu12==12.5.8.93
 + nvidia-cusparselt-cu12==0.7.1
 + nvidia-nccl-cu12==2.27.5
 + nvidia-nvjitlink-cu12==12.8.93
 + nvidia-nvshmem-cu12==3.3.20
 + nvidia-nvtx-cu12==12.8.90
 + omegaconf==2.3.0
 + openunmix==1.3.0
 + pyyaml==6.0.3
 + retrying==1.4.2
 + setuptools==80.9.0
 + submitit==1.5.4
 + sympy==1.14.0
 + torch==2.9.1
 + torchaudio==2.9.1
 + torchcodec==0.9.1
 + tqdm==4.67.1
 + treetable==0.2.6
 + triton==3.5.1
 + typing-extensions==4.15.0
Installed 1 executable: demucs

however uv tool install demucs --with torch==2.8.0 ran uvx demucs /home/dave/Development/stems/tmp.wav with:

Important: the default model was recently changed to `htdemucs` the latest Hybrid Transformer Demucs model. In some cases, this model can actually perform worse than previous models. To get back the old default model use `-n mdx_extra_q`.
Selected model is a bag of 1 models. You will see that many progress bars per track.
Separated tracks will be stored in /home/dave/separated/htdemucs
Namespace(tracks=[PosixPath('/home/dave/Development/stems/tmp.wav')], sig=None, name='htdemucs', repo=None, verbose=False, out=PosixPath('separated'), filename='{track}/{stem}.{ext}', device='cuda', shifts=1, overlap=0.25, split=True, segment=None, stem=None, int24=False, float32=False, clip_mode='rescale', flac=False, mp3=False, mp3_bitrate=320, mp3_preset=2, jobs=0)
Separating track /home/dave/Development/stems/tmp.wav
100%|██████████████████████████████████████████████████████████████████████| 204.75/204.75 [00:08<00:00, 25.11seconds/s]
/home/dave/.local/share/uv/tools/demucs/lib/python3.12/site-packages/torchaudio/_backend/utils.py:337: UserWarning: In 2.9, this function's implementation will be changed to use torchaudio.save_with_torchcodec` under the hood. Some parameters like format, encoding, bits_per_sample, buffer_size, and ``backend`` will be ignored. We recommend that you port your code to rely directly on TorchCodec's encoder instead: https://docs.pytorch.org/torchcodec/stable/generated/torchcodec.encoders.AudioEncoder
  warnings.warn(
/home/dave/.local/share/uv/tools/demucs/lib/python3.12/site-packages/torchaudio/_backend/ffmpeg.py:247: UserWarning: torio.io._streaming_media_encoder.StreamingMediaEncoder has been deprecated. This deprecation is part of a large refactoring effort to transition TorchAudio into a maintenance phase. The decoding and encoding capabilities of PyTorch for both audio and video are being consolidated into TorchCodec. Please see https://github.com/pytorch/audio/issues/3902 for more information. It will be removed from the 2.9 release. 
  s = torchaudio.io.StreamWriter(uri, format=muxer, buffer_size=buffer_size)

in environment:

Resolved 41 packages in 192ms
Prepared 4 packages in 1m 23s
Uninstalled 6 packages in 121ms
Installed 4 packages in 100ms
 - nvidia-nccl-cu12==2.27.5
 + nvidia-nccl-cu12==2.27.3
 - nvidia-nvshmem-cu12==3.3.20
 - torch==2.9.1
 + torch==2.8.0
 - torchaudio==2.9.1
 + torchaudio==2.8.0
 - torchcodec==0.9.1
 - triton==3.5.1
 + triton==3.4.0
Installed 1 executable: demucs

Output completed though and audio separation seemed successful with 4 decent outputs
🥇

@samuelbradshaw

Copy link
Copy Markdown
Author

Thanks! I updated this pull request to use torchaudio>=0.8,<2.9.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants