ylgatatooine commited on
Commit ·
2e97744
1
Parent(s): b607631
third version
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- __pycache__/configuration_bigcodec.cpython-39.pyc +0 -0
- __pycache__/modeling_bigcodec.cpython-39.pyc +0 -0
- __pycache__/modeling_xcodec2.cpython-39.pyc +0 -0
- ckpt/epoch=4-step=1400000.ckpt +3 -0
- vq/__init__.py +4 -0
- vq/__pycache__/__init__.cpython-310.pyc +0 -0
- vq/__pycache__/__init__.cpython-311.pyc +0 -0
- vq/__pycache__/__init__.cpython-312.pyc +0 -0
- vq/__pycache__/__init__.cpython-38.pyc +0 -0
- vq/__pycache__/__init__.cpython-39.pyc +0 -0
- vq/__pycache__/activations.cpython-310.pyc +0 -0
- vq/__pycache__/activations.cpython-311.pyc +0 -0
- vq/__pycache__/activations.cpython-312.pyc +0 -0
- vq/__pycache__/activations.cpython-38.pyc +0 -0
- vq/__pycache__/activations.cpython-39.pyc +0 -0
- vq/__pycache__/blocks.cpython-310.pyc +0 -0
- vq/__pycache__/blocks.cpython-39.pyc +0 -0
- vq/__pycache__/bs_roformer5.cpython-310.pyc +0 -0
- vq/__pycache__/bs_roformer5.cpython-38.pyc +0 -0
- vq/__pycache__/bs_roformer5.cpython-39.pyc +0 -0
- vq/__pycache__/codec_decoder.cpython-310.pyc +0 -0
- vq/__pycache__/codec_decoder.cpython-311.pyc +0 -0
- vq/__pycache__/codec_decoder.cpython-312.pyc +0 -0
- vq/__pycache__/codec_decoder.cpython-39.pyc +0 -0
- vq/__pycache__/codec_decoder_vocos.cpython-310.pyc +0 -0
- vq/__pycache__/codec_decoder_vocos.cpython-311.pyc +0 -0
- vq/__pycache__/codec_decoder_vocos.cpython-312.pyc +0 -0
- vq/__pycache__/codec_decoder_vocos.cpython-39.pyc +0 -0
- vq/__pycache__/codec_encoder.cpython-310.pyc +0 -0
- vq/__pycache__/codec_encoder.cpython-311.pyc +0 -0
- vq/__pycache__/codec_encoder.cpython-312.pyc +0 -0
- vq/__pycache__/codec_encoder.cpython-38.pyc +0 -0
- vq/__pycache__/codec_encoder.cpython-39.pyc +0 -0
- vq/__pycache__/factorized_vector_quantize.cpython-310.pyc +0 -0
- vq/__pycache__/factorized_vector_quantize.cpython-311.pyc +0 -0
- vq/__pycache__/factorized_vector_quantize.cpython-312.pyc +0 -0
- vq/__pycache__/factorized_vector_quantize.cpython-39.pyc +0 -0
- vq/__pycache__/module.cpython-310.pyc +0 -0
- vq/__pycache__/module.cpython-311.pyc +0 -0
- vq/__pycache__/module.cpython-312.pyc +0 -0
- vq/__pycache__/module.cpython-38.pyc +0 -0
- vq/__pycache__/module.cpython-39.pyc +0 -0
- vq/__pycache__/residual_vq.cpython-310.pyc +0 -0
- vq/__pycache__/residual_vq.cpython-311.pyc +0 -0
- vq/__pycache__/residual_vq.cpython-312.pyc +0 -0
- vq/__pycache__/residual_vq.cpython-39.pyc +0 -0
- vq/__pycache__/unet.cpython-312.pyc +0 -0
- vq/__pycache__/unet.cpython-39.pyc +0 -0
- vq/activations.py +120 -0
- vq/alias_free_torch/__init__.py +6 -0
__pycache__/configuration_bigcodec.cpython-39.pyc
ADDED
|
Binary file (743 Bytes). View file
|
|
|
__pycache__/modeling_bigcodec.cpython-39.pyc
ADDED
|
Binary file (2.6 kB). View file
|
|
|
__pycache__/modeling_xcodec2.cpython-39.pyc
ADDED
|
Binary file (4.07 kB). View file
|
|
|
ckpt/epoch=4-step=1400000.ckpt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:02d8c58b95ac84de701a94e351b6981523bd106cbd05863a09cc56dd148c689e
|
| 3 |
+
size 8306367217
|
vq/__init__.py
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from vq.codec_encoder import CodecEncoder
|
| 2 |
+
from vq.codec_decoder import CodecDecoder
|
| 3 |
+
from vq.codec_decoder_vocos import CodecDecoderVocos
|
| 4 |
+
from vq.codec_encoder import CodecEncoder_Transformer,CodecEncoder_only_Transformer
|
vq/__pycache__/__init__.cpython-310.pyc
ADDED
|
Binary file (389 Bytes). View file
|
|
|
vq/__pycache__/__init__.cpython-311.pyc
ADDED
|
Binary file (371 Bytes). View file
|
|
|
vq/__pycache__/__init__.cpython-312.pyc
ADDED
|
Binary file (318 Bytes). View file
|
|
|
vq/__pycache__/__init__.cpython-38.pyc
ADDED
|
Binary file (414 Bytes). View file
|
|
|
vq/__pycache__/__init__.cpython-39.pyc
ADDED
|
Binary file (383 Bytes). View file
|
|
|
vq/__pycache__/activations.cpython-310.pyc
ADDED
|
Binary file (4 kB). View file
|
|
|
vq/__pycache__/activations.cpython-311.pyc
ADDED
|
Binary file (6.07 kB). View file
|
|
|
vq/__pycache__/activations.cpython-312.pyc
ADDED
|
Binary file (5.65 kB). View file
|
|
|
vq/__pycache__/activations.cpython-38.pyc
ADDED
|
Binary file (4.07 kB). View file
|
|
|
vq/__pycache__/activations.cpython-39.pyc
ADDED
|
Binary file (4.04 kB). View file
|
|
|
vq/__pycache__/blocks.cpython-310.pyc
ADDED
|
Binary file (6.03 kB). View file
|
|
|
vq/__pycache__/blocks.cpython-39.pyc
ADDED
|
Binary file (6.29 kB). View file
|
|
|
vq/__pycache__/bs_roformer5.cpython-310.pyc
ADDED
|
Binary file (3.91 kB). View file
|
|
|
vq/__pycache__/bs_roformer5.cpython-38.pyc
ADDED
|
Binary file (3.91 kB). View file
|
|
|
vq/__pycache__/bs_roformer5.cpython-39.pyc
ADDED
|
Binary file (3.86 kB). View file
|
|
|
vq/__pycache__/codec_decoder.cpython-310.pyc
ADDED
|
Binary file (9.09 kB). View file
|
|
|
vq/__pycache__/codec_decoder.cpython-311.pyc
ADDED
|
Binary file (8.78 kB). View file
|
|
|
vq/__pycache__/codec_decoder.cpython-312.pyc
ADDED
|
Binary file (7.76 kB). View file
|
|
|
vq/__pycache__/codec_decoder.cpython-39.pyc
ADDED
|
Binary file (9.22 kB). View file
|
|
|
vq/__pycache__/codec_decoder_vocos.cpython-310.pyc
ADDED
|
Binary file (18.1 kB). View file
|
|
|
vq/__pycache__/codec_decoder_vocos.cpython-311.pyc
ADDED
|
Binary file (27.7 kB). View file
|
|
|
vq/__pycache__/codec_decoder_vocos.cpython-312.pyc
ADDED
|
Binary file (25.2 kB). View file
|
|
|
vq/__pycache__/codec_decoder_vocos.cpython-39.pyc
ADDED
|
Binary file (18.4 kB). View file
|
|
|
vq/__pycache__/codec_encoder.cpython-310.pyc
ADDED
|
Binary file (9.97 kB). View file
|
|
|
vq/__pycache__/codec_encoder.cpython-311.pyc
ADDED
|
Binary file (4.91 kB). View file
|
|
|
vq/__pycache__/codec_encoder.cpython-312.pyc
ADDED
|
Binary file (4.39 kB). View file
|
|
|
vq/__pycache__/codec_encoder.cpython-38.pyc
ADDED
|
Binary file (7.45 kB). View file
|
|
|
vq/__pycache__/codec_encoder.cpython-39.pyc
ADDED
|
Binary file (10.2 kB). View file
|
|
|
vq/__pycache__/factorized_vector_quantize.cpython-310.pyc
ADDED
|
Binary file (3.71 kB). View file
|
|
|
vq/__pycache__/factorized_vector_quantize.cpython-311.pyc
ADDED
|
Binary file (6.3 kB). View file
|
|
|
vq/__pycache__/factorized_vector_quantize.cpython-312.pyc
ADDED
|
Binary file (5.82 kB). View file
|
|
|
vq/__pycache__/factorized_vector_quantize.cpython-39.pyc
ADDED
|
Binary file (3.64 kB). View file
|
|
|
vq/__pycache__/module.cpython-310.pyc
ADDED
|
Binary file (12 kB). View file
|
|
|
vq/__pycache__/module.cpython-311.pyc
ADDED
|
Binary file (18.2 kB). View file
|
|
|
vq/__pycache__/module.cpython-312.pyc
ADDED
|
Binary file (16.1 kB). View file
|
|
|
vq/__pycache__/module.cpython-38.pyc
ADDED
|
Binary file (12.2 kB). View file
|
|
|
vq/__pycache__/module.cpython-39.pyc
ADDED
|
Binary file (12.2 kB). View file
|
|
|
vq/__pycache__/residual_vq.cpython-310.pyc
ADDED
|
Binary file (1.86 kB). View file
|
|
|
vq/__pycache__/residual_vq.cpython-311.pyc
ADDED
|
Binary file (3.04 kB). View file
|
|
|
vq/__pycache__/residual_vq.cpython-312.pyc
ADDED
|
Binary file (2.54 kB). View file
|
|
|
vq/__pycache__/residual_vq.cpython-39.pyc
ADDED
|
Binary file (1.78 kB). View file
|
|
|
vq/__pycache__/unet.cpython-312.pyc
ADDED
|
Binary file (8.82 kB). View file
|
|
|
vq/__pycache__/unet.cpython-39.pyc
ADDED
|
Binary file (5.58 kB). View file
|
|
|
vq/activations.py
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Implementation adapted from https://github.com/EdwardDixon/snake under the MIT license.
|
| 2 |
+
# LICENSE is in incl_licenses directory.
|
| 3 |
+
|
| 4 |
+
import torch
|
| 5 |
+
from torch import nn, sin, pow
|
| 6 |
+
from torch.nn import Parameter
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
class Snake(nn.Module):
|
| 10 |
+
'''
|
| 11 |
+
Implementation of a sine-based periodic activation function
|
| 12 |
+
Shape:
|
| 13 |
+
- Input: (B, C, T)
|
| 14 |
+
- Output: (B, C, T), same shape as the input
|
| 15 |
+
Parameters:
|
| 16 |
+
- alpha - trainable parameter
|
| 17 |
+
References:
|
| 18 |
+
- This activation function is from this paper by Liu Ziyin, Tilman Hartwig, Masahito Ueda:
|
| 19 |
+
https://arxiv.org/abs/2006.08195
|
| 20 |
+
Examples:
|
| 21 |
+
>>> a1 = snake(256)
|
| 22 |
+
>>> x = torch.randn(256)
|
| 23 |
+
>>> x = a1(x)
|
| 24 |
+
'''
|
| 25 |
+
def __init__(self, in_features, alpha=1.0, alpha_trainable=True, alpha_logscale=False):
|
| 26 |
+
'''
|
| 27 |
+
Initialization.
|
| 28 |
+
INPUT:
|
| 29 |
+
- in_features: shape of the input
|
| 30 |
+
- alpha: trainable parameter
|
| 31 |
+
alpha is initialized to 1 by default, higher values = higher-frequency.
|
| 32 |
+
alpha will be trained along with the rest of your model.
|
| 33 |
+
'''
|
| 34 |
+
super(Snake, self).__init__()
|
| 35 |
+
self.in_features = in_features
|
| 36 |
+
|
| 37 |
+
# initialize alpha
|
| 38 |
+
self.alpha_logscale = alpha_logscale
|
| 39 |
+
if self.alpha_logscale: # log scale alphas initialized to zeros
|
| 40 |
+
self.alpha = Parameter(torch.zeros(in_features) * alpha)
|
| 41 |
+
else: # linear scale alphas initialized to ones
|
| 42 |
+
self.alpha = Parameter(torch.ones(in_features) * alpha)
|
| 43 |
+
|
| 44 |
+
self.alpha.requires_grad = alpha_trainable
|
| 45 |
+
|
| 46 |
+
self.no_div_by_zero = 0.000000001
|
| 47 |
+
|
| 48 |
+
def forward(self, x):
|
| 49 |
+
'''
|
| 50 |
+
Forward pass of the function.
|
| 51 |
+
Applies the function to the input elementwise.
|
| 52 |
+
Snake ∶= x + 1/a * sin^2 (xa)
|
| 53 |
+
'''
|
| 54 |
+
alpha = self.alpha.unsqueeze(0).unsqueeze(-1) # line up with x to [B, C, T]
|
| 55 |
+
if self.alpha_logscale:
|
| 56 |
+
alpha = torch.exp(alpha)
|
| 57 |
+
x = x + (1.0 / (alpha + self.no_div_by_zero)) * pow(sin(x * alpha), 2)
|
| 58 |
+
|
| 59 |
+
return x
|
| 60 |
+
|
| 61 |
+
|
| 62 |
+
class SnakeBeta(nn.Module):
|
| 63 |
+
'''
|
| 64 |
+
A modified Snake function which uses separate parameters for the magnitude of the periodic components
|
| 65 |
+
Shape:
|
| 66 |
+
- Input: (B, C, T)
|
| 67 |
+
- Output: (B, C, T), same shape as the input
|
| 68 |
+
Parameters:
|
| 69 |
+
- alpha - trainable parameter that controls frequency
|
| 70 |
+
- beta - trainable parameter that controls magnitude
|
| 71 |
+
References:
|
| 72 |
+
- This activation function is a modified version based on this paper by Liu Ziyin, Tilman Hartwig, Masahito Ueda:
|
| 73 |
+
https://arxiv.org/abs/2006.08195
|
| 74 |
+
Examples:
|
| 75 |
+
>>> a1 = snakebeta(256)
|
| 76 |
+
>>> x = torch.randn(256)
|
| 77 |
+
>>> x = a1(x)
|
| 78 |
+
'''
|
| 79 |
+
def __init__(self, in_features, alpha=1.0, alpha_trainable=True, alpha_logscale=False):
|
| 80 |
+
'''
|
| 81 |
+
Initialization.
|
| 82 |
+
INPUT:
|
| 83 |
+
- in_features: shape of the input
|
| 84 |
+
- alpha - trainable parameter that controls frequency
|
| 85 |
+
- beta - trainable parameter that controls magnitude
|
| 86 |
+
alpha is initialized to 1 by default, higher values = higher-frequency.
|
| 87 |
+
beta is initialized to 1 by default, higher values = higher-magnitude.
|
| 88 |
+
alpha will be trained along with the rest of your model.
|
| 89 |
+
'''
|
| 90 |
+
super(SnakeBeta, self).__init__()
|
| 91 |
+
self.in_features = in_features
|
| 92 |
+
|
| 93 |
+
# initialize alpha
|
| 94 |
+
self.alpha_logscale = alpha_logscale
|
| 95 |
+
if self.alpha_logscale: # log scale alphas initialized to zeros
|
| 96 |
+
self.alpha = Parameter(torch.zeros(in_features) * alpha)
|
| 97 |
+
self.bias = Parameter(torch.zeros(in_features) * alpha)
|
| 98 |
+
else: # linear scale alphas initialized to ones
|
| 99 |
+
self.alpha = Parameter(torch.ones(in_features) * alpha)
|
| 100 |
+
self.bias = Parameter(torch.ones(in_features) * alpha)
|
| 101 |
+
|
| 102 |
+
self.alpha.requires_grad = alpha_trainable
|
| 103 |
+
self.bias.requires_grad = alpha_trainable
|
| 104 |
+
|
| 105 |
+
self.no_div_by_zero = 0.000000001
|
| 106 |
+
|
| 107 |
+
def forward(self, x):
|
| 108 |
+
'''
|
| 109 |
+
Forward pass of the function.
|
| 110 |
+
Applies the function to the input elementwise.
|
| 111 |
+
SnakeBeta ∶= x + 1/b * sin^2 (xa)
|
| 112 |
+
'''
|
| 113 |
+
alpha = self.alpha.unsqueeze(0).unsqueeze(-1) # line up with x to [B, C, T]
|
| 114 |
+
beta = self.bias.unsqueeze(0).unsqueeze(-1)
|
| 115 |
+
if self.alpha_logscale:
|
| 116 |
+
alpha = torch.exp(alpha)
|
| 117 |
+
beta = torch.exp(beta)
|
| 118 |
+
x = x + (1.0 / (beta + self.no_div_by_zero)) * pow(sin(x * alpha), 2)
|
| 119 |
+
|
| 120 |
+
return x
|
vq/alias_free_torch/__init__.py
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Adapted from https://github.com/junjun3518/alias-free-torch under the Apache License 2.0
|
| 2 |
+
# LICENSE is in incl_licenses directory.
|
| 3 |
+
|
| 4 |
+
from .filter import *
|
| 5 |
+
from .resample import *
|
| 6 |
+
from .act import *
|