-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error when trying to train yolov8 model #14664
Comments
👋 Hello @vrathi101, thank you for your interest in Ultralytics YOLOv8 🚀! We recommend a visit to the Docs for new users where you can find many Python and CLI usage examples and where many of the most common questions may already be answered. If this is a 🐛 Bug Report, please provide a minimum reproducible example to help us debug it. If this is a custom training ❓ Question, please provide as much information as possible, including dataset image examples and training logs, and verify you are following our Tips for Best Training Results. Join the vibrant Ultralytics Discord 🎧 community for real-time conversations and collaborations. This platform offers a perfect space to inquire, showcase your work, and connect with fellow Ultralytics users. InstallPip install the pip install ultralytics EnvironmentsYOLOv8 may be run in any of the following up-to-date verified environments (with all dependencies including CUDA/CUDNN, Python and PyTorch preinstalled):
StatusIf this badge is green, all Ultralytics CI tests are currently passing. CI tests verify correct operation of all YOLOv8 Modes and Tasks on macOS, Windows, and Ubuntu every 24 hours and on every commit. |
Just restart the notebook kernel |
I tried that but now am getting this error: AttributeError Traceback (most recent call last) File /opt/conda/lib/python3.10/site-packages/ultralytics/engine/model.py:810, in Model.train(self, trainer, **kwargs) File /opt/conda/lib/python3.10/site-packages/ultralytics/engine/trainer.py:206, in BaseTrainer.train(self) File /opt/conda/lib/python3.10/site-packages/ultralytics/engine/trainer.py:329, in BaseTrainer._do_train(self, world_size) File /opt/conda/lib/python3.10/site-packages/ultralytics/engine/trainer.py:270, in BaseTrainer._setup_train(self, world_size) AttributeError: module 'torch.amp' has no attribute 'GradScaler' |
yes that worked, thank you! |
@vrathi101 closing the issue as it's resolved, please feel free to reopen it if you encounter any related issues. :) |
Search before asking
Question
I followed the Ultralytics documentation online for using YoloV8 for training an object detection model but keep experiencing the following issue. This is the code I ran:
os.chdir('/kaggle/working')
!pip uninstall -y ultralytics
!pip cache purge
!pip install -U ultralytics
from ultralytics import YOLO
model = YOLO("yolov8s.pt")
results = model.train(
data="/kaggle/working/data.yaml", epochs=20,
imgsz=640, batch=-1, save=True
)
I previously installed ultralytics so here I just uninstalled and reinstalled it. the model loads properly but whenever I try training it I get the following error:
FileNotFoundError Traceback (most recent call last)
Cell In[27], line 1
----> 1 results = model.train(
2 data="/kaggle/working/data.yaml", epochs=20,
3 imgsz=640, batch=-1, save=True
4 )
File /opt/conda/lib/python3.10/site-packages/ultralytics/yolo/engine/model.py:189, in YOLO.train(self, **kwargs)
186 if overrides.get("resume"):
187 overrides["resume"] = self.ckpt_path
--> 189 self.trainer = self.TrainerClass(overrides=overrides)
190 if not overrides.get("resume"): # manually set model only if not resuming
191 self.trainer.model = self.trainer.get_model(weights=self.model if self.ckpt else None, cfg=self.model.yaml)
File /opt/conda/lib/python3.10/site-packages/ultralytics/yolo/engine/trainer.py:86, in init(self, config, overrides)
File /opt/conda/lib/python3.10/site-packages/ultralytics/yolo/configs/init.py:25, in get_config(config, overrides)
File /opt/conda/lib/python3.10/site-packages/omegaconf/omegaconf.py:189, in OmegaConf.load(file_)
186 from .utils import get_yaml_loader
188 if isinstance(file, (str, pathlib.Path)):
--> 189 with io.open(os.path.abspath(file_), "r", encoding="utf-8") as f:
190 obj = yaml.load(f, Loader=get_yaml_loader())
191 elif getattr(file_, "read", None):
FileNotFoundError: [Errno 2] No such file or directory: '/opt/conda/lib/python3.10/site-packages/ultralytics/yolo/configs/default.yaml'
The text was updated successfully, but these errors were encountered: