From 3369b94068dbf7df3a14cc37ad47a47c842322e8 Mon Sep 17 00:00:00 2001 From: Erick Cobos Date: Fri, 28 Jun 2024 14:20:10 +0200 Subject: [PATCH 1/3] Fixes wrong output dimensions in ConvTranspose1d Changes output_padding to deal better with odd strides. --- dac/model/dac.py | 1 + 1 file changed, 1 insertion(+) diff --git a/dac/model/dac.py b/dac/model/dac.py index eb754b2..cbcbe52 100644 --- a/dac/model/dac.py +++ b/dac/model/dac.py @@ -102,6 +102,7 @@ def __init__(self, input_dim: int = 16, output_dim: int = 8, stride: int = 1): kernel_size=2 * stride, stride=stride, padding=math.ceil(stride / 2), + output_padding=0 if stride % 2 == 0 else 1 ), ResidualUnit(output_dim, dilation=1), ResidualUnit(output_dim, dilation=3), From 9b12d8b3fee05cd40a919874754a9b0dad498322 Mon Sep 17 00:00:00 2001 From: Erick Cobos Date: Fri, 28 Jun 2024 15:02:17 +0200 Subject: [PATCH 2/3] bump version from 1.0.0 to 1.0.1 plenty of changes since 1.0.0 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index b681d97..9b4fa0f 100644 --- a/setup.py +++ b/setup.py @@ -6,7 +6,7 @@ setup( name="descript-audio-codec", - version="1.0.0", + version="1.0.1", classifiers=[ "Intended Audience :: Developers", "Natural Language :: English", From 99ecabf29789e3e81c901afd150e4f92f2550837 Mon Sep 17 00:00:00 2001 From: Erick Cobos Date: Fri, 28 Jun 2024 15:12:48 +0200 Subject: [PATCH 3/3] minor: code refactoring --- dac/model/dac.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/dac/model/dac.py b/dac/model/dac.py index cbcbe52..5d2084e 100644 --- a/dac/model/dac.py +++ b/dac/model/dac.py @@ -196,10 +196,9 @@ def __init__( self.delay = self.get_delay() - def preprocess(self, audio_data, sample_rate): - if sample_rate is None: - sample_rate = self.sample_rate - assert sample_rate == self.sample_rate + def preprocess(self, audio_data, sample_rate=None): + if sample_rate: + assert sample_rate == self.sample_rate, f'Expected sample rate is {self.sample_rate}' length = audio_data.shape[-1] right_pad = math.ceil(length / self.hop_length) * self.hop_length - length