Fix multiprocess (#201)

* fix nultiprocess

* fix format

* fix multiprocess=0
This commit is contained in:
Isotr0py
2023-11-28 12:29:08 +08:00
committed by GitHub
parent e92f67fe43
commit edb5d05e34
3 changed files with 21 additions and 7 deletions

View File

@@ -136,7 +136,12 @@ if __name__ == "__main__":
wavnames = [line.split("|")[0] for line in lines]
dataset = AudioDataset(wavnames, 16000, processor)
data_loader = DataLoader(dataset, batch_size=1, shuffle=False, num_workers=16)
data_loader = DataLoader(
dataset,
batch_size=1,
shuffle=False,
num_workers=min(args.num_processes, os.cpu_count() - 1),
)
with torch.no_grad():
for i, data in tqdm(enumerate(data_loader), total=len(data_loader)):