fix(train): RuntimeError: context has already been set

This commit is contained in:
源文雨 2024-06-04 01:58:26 +09:00
parent b8e0940175
commit ed96cf1721
3 changed files with 2 additions and 5 deletions

View File

@ -3,9 +3,7 @@ import glob
import json import json
import logging import logging
import os import os
import subprocess
import sys import sys
import shutil
import numpy as np import numpy as np
import torch import torch

View File

@ -636,5 +636,5 @@ def train_and_evaluate(
if __name__ == "__main__": if __name__ == "__main__":
torch.multiprocessing.set_start_method("spawn") mp.set_start_method("spawn", force=True)
main() main()

View File

@ -8,7 +8,6 @@ logger = logging.getLogger(__name__)
from functools import lru_cache from functools import lru_cache
from time import time from time import time
import faiss
import librosa import librosa
import numpy as np import numpy as np
import parselmouth import parselmouth
@ -331,9 +330,9 @@ class Pipeline(object):
and os.path.exists(file_index) and os.path.exists(file_index)
and index_rate != 0 and index_rate != 0
): ):
if "faiss" not in sys.modules: import faiss
try: try:
index = faiss.read_index(file_index) index = faiss.read_index(file_index)
# big_npy = np.load(file_big_npy)
big_npy = index.reconstruct_n(0, index.ntotal) big_npy = index.reconstruct_n(0, index.ntotal)
except: except:
traceback.print_exc() traceback.print_exc()