Move everything into the tortoise/ subdirectory

For eventual packaging.
This commit is contained in:
James Betker 2022-05-01 16:24:24 -06:00
parent 33f60ce1e2
commit f7c8decfdb
23 changed files with 30 additions and 35 deletions

View File

@ -1,4 +1,3 @@
import argparse
import os
import random
from urllib import request
@ -8,19 +7,18 @@ import torch.nn.functional as F
import progressbar
import torchaudio
from models.classifier import AudioMiniEncoderWithClassifierHead
from models.cvvp import CVVP
from models.diffusion_decoder import DiffusionTts
from models.autoregressive import UnifiedVoice
from tortoise.models.classifier import AudioMiniEncoderWithClassifierHead
from tortoise.models.cvvp import CVVP
from tortoise.models.diffusion_decoder import DiffusionTts
from tortoise.models.autoregressive import UnifiedVoice
from tqdm import tqdm
from models.arch_util import TorchMelSpectrogram
from models.clvp import CLVP
from models.vocoder import UnivNetGenerator
from utils.audio import load_audio, wav_to_univnet_mel, denormalize_tacotron_mel
from utils.diffusion import SpacedDiffusion, space_timesteps, get_named_beta_schedule
from utils.tokenizer import VoiceBpeTokenizer, lev_distance
from tortoise.models.arch_util import TorchMelSpectrogram
from tortoise.models.clvp import CLVP
from tortoise.models.vocoder import UnivNetGenerator
from tortoise.utils.audio import wav_to_univnet_mel, denormalize_tacotron_mel
from tortoise.utils.diffusion import SpacedDiffusion, space_timesteps, get_named_beta_schedule
from tortoise.utils.tokenizer import VoiceBpeTokenizer
pbar = None

View File

@ -4,7 +4,7 @@ import os
import torchaudio
from api import TextToSpeech
from utils.audio import load_audio, get_voices
from tortoise.utils.audio import load_audio, get_voices
if __name__ == '__main__':
parser = argparse.ArgumentParser()

View File

@ -3,7 +3,7 @@ import os
import torchaudio
from api import TextToSpeech
from utils.audio import load_audio
from tortoise.utils.audio import load_audio
if __name__ == '__main__':
fname = 'Y:\\clips\\books2\\subset512-oco.tsv'

View File

@ -1,7 +1,7 @@
import argparse
from api import classify_audio_clip
from utils.audio import load_audio
from tortoise.utils.audio import load_audio
if __name__ == '__main__':
parser = argparse.ArgumentParser()

View File

@ -5,7 +5,7 @@ import torch
import torch.nn as nn
import torch.nn.functional as F
import torchaudio
from models.xtransformers import ContinuousTransformerWrapper, RelativePositionBias
from tortoise.models.xtransformers import ContinuousTransformerWrapper, RelativePositionBias
def zero_module(module):

View File

@ -6,8 +6,8 @@ import torch.nn.functional as F
from transformers import GPT2Config, GPT2PreTrainedModel, LogitsProcessorList
from transformers.modeling_outputs import CausalLMOutputWithCrossAttentions
from transformers.utils.model_parallel_utils import get_device_map, assert_device_map
from models.arch_util import AttentionBlock
from utils.typical_sampling import TypicalLogitsWarper
from tortoise.models.arch_util import AttentionBlock
from tortoise.utils.typical_sampling import TypicalLogitsWarper
def null_position_embeddings(range, dim):

View File

@ -1,9 +1,8 @@
import torch
import torch.nn as nn
import torch.nn.functional as F
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):

View File

@ -3,9 +3,9 @@ import torch.nn as nn
import torch.nn.functional as F
from torch import einsum
from models.arch_util import CheckpointedXTransformerEncoder
from models.transformer import Transformer
from models.xtransformers import Encoder
from tortoise.models.arch_util import CheckpointedXTransformerEncoder
from tortoise.models.transformer import Transformer
from tortoise.models.xtransformers import Encoder
def exists(val):

View File

@ -4,8 +4,8 @@ import torch.nn.functional as F
from torch import einsum
from torch.utils.checkpoint import checkpoint
from models.arch_util import AttentionBlock
from models.xtransformers import ContinuousTransformerWrapper, Encoder
from tortoise.models.arch_util import AttentionBlock
from tortoise.models.xtransformers import ContinuousTransformerWrapper, Encoder
def exists(val):

View File

@ -7,7 +7,7 @@ import torch.nn as nn
import torch.nn.functional as F
from torch import autocast
from models.arch_util import normalization, AttentionBlock
from tortoise.models.arch_util import normalization, AttentionBlock
def is_latent(t):

View File

@ -2,12 +2,10 @@ import argparse
import os
import torch
import torch.nn.functional as F
import torchaudio
from api import TextToSpeech, format_conditioning
from utils.audio import load_audio, get_voices
from utils.tokenizer import VoiceBpeTokenizer
from api import TextToSpeech
from tortoise.utils.audio import load_audio, get_voices
def split_and_recombine_text(texts, desired_length=200, max_len=300):

View File

@ -4,7 +4,7 @@ import os
if __name__ == '__main__':
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}'
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 + "</tr>"
lines.append(line)
for txt in os.listdir('results/various/'):
for txt in os.listdir('../results/various/'):
if 'desktop' in txt:
continue
line = f'<tr><td>{txt}</td>'
@ -42,7 +42,7 @@ if __name__ == '__main__':
result = result + '\n'.join(lines) + "</table>"
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}'
result = result + f'<audio controls="" style="width: 600px;"><source src="{url}" type="audio/mp3"></audio><br>\n'

View File

@ -4,7 +4,7 @@ from random import shuffle
import torchaudio
from api import TextToSpeech
from utils.audio import load_audio
from tortoise.utils.audio import load_audio
def permutations(args):

View File

View File

@ -6,7 +6,7 @@ import torchaudio
import numpy as np
from scipy.io.wavfile import read
from utils.stft import STFT
from tortoise.utils.stft import STFT
def load_wav_to_torch(full_path):