forked from mrq/tortoise-tts
Merge pull request #3 from osanseviero/main
Misc improvements and packaging
This commit is contained in:
commit
1a41f7f769
|
@ -7,4 +7,6 @@ inflect
|
||||||
progressbar
|
progressbar
|
||||||
einops
|
einops
|
||||||
unidecode
|
unidecode
|
||||||
entmax
|
entmax
|
||||||
|
scipy
|
||||||
|
librosa
|
21
setup.py
Normal file
21
setup.py
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
from setuptools import setup, find_packages
|
||||||
|
|
||||||
|
install_requires = [
|
||||||
|
"torch",
|
||||||
|
"torchaudio",
|
||||||
|
"rotary_embedding_torch",
|
||||||
|
"transformers",
|
||||||
|
"tokenizers",
|
||||||
|
"inflect",
|
||||||
|
"progressbar",
|
||||||
|
"einops",
|
||||||
|
"unidecode",
|
||||||
|
"scipy",
|
||||||
|
"librosa"
|
||||||
|
]
|
||||||
|
|
||||||
|
setup(
|
||||||
|
name="tortoise_tts",
|
||||||
|
packages=find_packages(),
|
||||||
|
install_requires=install_requires,
|
||||||
|
)
|
1
tortoise_tts/__init__.py
Normal file
1
tortoise_tts/__init__.py
Normal file
|
@ -0,0 +1 @@
|
||||||
|
from .api import TextToSpeech
|
|
@ -8,18 +8,18 @@ import torch.nn.functional as F
|
||||||
import progressbar
|
import progressbar
|
||||||
import torchaudio
|
import torchaudio
|
||||||
|
|
||||||
from models.classifier import AudioMiniEncoderWithClassifierHead
|
from tortoise_tts.models.classifier import AudioMiniEncoderWithClassifierHead
|
||||||
from models.cvvp import CVVP
|
from tortoise_tts.models.cvvp import CVVP
|
||||||
from models.diffusion_decoder import DiffusionTts
|
from tortoise_tts.models.diffusion_decoder import DiffusionTts
|
||||||
from models.autoregressive import UnifiedVoice
|
from tortoise_tts.models.autoregressive import UnifiedVoice
|
||||||
from tqdm import tqdm
|
from tqdm import tqdm
|
||||||
|
|
||||||
from models.arch_util import TorchMelSpectrogram
|
from tortoise_tts.models.arch_util import TorchMelSpectrogram
|
||||||
from models.clvp import CLVP
|
from tortoise_tts.models.clvp import CLVP
|
||||||
from models.vocoder import UnivNetGenerator
|
from tortoise_tts.models.vocoder import UnivNetGenerator
|
||||||
from utils.audio import load_audio, wav_to_univnet_mel, denormalize_tacotron_mel
|
from tortoise_tts.utils.audio import load_audio, wav_to_univnet_mel, denormalize_tacotron_mel
|
||||||
from utils.diffusion import SpacedDiffusion, space_timesteps, get_named_beta_schedule
|
from tortoise_tts.utils.diffusion import SpacedDiffusion, space_timesteps, get_named_beta_schedule
|
||||||
from utils.tokenizer import VoiceBpeTokenizer, lev_distance
|
from tortoise_tts.utils.tokenizer import VoiceBpeTokenizer, lev_distance
|
||||||
|
|
||||||
|
|
||||||
pbar = None
|
pbar = None
|
0
tortoise_tts/models/__init__.py
Normal file
0
tortoise_tts/models/__init__.py
Normal file
|
@ -5,7 +5,7 @@ import torch
|
||||||
import torch.nn as nn
|
import torch.nn as nn
|
||||||
import torch.nn.functional as F
|
import torch.nn.functional as F
|
||||||
import torchaudio
|
import torchaudio
|
||||||
from models.xtransformers import ContinuousTransformerWrapper, RelativePositionBias
|
from tortoise_tts.models.xtransformers import ContinuousTransformerWrapper, RelativePositionBias
|
||||||
|
|
||||||
|
|
||||||
def zero_module(module):
|
def zero_module(module):
|
|
@ -6,8 +6,8 @@ import torch.nn.functional as F
|
||||||
from transformers import GPT2Config, GPT2PreTrainedModel, LogitsProcessorList
|
from transformers import GPT2Config, GPT2PreTrainedModel, LogitsProcessorList
|
||||||
from transformers.modeling_outputs import CausalLMOutputWithCrossAttentions
|
from transformers.modeling_outputs import CausalLMOutputWithCrossAttentions
|
||||||
from transformers.utils.model_parallel_utils import get_device_map, assert_device_map
|
from transformers.utils.model_parallel_utils import get_device_map, assert_device_map
|
||||||
from models.arch_util import AttentionBlock
|
from tortoise_tts.models.arch_util import AttentionBlock
|
||||||
from utils.typical_sampling import TypicalLogitsWarper
|
from tortoise_tts.utils.typical_sampling import TypicalLogitsWarper
|
||||||
|
|
||||||
|
|
||||||
def null_position_embeddings(range, dim):
|
def null_position_embeddings(range, dim):
|
|
@ -3,7 +3,7 @@ import torch.nn as nn
|
||||||
import torch.nn.functional as F
|
import torch.nn.functional as F
|
||||||
from torch.utils.checkpoint import checkpoint
|
from torch.utils.checkpoint import checkpoint
|
||||||
|
|
||||||
from models.arch_util import Upsample, Downsample, normalization, zero_module, AttentionBlock
|
from tortoise_tts.models.arch_util import Upsample, Downsample, normalization, zero_module, AttentionBlock
|
||||||
|
|
||||||
|
|
||||||
class ResBlock(nn.Module):
|
class ResBlock(nn.Module):
|
|
@ -3,9 +3,9 @@ import torch.nn as nn
|
||||||
import torch.nn.functional as F
|
import torch.nn.functional as F
|
||||||
from torch import einsum
|
from torch import einsum
|
||||||
|
|
||||||
from models.arch_util import CheckpointedXTransformerEncoder
|
from tortoise_tts.models.arch_util import CheckpointedXTransformerEncoder
|
||||||
from models.transformer import Transformer
|
from tortoise_tts.models.transformer import Transformer
|
||||||
from models.xtransformers import Encoder
|
from tortoise_tts.models.xtransformers import Encoder
|
||||||
|
|
||||||
|
|
||||||
def exists(val):
|
def exists(val):
|
|
@ -4,8 +4,8 @@ import torch.nn.functional as F
|
||||||
from torch import einsum
|
from torch import einsum
|
||||||
from torch.utils.checkpoint import checkpoint
|
from torch.utils.checkpoint import checkpoint
|
||||||
|
|
||||||
from models.arch_util import AttentionBlock
|
from tortoise_tts.models.arch_util import AttentionBlock
|
||||||
from models.xtransformers import ContinuousTransformerWrapper, Encoder
|
from tortoise_tts.models.xtransformers import ContinuousTransformerWrapper, Encoder
|
||||||
|
|
||||||
|
|
||||||
def exists(val):
|
def exists(val):
|
|
@ -7,7 +7,7 @@ import torch.nn as nn
|
||||||
import torch.nn.functional as F
|
import torch.nn.functional as F
|
||||||
from torch import autocast
|
from torch import autocast
|
||||||
|
|
||||||
from models.arch_util import normalization, AttentionBlock
|
from tortoise_tts.models.arch_util import normalization, AttentionBlock
|
||||||
|
|
||||||
|
|
||||||
def is_latent(t):
|
def is_latent(t):
|
0
tortoise_tts/results/__init__.py
Normal file
0
tortoise_tts/results/__init__.py
Normal file
4
tortoise_tts/utils/__init__.py
Normal file
4
tortoise_tts/utils/__init__.py
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
from .audio import (
|
||||||
|
load_audio,
|
||||||
|
get_voices
|
||||||
|
)
|
|
@ -6,7 +6,7 @@ import torchaudio
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from scipy.io.wavfile import read
|
from scipy.io.wavfile import read
|
||||||
|
|
||||||
from utils.stft import STFT
|
from tortoise_tts.utils.stft import STFT
|
||||||
|
|
||||||
|
|
||||||
def load_wav_to_torch(full_path):
|
def load_wav_to_torch(full_path):
|
|
@ -3,6 +3,7 @@ import re
|
||||||
import inflect
|
import inflect
|
||||||
import torch
|
import torch
|
||||||
from tokenizers import Tokenizer
|
from tokenizers import Tokenizer
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
|
||||||
# Regular expression matching whitespace:
|
# Regular expression matching whitespace:
|
||||||
|
@ -165,6 +166,8 @@ def lev_distance(s1, s2):
|
||||||
|
|
||||||
class VoiceBpeTokenizer:
|
class VoiceBpeTokenizer:
|
||||||
def __init__(self, vocab_file='data/tokenizer.json'):
|
def __init__(self, vocab_file='data/tokenizer.json'):
|
||||||
|
vocab_file = str(Path(__file__).parent.parent / Path(vocab_file))
|
||||||
|
print(vocab_file)
|
||||||
if vocab_file is not None:
|
if vocab_file is not None:
|
||||||
self.tokenizer = Tokenizer.from_file(vocab_file)
|
self.tokenizer = Tokenizer.from_file(vocab_file)
|
||||||
|
|
0
tortoise_tts/voices/__init__.py
Normal file
0
tortoise_tts/voices/__init__.py
Normal file
Loading…
Reference in New Issue
Block a user