most probably i meet the same issue here. I’m using Flask to server a web service which workd as multi-processing to predict images. Then i got following error.
Exception in thread Thread-19:
Traceback (most recent call last):
  File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.6/threading.py", line 864, in run
    self._target(*self._args, **self._kwargs)
  File "/content/flask-video-streaming/base_camera.py", line 97, in _thread
    for frame in frames_iterator:
  File "<ipython-input-22-98a25d1b92f5>", line 38, in frames
    predictor = DefaultPredictor(cfg)
  File "/content/detectron2_repo/detectron2/engine/defaults.py", line 163, in __init__
    self.model = build_model(self.cfg)
  File "/content/detectron2_repo/detectron2/modeling/meta_arch/build.py", line 19, in build_model
    return META_ARCH_REGISTRY.get(meta_arch)(cfg)
  File "/content/detectron2_repo/detectron2/modeling/meta_arch/rcnn.py", line 41, in __init__
    pixel_mean = torch.Tensor(cfg.MODEL.PIXEL_MEAN).to(self.device).view(num_channels, 1, 1)
  File "/usr/local/lib/python3.6/dist-packages/torch/cuda/__init__.py", line 197, in _lazy_init
    torch._C._cuda_init()
RuntimeError: cuda runtime error (3) : initialization error at /pytorch/aten/src/THC/THCGeneral.cpp:54

after some google searching, i tried following solutions but none of them working. Anyone have some suggestions to let me go forward? thanks in advance!
if __name__ == "__main__":

#    manager.run(host='0.0.0.0', threaded=True)

    print(torch.multiprocessing.get_start_method())

    torch.multiprocessing.set_start_method('spawn', force=True)

    #torch.multiprocessing = torch.multiprocessing.get_context('spawn')

    #torch.multiprocessing.set_start_method('spawn')

    #torch.multiprocessing.set_start_method('forkserver', force=True)

    app.run(host='0.0.0.0', threaded=False, processes=2)