mirror of
https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI.git
synced 2025-04-26 06:28:59 +08:00
Update config.py
This commit is contained in:
parent
69ea94609b
commit
8370356d95
19
config.py
19
config.py
@ -53,7 +53,7 @@ class Config:
|
|||||||
i_device = int(self.device.split(":")[-1])
|
i_device = int(self.device.split(":")[-1])
|
||||||
self.gpu_name = torch.cuda.get_device_name(i_device)
|
self.gpu_name = torch.cuda.get_device_name(i_device)
|
||||||
if (
|
if (
|
||||||
"16" in self.gpu_name
|
("16" in gpu_name and "V100"not in gpu_name.upper())
|
||||||
or "P40" in self.gpu_name.upper()
|
or "P40" in self.gpu_name.upper()
|
||||||
or "1070" in self.gpu_name
|
or "1070" in self.gpu_name
|
||||||
or "1080" in self.gpu_name
|
or "1080" in self.gpu_name
|
||||||
@ -61,9 +61,16 @@ class Config:
|
|||||||
print("16系显卡强制单精度")
|
print("16系显卡强制单精度")
|
||||||
self.is_half = False
|
self.is_half = False
|
||||||
for config_file in ["32k.json", "40k.json", "48k.json"]:
|
for config_file in ["32k.json", "40k.json", "48k.json"]:
|
||||||
with open(f"configs/{config_file}", "r+") as f:
|
with open(f"configs/{config_file}", "r") as f:
|
||||||
strr = f.read().replace("true", "false")
|
strr = f.read().replace("true", "false")
|
||||||
|
with open(f"configs/{config_file}", "w") as f:
|
||||||
f.write(strr)
|
f.write(strr)
|
||||||
|
with open("trainset_preprocess_pipeline_print.py", "r") as f:
|
||||||
|
strr = f.read().replace("3.7", "3.0")
|
||||||
|
with open("trainset_preprocess_pipeline_print.py", "w") as f:
|
||||||
|
f.write(strr)
|
||||||
|
else:
|
||||||
|
self.gpu_name = None
|
||||||
self.gpu_mem = int(
|
self.gpu_mem = int(
|
||||||
torch.cuda.get_device_properties(i_device).total_memory
|
torch.cuda.get_device_properties(i_device).total_memory
|
||||||
/ 1024
|
/ 1024
|
||||||
@ -72,17 +79,17 @@ class Config:
|
|||||||
+ 0.4
|
+ 0.4
|
||||||
)
|
)
|
||||||
if self.gpu_mem <= 4:
|
if self.gpu_mem <= 4:
|
||||||
with open("trainset_preprocess_pipeline_print.py", "r+") as f:
|
with open("trainset_preprocess_pipeline_print.py", "r") as f:
|
||||||
strr = f.read().replace("3.7", "3.0")
|
strr = f.read().replace("3.7", "3.0")
|
||||||
|
with open("trainset_preprocess_pipeline_print.py", "w") as f:
|
||||||
f.write(strr)
|
f.write(strr)
|
||||||
else:
|
|
||||||
self.gpu_name = None
|
|
||||||
elif torch.backends.mps.is_available():
|
elif torch.backends.mps.is_available():
|
||||||
print("没有发现支持的N卡, 使用MPS进行推理")
|
print("没有发现支持的N卡, 使用MPS进行推理")
|
||||||
self.device = "mps"
|
self.device = "mps"
|
||||||
else:
|
else:
|
||||||
print("没有发现支持的N卡, 使用CPU进行推理")
|
print("没有发现支持的N卡, 使用CPU进行推理")
|
||||||
self.device = "cpu"
|
self.device = "cpu"
|
||||||
|
self.is_half = True
|
||||||
|
|
||||||
if self.n_cpu == 0:
|
if self.n_cpu == 0:
|
||||||
self.n_cpu = cpu_count()
|
self.n_cpu = cpu_count()
|
||||||
@ -100,7 +107,7 @@ class Config:
|
|||||||
x_center = 38
|
x_center = 38
|
||||||
x_max = 41
|
x_max = 41
|
||||||
|
|
||||||
if self.gpu_name != None and self.gpu_mem <= 4:
|
if self.gpu_mem != None and self.gpu_mem <= 4:
|
||||||
x_pad = 1
|
x_pad = 1
|
||||||
x_query = 5
|
x_query = 5
|
||||||
x_center = 30
|
x_center = 30
|
||||||
|
Loading…
x
Reference in New Issue
Block a user