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 logging
import os
import subprocess
import sys
import shutil
import numpy as np
import torch

View File

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

View File

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