pymss 2.3.2__tar.gz → 2.3.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pymss-2.3.2 → pymss-2.3.4}/PKG-INFO +17 -4
- {pymss-2.3.2 → pymss-2.3.4}/README.md +16 -3
- {pymss-2.3.2 → pymss-2.3.4}/pymss/cli.py +6 -6
- {pymss-2.3.2 → pymss-2.3.4}/pymss/modules/vocal_remover/uvr_lib_v5/spec_utils.py +4 -3
- {pymss-2.3.2 → pymss-2.3.4}/pymss/modules/vocal_remover/vr_separator.py +3 -3
- {pymss-2.3.2 → pymss-2.3.4}/pymss/operations/command.py +3 -2
- {pymss-2.3.2 → pymss-2.3.4}/pymss/plugins/install.py +15 -7
- {pymss-2.3.2 → pymss-2.3.4}/pymss/separator.py +63 -38
- {pymss-2.3.2 → pymss-2.3.4}/pymss/utils.py +8 -2
- {pymss-2.3.2 → pymss-2.3.4}/pymss.egg-info/PKG-INFO +17 -4
- {pymss-2.3.2 → pymss-2.3.4}/pymss.egg-info/SOURCES.txt +4 -1
- {pymss-2.3.2 → pymss-2.3.4}/pymss_plugin_manager/_engine.py +231 -80
- pymss-2.3.4/pymss_plugin_manager/_platform.py +10 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss_plugin_manager/cli.py +8 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss_plugin_manager/context.py +3 -2
- {pymss-2.3.2 → pymss-2.3.4}/pymss_plugin_manager/service.py +5 -3
- {pymss-2.3.2 → pymss-2.3.4}/pyproject.toml +1 -1
- {pymss-2.3.2 → pymss-2.3.4}/test/test_npu_runtime.py +1 -0
- pymss-2.3.4/test/test_platform_queries.py +30 -0
- {pymss-2.3.2 → pymss-2.3.4}/test/test_plugin_management.py +397 -1
- {pymss-2.3.2 → pymss-2.3.4}/test/test_plugin_sources.py +79 -1
- pymss-2.3.4/test/test_xpu_runtime.py +95 -0
- {pymss-2.3.2 → pymss-2.3.4}/LICENSE +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss/__init__.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss/__main__.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss/_builtin_node_types.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss/_identifiers.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss/audio_io.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss/audio_services.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss/config.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss/ensemble.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss/graph/__init__.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss/graph/builtin_nodes.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss/graph/comfy_loader.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss/graph/core.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss/graph/nodes.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss/graph/runner.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss/graph/yaml_compiler.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss/logger.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss/model_download.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss/model_registry.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss/modules/__init__.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss/modules/_core_shims.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss/modules/vocal_remover/__init__.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss/modules/vocal_remover/common_separator.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss/modules/vocal_remover/uvr_lib_v5/__init__.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss/modules/vocal_remover/vr_mlx.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss/modules/vocal_remover/vr_models.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss/operations/__init__.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss/operations/_command_bootstrap.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss/operations/_command_process.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss/operations/_profile_lock.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss/operations/_python_entry.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss/operations/_rpc_session.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss/operations/builtins.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss/operations/files.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss/operations/graph_bridge.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss/operations/host_services.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss/operations/kit_builtins.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss/operations/python_profiles.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss/operations/rpc_process.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss/plugins/__init__.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss/plugins/builtins.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss/plugins/codecs.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss/plugins/graph_ops.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss/plugins/kit.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss/plugins/lifecycle.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss/plugins/loader.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss/plugins/manifest.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss/plugins/marketplace.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss/plugins/registry.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss/plugins/service.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss/plugins/sources.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss/progress.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss/resources/model_catalog.json +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss/resources/vr_modelparams/1band_sr16000_hl512.json +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss/resources/vr_modelparams/1band_sr32000_hl512.json +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss/resources/vr_modelparams/1band_sr33075_hl384.json +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss/resources/vr_modelparams/1band_sr44100_hl1024.json +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss/resources/vr_modelparams/1band_sr44100_hl256.json +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss/resources/vr_modelparams/1band_sr44100_hl512.json +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss/resources/vr_modelparams/1band_sr44100_hl512_cut.json +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss/resources/vr_modelparams/1band_sr44100_hl512_nf1024.json +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss/resources/vr_modelparams/2band_32000.json +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss/resources/vr_modelparams/2band_44100_lofi.json +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss/resources/vr_modelparams/2band_48000.json +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss/resources/vr_modelparams/3band_44100.json +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss/resources/vr_modelparams/3band_44100_mid.json +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss/resources/vr_modelparams/3band_44100_msb2.json +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss/resources/vr_modelparams/4band_44100.json +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss/resources/vr_modelparams/4band_44100_mid.json +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss/resources/vr_modelparams/4band_44100_msb.json +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss/resources/vr_modelparams/4band_44100_msb2.json +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss/resources/vr_modelparams/4band_44100_reverse.json +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss/resources/vr_modelparams/4band_44100_sw.json +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss/resources/vr_modelparams/4band_v2.json +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss/resources/vr_modelparams/4band_v2_sn.json +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss/resources/vr_modelparams/4band_v3.json +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss/resources/vr_modelparams/4band_v3_sn.json +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss/resources/vr_modelparams/4band_v4_ms_fullband.json +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss/server/__init__.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss/server/app.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss/server/audio.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss/server/config.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss/server/errors.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss/server/models.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss/server/state.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss/server/webui.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss/server/webui_static/assets/index-C2f3RgYK.js +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss/server/webui_static/assets/index-Dd_kG96D.css +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss/server/webui_static/assets/noto-sans-cyrillic-ext-wght-normal-DSNfmdVt.woff2 +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss/server/webui_static/assets/noto-sans-cyrillic-wght-normal-B2hlT84T.woff2 +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss/server/webui_static/assets/noto-sans-devanagari-wght-normal-Cv-Vwajv.woff2 +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss/server/webui_static/assets/noto-sans-greek-ext-wght-normal-12T8GTDR.woff2 +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss/server/webui_static/assets/noto-sans-greek-wght-normal-Ymb6dZNd.woff2 +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss/server/webui_static/assets/noto-sans-latin-ext-wght-normal-W1qJv59z.woff2 +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss/server/webui_static/assets/noto-sans-latin-wght-normal-BYSzYMf3.woff2 +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss/server/webui_static/assets/noto-sans-vietnamese-wght-normal-DLTJy58D.woff2 +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss/server/webui_static/index.html +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss/user_models.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss/workflow.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss.egg-info/dependency_links.txt +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss.egg-info/entry_points.txt +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss.egg-info/requires.txt +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss.egg-info/top_level.txt +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss_plugin_manager/LICENSE +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss_plugin_manager/NOTICE +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss_plugin_manager/__init__.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss_plugin_manager/environment.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss_plugin_manager/inventory.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss_plugin_manager/leases.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss_plugin_manager/locks.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/pymss_plugin_manager/profiles.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/setup.cfg +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/test/test_all.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/test/test_audio_downmix.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/test/test_audio_formats.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/test/test_audio_layout_metadata.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/test/test_audio_materialization.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/test/test_audio_resample.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/test/test_audio_services.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/test/test_builtin_capabilities.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/test/test_builtin_operations.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/test/test_codec_capabilities.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/test/test_command_bootstrap.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/test/test_command_operations.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/test/test_command_process.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/test/test_core_shims.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/test/test_graph.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/test/test_graph_audio_merge.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/test/test_graph_custom_models.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/test/test_graph_execution_events.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/test/test_graph_lifecycle.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/test/test_graph_resample_service.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/test/test_graph_runner_lifecycle.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/test/test_kit_builtins.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/test/test_legacy_loudnorm_node.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/test/test_mlx_warmup.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/test/test_model_catalog_overrides.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/test/test_model_detection.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/test/test_model_download_progress.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/test/test_operation_graph_bridge.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/test/test_operation_invocation.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/test/test_operations.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/test/test_overlap_finalize.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/test/test_plugin_environment.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/test/test_plugin_kit.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/test/test_plugin_macos_attributes.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/test/test_plugin_marketplace.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/test/test_plugin_node_contract.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/test/test_plugin_protocol.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/test/test_plugin_protocol_posix.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/test/test_plugins.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/test/test_polarformer.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/test/test_progress.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/test/test_python_profiles.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/test/test_rpc_declarations.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/test/test_rpc_process.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/test/test_separator_channels.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/test/test_separator_device_defaults.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/test/test_use_amp.py +0 -0
- {pymss-2.3.2 → pymss-2.3.4}/test/test_workflow.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pymss
|
|
3
|
-
Version: 2.3.
|
|
3
|
+
Version: 2.3.4
|
|
4
4
|
Summary: Python package for music source separation.
|
|
5
5
|
Author-email: KitsuneX07 <ghast1085654218@163.com>
|
|
6
6
|
Maintainer-email: baicai1145 <3423714059@qq.com>
|
|
@@ -53,6 +53,19 @@ If you want the CUDA build of PyTorch, install it first:
|
|
|
53
53
|
pip install torch torchvision --index-url https://download.pytorch.org/whl/cu128
|
|
54
54
|
```
|
|
55
55
|
|
|
56
|
+
### Intel XPU (Arc)
|
|
57
|
+
|
|
58
|
+
Linux requires working Level Zero and OpenCL drivers. Install the official PyTorch XPU wheel before pymss:
|
|
59
|
+
|
|
60
|
+
```sh
|
|
61
|
+
pip install torch --index-url https://download.pytorch.org/whl/xpu
|
|
62
|
+
pip install pymss
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Use `--device xpu` to force Intel GPU execution and `--device-id` to select a device. When multiple IDs are supplied, only the first is used; multi-XPU parallel execution is not supported. `--device auto` prefers CUDA, then XPU, NPU, and Apple Silicon. XPU hardware inference is experimental and explicitly uses FP32, even when `use_amp=True`. bf16 AMP requires separate model accuracy and performance validation.
|
|
66
|
+
|
|
67
|
+
A manual benchmark script is available at `test/manual/xpu_benchmark.py` to compare FP32 CPU and XPU inference performance on local hardware.
|
|
68
|
+
|
|
56
69
|
### AMD ROCm
|
|
57
70
|
|
|
58
71
|
|
|
@@ -80,7 +93,7 @@ Choose a combination with PyTorch 2.7.1 or later, then install pymss:
|
|
|
80
93
|
pip install pymss
|
|
81
94
|
```
|
|
82
95
|
|
|
83
|
-
Use `--device npu` (or `device="auto"`, which prefers CUDA, then NPU,
|
|
96
|
+
Use `--device npu` (or `device="auto"`, which prefers CUDA, then XPU, NPU, and Apple Silicon).
|
|
84
97
|
`--device-id` selects the NPU index; if multiple IDs are supplied, only the first is used.
|
|
85
98
|
Multi-NPU parallel execution is not supported. On NPU, STFT/ISTFT uses `torch.fft` primitives.
|
|
86
99
|
RNN/LSTM/GRU layers use a CPU inference fallback for affected `torch_npu` builds, with results
|
|
@@ -153,7 +166,7 @@ pymss infer bs_roformer_voc_hyperacev2 \
|
|
|
153
166
|
--format wav # wav | flac | mp3 | m4a | aac | opus | vorbis | ogg
|
|
154
167
|
```
|
|
155
168
|
|
|
156
|
-
`--device auto`
|
|
169
|
+
`--device auto` prefers CUDA, then Intel XPU, Ascend NPU (`torch_npu`), and Apple Silicon MLX. Use `--device xpu` to force Intel GPU, `--device npu` to force Ascend NPU, `--device mlx` to force MLX, or `--device mps` to force PyTorch MPS.
|
|
157
170
|
`--save-as-folder` writes each input audio file's stems under a subfolder named after that audio file, for example `results/song/song_vocals.wav`.
|
|
158
171
|
|
|
159
172
|
The default download source is ModelScope. You can choose another source or model directory:
|
|
@@ -460,7 +473,7 @@ For a detailed explanation of every `MSSeparator` argument, see the [MSSeparator
|
|
|
460
473
|
'vr']
|
|
461
474
|
- model_path: The path to the model file.
|
|
462
475
|
- config_path: The path to the configuration file.
|
|
463
|
-
- device: The type of device, default is 'auto'. Must be one of ['auto', 'cuda', 'npu', 'mps', 'cpu']
|
|
476
|
+
- device: The type of device, default is 'auto'. Must be one of ['auto', 'cuda', 'rocm', 'npu', 'xpu', 'mps', 'mlx', 'cpu']
|
|
464
477
|
- device_ids: List of device IDs, default is [0].
|
|
465
478
|
- output_format: The output audio format, default is 'wav'. One of wav, flac, mp3, m4a, aac, opus, vorbis, ogg.
|
|
466
479
|
- use_tta: Whether to use TTA, default is False. Using TTA will triple the processing time with a little bit improvement in quality.
|
|
@@ -13,6 +13,19 @@ If you want the CUDA build of PyTorch, install it first:
|
|
|
13
13
|
pip install torch torchvision --index-url https://download.pytorch.org/whl/cu128
|
|
14
14
|
```
|
|
15
15
|
|
|
16
|
+
### Intel XPU (Arc)
|
|
17
|
+
|
|
18
|
+
Linux requires working Level Zero and OpenCL drivers. Install the official PyTorch XPU wheel before pymss:
|
|
19
|
+
|
|
20
|
+
```sh
|
|
21
|
+
pip install torch --index-url https://download.pytorch.org/whl/xpu
|
|
22
|
+
pip install pymss
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Use `--device xpu` to force Intel GPU execution and `--device-id` to select a device. When multiple IDs are supplied, only the first is used; multi-XPU parallel execution is not supported. `--device auto` prefers CUDA, then XPU, NPU, and Apple Silicon. XPU hardware inference is experimental and explicitly uses FP32, even when `use_amp=True`. bf16 AMP requires separate model accuracy and performance validation.
|
|
26
|
+
|
|
27
|
+
A manual benchmark script is available at `test/manual/xpu_benchmark.py` to compare FP32 CPU and XPU inference performance on local hardware.
|
|
28
|
+
|
|
16
29
|
### AMD ROCm
|
|
17
30
|
|
|
18
31
|
|
|
@@ -40,7 +53,7 @@ Choose a combination with PyTorch 2.7.1 or later, then install pymss:
|
|
|
40
53
|
pip install pymss
|
|
41
54
|
```
|
|
42
55
|
|
|
43
|
-
Use `--device npu` (or `device="auto"`, which prefers CUDA, then NPU,
|
|
56
|
+
Use `--device npu` (or `device="auto"`, which prefers CUDA, then XPU, NPU, and Apple Silicon).
|
|
44
57
|
`--device-id` selects the NPU index; if multiple IDs are supplied, only the first is used.
|
|
45
58
|
Multi-NPU parallel execution is not supported. On NPU, STFT/ISTFT uses `torch.fft` primitives.
|
|
46
59
|
RNN/LSTM/GRU layers use a CPU inference fallback for affected `torch_npu` builds, with results
|
|
@@ -113,7 +126,7 @@ pymss infer bs_roformer_voc_hyperacev2 \
|
|
|
113
126
|
--format wav # wav | flac | mp3 | m4a | aac | opus | vorbis | ogg
|
|
114
127
|
```
|
|
115
128
|
|
|
116
|
-
`--device auto`
|
|
129
|
+
`--device auto` prefers CUDA, then Intel XPU, Ascend NPU (`torch_npu`), and Apple Silicon MLX. Use `--device xpu` to force Intel GPU, `--device npu` to force Ascend NPU, `--device mlx` to force MLX, or `--device mps` to force PyTorch MPS.
|
|
117
130
|
`--save-as-folder` writes each input audio file's stems under a subfolder named after that audio file, for example `results/song/song_vocals.wav`.
|
|
118
131
|
|
|
119
132
|
The default download source is ModelScope. You can choose another source or model directory:
|
|
@@ -420,7 +433,7 @@ For a detailed explanation of every `MSSeparator` argument, see the [MSSeparator
|
|
|
420
433
|
'vr']
|
|
421
434
|
- model_path: The path to the model file.
|
|
422
435
|
- config_path: The path to the configuration file.
|
|
423
|
-
- device: The type of device, default is 'auto'. Must be one of ['auto', 'cuda', 'npu', 'mps', 'cpu']
|
|
436
|
+
- device: The type of device, default is 'auto'. Must be one of ['auto', 'cuda', 'rocm', 'npu', 'xpu', 'mps', 'mlx', 'cpu']
|
|
424
437
|
- device_ids: List of device IDs, default is [0].
|
|
425
438
|
- output_format: The output audio format, default is 'wav'. One of wav, flac, mp3, m4a, aac, opus, vorbis, ogg.
|
|
426
439
|
- use_tta: Whether to use TTA, default is False. Using TTA will triple the processing time with a little bit improvement in quality.
|
|
@@ -855,9 +855,9 @@ def build_parser():
|
|
|
855
855
|
action="store_true",
|
|
856
856
|
help="Save each input audio file's separated stems in a subfolder named after the audio file.",
|
|
857
857
|
)
|
|
858
|
-
infer_parser.add_argument("--device", default="auto", choices=["auto", "cpu", "cuda", "rocm", "mps", "npu", "mlx"])
|
|
858
|
+
infer_parser.add_argument("--device", default="auto", choices=["auto", "cpu", "cuda", "rocm", "mps", "npu", "xpu", "mlx"])
|
|
859
859
|
infer_parser.add_argument(
|
|
860
|
-
"--device-id", action="append", type=int, dest="device_ids", help="
|
|
860
|
+
"--device-id", action="append", type=int, dest="device_ids", help="Accelerator device id. Can be repeated; XPU/NPU use the first."
|
|
861
861
|
)
|
|
862
862
|
infer_parser.add_argument("--format", default="wav", choices=["wav", "flac", "mp3", "m4a"], dest="output_format")
|
|
863
863
|
infer_parser.add_argument("--wav-bit-depth", default="FLOAT", choices=["FLOAT", "PCM_16", "PCM_24"])
|
|
@@ -975,7 +975,7 @@ def build_parser():
|
|
|
975
975
|
)
|
|
976
976
|
workflow_run_parser.add_argument("--source", default="modelscope", choices=["modelscope", "huggingface", "hf-mirror"])
|
|
977
977
|
workflow_run_parser.add_argument("--endpoint", help="Custom resolve endpoint. It must serve files by relative path.")
|
|
978
|
-
workflow_run_parser.add_argument("--device", choices=["auto", "cpu", "cuda", "rocm", "mps", "npu", "mlx"])
|
|
978
|
+
workflow_run_parser.add_argument("--device", choices=["auto", "cpu", "cuda", "rocm", "mps", "npu", "xpu", "mlx"])
|
|
979
979
|
workflow_run_parser.add_argument("--format", choices=["wav", "flac", "mp3", "m4a"], dest="output_format")
|
|
980
980
|
workflow_run_parser.add_argument("--wav-bit-depth", default="FLOAT", choices=["FLOAT", "PCM_16", "PCM_24"])
|
|
981
981
|
workflow_run_parser.add_argument("--flac-bit-depth", default="PCM_16", choices=["PCM_16", "PCM_24"])
|
|
@@ -1018,7 +1018,7 @@ def build_parser():
|
|
|
1018
1018
|
comfy_run_parser.add_argument("--download", action="store_true", help="Download missing model files before running.")
|
|
1019
1019
|
comfy_run_parser.add_argument("--source", default="modelscope", choices=["modelscope", "huggingface", "hf-mirror"])
|
|
1020
1020
|
comfy_run_parser.add_argument("--endpoint", help="Custom resolve endpoint. It must serve files by relative path.")
|
|
1021
|
-
comfy_run_parser.add_argument("--device", choices=["auto", "cpu", "cuda", "rocm", "mps", "npu", "mlx"])
|
|
1021
|
+
comfy_run_parser.add_argument("--device", choices=["auto", "cpu", "cuda", "rocm", "mps", "npu", "xpu", "mlx"])
|
|
1022
1022
|
comfy_run_parser.add_argument("--format", choices=["wav", "flac", "mp3", "m4a", "aac", "opus", "vorbis", "ogg"], dest="output_format")
|
|
1023
1023
|
comfy_run_parser.add_argument("--strict", dest="strict", action="store_true", default=True, help="Fail on unknown node types (default).")
|
|
1024
1024
|
comfy_run_parser.add_argument("--no-strict", dest="strict", action="store_false", help="Skip unknown node types with a warning.")
|
|
@@ -1046,13 +1046,13 @@ def build_parser():
|
|
|
1046
1046
|
)
|
|
1047
1047
|
serve_parser.add_argument("--source", default="modelscope", choices=["modelscope", "huggingface", "hf-mirror"])
|
|
1048
1048
|
serve_parser.add_argument("--endpoint", help="Custom resolve endpoint. It must serve files by relative path.")
|
|
1049
|
-
serve_parser.add_argument("--device", default="auto", choices=["auto", "cpu", "cuda", "rocm", "mps", "npu", "mlx"])
|
|
1049
|
+
serve_parser.add_argument("--device", default="auto", choices=["auto", "cpu", "cuda", "rocm", "mps", "npu", "xpu", "mlx"])
|
|
1050
1050
|
serve_parser.add_argument(
|
|
1051
1051
|
"--device-id",
|
|
1052
1052
|
action="append",
|
|
1053
1053
|
type=int,
|
|
1054
1054
|
dest="device_ids",
|
|
1055
|
-
help="
|
|
1055
|
+
help="Accelerator device id. Can be repeated; XPU/NPU use the first.",
|
|
1056
1056
|
)
|
|
1057
1057
|
serve_parser.add_argument("--host", default="127.0.0.1")
|
|
1058
1058
|
serve_parser.add_argument("--port", default=8000, type=int)
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import math
|
|
2
2
|
import platform
|
|
3
|
+
import sys
|
|
3
4
|
import traceback
|
|
4
5
|
|
|
5
6
|
import librosa
|
|
@@ -9,7 +10,7 @@ import torch
|
|
|
9
10
|
|
|
10
11
|
ARM = "arm"
|
|
11
12
|
wav_resolution = (
|
|
12
|
-
"polyphase" if platform
|
|
13
|
+
"polyphase" if sys.platform == "darwin" and (platform.processor() == ARM or ARM in platform.platform()) else "soxr_hq"
|
|
13
14
|
)
|
|
14
15
|
|
|
15
16
|
|
|
@@ -201,7 +202,7 @@ def wave_to_spectrogram(wave, hop_length, n_fft, mp, band, is_v51_model=False, t
|
|
|
201
202
|
|
|
202
203
|
def _torch_stft(wave, n_fft, hop_length, device):
|
|
203
204
|
device_type = None if device is None else torch.device(device).type
|
|
204
|
-
if device_type not in ("cuda", "npu"):
|
|
205
|
+
if device_type not in ("cuda", "npu", "xpu"):
|
|
205
206
|
return None
|
|
206
207
|
wave_t = torch.from_numpy(np.ascontiguousarray(wave)).to(device)
|
|
207
208
|
if device_type == "npu":
|
|
@@ -234,7 +235,7 @@ def _torch_stft(wave, n_fft, hop_length, device):
|
|
|
234
235
|
|
|
235
236
|
def _torch_istft(spec, hop_length, device):
|
|
236
237
|
device_type = None if device is None else torch.device(device).type
|
|
237
|
-
if device_type not in ("cuda", "npu"):
|
|
238
|
+
if device_type not in ("cuda", "npu", "xpu"):
|
|
238
239
|
return None
|
|
239
240
|
n_fft = (spec.shape[1] - 1) * 2
|
|
240
241
|
spec_t = torch.from_numpy(np.ascontiguousarray(spec)).to(device)
|
|
@@ -12,6 +12,8 @@ from tqdm import tqdm
|
|
|
12
12
|
from pymss_core.modules.vocal_remover import ModelParameters, determine_model_capacity
|
|
13
13
|
from pymss_core.modules.vocal_remover.uvr_lib_v5.vr_network import nets_new
|
|
14
14
|
|
|
15
|
+
from pymss.utils import _autocast
|
|
16
|
+
|
|
15
17
|
from .common_separator import CommonSeparator
|
|
16
18
|
from .uvr_lib_v5 import spec_utils
|
|
17
19
|
|
|
@@ -332,9 +334,7 @@ class VRSeparator(CommonSeparator):
|
|
|
332
334
|
if self.use_channels_last
|
|
333
335
|
else x_batch_cpu.to(device=device, non_blocking=True)
|
|
334
336
|
)
|
|
335
|
-
|
|
336
|
-
use_amp = self.use_amp and device_type in ("cuda", "mps", "npu")
|
|
337
|
-
with torch.amp.autocast(device_type, dtype=torch.float16, enabled=use_amp):
|
|
337
|
+
with _autocast(device, self.use_amp):
|
|
338
338
|
pred = self.model_run.predict_mask(x_batch)
|
|
339
339
|
if not pred.size()[3] > 0:
|
|
340
340
|
raise ValueError("Window size error: h1_shape[3] must be greater than h2_shape[3]")
|
|
@@ -11,7 +11,6 @@ from contextlib import contextmanager
|
|
|
11
11
|
import math
|
|
12
12
|
import os
|
|
13
13
|
from pathlib import Path, PurePosixPath
|
|
14
|
-
import platform
|
|
15
14
|
import re
|
|
16
15
|
import shutil
|
|
17
16
|
import stat
|
|
@@ -19,6 +18,8 @@ import tempfile
|
|
|
19
18
|
import tomllib
|
|
20
19
|
from typing import Any, Mapping
|
|
21
20
|
|
|
21
|
+
from pymss_plugin_manager._platform import machine as platform_machine
|
|
22
|
+
|
|
22
23
|
from . import OperationContext, OperationError, OperationSpec
|
|
23
24
|
from ._command_process import run_command_process
|
|
24
25
|
from .files import FileArtifact, input_file
|
|
@@ -57,7 +58,7 @@ def _executable(root: Path, value: str) -> Path:
|
|
|
57
58
|
def current_target() -> str:
|
|
58
59
|
import sys
|
|
59
60
|
|
|
60
|
-
machine =
|
|
61
|
+
machine = platform_machine().lower()
|
|
61
62
|
architecture = {"amd64": "x86_64", "aarch64": "arm64"}.get(machine, machine)
|
|
62
63
|
return f"{sys.platform}-{architecture}"
|
|
63
64
|
|
|
@@ -142,20 +142,28 @@ def _clone(url: str, dest: Path, subpath: str | None = None, ref: str | None = N
|
|
|
142
142
|
|
|
143
143
|
with tempfile.TemporaryDirectory(prefix="pymss-git-", dir=temporary_root) as temporary:
|
|
144
144
|
repo = Path(temporary) / "repo"
|
|
145
|
+
git_repo = str(repo)
|
|
146
|
+
if sys.platform == "win32":
|
|
147
|
+
# Git directory arguments do not accept Win32 extended path prefixes.
|
|
148
|
+
if git_repo.startswith("\\\\?\\UNC\\"):
|
|
149
|
+
git_repo = "\\\\" + git_repo[8:]
|
|
150
|
+
elif git_repo.startswith("\\\\?\\") and git_repo[5:7] == ":\\":
|
|
151
|
+
git_repo = git_repo[4:]
|
|
152
|
+
git_command = ["git", "-c", "core.longpaths=true"] if sys.platform == "win32" else ["git"]
|
|
145
153
|
try:
|
|
146
154
|
def git(*args: str) -> str:
|
|
147
155
|
return subprocess.run( # noqa: S603, S607
|
|
148
|
-
[
|
|
156
|
+
[*git_command, *args], check=True, capture_output=True, text=True, timeout=180,
|
|
149
157
|
).stdout.strip()
|
|
150
158
|
|
|
151
159
|
if ref:
|
|
152
|
-
git("init",
|
|
153
|
-
git("-C",
|
|
154
|
-
git("-C",
|
|
155
|
-
git("-C",
|
|
160
|
+
git("init", git_repo)
|
|
161
|
+
git("-C", git_repo, "remote", "add", "origin", url)
|
|
162
|
+
git("-C", git_repo, "fetch", "--depth", "1", "origin", ref)
|
|
163
|
+
git("-C", git_repo, "checkout", "--detach", "FETCH_HEAD")
|
|
156
164
|
else:
|
|
157
|
-
git("clone", "--depth", "1", url,
|
|
158
|
-
commit = git("-C",
|
|
165
|
+
git("clone", "--depth", "1", url, git_repo)
|
|
166
|
+
commit = git("-C", git_repo, "rev-parse", "HEAD")
|
|
159
167
|
except (subprocess.SubprocessError, OSError) as exc:
|
|
160
168
|
detail = exc.stderr.strip() if isinstance(exc, subprocess.CalledProcessError) else str(exc)
|
|
161
169
|
raise InstallError(f"git source acquisition failed: {detail}") from exc
|
|
@@ -9,6 +9,7 @@ import torch
|
|
|
9
9
|
import numpy as np
|
|
10
10
|
from yaml import YAMLError
|
|
11
11
|
import platform
|
|
12
|
+
import sys
|
|
12
13
|
import subprocess
|
|
13
14
|
from time import time
|
|
14
15
|
from tqdm import tqdm
|
|
@@ -88,6 +89,25 @@ def _npu_runtime_available():
|
|
|
88
89
|
return False
|
|
89
90
|
|
|
90
91
|
|
|
92
|
+
def _xpu_runtime_available():
|
|
93
|
+
"""Return True when PyTorch reports an available Intel XPU runtime."""
|
|
94
|
+
try:
|
|
95
|
+
return torch.xpu.is_available()
|
|
96
|
+
except Exception:
|
|
97
|
+
return False
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
def _validate_device_ids(device_ids, device_count, backend):
|
|
101
|
+
"""Raise ValueError unless all requested accelerator IDs exist and are integers."""
|
|
102
|
+
if not isinstance(device_ids, (list, tuple)) or not device_ids or any(
|
|
103
|
+
isinstance(index, bool) or not isinstance(index, int) or index < 0 for index in device_ids
|
|
104
|
+
):
|
|
105
|
+
raise ValueError(f"{backend} device_ids must be a non-empty list of non-negative integers")
|
|
106
|
+
invalid_ids = [index for index in device_ids if index >= device_count]
|
|
107
|
+
if invalid_ids:
|
|
108
|
+
raise ValueError(f"{backend} device ID(s) {invalid_ids} are outside the available range [0, {device_count})")
|
|
109
|
+
|
|
110
|
+
|
|
91
111
|
def _resolve_public_device(device, inference_params, logger):
|
|
92
112
|
"""Resolve public device.
|
|
93
113
|
|
|
@@ -117,8 +137,13 @@ def _resolve_public_device(device, inference_params, logger):
|
|
|
117
137
|
raise RuntimeError("device='npu' requires the torch_npu package with an available Ascend device")
|
|
118
138
|
logger.debug("Using Ascend NPU through torch_npu")
|
|
119
139
|
return "npu", inference_params
|
|
140
|
+
if requested_device == "xpu":
|
|
141
|
+
if not _xpu_runtime_available():
|
|
142
|
+
raise RuntimeError("device='xpu' requires an XPU-enabled PyTorch build with a visible Intel GPU")
|
|
143
|
+
logger.debug("Using Intel GPU through PyTorch XPU")
|
|
144
|
+
return "xpu", inference_params
|
|
120
145
|
if requested_device not in {"auto", "cpu", "cuda", "mps"}:
|
|
121
|
-
raise ValueError("device must be 'auto', 'cpu', 'cuda', 'mps', 'rocm', 'npu', or 'mlx'")
|
|
146
|
+
raise ValueError("device must be 'auto', 'cpu', 'cuda', 'mps', 'rocm', 'npu', 'xpu', or 'mlx'")
|
|
122
147
|
return requested_device, inference_params
|
|
123
148
|
|
|
124
149
|
|
|
@@ -134,42 +159,33 @@ def _select_device(device, device_ids, logger):
|
|
|
134
159
|
Any: Computed result."""
|
|
135
160
|
if device == "npu":
|
|
136
161
|
device_count = torch.npu.device_count()
|
|
137
|
-
|
|
138
|
-
isinstance(index, bool) or not isinstance(index, int) or index < 0 for index in device_ids
|
|
139
|
-
):
|
|
140
|
-
raise ValueError("NPU device_ids must be a non-empty list of non-negative integers")
|
|
141
|
-
invalid_ids = [index for index in device_ids if index >= device_count]
|
|
142
|
-
if invalid_ids:
|
|
143
|
-
raise ValueError(f"NPU device ID(s) {invalid_ids} are outside the available range [0, {device_count})")
|
|
162
|
+
_validate_device_ids(device_ids, device_count, "NPU")
|
|
144
163
|
logger.debug("Ascend NPU is available through torch_npu, setting Torch device to NPU")
|
|
145
164
|
return f"npu:{device_ids[0]}"
|
|
165
|
+
if device == "xpu":
|
|
166
|
+
_validate_device_ids(device_ids, torch.xpu.device_count(), "XPU")
|
|
167
|
+
logger.debug("Intel GPU is available through PyTorch XPU")
|
|
168
|
+
return f"xpu:{device_ids[0]}"
|
|
146
169
|
if device not in ["cpu", "mps"]:
|
|
147
170
|
cuda_available = torch.cuda.is_available()
|
|
148
171
|
if device == "cuda" and not cuda_available:
|
|
149
172
|
raise RuntimeError("device='cuda' requires a CUDA or ROCm-enabled PyTorch build with an available GPU")
|
|
150
173
|
if cuda_available:
|
|
151
|
-
if not isinstance(device_ids, (list, tuple)) or not device_ids or any(
|
|
152
|
-
isinstance(index, bool) or not isinstance(index, int) or index < 0 for index in device_ids
|
|
153
|
-
):
|
|
154
|
-
raise ValueError("CUDA device_ids must be a non-empty list of non-negative integers")
|
|
155
174
|
device_count = torch.cuda.device_count()
|
|
156
|
-
|
|
157
|
-
if invalid_ids:
|
|
158
|
-
raise ValueError(f"CUDA device ID(s) {invalid_ids} are outside the available range [0, {device_count})")
|
|
175
|
+
_validate_device_ids(device_ids, device_count, "CUDA")
|
|
159
176
|
if getattr(torch.version, "hip", None):
|
|
160
177
|
logger.debug("ROCm/HIP device is available in Torch, setting Torch device to CUDA device (backed by ROCm)")
|
|
161
178
|
else:
|
|
162
179
|
logger.debug("CUDA is available in Torch, setting Torch device to CUDA")
|
|
163
180
|
return f"cuda:{device_ids[0]}"
|
|
181
|
+
if _xpu_runtime_available():
|
|
182
|
+
xpu_count = torch.xpu.device_count()
|
|
183
|
+
_validate_device_ids(device_ids, xpu_count, "XPU")
|
|
184
|
+
logger.debug("auto device selected Intel GPU through PyTorch XPU")
|
|
185
|
+
return f"xpu:{device_ids[0]}"
|
|
164
186
|
if _npu_runtime_available():
|
|
165
187
|
npu_count = torch.npu.device_count()
|
|
166
|
-
|
|
167
|
-
isinstance(index, bool) or not isinstance(index, int) or index < 0 for index in device_ids
|
|
168
|
-
):
|
|
169
|
-
raise ValueError("NPU device_ids must be a non-empty list of non-negative integers")
|
|
170
|
-
invalid_ids = [index for index in device_ids if index >= npu_count]
|
|
171
|
-
if invalid_ids:
|
|
172
|
-
raise ValueError(f"NPU device ID(s) {invalid_ids} are outside the available range [0, {npu_count})")
|
|
188
|
+
_validate_device_ids(device_ids, npu_count, "NPU")
|
|
173
189
|
logger.debug("auto device selected Ascend NPU through torch_npu")
|
|
174
190
|
return f"npu:{device_ids[0]}"
|
|
175
191
|
if torch.backends.mps.is_available():
|
|
@@ -739,15 +755,16 @@ class MSSeparator:
|
|
|
739
755
|
VR models use built-in metadata instead of an MSS YAML config.
|
|
740
756
|
Defaults to None.
|
|
741
757
|
device (str, optional): Runtime device. Valid values are ``auto``,
|
|
742
|
-
``cpu``, ``cuda``, ``rocm``, ``mps``, and ``mlx``.
|
|
743
|
-
|
|
744
|
-
AMD ROCm GPUs and maps to the ``cuda`` device
|
|
745
|
-
exposes HIP devices as ``cuda``). ``mlx`` is a
|
|
746
|
-
Apple Silicon MLX execution through the MPS
|
|
747
|
-
to ``"auto"``.
|
|
748
|
-
device_ids (list[int], optional):
|
|
749
|
-
enable ``torch.nn.DataParallel`` for supported Torch models
|
|
750
|
-
|
|
758
|
+
``cpu``, ``cuda``, ``rocm``, ``npu``, ``xpu``, ``mps``, and ``mlx``.
|
|
759
|
+
``auto`` chooses CUDA, XPU, NPU, Apple MPS, then CPU. ``rocm`` is a
|
|
760
|
+
public shortcut for AMD ROCm GPUs and maps to the ``cuda`` device
|
|
761
|
+
path (ROCm PyTorch exposes HIP devices as ``cuda``). ``mlx`` is a
|
|
762
|
+
public shortcut for Apple Silicon MLX execution through the MPS
|
|
763
|
+
device path. Defaults to ``"auto"``.
|
|
764
|
+
device_ids (list[int], optional): Accelerator device IDs. Multiple IDs
|
|
765
|
+
can enable ``torch.nn.DataParallel`` for supported Torch models on
|
|
766
|
+
CUDA. XPU and NPU use only the first ID. This does not select
|
|
767
|
+
multiple MPS or MLX devices. Defaults to ``[0]``.
|
|
751
768
|
output_format (str, optional): Format used by ``process_folder()`` and
|
|
752
769
|
``save_audio()``. Supported values are ``wav``, ``flac``, ``mp3``,
|
|
753
770
|
and ``m4a``. Defaults to ``"wav"``.
|
|
@@ -853,10 +870,11 @@ class MSSeparator:
|
|
|
853
870
|
config_path (str | os.PathLike | None, optional): YAML config path.
|
|
854
871
|
If omitted, pymss tries ``model_path + ".yaml"``. Defaults to
|
|
855
872
|
None.
|
|
856
|
-
device (str, optional): ``auto``, ``cpu``, ``cuda``, ``rocm``,
|
|
857
|
-
``mlx``. Defaults to ``"auto"``.
|
|
858
|
-
device_ids (list[int], optional):
|
|
859
|
-
|
|
873
|
+
device (str, optional): ``auto``, ``cpu``, ``cuda``, ``rocm``,
|
|
874
|
+
``npu``, ``xpu``, ``mps``, or ``mlx``. Defaults to ``"auto"``.
|
|
875
|
+
device_ids (list[int], optional): Accelerator device IDs. CUDA can
|
|
876
|
+
use multiple IDs with DataParallel; XPU and NPU use the first.
|
|
877
|
+
Defaults to ``[0]``.
|
|
860
878
|
output_format (str, optional): Saved audio format: ``wav``,
|
|
861
879
|
``flac``, ``mp3``, or ``m4a``. Defaults to ``"wav"``.
|
|
862
880
|
use_tta (bool, optional): Enables test-time augmentation. Defaults
|
|
@@ -1080,8 +1098,12 @@ class MSSeparator:
|
|
|
1080
1098
|
|
|
1081
1099
|
Returns:
|
|
1082
1100
|
None: Operating system, Python, and PyTorch versions are logged."""
|
|
1083
|
-
|
|
1084
|
-
|
|
1101
|
+
if sys.platform == "win32":
|
|
1102
|
+
os_name = "Windows"
|
|
1103
|
+
os_version = ".".join(map(str, sys.getwindowsversion()[:3]))
|
|
1104
|
+
else:
|
|
1105
|
+
os_name = platform.system()
|
|
1106
|
+
os_version = platform.version()
|
|
1085
1107
|
self.logger.debug(f"Operating System: {os_name} {os_version}")
|
|
1086
1108
|
|
|
1087
1109
|
python_version = platform.python_version()
|
|
@@ -1853,7 +1875,7 @@ class MSSeparator:
|
|
|
1853
1875
|
None: This callable does not accept user-provided arguments.
|
|
1854
1876
|
|
|
1855
1877
|
Returns:
|
|
1856
|
-
None: Python garbage collection runs, and
|
|
1878
|
+
None: Python garbage collection runs, and accelerator caches are
|
|
1857
1879
|
emptied for the active device."""
|
|
1858
1880
|
self.logger.debug("Running garbage collection...")
|
|
1859
1881
|
gc.collect()
|
|
@@ -1867,3 +1889,6 @@ class MSSeparator:
|
|
|
1867
1889
|
if "npu" in self.device:
|
|
1868
1890
|
self.logger.debug("Clearing NPU cache...")
|
|
1869
1891
|
torch.npu.empty_cache()
|
|
1892
|
+
if "xpu" in self.device:
|
|
1893
|
+
self.logger.debug("Clearing XPU cache...")
|
|
1894
|
+
torch.xpu.empty_cache()
|
|
@@ -11,6 +11,10 @@ from pymss_core import get_model_from_config as _core_get_model_from_config
|
|
|
11
11
|
from .config import load_config
|
|
12
12
|
from .progress import _ProgressContext
|
|
13
13
|
|
|
14
|
+
# XPU deliberately stays in FP32 until bf16 AMP has model accuracy benchmarks.
|
|
15
|
+
# Share this policy with the VR inference path; XPU must not inherit fp16 AMP.
|
|
16
|
+
FP32_INFERENCE_DEVICE_TYPES = frozenset({"xpu"})
|
|
17
|
+
|
|
14
18
|
|
|
15
19
|
def apply_msst_inference_compat(config, logger=None, *, user_set_chunk_size=False):
|
|
16
20
|
"""Normalize MSST-style ``num_overlap`` / ``inference.chunk_size`` for pymss.
|
|
@@ -305,6 +309,8 @@ def _autocast(device, enabled):
|
|
|
305
309
|
Returns:
|
|
306
310
|
Any: Computed result."""
|
|
307
311
|
device_type = torch.device(device).type
|
|
312
|
+
if device_type in FP32_INFERENCE_DEVICE_TYPES:
|
|
313
|
+
return nullcontext()
|
|
308
314
|
if enabled and device_type in ("cuda", "mps", "npu"):
|
|
309
315
|
return torch.amp.autocast(device_type, dtype=torch.float16)
|
|
310
316
|
return nullcontext()
|
|
@@ -648,7 +654,7 @@ def _finalize_overlap(result, counter, length_init, border):
|
|
|
648
654
|
counter = counter[..., start:end]
|
|
649
655
|
output_shape = result.shape[:-1] + (end - start,)
|
|
650
656
|
|
|
651
|
-
if torch.device(result.device).type not in ("cuda", "npu"):
|
|
657
|
+
if torch.device(result.device).type not in ("cuda", "npu", "xpu"):
|
|
652
658
|
estimated_sources = (result / counter).cpu().numpy()
|
|
653
659
|
np.nan_to_num(estimated_sources, copy=False, nan=0.0)
|
|
654
660
|
return estimated_sources
|
|
@@ -1098,7 +1104,7 @@ def demix_track(config, model, mix, device, pbar=False, source_indices=None, pro
|
|
|
1098
1104
|
mix, length_init = _prepare_mix_for_chunks(mix, border)
|
|
1099
1105
|
chunk_starts, chunk_windows = _build_chunk_plan(mix.shape[1], C, step, fade_size)
|
|
1100
1106
|
device_type = torch.device(device).type
|
|
1101
|
-
use_complete_fast_path = device_type in ("cuda", "cpu", "npu")
|
|
1107
|
+
use_complete_fast_path = device_type in ("cuda", "cpu", "npu", "xpu")
|
|
1102
1108
|
mix_device = _model_mix(mix, device)
|
|
1103
1109
|
|
|
1104
1110
|
with _autocast(device, _resolve_use_amp(config)):
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pymss
|
|
3
|
-
Version: 2.3.
|
|
3
|
+
Version: 2.3.4
|
|
4
4
|
Summary: Python package for music source separation.
|
|
5
5
|
Author-email: KitsuneX07 <ghast1085654218@163.com>
|
|
6
6
|
Maintainer-email: baicai1145 <3423714059@qq.com>
|
|
@@ -53,6 +53,19 @@ If you want the CUDA build of PyTorch, install it first:
|
|
|
53
53
|
pip install torch torchvision --index-url https://download.pytorch.org/whl/cu128
|
|
54
54
|
```
|
|
55
55
|
|
|
56
|
+
### Intel XPU (Arc)
|
|
57
|
+
|
|
58
|
+
Linux requires working Level Zero and OpenCL drivers. Install the official PyTorch XPU wheel before pymss:
|
|
59
|
+
|
|
60
|
+
```sh
|
|
61
|
+
pip install torch --index-url https://download.pytorch.org/whl/xpu
|
|
62
|
+
pip install pymss
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Use `--device xpu` to force Intel GPU execution and `--device-id` to select a device. When multiple IDs are supplied, only the first is used; multi-XPU parallel execution is not supported. `--device auto` prefers CUDA, then XPU, NPU, and Apple Silicon. XPU hardware inference is experimental and explicitly uses FP32, even when `use_amp=True`. bf16 AMP requires separate model accuracy and performance validation.
|
|
66
|
+
|
|
67
|
+
A manual benchmark script is available at `test/manual/xpu_benchmark.py` to compare FP32 CPU and XPU inference performance on local hardware.
|
|
68
|
+
|
|
56
69
|
### AMD ROCm
|
|
57
70
|
|
|
58
71
|
|
|
@@ -80,7 +93,7 @@ Choose a combination with PyTorch 2.7.1 or later, then install pymss:
|
|
|
80
93
|
pip install pymss
|
|
81
94
|
```
|
|
82
95
|
|
|
83
|
-
Use `--device npu` (or `device="auto"`, which prefers CUDA, then NPU,
|
|
96
|
+
Use `--device npu` (or `device="auto"`, which prefers CUDA, then XPU, NPU, and Apple Silicon).
|
|
84
97
|
`--device-id` selects the NPU index; if multiple IDs are supplied, only the first is used.
|
|
85
98
|
Multi-NPU parallel execution is not supported. On NPU, STFT/ISTFT uses `torch.fft` primitives.
|
|
86
99
|
RNN/LSTM/GRU layers use a CPU inference fallback for affected `torch_npu` builds, with results
|
|
@@ -153,7 +166,7 @@ pymss infer bs_roformer_voc_hyperacev2 \
|
|
|
153
166
|
--format wav # wav | flac | mp3 | m4a | aac | opus | vorbis | ogg
|
|
154
167
|
```
|
|
155
168
|
|
|
156
|
-
`--device auto`
|
|
169
|
+
`--device auto` prefers CUDA, then Intel XPU, Ascend NPU (`torch_npu`), and Apple Silicon MLX. Use `--device xpu` to force Intel GPU, `--device npu` to force Ascend NPU, `--device mlx` to force MLX, or `--device mps` to force PyTorch MPS.
|
|
157
170
|
`--save-as-folder` writes each input audio file's stems under a subfolder named after that audio file, for example `results/song/song_vocals.wav`.
|
|
158
171
|
|
|
159
172
|
The default download source is ModelScope. You can choose another source or model directory:
|
|
@@ -460,7 +473,7 @@ For a detailed explanation of every `MSSeparator` argument, see the [MSSeparator
|
|
|
460
473
|
'vr']
|
|
461
474
|
- model_path: The path to the model file.
|
|
462
475
|
- config_path: The path to the configuration file.
|
|
463
|
-
- device: The type of device, default is 'auto'. Must be one of ['auto', 'cuda', 'npu', 'mps', 'cpu']
|
|
476
|
+
- device: The type of device, default is 'auto'. Must be one of ['auto', 'cuda', 'rocm', 'npu', 'xpu', 'mps', 'mlx', 'cpu']
|
|
464
477
|
- device_ids: List of device IDs, default is [0].
|
|
465
478
|
- output_format: The output audio format, default is 'wav'. One of wav, flac, mp3, m4a, aac, opus, vorbis, ogg.
|
|
466
479
|
- use_tta: Whether to use TTA, default is False. Using TTA will triple the processing time with a little bit improvement in quality.
|
|
@@ -116,6 +116,7 @@ pymss_plugin_manager/LICENSE
|
|
|
116
116
|
pymss_plugin_manager/NOTICE
|
|
117
117
|
pymss_plugin_manager/__init__.py
|
|
118
118
|
pymss_plugin_manager/_engine.py
|
|
119
|
+
pymss_plugin_manager/_platform.py
|
|
119
120
|
pymss_plugin_manager/cli.py
|
|
120
121
|
pymss_plugin_manager/context.py
|
|
121
122
|
pymss_plugin_manager/environment.py
|
|
@@ -156,6 +157,7 @@ test/test_operation_graph_bridge.py
|
|
|
156
157
|
test/test_operation_invocation.py
|
|
157
158
|
test/test_operations.py
|
|
158
159
|
test/test_overlap_finalize.py
|
|
160
|
+
test/test_platform_queries.py
|
|
159
161
|
test/test_plugin_environment.py
|
|
160
162
|
test/test_plugin_kit.py
|
|
161
163
|
test/test_plugin_macos_attributes.py
|
|
@@ -174,4 +176,5 @@ test/test_rpc_process.py
|
|
|
174
176
|
test/test_separator_channels.py
|
|
175
177
|
test/test_separator_device_defaults.py
|
|
176
178
|
test/test_use_amp.py
|
|
177
|
-
test/test_workflow.py
|
|
179
|
+
test/test_workflow.py
|
|
180
|
+
test/test_xpu_runtime.py
|