Skip to content

Commit 87e835e

Browse files
committed
move beartype onto methods
1 parent 7422185 commit 87e835e

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

musiclm_pytorch/musiclm_pytorch.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -503,8 +503,8 @@ def forward(
503503

504504
# text transformer
505505

506-
@beartype
507506
class TextTransformer(nn.Module):
507+
@beartype
508508
def __init__(
509509
self,
510510
dim,
@@ -546,6 +546,7 @@ def __init__(
546546
def device(self):
547547
return next(self.parameters()).device
548548

549+
@beartype
549550
def forward(
550551
self,
551552
x = None,
@@ -648,8 +649,8 @@ def forward(self, *, audio_layers, text_layers):
648649

649650
# main classes
650651

651-
@beartype
652652
class MuLaN(nn.Module):
653+
@beartype
653654
def __init__(
654655
self,
655656
audio_transformer: AudioSpectrogramTransformer,
@@ -705,6 +706,7 @@ def get_audio_latents(
705706

706707
return out, audio_layers
707708

709+
@beartype
708710
def get_text_latents(
709711
self,
710712
texts = None,
@@ -720,6 +722,7 @@ def get_text_latents(
720722

721723
return out, text_layers
722724

725+
@beartype
723726
def forward(
724727
self,
725728
wavs,
@@ -766,8 +769,8 @@ def forward(
766769

767770
# music lm
768771

769-
@beartype
770772
class MuLaNEmbedQuantizer(AudioConditionerBase):
773+
@beartype
771774
def __init__(
772775
self,
773776
mulan: MuLaN,
@@ -851,8 +854,8 @@ def forward(
851854
cond_embeddings = cond_embeddings.gather(2, indices)
852855
return rearrange(cond_embeddings, 'b q 1 d -> b q d')
853856

854-
@beartype
855857
class MusicLM(nn.Module):
858+
@beartype
856859
def __init__(
857860
self,
858861
audio_lm: AudioLM,

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
setup(
44
name = 'musiclm-pytorch',
55
packages = find_packages(exclude=[]),
6-
version = '0.2.1',
6+
version = '0.2.2',
77
license='MIT',
88
description = 'MusicLM - AudioLM + Audio CLIP to text to music synthesis',
99
author = 'Phil Wang',

0 commit comments

Comments
 (0)