fix: config
Browse files
config.py
CHANGED
@@ -2,19 +2,6 @@ import argparse
|
|
2 |
import torch
|
3 |
from multiprocessing import cpu_count
|
4 |
|
5 |
-
|
6 |
-
def config_file_change_fp32():
|
7 |
-
for config_file in ["32k.json", "40k.json", "48k.json"]:
|
8 |
-
with open(f"configs/{config_file}", "r") as f:
|
9 |
-
strr = f.read().replace("true", "false")
|
10 |
-
with open(f"configs/{config_file}", "w") as f:
|
11 |
-
f.write(strr)
|
12 |
-
with open("trainset_preprocess_pipeline_print.py", "r") as f:
|
13 |
-
strr = f.read().replace("3.7", "3.0")
|
14 |
-
with open("trainset_preprocess_pipeline_print.py", "w") as f:
|
15 |
-
f.write(strr)
|
16 |
-
|
17 |
-
|
18 |
class Config:
|
19 |
def __init__(self):
|
20 |
self.device = "cuda:0"
|
@@ -75,7 +62,6 @@ class Config:
|
|
75 |
):
|
76 |
print("16系/10系显卡和P40强制单精度")
|
77 |
self.is_half = False
|
78 |
-
config_file_change_fp32()
|
79 |
else:
|
80 |
self.gpu_name = None
|
81 |
self.gpu_mem = int(
|
@@ -86,20 +72,15 @@ class Config:
|
|
86 |
+ 0.4
|
87 |
)
|
88 |
if self.gpu_mem <= 4:
|
89 |
-
|
90 |
-
strr = f.read().replace("3.7", "3.0")
|
91 |
-
with open("trainset_preprocess_pipeline_print.py", "w") as f:
|
92 |
-
f.write(strr)
|
93 |
elif torch.backends.mps.is_available():
|
94 |
print("没有发现支持的N卡, 使用MPS进行推理")
|
95 |
self.device = "mps"
|
96 |
self.is_half = False
|
97 |
-
config_file_change_fp32()
|
98 |
else:
|
99 |
print("没有发现支持的N卡, 使用CPU进行推理")
|
100 |
self.device = "cpu"
|
101 |
self.is_half = False
|
102 |
-
config_file_change_fp32()
|
103 |
|
104 |
if self.n_cpu == 0:
|
105 |
self.n_cpu = cpu_count()
|
|
|
2 |
import torch
|
3 |
from multiprocessing import cpu_count
|
4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
class Config:
|
6 |
def __init__(self):
|
7 |
self.device = "cuda:0"
|
|
|
62 |
):
|
63 |
print("16系/10系显卡和P40强制单精度")
|
64 |
self.is_half = False
|
|
|
65 |
else:
|
66 |
self.gpu_name = None
|
67 |
self.gpu_mem = int(
|
|
|
72 |
+ 0.4
|
73 |
)
|
74 |
if self.gpu_mem <= 4:
|
75 |
+
nope = None
|
|
|
|
|
|
|
76 |
elif torch.backends.mps.is_available():
|
77 |
print("没有发现支持的N卡, 使用MPS进行推理")
|
78 |
self.device = "mps"
|
79 |
self.is_half = False
|
|
|
80 |
else:
|
81 |
print("没有发现支持的N卡, 使用CPU进行推理")
|
82 |
self.device = "cpu"
|
83 |
self.is_half = False
|
|
|
84 |
|
85 |
if self.n_cpu == 0:
|
86 |
self.n_cpu = cpu_count()
|