kevinwang676 commited on
Commit
ed9bc62
1 Parent(s): d16f51d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -2
app.py CHANGED
@@ -361,7 +361,7 @@ def load_hubert():
361
  hubert_model = hubert_model.float()
362
  hubert_model.eval()
363
  '''
364
-
365
  def load_hubert():
366
  global hubert_model
367
 
@@ -376,7 +376,7 @@ def load_hubert():
376
  hubert_model.load_state_dict(state_dict['model'])
377
 
378
  # Move the model to the desired device
379
- hubert_model = hubert_model.to("cuda:0")
380
 
381
  # Set the model to half precision if required
382
  if config.is_half:
@@ -388,6 +388,21 @@ def load_hubert():
388
  hubert_model.eval()
389
 
390
  load_hubert()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
391
 
392
  def rvc_models(model_name):
393
  global vc, net_g, index_files, tgt_sr, version
 
361
  hubert_model = hubert_model.float()
362
  hubert_model.eval()
363
  '''
364
+ '''
365
  def load_hubert():
366
  global hubert_model
367
 
 
376
  hubert_model.load_state_dict(state_dict['model'])
377
 
378
  # Move the model to the desired device
379
+ hubert_model = hubert_model.to("cpu")
380
 
381
  # Set the model to half precision if required
382
  if config.is_half:
 
388
  hubert_model.eval()
389
 
390
  load_hubert()
391
+ '''
392
+ from fairseq import checkpoint_utils
393
+
394
+ global hubert_model
395
+ models, _, _ = checkpoint_utils.load_model_ensemble_and_task(
396
+ ["hubert_base.pt"],
397
+ suffix="",
398
+ )
399
+ hubert_model = models[0]
400
+ hubert_model = hubert_model.to(config.device)
401
+ if config.is_half:
402
+ hubert_model = hubert_model.half()
403
+ else:
404
+ hubert_model = hubert_model.float()
405
+ hubert_model.eval()
406
 
407
  def rvc_models(model_name):
408
  global vc, net_g, index_files, tgt_sr, version