forked from mrq/tortoise-tts
Move everything into the tortoise/ subdirectory
For eventual packaging.
This commit is contained in:
parent
33f60ce1e2
commit
f7c8decfdb
|
@ -1,4 +1,3 @@
|
||||||
import argparse
|
|
||||||
import os
|
import os
|
||||||
import random
|
import random
|
||||||
from urllib import request
|
from urllib import request
|
||||||
|
@ -8,19 +7,18 @@ import torch.nn.functional as F
|
||||||
import progressbar
|
import progressbar
|
||||||
import torchaudio
|
import torchaudio
|
||||||
|
|
||||||
from models.classifier import AudioMiniEncoderWithClassifierHead
|
from tortoise.models.classifier import AudioMiniEncoderWithClassifierHead
|
||||||
from models.cvvp import CVVP
|
from tortoise.models.cvvp import CVVP
|
||||||
from models.diffusion_decoder import DiffusionTts
|
from tortoise.models.diffusion_decoder import DiffusionTts
|
||||||
from models.autoregressive import UnifiedVoice
|
from tortoise.models.autoregressive import UnifiedVoice
|
||||||
from tqdm import tqdm
|
from tqdm import tqdm
|
||||||
|
|
||||||
from models.arch_util import TorchMelSpectrogram
|
from tortoise.models.arch_util import TorchMelSpectrogram
|
||||||
from models.clvp import CLVP
|
from tortoise.models.clvp import CLVP
|
||||||
from models.vocoder import UnivNetGenerator
|
from tortoise.models.vocoder import UnivNetGenerator
|
||||||
from utils.audio import load_audio, wav_to_univnet_mel, denormalize_tacotron_mel
|
from tortoise.utils.audio import wav_to_univnet_mel, denormalize_tacotron_mel
|
||||||
from utils.diffusion import SpacedDiffusion, space_timesteps, get_named_beta_schedule
|
from tortoise.utils.diffusion import SpacedDiffusion, space_timesteps, get_named_beta_schedule
|
||||||
from utils.tokenizer import VoiceBpeTokenizer, lev_distance
|
from tortoise.utils.tokenizer import VoiceBpeTokenizer
|
||||||
|
|
||||||
|
|
||||||
pbar = None
|
pbar = None
|
||||||
|
|
|
@ -4,7 +4,7 @@ import os
|
||||||
import torchaudio
|
import torchaudio
|
||||||
|
|
||||||
from api import TextToSpeech
|
from api import TextToSpeech
|
||||||
from utils.audio import load_audio, get_voices
|
from tortoise.utils.audio import load_audio, get_voices
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
|
@ -3,7 +3,7 @@ import os
|
||||||
import torchaudio
|
import torchaudio
|
||||||
|
|
||||||
from api import TextToSpeech
|
from api import TextToSpeech
|
||||||
from utils.audio import load_audio
|
from tortoise.utils.audio import load_audio
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
fname = 'Y:\\clips\\books2\\subset512-oco.tsv'
|
fname = 'Y:\\clips\\books2\\subset512-oco.tsv'
|
|
@ -1,7 +1,7 @@
|
||||||
import argparse
|
import argparse
|
||||||
|
|
||||||
from api import classify_audio_clip
|
from api import classify_audio_clip
|
||||||
from utils.audio import load_audio
|
from tortoise.utils.audio import load_audio
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
|
@ -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.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.models.arch_util import AttentionBlock
|
||||||
from utils.typical_sampling import TypicalLogitsWarper
|
from tortoise.utils.typical_sampling import TypicalLogitsWarper
|
||||||
|
|
||||||
|
|
||||||
def null_position_embeddings(range, dim):
|
def null_position_embeddings(range, dim):
|
|
@ -1,9 +1,8 @@
|
||||||
import torch
|
import torch
|
||||||
import torch.nn as nn
|
import torch.nn as nn
|
||||||
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.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.models.arch_util import CheckpointedXTransformerEncoder
|
||||||
from models.transformer import Transformer
|
from tortoise.models.transformer import Transformer
|
||||||
from models.xtransformers import Encoder
|
from tortoise.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.models.arch_util import AttentionBlock
|
||||||
from models.xtransformers import ContinuousTransformerWrapper, Encoder
|
from tortoise.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.models.arch_util import normalization, AttentionBlock
|
||||||
|
|
||||||
|
|
||||||
def is_latent(t):
|
def is_latent(t):
|
|
@ -2,12 +2,10 @@ import argparse
|
||||||
import os
|
import os
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
import torch.nn.functional as F
|
|
||||||
import torchaudio
|
import torchaudio
|
||||||
|
|
||||||
from api import TextToSpeech, format_conditioning
|
from api import TextToSpeech
|
||||||
from utils.audio import load_audio, get_voices
|
from tortoise.utils.audio import load_audio, get_voices
|
||||||
from utils.tokenizer import VoiceBpeTokenizer
|
|
||||||
|
|
||||||
|
|
||||||
def split_and_recombine_text(texts, desired_length=200, max_len=300):
|
def split_and_recombine_text(texts, desired_length=200, max_len=300):
|
|
@ -4,7 +4,7 @@ import os
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
result = "<html><head><title>These words were never spoken.</title></head><body><h1>Handpicked results</h1>"
|
result = "<html><head><title>These words were never spoken.</title></head><body><h1>Handpicked results</h1>"
|
||||||
for fv in os.listdir('results/favorites'):
|
for fv in os.listdir('../results/favorites'):
|
||||||
url = f'https://github.com/neonbjb/tortoise-tts/raw/main/results/favorites/{fv}'
|
url = f'https://github.com/neonbjb/tortoise-tts/raw/main/results/favorites/{fv}'
|
||||||
result = result + f'<audio controls="" style="width: 600px;"><source src="{url}" type="audio/mp3"></audio><br>\n'
|
result = result + f'<audio controls="" style="width: 600px;"><source src="{url}" type="audio/mp3"></audio><br>\n'
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ if __name__ == '__main__':
|
||||||
line = line + f'<td><audio controls="" style="width: 150px;"><source src="{url}" type="audio/mp3"></audio></td>'
|
line = line + f'<td><audio controls="" style="width: 150px;"><source src="{url}" type="audio/mp3"></audio></td>'
|
||||||
line = line + "</tr>"
|
line = line + "</tr>"
|
||||||
lines.append(line)
|
lines.append(line)
|
||||||
for txt in os.listdir('results/various/'):
|
for txt in os.listdir('../results/various/'):
|
||||||
if 'desktop' in txt:
|
if 'desktop' in txt:
|
||||||
continue
|
continue
|
||||||
line = f'<tr><td>{txt}</td>'
|
line = f'<tr><td>{txt}</td>'
|
||||||
|
@ -42,7 +42,7 @@ if __name__ == '__main__':
|
||||||
result = result + '\n'.join(lines) + "</table>"
|
result = result + '\n'.join(lines) + "</table>"
|
||||||
|
|
||||||
result = result + "<h1>Longform result for all voices:</h1>"
|
result = result + "<h1>Longform result for all voices:</h1>"
|
||||||
for lf in os.listdir('results/riding_hood'):
|
for lf in os.listdir('../results/riding_hood'):
|
||||||
url = f'https://github.com/neonbjb/tortoise-tts/raw/main/results/riding_hood/{lf}'
|
url = f'https://github.com/neonbjb/tortoise-tts/raw/main/results/riding_hood/{lf}'
|
||||||
result = result + f'<audio controls="" style="width: 600px;"><source src="{url}" type="audio/mp3"></audio><br>\n'
|
result = result + f'<audio controls="" style="width: 600px;"><source src="{url}" type="audio/mp3"></audio><br>\n'
|
||||||
|
|
|
@ -4,7 +4,7 @@ from random import shuffle
|
||||||
import torchaudio
|
import torchaudio
|
||||||
|
|
||||||
from api import TextToSpeech
|
from api import TextToSpeech
|
||||||
from utils.audio import load_audio
|
from tortoise.utils.audio import load_audio
|
||||||
|
|
||||||
|
|
||||||
def permutations(args):
|
def permutations(args):
|
0
tortoise/utils/__init__.py
Normal file
0
tortoise/utils/__init__.py
Normal file
|
@ -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.utils.stft import STFT
|
||||||
|
|
||||||
|
|
||||||
def load_wav_to_torch(full_path):
|
def load_wav_to_torch(full_path):
|
Loading…
Reference in New Issue
Block a user