From d32c307fdb00e96e53281dab414ff4a37c0c4798 Mon Sep 17 00:00:00 2001 From: Flavio Schneider Date: Wed, 5 Oct 2022 11:48:39 +0200 Subject: [PATCH] fix: sigmoid norm --- audio_diffusion_pytorch/utils.py | 4 ++-- setup.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/audio_diffusion_pytorch/utils.py b/audio_diffusion_pytorch/utils.py index d233379..96dd831 100644 --- a/audio_diffusion_pytorch/utils.py +++ b/audio_diffusion_pytorch/utils.py @@ -87,7 +87,7 @@ def upsample(waveforms: Tensor, factor: int, **kwargs) -> Tensor: def wave_norm(x: Tensor, peak: float = 0.5, alpha: float = 20.0) -> Tensor: x = x.clip(-1, 1) - x = torch.sigmoid(alpha * x) + x = 2 * torch.sigmoid(alpha * x) - 1 x = x.clip(-1, 1) return x * peak @@ -95,6 +95,6 @@ def wave_norm(x: Tensor, peak: float = 0.5, alpha: float = 20.0) -> Tensor: def wave_unnorm(x: Tensor, peak: float = 0.5, alpha: float = 20.0) -> Tensor: x = x / peak x = x.clip(-1, 1) - x = (1.0 / alpha) * torch.log(x / (1 - x)) + x = (1.0 / alpha) * torch.log((x + 1) / (1 - x)) x = x.clip(-1, 1) return x diff --git a/setup.py b/setup.py index ed46870..8bd33f1 100644 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ setup( name="audio-diffusion-pytorch", packages=find_packages(exclude=[]), - version="0.0.55", + version="0.0.54", license="MIT", description="Audio Diffusion - PyTorch", long_description_content_type="text/markdown",