forked from mrq/ai-voice-cloning
wrap checking for metadata when adding a voice in case it throws an error
This commit is contained in:
parent
b6f7aa6264
commit
ed2cf9f5ee
14
src/utils.py
14
src/utils.py
|
@ -490,6 +490,17 @@ def stop_training():
|
|||
training_process.kill()
|
||||
return "Training cancelled"
|
||||
|
||||
def convert_to_halfp():
|
||||
autoregressive_model_path = get_model_path('autoregressive.pth')
|
||||
model = torch.load(autoregressive_model_path)
|
||||
for k in model:
|
||||
if re.findall(r'\.weight$', k):
|
||||
print(f"Converting: {k}")
|
||||
model[k] = model[k].half()
|
||||
|
||||
torch.save(model, './models/tortoise/autoregressive_half.pth')
|
||||
print('Converted model to half precision: ./models/tortoise/autoregressive_half.pth')
|
||||
|
||||
def prepare_dataset( files, outdir, language=None, progress=None ):
|
||||
unload_tts()
|
||||
|
||||
|
@ -961,6 +972,7 @@ def read_generate_settings(file, read_latents=True):
|
|||
if isinstance(file, list) and len(file) == 1:
|
||||
file = file[0]
|
||||
|
||||
try:
|
||||
if file is not None:
|
||||
if hasattr(file, 'name'):
|
||||
file = file.name
|
||||
|
@ -972,6 +984,8 @@ def read_generate_settings(file, read_latents=True):
|
|||
elif file[-5:] == ".json":
|
||||
with open(file, 'r') as f:
|
||||
j = json.load(f)
|
||||
except Exception as e:
|
||||
pass
|
||||
|
||||
if j is None:
|
||||
print("No metadata found in audio file to read")
|
||||
|
|
Loading…
Reference in New Issue
Block a user