1
0
mirror of synced 2025-01-31 20:05:20 +01:00

Update config.py

This commit is contained in:
RVC-Boss 2023-05-21 03:30:27 +00:00 committed by GitHub
parent 28948f8961
commit 79a79c3b99
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,6 +2,16 @@ import argparse
import torch
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:
def __init__(self):
@ -60,15 +70,7 @@ class Config:
):
print("16系/10系显卡和P40强制单精度")
self.is_half = False
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)
config_file_change_fp32()
else:
self.gpu_name = None
self.gpu_mem = int(
@ -87,10 +89,12 @@ class Config:
print("没有发现支持的N卡, 使用MPS进行推理")
self.device = "mps"
self.is_half = False
config_file_change_fp32()
else:
print("没有发现支持的N卡, 使用CPU进行推理")
self.device = "cpu"
self.is_half = False
config_file_change_fp32()
if self.n_cpu == 0:
self.n_cpu = cpu_count()