---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
<ipython-input-4-cd53479c1665> in <cell line: 206>()
    209     progress_bar = tqdm(train_loader, desc=f"Epoch {epoch+1}/{num_epochs}")
    210 
--> 211     for batch in progress_bar:
    212         images = batch['image'].to(device, non_blocking=True)
    213         seg_masks = batch['seg_mask'].to(device, non_blocking=True)

5 frames
/usr/local/lib/python3.10/dist-packages/tqdm/notebook.py in __iter__(self)
    248         try:
    249             it = super().__iter__()
--> 250             for obj in it:
    251                 # return super(tqdm...) will not catch exception
    252                 yield obj

/usr/local/lib/python3.10/dist-packages/tqdm/std.py in __iter__(self)
   1179 
   1180         try:
-> 1181             for obj in iterable:
   1182                 yield obj
   1183                 # Update and possibly print the progressbar.

/usr/local/lib/python3.10/dist-packages/torch/utils/data/dataloader.py in __next__(self)
    699                 # TODO(https://github.com/pytorch/pytorch/issues/76750)
    700                 self._reset()  # type: ignore[call-arg]
--> 701             data = self._next_data()
    702             self._num_yielded += 1
    703             if (

/usr/local/lib/python3.10/dist-packages/torch/utils/data/dataloader.py in _next_data(self)
   1463             else:
   1464                 del self._task_info[idx]
-> 1465                 return self._process_data(data)
   1466 
   1467     def _try_put_index(self):

/usr/local/lib/python3.10/dist-packages/torch/utils/data/dataloader.py in _process_data(self, data)
   1489         self._try_put_index()
   1490         if isinstance(data, ExceptionWrapper):
-> 1491             data.reraise()
   1492         return data
   1493 

/usr/local/lib/python3.10/dist-packages/torch/_utils.py in reraise(self)
    713             # instantiate since we don't know how to
    714             raise RuntimeError(msg) from None
--> 715         raise exception
    716 
    717 

RuntimeError: Caught RuntimeError in DataLoader worker process 0.
Original Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/torch/utils/data/_utils/worker.py", line 351, in _worker_loop
    data = fetcher.fetch(index)  # type: ignore[possibly-undefined]
  File "/usr/local/lib/python3.10/dist-packages/torch/utils/data/_utils/fetch.py", line 52, in fetch
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "/usr/local/lib/python3.10/dist-packages/torch/utils/data/_utils/fetch.py", line 52, in <listcomp>
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "<ipython-input-4-cd53479c1665>", line 67, in __getitem__
    results = yolo_model(img_path, verbose=False)
  File "/usr/local/lib/python3.10/dist-packages/ultralytics/engine/model.py", line 176, in __call__
    return self.predict(source, stream, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/ultralytics/engine/model.py", line 547, in predict
    self.predictor.setup_model(model=self.model, verbose=is_cli)
  File "/usr/local/lib/python3.10/dist-packages/ultralytics/engine/predictor.py", line 306, in setup_model
    device=select_device(self.args.device, verbose=verbose),
  File "/usr/local/lib/python3.10/dist-packages/ultralytics/utils/torch_utils.py", line 218, in select_device
    s += f"{'' if i == 0 else space}CUDA:{d} ({get_gpu_info(i)})\n"  # bytes to MB
  File "/usr/local/lib/python3.10/dist-packages/ultralytics/utils/torch_utils.py", line 129, in get_gpu_info
    properties = torch.cuda.get_device_properties(index)
  File "/usr/local/lib/python3.10/dist-packages/torch/cuda/__init__.py", line 523, in get_device_properties
    _lazy_init()  # will define _get_device_properties
  File "/usr/local/lib/python3.10/dist-packages/torch/cuda/__init__.py", line 305, in _lazy_init
    raise RuntimeError(
RuntimeError: Cannot re-initialize CUDA in forked subprocess. To use CUDA with multiprocessing, you must use the 'spawn' start method