will2dye4 / unmixer

Create and explore isolated tracks from music files
https://pypi.org/project/unmixer/
MIT License
18 stars 1 forks source link

Allow specifying the name of a pre-trained model for demucs #17

Closed will2dye4 closed 12 months ago

will2dye4 commented 1 year ago

The demucs readme has a hard-coded list of supported models.

It may also be possible to fetch the list of models programmatically using something like:

>>> from demucs.pretrained import _parse_remote_files, REMOTE_ROOT
>>> from demucs.repo import AnyModelRepo, BagOnlyRepo, RemoteRepo
>>> models = _parse_remote_files(REMOTE_ROOT / 'files.txt')
>>> model_repo = RemoteRepo(models)
>>> bag_repo = BagOnlyRepo(REMOTE_ROOT, model_repo)
>>> bag_repo._bags.keys()
dict_keys(['htdemucs_6s', 'repro_mdx_a', 'mdx_extra_q', 'mdx', 'repro_mdx_a_time_only', 'hdemucs_mmi', 'mdx_extra', 'htdemucs', 'repro_mdx_a_hybrid_only', 'htdemucs_ft', 'mdx_q'])

Of course, using non-public functions and attributes may cause such an approach to break without warning. It doesn't look like demucs provides a public API for getting the model list. Maybe hard-coding is the way to go after all?

This should be configurable via CLI flag (--model <name>) and also via the Import Settings in the Song Importer.

will2dye4 commented 1 year ago

It looks like the latest version does provide a command line flag (--list-models) to do this, but it hasn't been released yet: https://github.com/facebookresearch/demucs/blob/main/demucs/separate.py#L26.

will2dye4 commented 12 months ago

Fixed in v1.2.0.