helloWorld199 commited on
Commit
3693dff
1 Parent(s): 3e80b7b

device changed to cpu

Browse files
Files changed (1) hide show
  1. src/main.py +11 -4
src/main.py CHANGED
@@ -193,9 +193,9 @@ def preprocess_song(song_input, mdx_model_params, song_id, is_webui, input_type,
193
  def voice_change(voice_model, vocals_path, output_path, pitch_change, f0_method, index_rate, filter_radius, rms_mix_rate, protect, crepe_hop_length, is_webui):
194
  rvc_model_path, rvc_index_path = get_rvc_model(voice_model, is_webui)
195
  device = 'cpu'
196
- config = Config(device, False)
197
  hubert_model = load_hubert(device, config.is_half, os.path.join(rvc_models_dir, 'hubert_base.pt'))
198
- cpt, version, net_g, tgt_sr, vc = get_vc(device, False, config, rvc_model_path)
199
 
200
  # convert main vocals
201
  rvc_infer(rvc_index_path, index_rate, vocals_path, output_path, pitch_change, f0_method, cpt, version, net_g, filter_radius, tgt_sr, rms_mix_rate, protect, crepe_hop_length, vc, hubert_model)
@@ -310,8 +310,10 @@ def song_cover_pipeline(song_input, voice_model, pitch_change, keep_files,
310
  if file and os.path.exists(file):
311
  os.remove(file)
312
 
313
- return ai_cover_path
314
 
 
 
315
  except Exception as e:
316
  raise_exception(str(e), is_webui)
317
 
@@ -343,7 +345,7 @@ if __name__ == '__main__':
343
  if not os.path.exists(os.path.join(rvc_models_dir, rvc_dirname)):
344
  raise Exception(f'The folder {os.path.join(rvc_models_dir, rvc_dirname)} does not exist.')
345
 
346
- cover_path = song_cover_pipeline(args.song_input, rvc_dirname, args.pitch_change, args.keep_files,
347
  main_gain=args.main_vol, backup_gain=args.backup_vol, inst_gain=args.inst_vol,
348
  index_rate=args.index_rate, filter_radius=args.filter_radius,
349
  rms_mix_rate=args.rms_mix_rate, f0_method=args.pitch_detection_algo,
@@ -353,3 +355,8 @@ if __name__ == '__main__':
353
  reverb_dry=args.reverb_dryness, reverb_damping=args.reverb_damping,
354
  output_format=args.output_format)
355
  print(f'[+] Cover generated at {cover_path}')
 
 
 
 
 
 
193
  def voice_change(voice_model, vocals_path, output_path, pitch_change, f0_method, index_rate, filter_radius, rms_mix_rate, protect, crepe_hop_length, is_webui):
194
  rvc_model_path, rvc_index_path = get_rvc_model(voice_model, is_webui)
195
  device = 'cpu'
196
+ config = Config(device, True)
197
  hubert_model = load_hubert(device, config.is_half, os.path.join(rvc_models_dir, 'hubert_base.pt'))
198
+ cpt, version, net_g, tgt_sr, vc = get_vc(device, config.is_half, config, rvc_model_path)
199
 
200
  # convert main vocals
201
  rvc_infer(rvc_index_path, index_rate, vocals_path, output_path, pitch_change, f0_method, cpt, version, net_g, filter_radius, tgt_sr, rms_mix_rate, protect, crepe_hop_length, vc, hubert_model)
 
310
  if file and os.path.exists(file):
311
  os.remove(file)
312
 
313
+ # Returning the stems: AI cover, original vocal, original instrumental, AI generated vocal
314
 
315
+ return ai_cover_path, vocals_path, instrumentals_path, ai_vocals_path
316
+
317
  except Exception as e:
318
  raise_exception(str(e), is_webui)
319
 
 
345
  if not os.path.exists(os.path.join(rvc_models_dir, rvc_dirname)):
346
  raise Exception(f'The folder {os.path.join(rvc_models_dir, rvc_dirname)} does not exist.')
347
 
348
+ cover_path, original_vocals, original_instrumentals, ai_vocals= song_cover_pipeline(args.song_input, rvc_dirname, args.pitch_change, args.keep_files,
349
  main_gain=args.main_vol, backup_gain=args.backup_vol, inst_gain=args.inst_vol,
350
  index_rate=args.index_rate, filter_radius=args.filter_radius,
351
  rms_mix_rate=args.rms_mix_rate, f0_method=args.pitch_detection_algo,
 
355
  reverb_dry=args.reverb_dryness, reverb_damping=args.reverb_damping,
356
  output_format=args.output_format)
357
  print(f'[+] Cover generated at {cover_path}')
358
+ print(f'[+] Original vocals at {original_vocals}')
359
+ print(f'[+] Original instrumentals at {original_instrumentals}')
360
+ print(f'[+] AI vocals at {ai_vocals}')
361
+
362
+