from ultralytics import YOLO

# Load a model
model = YOLO('E:/code_files/train/ultralytics-main/model_files/yolov8x.pt')  # load an official model
model = YOLO('E:/code_files/jy/20240411_model_test/train/weights/best.pt')  # load a custom trained model

# Export the model
model.export(format='engine',half=True)