from ultralytics import YOLOv10

model = YOLOv10()
# If you want to finetune the model with pretrained weights, you could load the 
# pretrained weights like below
# model = YOLOv10('yolov10s.pt')
# Or
# model = YOLOv10.from_pretrained('jameslahm/yolov10{n/s/m/b/l/x}')


# model.train(data='coco.yaml', model='yolov10s.yaml', epochs=500, batch=256, imgsz=640, resume=True, device='0,1,2,3') # for resume
model.train(data='coco.yaml', model='yolov10s.yaml', epochs=500, batch=256, imgsz=640, device='0,1,2,3')
# Note that you can upload your trained model to HuggingFace Hub like below
# model.push_to_hub("reponame", config={"model": "yolov10n/s/m/b/l/x.yaml"})


'''
if you want to resume, need to add something here:
ultralytics/engine/trainer.py:__init__:

overrides["resume"] = 'runs/detect/train/weights/last.pt'
self.args.resume = True
'''
