freyza commited on
Commit
4911343
1 Parent(s): 9bd61df

Update src/rvc.py

Browse files
Files changed (1) hide show
  1. src/rvc.py +17 -2
src/rvc.py CHANGED
@@ -17,11 +17,25 @@ from vc_infer_pipeline import VC
17
  BASE_DIR = Path(__file__).resolve().parent.parent
18
 
19
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  class Config:
21
  def __init__(self, device, is_half):
22
  self.device = device
23
  self.is_half = is_half
24
- self.n_cpu = 0
25
  self.gpu_name = None
26
  self.gpu_mem = None
27
  self.x_pad, self.x_query, self.x_center, self.x_max = self.device_config()
@@ -68,7 +82,8 @@ class Config:
68
  else:
69
  print("No supported N-card found, use CPU for inference")
70
  self.device = "cpu"
71
- self.is_half = True
 
72
 
73
  if self.n_cpu == 0:
74
  self.n_cpu = cpu_count()
 
17
  BASE_DIR = Path(__file__).resolve().parent.parent
18
 
19
 
20
+ # config cpu
21
+ def use_fp32_config():
22
+ for config_file in [
23
+ "32k.json",
24
+ "40k.json",
25
+ "48k.json",
26
+ "48k_v2.json",
27
+ "32k_v2.json",
28
+ ]:
29
+ with open(f"src/configs/{config_file}", "r") as f:
30
+ strr = f.read().replace("true", "false")
31
+ with open(f"src/configs/{config_file}", "w") as f:
32
+ f.write(strr)
33
+
34
  class Config:
35
  def __init__(self, device, is_half):
36
  self.device = device
37
  self.is_half = is_half
38
+ self.n_cpu = 2 # set cpu cores
39
  self.gpu_name = None
40
  self.gpu_mem = None
41
  self.x_pad, self.x_query, self.x_center, self.x_max = self.device_config()
 
82
  else:
83
  print("No supported N-card found, use CPU for inference")
84
  self.device = "cpu"
85
+ self.is_half = False
86
+ use_fp32_config() # cpu config
87
 
88
  if self.n_cpu == 0:
89
  self.n_cpu = cpu_count()