Memory issues - chunk_size table for combatting “RuntimeError”
dim_t (old patches) to chunk_size conversion (new patches) for Roformers with hop_length = 441 in the model’s yaml (patch #1-2 and Linux uses dim_t instead of chunk_size - more)
Useful if you see insufficient memory error, so you can decrease the default by the following value steps.
The formula is: chunk_size = (dim_t - 1) * hop_length
Go to Choose “MDX-Net model” and scroll down the the bottom to reach “Edit Model Config”, or edit the model yaml directly in Ultimate Vocal Remover\models\MDX_Net_Models\model_data\mdx_c_configs e.g. in Notepad++ and find “chunk_size” value and edit as in the following.
For this to work, you need to ensure that in:
Settings>Choose Advanced Menu >Advanced MDX Options>>Multi-Network Only Options you have the “Segment Default” option checked.
Otherwise the value from the main UVR window in “Segment Size” will be used instead (at least if it’s not set to “Default”).
dim_t = 2001 is chunk_size = 882000 (20s) - used by gilliaan’s de-effect
dim_t = 1700 is chunk_size = 749259 (17s) - used by inst resurrection
dim_t = 1333 is chunk_size = 587412 (13,32s)
dim_t = 1201 is chunk_size = 529200 (12s) - used by some newer models
dim_t = 1101 is chunk_size = 485100 (11.00s) - that dim_t value was giving the highest SDR for models trained with 8s chunks, at least in times of models released in beta Roformer beta patch #2 period, it’s default for e.g. duality models
dim_t = 801 is chunk_size = 352800 (8.00s) - default for most models, max working on Intel/AMD 8GB GPUs on 900MB models, 6-stem SW model on 4GB NVIDIA GPUs works faster with this or lower than 485100 setting
dim_t = 556 is chunk_size = 244755 (5,5s)
dim_t = 501 is chunk_size = 220500 (5s) - also, as below, but separation time slightly increased with at least a few browser tabs opened, higher crashes no matter what
dim_t = 456 is chunk_size = 200655 (4,5s) - works with Resurrection inst on 4GB AMD GPU
dim_t = 401 is chunk_size = 176400 (4s)
dim_t = 356 is chunk_size = 156555 (3,55s) - max supported for becruily inst and AMD 4GB VRAM (when in previous beta, dim_t needed to correspond with overlap to avoid stem misalignment, so probably halves caused misalignment before),
it can be more muddy in certain parts of songs vs 256
dim_t = 301 is chunk_size = 132300 (3s) - max working on NVIDIA 2GB VRAM GPU with deux model (memory management in CUDA is much better than in DirectML)
dim_t = 256 is chunk_size = 112455 (2,55s) - max working with e.g. becruily and smaller unwa’s 400MB exp. models on 4GB AMD GPU
dim_t = 201 is chunk_size = 88200 (2s) - required value for some more resource-hungry/bigger Roformers on AMD 4GB VRAM (some models only worked with that dim_t with earlier beta patches and here’s it’s probably the same or with 256 equivalent), but is still not low enough for most Roformers when demudder is used, and give “Could not allocate tensor” while single model separation previously worked with even bigger chunk setting. You shouldn’t go lower with that parameter, as even a 2 seconds chunk might sometimes give audio skips every two seconds, at least on UVR Roformer patch #2. 2 or 2,5 seconds will be [a] rather bare minimum.” - jarredou (DTN edit)
All inst/voc Roformers seem to use hop_length: 441 (but ensure in yaml), so you always multiply that hop value by the desired dim_t - 1 to get correct chunk_size (e.g. corresponding with old dim_t values you were using in older beta patches)
Setting your NVIDIA Control Panel UVR profile to “CUDA Sysmem Fallback Policy” to “Prefer Sysmem Fallback” makes it crash less on e.g. 2GB GPU - mohammedmehditber
Performance issues
If the chunk_size is too big for your VRAM, it can slow down separation (esp. on Intel/AMD using DirectML).
If it’s slow, also make sure your overlap is not higher than 2 for the fastest separation.
[MSST only] “If not set already, batch_size=1 can also reduce memory footprint
And if the model is not converted to FP16 already [like Deux], converting it to FP16 should also reduce memory usage.
It can be done with that script https://github.com/ZFTurbo/Music-Source-Separation-Training/blob/main/scripts/prepare_weights_for_inference.py” - jarredou
But, sometimes FP16 might cause performance drops on GPUs not having FP16 acceleration (it starts from RTX 2000/RX 6000/ARC [rather only discrete Alchemist]), plus DirectML might have its own peculiarities in that regard.
So ideally, it would be best to have both model variants for various GPUs.
Usage of the script (install Python, and on fresh installation execute “pip install torch” then execute):
python C:\path_of_the_script\prepare_weights_for_inference.py --checkpoint "path_to_the_input_model/model_to_clean.ckpt" --output_file "path_to_the_output_model/cleaned_model.ckpt” --float16
- UVR won’t run without min. 3GB of disk space on C:\, but sometimes it’s still not enough for e.g. GPU Conversion unchecked to not trigger memory issues (e.g. “cannot allocate”), esp. on 2-3h files with e.g. Wind model (issues occuring on even 32GB RAM).
But there's a workaround for the 3GB error here
- If you don’t have much space on C:\ you can set the pagefile to even min. 500MB on C: drive and use other partition for pagefile if you run out of space on C:\ during the process and error occured
https://mcci.com/support/guides/how-to-change-the-windows-pagefile-size
- We have some reports about user custom ensemble presets from older versions no longer working (since 11/17/24 patch).
Sadly, you need to get rid of them (don’t restore their files manually) or the ensemble will not work and model choice will be greyed out. You need to start from scratch
- If your computer shuts down during separation, it’s usually the PSU's fault. Consider replacement to a higher-grade/tier one, and/or with more power, or if you have two 12V rails (V1 and V2 on your PSU label), you can use molex to 6/8 pin GPU adapter and don't use dedicated GPU plug from your PSU.
- Black screens during separation might be an indicator of outdated drivers and/or lack of KB5077181 update occuring on NVIDIA GPUs (more).
Errors troubleshooting
“got an unexpected keyword argument 'linear_transformer_depth’ ”
In case of the error with any external Roformer model:
- delete “linear_transformer_depth: 0” line from the YAML file
- To fix issues with BS variant of e.g. anvuew’s de-reverb model in UVR, additionally to the above, also change the following in the yaml file:
“stft_hop_length: 512 to stft_hop_length: 441 so it matches the hop_length above” (thx lew).
If that line is not present in your model’s yaml config file, go to the settings, then choose MDX In the Advanced menu, and click the "Clear auto-set cache" button.
Then go back to the main settings, click "Reset all settings to default" and restart the app (thx santilli_).
These issues don’t happen in the ZFTurbo’s CML inference code of:
https://github.com/ZFTurbo/Music-Source-Separation-Training/