[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-70809":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":17,"stars7d":18,"stars30d":19,"stars90d":16,"forks30d":16,"starsTrendScore":20,"compositeScore":21,"rankGlobal":10,"rankLanguage":10,"license":22,"archived":23,"fork":24,"defaultBranch":25,"hasWiki":24,"hasPages":24,"topics":26,"createdAt":10,"pushedAt":10,"updatedAt":27,"readmeContent":28,"aiSummary":29,"trendingCount":16,"starSnapshotCount":16,"syncStatus":14,"lastSyncTime":30,"discoverSource":31},70809,"demucs","facebookresearch\u002Fdemucs","facebookresearch","Code for the paper Hybrid Spectrogram and Waveform Source Separation","",null,"Python",10189,1512,2,272,0,18,42,126,54,119.54,"MIT License",true,false,"main",[],"2026-06-12 04:00:57","# Demucs Music Source Separation\n\n[![Support Ukraine](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FSupport-Ukraine-FFD500?style=flat&labelColor=005BBB)](https:\u002F\u002Fopensource.fb.com\u002Fsupport-ukraine)\n![tests badge](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002Fdemucs\u002Fworkflows\u002Ftests\u002Fbadge.svg)\n![linter badge](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002Fdemucs\u002Fworkflows\u002Flinter\u002Fbadge.svg)\n\n\n**Important:** As I am no longer working at Meta, **this repository is not maintained anymore**.\nI've created a fork at [github.com\u002Fadefossez\u002Fdemucs](https:\u002F\u002Fgithub.com\u002Fadefossez\u002Fdemucs). Note that this project is not actively maintained anymore\nand only important bug fixes will be processed on the new repo. Please do not open issues for feature request or if Demucs doesn't work perfectly for your use case :)\n\nThis is the 4th release of Demucs (v4), featuring Hybrid Transformer based source separation.\n**For the classic Hybrid Demucs (v3):** [Go this commit][demucs_v3].\nIf you are experiencing issues and want the old Demucs back, please file an issue, and then you can get back to Demucs v3 with\n`git checkout v3`. You can also go [Demucs v2][demucs_v2].\n\n\nDemucs is a state-of-the-art music source separation model, currently capable of separating\ndrums, bass, and vocals from the rest of the accompaniment.\nDemucs is based on a U-Net convolutional architecture inspired by [Wave-U-Net][waveunet].\nThe v4 version features [Hybrid Transformer Demucs][htdemucs], a hybrid spectrogram\u002Fwaveform separation model using Transformers.\nIt is based on [Hybrid Demucs][hybrid_paper] (also provided in this repo), with the innermost layers\nreplaced by a cross-domain Transformer Encoder. This Transformer uses self-attention within each domain,\nand cross-attention across domains.\nThe model achieves a SDR of 9.00 dB on the MUSDB HQ test set. Moreover, when using sparse attention\nkernels to extend its receptive field and per source fine-tuning, we achieve state-of-the-art 9.20 dB of SDR.\n\nSamples are available [on our sample page](https:\u002F\u002Fai.honu.io\u002Fpapers\u002Fhtdemucs\u002Findex.html).\nCheckout [our paper][htdemucs] for more information.\nIt has been trained on the [MUSDB HQ][musdb] dataset + an extra training dataset of 800 songs.\nThis model separates drums, bass and vocals and other stems for any song.\n\n\nAs Hybrid Transformer Demucs is brand new, it is not activated by default, you can activate it in the usual\ncommands described hereafter with `-n htdemucs_ft`.\nThe single, non fine-tuned model is provided as `-n htdemucs`, and the retrained baseline\nas `-n hdemucs_mmi`. The Sparse Hybrid Transformer model decribed in our paper is not provided as its\nrequires custom CUDA code that is not ready for release yet.\nWe are also releasing an experimental 6 sources model, that adds a `guitar` and `piano` source.\nQuick testing seems to show okay quality for `guitar`, but a lot of bleeding and artifacts for the `piano` source.\n\n\n\u003Cp align=\"center\">\n\u003Cimg src=\".\u002Fdemucs.png\" alt=\"Schema representing the structure of Hybrid Transformer Demucs,\n    with a dual U-Net structure, one branch for the temporal domain,\n    and one branch for the spectral domain. There is a cross-domain Transformer between the Encoders and Decoders.\"\nwidth=\"800px\">\u003C\u002Fp>\n\n\n\n## Important news if you are already using Demucs\n\nSee the [release notes](.\u002Fdocs\u002Frelease.md) for more details.\n\n- 22\u002F02\u002F2023: added support for the [SDX 2023 Challenge](https:\u002F\u002Fwww.aicrowd.com\u002Fchallenges\u002Fsound-demixing-challenge-2023),\n    see the dedicated [doc page](.\u002Fdocs\u002Fsdx23.md)\n- 07\u002F12\u002F2022: Demucs v4 now on PyPI. **htdemucs** model now used by default. Also releasing\n    a 6 sources models (adding `guitar` and `piano`, although the latter doesn't work so well at the moment).\n- 16\u002F11\u002F2022: Added the new **Hybrid Transformer Demucs v4** models.\n\tAdding support for the [torchaudio implementation of HDemucs](https:\u002F\u002Fpytorch.org\u002Faudio\u002Fstable\u002Ftutorials\u002Fhybrid_demucs_tutorial.html).\n- 30\u002F08\u002F2022: added reproducibility and ablation grids, along with an updated version of the paper.\n- 17\u002F08\u002F2022: Releasing v3.0.5: Set split segment length to reduce memory. Compatible with pyTorch 1.12.\n- 24\u002F02\u002F2022: Releasing v3.0.4: split into two stems (i.e. karaoke mode).\n    Export as float32 or int24.\n- 17\u002F12\u002F2021: Releasing v3.0.3: bug fixes  (thanks @keunwoochoi), memory drastically\n    reduced on GPU (thanks @famzah) and new multi-core evaluation on CPU (`-j` flag).\n- 12\u002F11\u002F2021: Releasing **Demucs v3** with hybrid domain separation. Strong improvements\n\ton all sources. This is the model that won Sony MDX challenge.\n- 11\u002F05\u002F2021: Adding support for MusDB-HQ and arbitrary wav set, for the MDX challenge. For more information\non joining the challenge with Demucs see [the Demucs MDX instructions](docs\u002Fmdx.md)\n\n\n## Comparison with other models\n\nWe provide hereafter a summary of the different metrics presented in the paper.\nYou can also compare Hybrid Demucs (v3), [KUIELAB-MDX-Net][kuielab], [Spleeter][spleeter], Open-Unmix, Demucs (v1), and Conv-Tasnet on one of my favorite\nsongs on my [soundcloud playlist][soundcloud].\n\n### Comparison of accuracy\n\n`Overall SDR` is the mean of the SDR for each of the 4 sources, `MOS Quality` is a rating from 1 to 5\nof the naturalness and absence of artifacts given by human listeners (5 = no artifacts), `MOS Contamination`\nis a rating from 1 to 5 with 5 being zero contamination by other sources. We refer the reader to our [paper][hybrid_paper],\nfor more details.\n\n| Model                        | Domain      | Extra data?       | Overall SDR | MOS Quality | MOS Contamination |\n|------------------------------|-------------|-------------------|-------------|-------------|-------------------|\n| [Wave-U-Net][waveunet]       | waveform    | no                | 3.2         | -           | -                 |\n| [Open-Unmix][openunmix]      | spectrogram | no                | 5.3         | -           | -                 |\n| [D3Net][d3net]               | spectrogram | no                | 6.0         | -           | -                 |\n| [Conv-Tasnet][demucs_v2]     | waveform    | no                | 5.7         | -           |                   |\n| [Demucs (v2)][demucs_v2]     | waveform    | no                | 6.3         | 2.37        | 2.36              |\n| [ResUNetDecouple+][decouple] | spectrogram | no                | 6.7         | -           | -                 |\n| [KUIELAB-MDX-Net][kuielab]   | hybrid      | no                | 7.5         | **2.86**    | 2.55              |\n| [Band-Spit RNN][bandsplit]   | spectrogram | no                | **8.2**     | -           | -                 |\n| **Hybrid Demucs (v3)**       | hybrid      | no                | 7.7         | **2.83**    | **3.04**          |\n| [MMDenseLSTM][mmdenselstm]   | spectrogram | 804 songs         | 6.0         | -           | -                 |\n| [D3Net][d3net]               | spectrogram | 1.5k songs        | 6.7         | -           | -                 |\n| [Spleeter][spleeter]         | spectrogram | 25k songs         | 5.9         | -           | -                 |\n| [Band-Spit RNN][bandsplit]   | spectrogram | 1.7k (mixes only) | **9.0**     | -           | -                 |\n| **HT Demucs f.t. (v4)**      | hybrid      | 800 songs         | **9.0**     | -           | -                 |\n\n\n\n## Requirements\n\nYou will need at least Python 3.8. See `requirements_minimal.txt` for requirements for separation only,\nand `environment-[cpu|cuda].yml` (or `requirements.txt`) if you want to train a new model.\n\n### For Windows users\n\nEverytime you see `python3`, replace it with `python.exe`. You should always run commands from the\nAnaconda console.\n\n### For musicians\n\nIf you just want to use Demucs to separate tracks, you can install it with\n\n```bash\npython3 -m pip install -U demucs\n```\n\nFor bleeding edge versions, you can install directly from this repo using\n```bash\npython3 -m pip install -U git+https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002Fdemucs#egg=demucs\n```\n\nAdvanced OS support are provided on the following page, **you must read the page for your OS before posting an issues**:\n- **If you are using Windows:** [Windows support](docs\u002Fwindows.md).\n- **If you are using macOS:** [macOS support](docs\u002Fmac.md).\n- **If you are using Linux:** [Linux support](docs\u002Flinux.md).\n\n### For machine learning scientists\n\nIf you have anaconda installed, you can run from the root of this repository:\n\n```bash\nconda env update -f environment-cpu.yml  # if you don't have GPUs\nconda env update -f environment-cuda.yml # if you have GPUs\nconda activate demucs\npip install -e .\n```\n\nThis will create a `demucs` environment with all the dependencies installed.\n\nYou will also need to install [soundstretch\u002Fsoundtouch](https:\u002F\u002Fwww.surina.net\u002Fsoundtouch\u002Fsoundstretch.html): on macOS you can do `brew install sound-touch`,\nand on Ubuntu `sudo apt-get install soundstretch`. This is used for the\npitch\u002Ftempo augmentation.\n\n\n### Running in Docker\n\nThanks to @xserrat, there is now a Docker image definition ready for using Demucs. This can ensure all libraries are correctly installed without interfering with the host OS. See his repo [Docker Facebook Demucs](https:\u002F\u002Fgithub.com\u002Fxserrat\u002Fdocker-facebook-demucs) for more information.\n\n\n### Running from Colab\n\nI made a Colab to easily separate track with Demucs. Note that\ntransfer speeds with Colab are a bit slow for large media files,\nbut it will allow you to use Demucs without installing anything.\n\n[Demucs on Google Colab](https:\u002F\u002Fcolab.research.google.com\u002Fdrive\u002F1dC9nVxk3V_VPjUADsnFu8EiT-xnU1tGH?usp=sharing)\n\n### Web Demo\n\nIntegrated to [Hugging Face Spaces](https:\u002F\u002Fhuggingface.co\u002Fspaces) with [Gradio](https:\u002F\u002Fgithub.com\u002Fgradio-app\u002Fgradio). See demo: [![Hugging Face Spaces](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002F%F0%9F%A4%97%20Hugging%20Face-Spaces-blue)](https:\u002F\u002Fhuggingface.co\u002Fspaces\u002Fakhaliq\u002Fdemucs)\n\n### Graphical Interface\n\n@CarlGao4 has released a GUI for Demucs: [CarlGao4\u002FDemucs-Gui](https:\u002F\u002Fgithub.com\u002FCarlGao4\u002FDemucs-Gui). Downloads for Windows and macOS is available [here](https:\u002F\u002Fgithub.com\u002FCarlGao4\u002FDemucs-Gui\u002Freleases). Use [FossHub mirror](https:\u002F\u002Ffosshub.com\u002FDemucs-GUI.html) to speed up your download.\n\n@Anjok07 is providing a self contained GUI in [UVR (Ultimate Vocal Remover)](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002Fdemucs\u002Fissues\u002F334) that supports Demucs.\n\n### Other providers\n\nAudiostrip is providing free online separation with Demucs on their website [https:\u002F\u002Faudiostrip.co.uk\u002F](https:\u002F\u002Faudiostrip.co.uk\u002F).\n\n[MVSep](https:\u002F\u002Fmvsep.com\u002F) also provides free online separation, select `Demucs3 model B` for the best quality.\n\n[Neutone](https:\u002F\u002Fneutone.space\u002F) provides a realtime Demucs model in their free VST\u002FAU plugin that can be used in your favorite DAW.\n\n\n## Separating tracks\n\nIn order to try Demucs, you can just run from any folder (as long as you properly installed it)\n\n```bash\ndemucs PATH_TO_AUDIO_FILE_1 [PATH_TO_AUDIO_FILE_2 ...]   # for Demucs\n# If you used `pip install --user` you might need to replace demucs with python3 -m demucs\npython3 -m demucs --mp3 --mp3-bitrate BITRATE PATH_TO_AUDIO_FILE_1  # output files saved as MP3\n        # use --mp3-preset to change encoder preset, 2 for best quality, 7 for fastest\n# If your filename contain spaces don't forget to quote it !!!\ndemucs \"my music\u002Fmy favorite track.mp3\"\n# You can select different models with `-n` mdx_q is the quantized model, smaller but maybe a bit less accurate.\ndemucs -n mdx_q myfile.mp3\n# If you only want to separate vocals out of an audio, use `--two-stems=vocals` (You can also set to drums or bass)\ndemucs --two-stems=vocals myfile.mp3\n```\n\n\nIf you have a GPU, but you run out of memory, please use `--segment SEGMENT` to reduce length of each split. `SEGMENT` should be changed to a integer describing the length of each segment in seconds.\nA segment length of at least 10 is recommended (the bigger the number is, the more memory is required, but quality may increase). Note that the Hybrid Transformer models only support a maximum segment length of 7.8 seconds.\nCreating an environment variable `PYTORCH_NO_CUDA_MEMORY_CACHING=1` is also helpful. If this still does not help, please add `-d cpu` to the command line. See the section hereafter for more details on the memory requirements for GPU acceleration.\n\nSeparated tracks are stored in the `separated\u002FMODEL_NAME\u002FTRACK_NAME` folder. There you will find four stereo wav files sampled at 44.1 kHz: `drums.wav`, `bass.wav`,\n`other.wav`, `vocals.wav` (or `.mp3` if you used the `--mp3` option).\n\nAll audio formats supported by `torchaudio` can be processed (i.e. wav, mp3, flac, ogg\u002Fvorbis on Linux\u002FmacOS, etc.). On Windows, `torchaudio` has limited support, so we rely on `ffmpeg`, which should support pretty much anything.\nAudio is resampled on the fly if necessary.\nThe output will be a wav file encoded as int16.\nYou can save as float32 wav files with `--float32`, or 24 bits integer wav with `--int24`.\nYou can pass `--mp3` to save as mp3 instead, and set the bitrate (in kbps) with `--mp3-bitrate` (default is 320).\n\nIt can happen that the output would need clipping, in particular due to some separation artifacts.\nDemucs will automatically rescale each output stem so as to avoid clipping. This can however break\nthe relative volume between stems. If instead you prefer hard clipping, pass `--clip-mode clamp`.\nYou can also try to reduce the volume of the input mixture before feeding it to Demucs.\n\n\nOther pre-trained models can be selected with the `-n` flag.\nThe list of pre-trained models is:\n- `htdemucs`: first version of Hybrid Transformer Demucs. Trained on MusDB + 800 songs. Default model.\n- `htdemucs_ft`: fine-tuned version of `htdemucs`, separation will take 4 times more time\n    but might be a bit better. Same training set as `htdemucs`.\n- `htdemucs_6s`: 6 sources version of `htdemucs`, with `piano` and `guitar` being added as sources.\n    Note that the `piano` source is not working great at the moment.\n- `hdemucs_mmi`: Hybrid Demucs v3, retrained on MusDB + 800 songs.\n- `mdx`: trained only on MusDB HQ, winning model on track A at the [MDX][mdx] challenge.\n- `mdx_extra`: trained with extra training data (**including MusDB test set**), ranked 2nd on the track B\n    of the [MDX][mdx] challenge.\n- `mdx_q`, `mdx_extra_q`: quantized version of the previous models. Smaller download and storage\n    but quality can be slightly worse.\n- `SIG`: where `SIG` is a single model from the [model zoo](docs\u002Ftraining.md#model-zoo).\n\nThe `--two-stems=vocals` option allows separating vocals from the rest of the accompaniment (i.e., karaoke mode).\n`vocals` can be changed to any source in the selected model.\nThis will mix the files after separating the mix fully, so this won't be faster or use less memory.\n\nThe `--shifts=SHIFTS` performs multiple predictions with random shifts (a.k.a the *shift trick*) of the input and average them. This makes prediction `SHIFTS` times\nslower. Don't use it unless you have a GPU.\n\nThe `--overlap` option controls the amount of overlap between prediction windows. Default is 0.25 (i.e. 25%) which is probably fine.\nIt can probably be reduced to 0.1 to improve a bit speed.\n\n\nThe `-j` flag allow to specify a number of parallel jobs (e.g. `demucs -j 2 myfile.mp3`).\nThis will multiply by the same amount the RAM used so be careful!\n\n### Memory requirements for GPU acceleration\n\nIf you want to use GPU acceleration, you will need at least 3GB of RAM on your GPU for `demucs`. However, about 7GB of RAM will be required if you use the default arguments. Add `--segment SEGMENT` to change size of each split. If you only have 3GB memory, set SEGMENT to 8 (though quality may be worse if this argument is too small). Creating an environment variable `PYTORCH_NO_CUDA_MEMORY_CACHING=1` can help users with even smaller RAM such as 2GB (I separated a track that is 4 minutes but only 1.5GB is used), but this would make the separation slower.\n\nIf you do not have enough memory on your GPU, simply add `-d cpu` to the command line to use the CPU. With Demucs, processing time should be roughly equal to 1.5 times the duration of the track.\n\n## Calling from another Python program\n\nThe main function provides an `opt` parameter as a simple API. You can just pass the parsed command line as this parameter: \n```python\n# Assume that your command is `demucs --mp3 --two-stems vocals -n mdx_extra \"track with space.mp3\"`\n# The following codes are same as the command above:\nimport demucs.separate\ndemucs.separate.main([\"--mp3\", \"--two-stems\", \"vocals\", \"-n\", \"mdx_extra\", \"track with space.mp3\"])\n\n# Or like this\nimport demucs.separate\nimport shlex\ndemucs.separate.main(shlex.split('--mp3 --two-stems vocals -n mdx_extra \"track with space.mp3\"'))\n```\n\nTo use more complicated APIs, see [API docs](docs\u002Fapi.md)\n\n## Training Demucs\n\nIf you want to train (Hybrid) Demucs, please follow the [training doc](docs\u002Ftraining.md).\n\n## MDX Challenge reproduction\n\nIn order to reproduce the results from the Track A and Track B submissions, checkout the [MDX Hybrid Demucs submission repo][mdx_submission].\n\n\n\n## How to cite\n\n```\n@inproceedings{rouard2022hybrid,\n  title={Hybrid Transformers for Music Source Separation},\n  author={Rouard, Simon and Massa, Francisco and D{\\'e}fossez, Alexandre},\n  booktitle={ICASSP 23},\n  year={2023}\n}\n\n@inproceedings{defossez2021hybrid,\n  title={Hybrid Spectrogram and Waveform Source Separation},\n  author={D{\\'e}fossez, Alexandre},\n  booktitle={Proceedings of the ISMIR 2021 Workshop on Music Source Separation},\n  year={2021}\n}\n```\n\n## License\n\nDemucs is released under the MIT license as found in the [LICENSE](LICENSE) file.\n\n[hybrid_paper]: https:\u002F\u002Farxiv.org\u002Fabs\u002F2111.03600\n[waveunet]: https:\u002F\u002Fgithub.com\u002Ff90\u002FWave-U-Net\n[musdb]: https:\u002F\u002Fsigsep.github.io\u002Fdatasets\u002Fmusdb.html\n[openunmix]: https:\u002F\u002Fgithub.com\u002Fsigsep\u002Fopen-unmix-pytorch\n[mmdenselstm]: https:\u002F\u002Farxiv.org\u002Fabs\u002F1805.02410\n[demucs_v2]: https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002Fdemucs\u002Ftree\u002Fv2\n[demucs_v3]: https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002Fdemucs\u002Ftree\u002Fv3\n[spleeter]: https:\u002F\u002Fgithub.com\u002Fdeezer\u002Fspleeter\n[soundcloud]: https:\u002F\u002Fsoundcloud.com\u002Fhonualx\u002Fsets\u002Fsource-separation-in-the-waveform-domain\n[d3net]: https:\u002F\u002Farxiv.org\u002Fabs\u002F2010.01733\n[mdx]: https:\u002F\u002Fwww.aicrowd.com\u002Fchallenges\u002Fmusic-demixing-challenge-ismir-2021\n[kuielab]: https:\u002F\u002Fgithub.com\u002Fkuielab\u002Fmdx-net-submission\n[decouple]: https:\u002F\u002Farxiv.org\u002Fabs\u002F2109.05418\n[mdx_submission]: https:\u002F\u002Fgithub.com\u002Fadefossez\u002Fmdx21_demucs\n[bandsplit]: https:\u002F\u002Farxiv.org\u002Fabs\u002F2209.15174\n[htdemucs]: https:\u002F\u002Farxiv.org\u002Fabs\u002F2211.08553\n","Demucs 是一个先进的音乐源分离模型，能够从伴奏中分离出鼓、贝斯和人声。项目基于U-Net卷积架构，并在最新版本（v4）中引入了混合Transformer技术，结合频谱图与波形处理，通过自注意力和跨域注意力机制提高分离效果。该模型在MUSDB HQ测试集上实现了9.00dB的信号失真比（SDR），并通过稀疏注意力核进一步扩展感受野。Demucs适用于音频处理、音乐制作以及需要高质量音源分离的应用场景。尽管当前项目不再维护，但其提供的模型和技术对于研究者和开发者而言仍具有很高的参考价值。","2026-06-11 03:34:20","high_star"]