pytorch_dlprim icon indicating copy to clipboard operation
pytorch_dlprim copied to clipboard

Error when Running Pyannote Audio on OpenCL Backend - RuntimeError: Running sums are expected to be present

Open HideyoshiNakazone opened this issue 1 year ago • 4 comments

OS VERSION: Ubuntu 22.04 Mesa Version: 23.2.1-1ubuntu3.1~22.04.2 Python Version: 3.12.1


When running a Pyannote Pipeline with this Torch Backend the following exception is raised:

  File "$HOME/.cache/pypoetry/virtualenvs/mega-transcriptor-api-ZX9jWx3P-py3.12/lib/python3.12/site-packages/torch/nn/functional.py", line 2526, in instance_norm
    return torch.instance_norm(
           ^^^^^^^^^^^^^^^^^^^^
RuntimeError: Running sums are expected to be present

The backend is initialized and passed to the pipeline via the following code:

    torch.ops.load_library("pytorch_dlprim/build/dlprimitives/libdlprim_core.so")
    torch.ops.load_library("pytorch_dlprim/build/libpt_ocl.so")

    torch.utils.rename_privateuse1_backend('ocl')

    pipeline.to(torch.device("ocl:0"))

All PyTorch Packages where installed via the following repo: https://download.pytorch.org/whl/cpu/

Thanks for all your work, Vitor Hideyoshi

HideyoshiNakazone avatar Feb 11 '24 23:02 HideyoshiNakazone

Interesting. It looks like it is implemented as batch normalization but without running mean/variance.

I need to check if I can fix it.

What are the inputs for torch.instance_norm?

artyom-beilis avatar Feb 12 '24 06:02 artyom-beilis

I will write a function that runs that function directly, because the function call was made by another package

HideyoshiNakazone avatar Feb 12 '24 11:02 HideyoshiNakazone

I wasn't able to replicate it, but i ran the program in debug mode and created a pickle file with the input args for the following function call.

    torch.instance_norm(
        input, weight, bias, running_mean, running_var, use_input_stats, momentum, eps, torch.backends.cudnn.enabled
    )

dump.zip

Also, when running the function directly in the debug mode the following exception was thrown:

RuntimeError: Running sums are expected to be present

HideyoshiNakazone avatar Feb 12 '24 13:02 HideyoshiNakazone

torch.instance_norm(
       input, weight, bias, running_mean, running_var, use_input_stats, momentum, eps, torch.backends.cudnn.enabled
   )

Can you tell what are the parameters (shapes, scalar values etc) It is on forward or backward path?

artyom-beilis avatar Feb 16 '24 14:02 artyom-beilis