deepinsight / deepinsight/insightface

using cuda synthetic face data in MXFaceDataset

Open
#2,578 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
29.7k
Forks
6.1k
PR merge metrics
No merged PRs in 30d

Description

>>>latents = net(inputs.to("cuda").float(), randomize_noise=False, return_latents=True)
RuntimeError: Cannot re-initialize CUDA in forked subprocess. To use CUDA with multiprocessing, you must use the 'spawn' start method

1st method
torch.multiprocessing.set_start_method("spawn", force=True)
or
2nd method
from multiprocessing import Pool

def test(arg1, arg2):
return "hello," + arg1, arg2 + ' test', [2222, 5, 356]

if __name__ == '__main__':
p = Pool(2)
results = []
rslt1 = p.apply_async(test, ('world1', 'tea',))
results.append(rslt1)
rslt2 = p.apply_async(test, ('world2', 'cat',))
results.append(rslt2)
for r in results:
a, b, c = r.get()
print(a, b, c)
hello,world1 tea test [2222, 5, 356]
hello,world1 cat test [2222, 5, 356]

Stop for a long time to report errors:
RuntimeError: Timed out initializing process group in store based barrier on rank: 1, for key: store_based_barrier_key:1 (world_size=2, worker_count=4, timeout=0:30:00)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.