mirror of
https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI.git
synced 2025-02-12 16:42:54 +08:00
Update config.py
This commit is contained in:
parent
28948f8961
commit
79a79c3b99
22
config.py
22
config.py
@ -2,6 +2,16 @@ import argparse
|
|||||||
import torch
|
import torch
|
||||||
from multiprocessing import cpu_count
|
from multiprocessing import cpu_count
|
||||||
|
|
||||||
|
def config_file_change_fp32():
|
||||||
|
for config_file in ["32k.json", "40k.json", "48k.json"]:
|
||||||
|
with open(f"configs/{config_file}", "r") as f:
|
||||||
|
strr = f.read().replace("true", "false")
|
||||||
|
with open(f"configs/{config_file}", "w") as f:
|
||||||
|
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)
|
||||||
|
|
||||||
class Config:
|
class Config:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
@ -60,15 +70,7 @@ class Config:
|
|||||||
):
|
):
|
||||||
print("16系/10系显卡和P40强制单精度")
|
print("16系/10系显卡和P40强制单精度")
|
||||||
self.is_half = False
|
self.is_half = False
|
||||||
for config_file in ["32k.json", "40k.json", "48k.json"]:
|
config_file_change_fp32()
|
||||||
with open(f"configs/{config_file}", "r") as f:
|
|
||||||
strr = f.read().replace("true", "false")
|
|
||||||
with open(f"configs/{config_file}", "w") as f:
|
|
||||||
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:
|
else:
|
||||||
self.gpu_name = None
|
self.gpu_name = None
|
||||||
self.gpu_mem = int(
|
self.gpu_mem = int(
|
||||||
@ -87,10 +89,12 @@ class Config:
|
|||||||
print("没有发现支持的N卡, 使用MPS进行推理")
|
print("没有发现支持的N卡, 使用MPS进行推理")
|
||||||
self.device = "mps"
|
self.device = "mps"
|
||||||
self.is_half = False
|
self.is_half = False
|
||||||
|
config_file_change_fp32()
|
||||||
else:
|
else:
|
||||||
print("没有发现支持的N卡, 使用CPU进行推理")
|
print("没有发现支持的N卡, 使用CPU进行推理")
|
||||||
self.device = "cpu"
|
self.device = "cpu"
|
||||||
self.is_half = False
|
self.is_half = False
|
||||||
|
config_file_change_fp32()
|
||||||
|
|
||||||
if self.n_cpu == 0:
|
if self.n_cpu == 0:
|
||||||
self.n_cpu = cpu_count()
|
self.n_cpu = cpu_count()
|
||||||
|
Loading…
Reference in New Issue
Block a user