In [689]:
# good 160 unit *3 network
network_model = "func-28-1-3"
iter1 = 213750
iter2 = 23550
codec = 3200
model_type = 'functional'
output_fn_postfix1 = "output_" + str(0) + "_" + str(iter1)
output_fn_postfix1_mid = "output_" + str(1) + "_" + str(iter1)
output_fn_postfix2 = "output_" + str(0) + "_" + str(iter2)
output_fn_postfix2_mid = "output_" + str(1) + "_" + str(iter2)
from subprocess import check_output, call
import os
import json
home = os.environ.get('HOME')
if codec==3200:
codec_sub = '-3200'
else:
codec_sub = ''
os.chdir(home + "/store/c2gen/notebooks")
cb = home + "/store/c2gen/out/"+network_model+"/out-c2cb-"+str(output_fn_postfix1)
call(["bash", home + "/store/c2gen/c2towav.sh", cb ])
cb = home + "/store/c2gen/out/"+network_model+"/out-c2cb-"+str(output_fn_postfix1_mid)
call(["bash", home + "/store/c2gen/c2towav.sh", cb ])
cb = home + "/store/c2gen/out/"+network_model+"/out-c2cb-"+str(iter2)
call(["bash", home + "/store/c2gen/c2towav.sh", cb ])
import network_data as nd
from IPython.display import display, Markdown, Audio, Image
nh = home + "/store/c2gen/out/"+network_model+"/log"
if os.path.isfile(nh):
with open(nh) as f:
res = f.readlines()
print(str.join("",res[-12:]))
try:
res = check_output(["tail", '-n 1', home + "/store/c2gen/nohup/"+network_model+".out"])
except:
try:
res = check_output(["tail", '-n 1', home + "/store/c2gen/nohup-"+network_model+".out"])
except:
res = ''
if res != '':
res = str(res).replace('\\n', "\n")
res = str(res).replace('\\r', "\n")
res = str(res).replace('\\x08', "")
res = res.split("\n")[-1]
print(res)
In [690]:
with open(home + "/store/c2gen/out/"+network_model+"/config.json") as f:
config = j = json.load(f)
for k,v in j.items():
print(k,": ",v)
In [691]:
try:
with open(home + "/store/c2gen/out/" + network_model + '/notes.md', 'r') as fh:
display(Markdown(fh.read()))
except:
print("no markdown file found")
In [692]:
if model_type != 'functional':
nd.model_config(network_model)
In [693]:
nd.plot_training_loss(network_model, 'mean abs', columns=['generator_TD_Dense_0_loss', 'model_2_loss_2', 'model_2_loss_1', 'loss'], weights=[20,1,1,10], start_index=0, y_max=4)
In [694]:
with open(home + "/store/c2gen/out/"+network_model+"/training.log") as f:
rl = f.readlines()
print(str.join("",rl[0:1]))
print(str.join("",rl[-10:]))
with open(home + "/store/c2gen/out/"+network_model+"/gen_counter") as f:
latest_iter = (int(f.readlines()[0]))
print(latest_iter)
In [695]:
try:
print("Latest Iteration:", latest_iter)
output_fn_postfix = "output_" + str(0) + "_" + str(latest_iter)
output_fn_postfix_mid = "output_" + str(1) + "_" + str(latest_iter)
chart_postfix = output_fn_postfix
nd.plot_codec_params(network_model,chart_postfix, scale_up='orig')
nd.plot_codec_params(network_model,chart_postfix, scale_up='full', test_data_fn=config['test_data_fn'], test_seed_start=config['seed_start_index'])
nd.plot_spec_params(network_model,chart_postfix, params='Voicing')
nd.plot_spec_params(network_model,chart_postfix, params='Wo')
nd.plot_spec_params(network_model,chart_postfix, params='E')
nd.plot_spec_params(network_model,chart_postfix, params='LSPs', lsp_param=[0], test_data_fn=config['test_data_fn'], test_seed_start=config['seed_start_index'])
except FileNotFoundError:
print("File not found")
In [696]:
cb = home + "/store/c2gen/out/"+network_model+"/out-c2cb-"+str(output_fn_postfix)
call(["bash", home + "/store/c2gen/c2towav.sh", cb ])
try:
nd.plot_audio_waveform(network_model, output_fn_postfix)
display(Audio(filename=home + "/store/c2gen/out/"+network_model+"/out-c2cb-"+str(output_fn_postfix)+codec_sub+".wav"))
except FileNotFoundError:
print("file not found")
print()
In [697]:
cb = home + "/store/c2gen/out/"+network_model+"/out-c2cb-"+str(output_fn_postfix_mid)
call(["bash", home + "/store/c2gen/c2towav.sh", cb ])
try:
nd.plot_audio_waveform(network_model, output_fn_postfix_mid)
display(Audio(filename=home + "/store/c2gen/out/"+network_model+"/out-c2cb-"+str(output_fn_postfix_mid)+codec_sub+".wav"))
except FileNotFoundError:
print("file not found")
print()
In [698]:
print(output_fn_postfix1)
nd.plot_codec_params(network_model,output_fn_postfix1, scale_up='orig')
nd.plot_spec_params(network_model,output_fn_postfix1, params='Voicing')
nd.plot_spec_params(network_model,output_fn_postfix1, params='Wo')
nd.plot_spec_params(network_model,output_fn_postfix1, params='E')
nd.plot_spec_params(network_model,output_fn_postfix1, params='LSPs')
In [ ]:
nd.plot_audio_waveform(network_model, output_fn_postfix1)
Listen to the WAV file
In [ ]:
display(Audio(filename=home + "/store/c2gen/out/"+network_model+"/out-c2cb-"+str(output_fn_postfix1)+codec_sub+".wav"))
In [ ]:
nd.plot_audio_waveform(network_model, output_fn_postfix1_mid)
In [ ]:
display(Audio(filename=home + "/store/c2gen/out/"+network_model+"/out-c2cb-"+str(output_fn_postfix1_mid)+codec_sub+".wav"))
In [ ]:
nd.plot_codec_params(network_model,output_fn_postfix2, scale_up=True)
nd.plot_spec_params(network_model,output_fn_postfix2, params='Voicing')
nd.plot_spec_params(network_model,output_fn_postfix2, params='Wo')
nd.plot_spec_params(network_model,output_fn_postfix2, params='E')
nd.plot_spec_params(network_model,output_fn_postfix2, params='LSPs')
In [ ]:
nd.plot_audio_waveform(network_model, output_fn_postfix2)
Listen to the WAV file
In [ ]:
display(Audio(filename=home + "/store/c2gen/out/"+network_model+"/out-c2cb-"+str(output_fn_postfix2)+codec_sub+".wav"))