more arbitrary fixes

This commit is contained in:
James Betker 2022-03-17 17:45:44 -06:00
parent c14fc003ed
commit c5000420f6
3 changed files with 14 additions and 10 deletions

View File

@ -1,6 +1,7 @@
import argparse
import functools
import os
import sys
from multiprocessing.pool import ThreadPool
import torch
@ -54,13 +55,17 @@ def process_subdir(subdir, options, clip_sz):
clips = []
for path in paths:
clip = load_audio(str(path), 22050)
padding = clip_sz - clip.shape[1]
if padding > 0:
clip = F.pad(clip, (0, padding))
elif padding < 0:
clip = clip[:, :clip_sz]
clips.append(clip)
try:
clip = load_audio(str(path), 22050)
padding = clip_sz - clip.shape[1]
if padding > 0:
clip = F.pad(clip, (0, padding))
elif padding < 0:
clip = clip[:, :clip_sz]
clips.append(clip)
except:
print(f"Error processing {path}. Recovering gracefully.")
print(sys.exc_info())
sims = None
while len(clips) > 0:
stacked = torch.stack(clips[:256], dim=0).cuda()
@ -101,7 +106,7 @@ if __name__ == '__main__':
"""
parser = argparse.ArgumentParser()
parser.add_argument('-o', type=str, help='Path to the options YAML file used to train the CLIP model', default='../options/train_voice_voice_clip.yml')
parser.add_argument('--num_workers', type=int, help='Number concurrent processes to use', default=6)
parser.add_argument('--num_workers', type=int, help='Number concurrent processes to use', default=2)
parser.add_argument('--root_path', type=str, help='Root path to search for audio directories from', default='Y:\\filtered\\big_podcast')
parser.add_argument('--clip_size', type=int, help='Amount of audio samples to pull from each file', default=22050)
args = parser.parse_args()

View File

@ -6,7 +6,7 @@ import trainer.eval.evaluator as evaluator
# Evaluate how close to true Gaussian a flow network predicts in a "normal" pass given a LQ/HQ image pair.
from data.images.image_folder_dataset import ImageFolderDataset
from models.image_generation.srflow import GaussianDiag
from models.image_generation.srflow.flow import GaussianDiag
class FlowGaussianNll(evaluator.Evaluator):

View File

@ -6,7 +6,6 @@ from tqdm import tqdm
import trainer.eval.evaluator as evaluator
from data.images.image_pair_with_corresponding_points_dataset import ImagePairWithCorrespondingPointsDataset
from models.segformer.segformer import Segformer
# Uses two datasets: a "similar" and "dissimilar" dataset, each of which contains pairs of images and similar/dissimilar