r3gm commited on
Commit
a71eaf9
1 Parent(s): 3bf636a

Update src/rvc.py

Browse files
Files changed (1) hide show
  1. src/rvc.py +16 -1
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()
@@ -69,6 +83,7 @@ class Config:
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"configs/{config_file}", "r") as f:
30
+ strr = f.read().replace("true", "false")
31
+ with open(f"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()
 
83
  print("No supported N-card found, use CPU for inference")
84
  self.device = "cpu"
85
  self.is_half = True
86
+ use_fp32_config() # cpu config
87
 
88
  if self.n_cpu == 0:
89
  self.n_cpu = cpu_count()