Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Roformer separation failed: The size of tensor a (60417) must match the size of tensor b (352800) at non-singleton dimension 1 #29

Open
ColbyDash opened this issue Jan 5, 2025 · 2 comments

Comments

@ColbyDash
Copy link

I get this error when trying to use any one of the roformer models, could extend to any of the other models out there, with any clip under 8 seconds long. Oddly enough, the UVR app doesn't have this problem and lets me isolate clips as short as just half a second.

Traceback (most recent call last):
  File "E:\AI\UVR5-UI-1.7.0\app.py", line 283, in roformer_separator
    separation = separator.separate(audio)
  File "E:\AI\UVR5-UI-1.7.0\env\lib\site-packages\audio_separator\separator\separator.py", line 771, in separate
    output_files = self.model_instance.separate(audio_file_path, primary_output_name, secondary_output_name)
  File "E:\AI\UVR5-UI-1.7.0\env\lib\site-packages\audio_separator\separator\architectures\mdxc_separator.py", line 139, in separate
    source = self.demix(mix=mix)
  File "E:\AI\UVR5-UI-1.7.0\env\lib\site-packages\audio_separator\separator\architectures\mdxc_separator.py", line 267, in demix
    result = self.overlap_add(result, x, window, result.shape[-1] - chunk_size, length)
  File "E:\AI\UVR5-UI-1.7.0\env\lib\site-packages\audio_separator\separator\architectures\mdxc_separator.py", line 203, in overlap_add
    result[..., start : start + length] += x[..., :length] * weights[:length]
RuntimeError: The size of tensor a (60417) must match the size of tensor b (352800) at non-singleton dimension 1

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "E:\AI\UVR5-UI-1.7.0\env\lib\site-packages\gradio\queueing.py", line 624, in process_events
    response = await route_utils.call_process_api(
  File "E:\AI\UVR5-UI-1.7.0\env\lib\site-packages\gradio\route_utils.py", line 323, in call_process_api
    output = await app.get_blocks().process_api(
  File "E:\AI\UVR5-UI-1.7.0\env\lib\site-packages\gradio\blocks.py", line 2019, in process_api
    result = await self.call_function(
  File "E:\AI\UVR5-UI-1.7.0\env\lib\site-packages\gradio\blocks.py", line 1566, in call_function
    prediction = await anyio.to_thread.run_sync(  # type: ignore
  File "E:\AI\UVR5-UI-1.7.0\env\lib\site-packages\anyio\to_thread.py", line 56, in run_sync
    return await get_async_backend().run_sync_in_worker_thread(
  File "E:\AI\UVR5-UI-1.7.0\env\lib\site-packages\anyio\_backends\_asyncio.py", line 2505, in run_sync_in_worker_thread
    return await future
  File "E:\AI\UVR5-UI-1.7.0\env\lib\site-packages\anyio\_backends\_asyncio.py", line 1005, in run
    result = context.run(func, *args)
  File "E:\AI\UVR5-UI-1.7.0\env\lib\site-packages\gradio\utils.py", line 865, in wrapper
    response = f(*args, **kwargs)
  File "E:\AI\UVR5-UI-1.7.0\env\lib\site-packages\gradio\utils.py", line 865, in wrapper
    response = f(*args, **kwargs)
  File "E:\AI\UVR5-UI-1.7.0\app.py", line 293, in roformer_separator
    raise RuntimeError(f"Roformer separation failed: {e}") from e
RuntimeError: Roformer separation failed: The size of tensor a (60417) must match the size of tensor b (352800) at non-singleton dimension 1
@Eddycrack864
Copy link
Owner

Yes, there is currently a problem with Mel/BS Roformers when you use audio with a very short duration, around <10s. It doesn't affect all Roformers but it affects most of them.

But, tbh I don't know how to fix this problem yet, the code is almost identical to the UVR GUI so fixing this may take a while.

@ColbyDash
Copy link
Author

Yes, there is currently a problem with Mel/BS Roformers when you use audio with a very short duration, around <10s. It doesn't affect all Roformers but it affects most of them.

But, tbh I don't know how to fix this problem yet, the code is almost identical to the UVR GUI so fixing this may take a while.

I see. In the meantime, I had tried some of the older versions of UVR5 UI to see if they were any different whatsoever. Lo and behold, they weren't but v1.4.0 as far as I know had spat out a bit of a different wording of this error. If it helps in any way, here's that error for you:

Traceback (most recent call last):
  File "E:\AI\UVR5-UI-1.4.0\env\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "E:\AI\UVR5-UI-1.4.0\env\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "E:\AI\UVR5-UI-1.4.0\env\Scripts\audio-separator.exe\__main__.py", line 7, in <module>
  File "E:\AI\UVR5-UI-1.4.0\env\lib\site-packages\audio_separator\utils\cli.py", line 208, in main
    output_files = separator.separate(audio_file, primary_output_name=args.primary_output_name, secondary_output_name=args.secondary_output_name)
  File "E:\AI\UVR5-UI-1.4.0\env\lib\site-packages\audio_separator\separator\separator.py", line 774, in separate
    output_files = self.model_instance.separate(audio_file_path, primary_output_name, secondary_output_name)
  File "E:\AI\UVR5-UI-1.4.0\env\lib\site-packages\audio_separator\separator\architectures\mdxc_separator.py", line 139, in separate
    source = self.demix(mix=mix)
  File "E:\AI\UVR5-UI-1.4.0\env\lib\site-packages\audio_separator\separator\architectures\mdxc_separator.py", line 267, in demix
    result = self.overlap_add(result, x, window, result.shape[-1] - chunk_size, length)
  File "E:\AI\UVR5-UI-1.4.0\env\lib\site-packages\audio_separator\separator\architectures\mdxc_separator.py", line 203, in overlap_add
    result[..., start : start + length] += x[..., :length] * weights[:length]
RuntimeError: The size of tensor a (60417) must match the size of tensor b (352800) at non-singleton dimension 1
Traceback (most recent call last):
  File "E:\AI\UVR5-UI-1.4.0\env\lib\site-packages\gradio\queueing.py", line 624, in process_events
    response = await route_utils.call_process_api(
  File "E:\AI\UVR5-UI-1.4.0\env\lib\site-packages\gradio\route_utils.py", line 323, in call_process_api
    output = await app.get_blocks().process_api(
  File "E:\AI\UVR5-UI-1.4.0\env\lib\site-packages\gradio\blocks.py", line 2018, in process_api
    result = await self.call_function(
  File "E:\AI\UVR5-UI-1.4.0\env\lib\site-packages\gradio\blocks.py", line 1567, in call_function
    prediction = await anyio.to_thread.run_sync(  # type: ignore
  File "E:\AI\UVR5-UI-1.4.0\env\lib\site-packages\anyio\to_thread.py", line 56, in run_sync
    return await get_async_backend().run_sync_in_worker_thread(
  File "E:\AI\UVR5-UI-1.4.0\env\lib\site-packages\anyio\_backends\_asyncio.py", line 2461, in run_sync_in_worker_thread
    return await future
  File "E:\AI\UVR5-UI-1.4.0\env\lib\site-packages\anyio\_backends\_asyncio.py", line 962, in run
    result = context.run(func, *args)
  File "E:\AI\UVR5-UI-1.4.0\env\lib\site-packages\gradio\utils.py", line 846, in wrapper
    response = f(*args, **kwargs)
  File "E:\AI\UVR5-UI-1.4.0\app.py", line 194, in roformer_separator
    stem1_file = files_list[0]
IndexError: list index out of range

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

No branches or pull requests

2 participants