I am using Google Collab to try to reconstruct yolo9 so that I can then train it for custom objects.* https://deasadiqbal.medium.com/yolov9-object-detection-on-custom-dataset-computer-vision-project-357bac70daeb*

When I entered !python train_dual.py --workers 8 --batch 4 --img 640 --epochs 50 --data /content/yolov9/data.yaml --weights /content/yolov9-e.pt --device 0 --cfg /content/yolov9/models/detect/yolov9.yaml --hyp /content/yolov9/data/hyps/hyp.scratch-high.yaml

I got the following error message:

2024-03-13 21:16:22.000080: E external/local_xla/xla/stream_executor/cuda/cuda_fft.cc:607] Unable to register cuFFT factory: Attempting to register factory for plugin cuFFT when one has already been registered
2024-03-13 21:16:22.001565: E external/local_xla/xla/stream_executor/cuda/cuda_blas.cc:1515] Unable to register cuBLAS factory: Attempting to register factory for plugin cuBLAS when one has already been registered
2024-03-13 21:16:23.188892: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT
train_dual: weights=/content/yolov9-e.pt, cfg=/content/yolov9/models/detect/yolov9.yaml, data=/content/yolov9/data.yaml, hyp=/content/yolov9/data/hyps/hyp.scratch-high.yaml, epochs=50, batch_size=4, imgsz=640, rect=False, resume=False, nosave=False, noval=False, noautoanchor=False, noplots=False, evolve=None, bucket=, cache=None, image_weights=False, device=0, multi_scale=False, single_cls=False, optimizer=SGD, sync_bn=False, workers=8, project=runs/train, name=exp, exist_ok=False, quad=False, cos_lr=False, flat_cos_lr=False, fixed_lr=False, label_smoothing=0.0, patience=100, freeze=[0], save_period=-1, seed=0, local_rank=-1, min_items=0, close_mosaic=0, entity=None, upload_dataset=False, bbox_interval=-1, artifact_alias=latest
Traceback (most recent call last):
  File "/content/yolov9/train_dual.py", line 644, in <module>
    main(opt)
  File "/content/yolov9/train_dual.py", line 524, in main
    device = select_device(opt.device, batch_size=opt.batch_size)
  File "/content/yolov9/utils/torch_utils.py", line 114, in select_device
    assert torch.cuda.is_available() and torch.cuda.device_count() >= len(device.replace(',', '')), \
AssertionError: Invalid CUDA '--device 0' requested, use '--device cpu' or pass valid CUDA device(s)```

I am new at this and appreciate your assistance and may need more as I go along.
2

There are 2 best solutions below

3
Stéphane On

You should join the YOLO discord server. In the #general channel, the topic of YOLOv9 has been discussed recently by many users. The conclusion from everyone was the same: YOLOv9 is not ready for general use. Not just build problems, but it doesn't work well with custom datasets.

If what you want to use is specifically YOLOv9, then what I'm writing to you right now is not an answer to your post. Sorry!

If instead what you really want is to use YOLO on colab, then I have a different proposal to mention. Take a look at the #darknet-and-google-colab channel on the discord server I linked to above. There are several notebooks pinned to the channel that explains step-by-step how to use Darknet/YOLO on google colab. For example: output from google colab notebook

0
independent_bit1256 On

In addition to already provided answers I have an additional clue:

You are using Colab and there are different GPUs and setups available. Some Colab setups does not have a GPU!

As the CUDA-Error suggests you might want to use the cpu (by using device="cpu" instead of device=0 or suggested CLI arguments) or activate GPU support. To activate GPUs in Google Colab navigate to Edit -> Notebook Settings and select a GPU from the Hardware Accelerator menu (as clearly described in this Google "TensorFlow with GPU" Guideline, which applies to your case).