jhtonyKoo commited on
Commit
9e76a90
1 Parent(s): 77a1faa

Update inference/style_transfer.py

Browse files
Files changed (1) hide show
  1. inference/style_transfer.py +3 -27
inference/style_transfer.py CHANGED
@@ -70,9 +70,6 @@ class Mixing_Style_Transfer_Inference:
70
  num_workers=args.workers, \
71
  drop_last=False)
72
 
73
- # save current arguments
74
- self.save_args(args)
75
-
76
  ''' check stem-wise result '''
77
  if not self.args.do_not_separate:
78
  os.environ['MKL_THREADING_LAYER'] = 'GNU'
@@ -267,8 +264,8 @@ class Mixing_Style_Transfer_Inference:
267
  sf.write(os.path.join(cur_out_dir, f"{cur_inst_name}_{output_name_tag}.wav"), fin_data_out_inst.transpose(-1, -2), self.args.sample_rate, 'PCM_16')
268
  # remix
269
  fin_data_out_mix = sum(inst_outputs)
270
- fin_output_path = os.path.join(cur_out_dir, f"mixture_{output_name_tag}.wav")
271
- sf.write(fin_output_path, fin_data_out_mix.transpose(-1, -2), self.args.sample_rate, 'PCM_16')
272
 
273
  return fin_output_path
274
 
@@ -304,28 +301,7 @@ class Mixing_Style_Transfer_Inference:
304
  return whole_batch_data
305
 
306
 
307
- # save current inference arguments
308
- def save_args(self, params):
309
- info = '\n[args]\n'
310
- for sub_args in parser._action_groups:
311
- if sub_args.title in ['positional arguments', 'optional arguments', 'options']:
312
- continue
313
- size_sub = len(sub_args._group_actions)
314
- info += f' {sub_args.title} ({size_sub})\n'
315
- for i, arg in enumerate(sub_args._group_actions):
316
- prefix = '-'
317
- info += f' {prefix} {arg.dest:20s}: {getattr(params, arg.dest)}\n'
318
- info += '\n'
319
-
320
- os.makedirs(self.output_dir, exist_ok=True)
321
- record_path = f"{self.output_dir}style_transfer_inference_configurations.txt"
322
- f = open(record_path, 'w')
323
- np.savetxt(f, [info], delimiter=" ", fmt="%s")
324
- f.close()
325
-
326
-
327
-
328
- def set_up():
329
  os.environ['MASTER_ADDR'] = '127.0.0.1'
330
  os.environ["CUDA_VISIBLE_DEVICES"] = '0'
331
  os.environ['MASTER_PORT'] = '8888'
 
70
  num_workers=args.workers, \
71
  drop_last=False)
72
 
 
 
 
73
  ''' check stem-wise result '''
74
  if not self.args.do_not_separate:
75
  os.environ['MKL_THREADING_LAYER'] = 'GNU'
 
264
  sf.write(os.path.join(cur_out_dir, f"{cur_inst_name}_{output_name_tag}.wav"), fin_data_out_inst.transpose(-1, -2), self.args.sample_rate, 'PCM_16')
265
  # remix
266
  fin_data_out_mix = sum(inst_outputs)
267
+ fin_output_path = os.path.join(cur_out_dir, f"mixture_{output_name_tag}.wav"
268
+ sf.write(fin_output_path), fin_data_out_mix.transpose(-1, -2), self.args.sample_rate, 'PCM_16')
269
 
270
  return fin_output_path
271
 
 
301
  return whole_batch_data
302
 
303
 
304
+ def set_up()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
305
  os.environ['MASTER_ADDR'] = '127.0.0.1'
306
  os.environ["CUDA_VISIBLE_DEVICES"] = '0'
307
  os.environ['MASTER_PORT'] = '8888'