Code:
from ultralytics import YOLO
# Load a model
model = YOLO("yolov8m.yaml") # build a new model from scratch
# Use the model
results = model.predict(source="0", show=True, stream=True, classes=0, device='0')
model.train(data="conf.yaml", epochs=20, imgsz=600, device=' 0') # train the model
Error
Eror:NotImplementedError: Could not run 'torchvision::nms' with arguments from the 'CUDA' backend. This could be because the operator doesn't exist for this backend, or was omitted during the selective/custom build process (if using custom build). If you are a Facebook employee using PyTorch on mobile, please visit https://fburl.com/ptmfixes for possible resolutions. 'torchvision::nms' is only available for these backends: [CPU, QuantizedCPU, BackendSelect, Python, FuncTorchDynamicLayerBackMode, Functionalize, Named, Conjugate, Negative, ZeroTensor, ADInplaceOrView, AutogradOther, AutogradCPU, AutogradCUDA, AutogradXLA, AutogradMPS, AutogradXPU, AutogradHPU, AutogradLazy, AutogradMeta, Tracer, AutocastCPU, AutocastCUDA, FuncTorchBatched, FuncTorchVmapMode, Batched, VmapMode, FuncTorchGradWrapper, PythonTLSSnapshot, FuncTorchDynamicLayerFrontMode, PythonDispatcher].
File "C:\Users\pogti\Downloads\dataset_rust_ai\main.py", line 9, in <module>
model.train(data="conf.yaml", epochs=20, imgsz=600, device=' 0') # train the model
If I do below, I get: True
import torch
print(torch.cuda.is_available())