FutureWarning: `torch.nn.utils.weight_norm` is deprecated in favor of `torch.nn.utils.parametrizations.weight_norm`.

Author: DecodetalkersCreated Aug 26, 2026Updated Aug 26, 2026
Labelsbug

Describe the bug

https://github.com/search?q=repo%3Aspeechbrain%2Fspeechbrain+weight_norm&type=code

I have searched the weight_norm, they are all using the torch.nn.utils.weight_norm

this is the warning in torch

    .. warning::

        This function is deprecated.  Use :func:`torch.nn.utils.parametrizations.weight_norm`
        which uses the modern parametrization API.  The new ``weight_norm`` is compatible
        with ``state_dict`` generated from old ``weight_norm``.

        Migration guide:

        * The magnitude (``weight_g``) and direction (``weight_v``) are now expressed
          as ``parametrizations.weight.original0`` and ``parametrizations.weight.original1``
          respectively.  If this is bothering you, please comment on
          https://github.com/pytorch/pytorch/issues/102999

        * To remove the weight normalization reparametrization, use
          :func:`torch.nn.utils.parametrize.remove_parametrizations`.

        * The weight is no longer recomputed once at module forward; instead, it will
          be recomputed on every access.  To restore the old behavior, use
          :func:`torch.nn.utils.parametrize.cached` before invoking the module
          in question.

Should it be changed to parametrizations.weight_norm?

Expected behaviour

Can we solve this warning?

To Reproduce

No response

Environment Details

No response

Relevant Log Output

bash

Additional Context

No response