pythonpytorchneural-networkyolotraceback

NotImplementedError YOLO ultralitycs


When launching neural network training, I get this error:

NotImplementedError                       Traceback (most recent call last)
Cell In[1], line 5
      1 from ultralytics import YOLO
      3 model = YOLO('yolov8m.pt')
----> 5 results = model.train(data='dataset_yolo8/data.yaml', epochs=100, imgsz=640) #, model='yolov8m.pt')

File c:\Users\Mugmazoid\AppData\Local\Programs\Python\Python312\Lib\site-packages\ultralytics\engine\model.py:601, in Model.train(self, trainer, **kwargs)
    598             pass
    600 self.trainer.hub_session = self.session  # attach optional HUB session
--> 601 self.trainer.train()
    602 # Update model and cfg after training
    603 if RANK in (-1, 0):

File c:\Users\Mugmazoid\AppData\Local\Programs\Python\Python312\Lib\site-packages\ultralytics\engine\trainer.py:208, in BaseTrainer.train(self)
    205         ddp_cleanup(self, str(file))
    207 else:
--> 208     self._do_train(world_size)

File c:\Users\Mugmazoid\AppData\Local\Programs\Python\Python312\Lib\site-packages\ultralytics\engine\trainer.py:322, in BaseTrainer._do_train(self, world_size)
    320 if world_size > 1:
    321     self._setup_ddp(world_size)
--> 322 self._setup_train(world_size)
    324 nb = len(self.train_loader)  # number of batches
    325 nw = max(round(self.args.warmup_epochs * nb), 100) if self.args.warmup_epochs > 0 else -1  # warmup iterations
...
PythonTLSSnapshot: registered at ..\aten\src\ATen\core\PythonFallbackKernel.cpp:162 [backend fallback]
FuncTorchDynamicLayerFrontMode: registered at ..\aten\src\ATen\functorch\DynamicLayer.cpp:494 [backend fallback]
PreDispatch: registered at ..\aten\src\ATen\core\PythonFallbackKernel.cpp:166 [backend fallback]
PythonDispatcher: registered at ..\aten\src\ATen\core\PythonFallbackKernel.cpp:158 [backend fallback]  

All file paths are correct. Here's the entire code:

from ultralytics import YOLO

model = YOLO('yolov8m.pt')

results = model.train(data='dataset_yolo8/data.yaml', epochs=100, imgsz=640, batch = 40) #, model='yolov8m.pt')

What could be the issue and how to fix it?


Solution

  • There was a problem with python 3.12. Now I use python 3.11. Details here:

    Ultralytics YOLOv8.1.13 🚀 Python-3.11.5 torch-2.2.0+cu118 CUDA:0 (NVIDIA GeForce RTX 2060, 6144MiB)
    Setup complete ✅ (16 CPUs, 15.9 GB RAM, 213.6/232.3 GB disk)
    
    OS                  Windows-10-10.0.19045-SP0
    Environment         Windows
    Python              3.11.5
    Install             pip
    RAM                 15.95 GB
    CPU                 AMD Ryzen 7 3700X 8-Core Processor
    CUDA                11.8
    
    matplotlib          ✅ 3.8.2>=3.3.0
    numpy               ✅ 1.26.4>=1.22.2
    opencv-python       ✅ 4.9.0.80>=4.6.0
    pillow              ✅ 10.2.0>=7.1.2
    pyyaml              ✅ 6.0.1>=5.3.1
    requests            ✅ 2.31.0>=2.23.0
    scipy               ✅ 1.12.0>=1.4.1
    torch               ✅ 2.2.0+cu118>=1.8.0
    torchvision         ✅ 0.17.0+cu118>=0.9.0
    tqdm                ✅ 4.66.2>=4.64.0
    psutil              ✅ 5.9.8
    py-cpuinfo          ✅ 9.0.0
    thop                ✅ 0.1.1-2209072238>=0.1.1
    pandas              ✅ 2.2.0>=1.1.4
    seaborn             ✅ 0.13.2>=0.11.0