I was able to get a little bit further. It seems the problem did was with the classes definition. Originally the classes did not start in 0 and were not sequential. I defined them from 0 and sequential and the previous error seems to be resolved.
However, after trying to run I got a CUDA out of memory error even in the on an NVIDIA RTX 24Gb GPU, which seems very strange since the model is based on mobilenet:
Traceback (most recent call last):
  File "detector_totales.py", line 230, in <module>
    main()
  File "detector_totales.py", line 166, in main
    model = model.to(device)
  File "/home/jfmy/Repositories/eleccionesGT2019/.tse/lib/python3.6/site-packages/torch/nn/modules/module.py", line 386, in to
    return self._apply(convert)
  File "/home/jfmy/Repositories/eleccionesGT2019/.tse/lib/python3.6/site-packages/torch/nn/modules/module.py", line 193, in _apply
    module._apply(fn)
  File "/home/jfmy/Repositories/eleccionesGT2019/.tse/lib/python3.6/site-packages/torch/nn/modules/module.py", line 193, in _apply
    module._apply(fn)
  File "/home/jfmy/Repositories/eleccionesGT2019/.tse/lib/python3.6/site-packages/torch/nn/modules/module.py", line 193, in _apply
    module._apply(fn)
  File "/home/jfmy/Repositories/eleccionesGT2019/.tse/lib/python3.6/site-packages/torch/nn/modules/module.py", line 199, in _apply
    param.data = fn(param.data)
  File "/home/jfmy/Repositories/eleccionesGT2019/.tse/lib/python3.6/site-packages/torch/nn/modules/module.py", line 384, in convert
    return t.to(device, dtype if t.is_floating_point() else None, non_blocking)
RuntimeError: CUDA out of memory. Tried to allocate 246.00 MiB (GPU 0; 23.62 GiB total capacity; 65.31 MiB already
allocated; 60.75 MiB free; 20.69 MiB cached)

After trying to run on CPU, the model does start training and there is some output but a new error, which I do not understand, appears:
Traceback (most recent call last):
  File "detector_totales.py", line 230, in <module>
    main()
  File "detector_totales.py", line 196, in main
    evaluate(model, test_loader, device=device)
  File "/home/fer/git_clone/eleccionesGT2019/.tse/lib/python3.5/site-packages/torch/autograd/grad_mode.py", line 43, in decorate_no_grad
    return func(*args, **kwargs)
  File "/home/fer/git_clone/eleccionesGT2019/engine.py", line 78, in evaluate
    coco = get_coco_api_from_dataset(data_loader.dataset)
  File "/home/fer/git_clone/eleccionesGT2019/coco_utils.py", line 205, in get_coco_api_from_dataset
    return convert_to_coco_api(dataset)
  File "/home/fer/git_clone/eleccionesGT2019/coco_utils.py", line 155, in convert_to_coco_api
    image_id = targets["image_id"].item()
KeyError: 'image_id'

Any help on both errors will be appreciated.