-
Notifications
You must be signed in to change notification settings - Fork 0
/
Models.py
62 lines (55 loc) · 1.45 KB
/
Models.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
from diffusers import UNet2DConditionModel, AutoencoderKL
from transformers import ClapModel
import torch.nn as nn
from diffusers import MusicLDMPipeline
import torch
def VAEModel(config):
model = AutoencoderKL(
in_channels=1,
out_channels=1,
sample_size=config.sample_size,
block_out_channels=(128, 256, 384, 640),
down_block_types=(
"DownEncoderBlock2D",
"DownEncoderBlock2D",
"DownEncoderBlock2D",
"DownEncoderBlock2D",
),
up_block_types=(
"UpDecoderBlock2D",
"UpDecoderBlock2D",
"UpDecoderBlock2D",
"UpDecoderBlock2D",
),
latent_channels=16,
)
return model
def UNet2DCondition(config):
model = UNet2DConditionModel(
sample_size=config.sample_size,
in_channels=1,
out_channels=1,
layers_per_block=4,
block_out_channels=(128, 256, 384, 640),
down_block_types=(
"DownBlock2D",
"DownBlock2D",
"DownBlock2D",
"DownBlock2D",
),
mid_block_type=(
"MidBlock2D",
),
up_block_type=(
"UpBlock2D",
"UpBlock2D",
"UpBlock2D",
"UpBlock2D",
),
)
return model
def CLAPModel():
model = ClapModel.from_pretrained("laion/clap-htsat-unfused")
return model
def HifiGAN(spectrogram):
return model