Skip to content

Commit

Permalink
address #35
Browse files Browse the repository at this point in the history
  • Loading branch information
lucidrains committed Sep 11, 2024
1 parent 08a5e20 commit 6caa246
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
setup(
name = 'soundstorm-pytorch',
packages = find_packages(exclude=[]),
version = '0.4.3',
version = '0.4.6',
license='MIT',
description = 'SoundStorm - Efficient Parallel Audio Generation from Google Deepmind, in Pytorch',
author = 'Phil Wang',
Expand Down
5 changes: 5 additions & 0 deletions soundstorm_pytorch/soundstorm.py
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,8 @@ def __init__(
Rearrange('b n (h d) -> b (n h) d', h = num_effective_quantizers)
)

self.num_effective_quantizers = num_effective_quantizers

# each quantizer codebook would require its own logits weight and bias matrices
# the amazing einops makes this easy with 'EinMix'

Expand Down Expand Up @@ -579,6 +581,9 @@ def forward(
x = self.embedding_proj(x)

if exists(sum_embeds):
if sum_embeds.ndim == 3:
sum_embeds = reduce(sum_embeds, 'b (n h) d -> b n d', 'sum', h = self.num_effective_quantizers)

x = x + sum_embeds

if exists(cond):
Expand Down

0 comments on commit 6caa246

Please sign in to comment.