WinWut commited on
Commit
d483d19
·
1 Parent(s): 63365f5

Update model.py

Browse files
Files changed (1) hide show
  1. model.py +7 -3
model.py CHANGED
@@ -585,9 +585,10 @@ def update_lr(lr):
585
  opt_disc.learning_rate = lr
586
 
587
  #Build models and initialize optimizers
 
588
  #If load_model=True, specify the path where the models are saved
589
 
590
- gen,critic,siam, [opt_gen,opt_disc] = get_networks(shape, load_model=True,path="MELGANVC-0.4886211-0.5750153-0")
591
 
592
  #After Training, use these functions to convert data with the generator and save the results
593
 
@@ -635,7 +636,10 @@ def towave(spec, name, path='../content/', show=False):
635
  abwv = deprep(ab)
636
  print('Saving...')
637
  pathfin = f'{path}/{name}'
638
- os.mkdir(pathfin)
 
 
 
639
  sf.write(pathfin+'/AB.wav', abwv, sr)
640
  sf.write(pathfin+'/A.wav', awv, sr)
641
  print('Saved WAV!')
@@ -650,4 +654,4 @@ def towave(spec, name, path='../content/', show=False):
650
  axs[1].axis('off')
651
  axs[1].set_title('Generated')
652
  plt.show()
653
- return abwv
 
585
  opt_disc.learning_rate = lr
586
 
587
  #Build models and initialize optimizers
588
+ load_model_path='MELGANVC-0.4886211-0.5750153-0-20230612T163214Z-001\MELGANVC-0.4886211-0.5750153-0' #@param {type:"string"}
589
  #If load_model=True, specify the path where the models are saved
590
 
591
+ gen,critic,siam, [opt_gen,opt_disc] = get_networks(shape, load_model=True,path=load_model_path)
592
 
593
  #After Training, use these functions to convert data with the generator and save the results
594
 
 
636
  abwv = deprep(ab)
637
  print('Saving...')
638
  pathfin = f'{path}/{name}'
639
+ try:
640
+ os.mkdir(pathfin)
641
+ except:
642
+ pass
643
  sf.write(pathfin+'/AB.wav', abwv, sr)
644
  sf.write(pathfin+'/A.wav', awv, sr)
645
  print('Saved WAV!')
 
654
  axs[1].axis('off')
655
  axs[1].set_title('Generated')
656
  plt.show()
657
+ return abwv