I followed the steps in Launch: Deploy Custom Model Weights with Roboflow
to deploy my custom model.
I built this model with this notebook: https://colab.research.google.com/github/roboflow-ai/notebooks/blob/main/notebooks/train-yolov8-object-detection-on-custom-dataset.ipynb
I get out a best.pt file
I get this error message
loading Roboflow workspace...
loading Roboflow project...
Traceback (most recent call last):
File "src/roboflow_deploy.py", line 15, in <module>
project.version(1).deploy(model_type="yolov8", model_path=str(f"{REPO_DIR}/models/"))
File ".venv/lib/python3.9/site-packages/roboflow/core/version.py", line 501, in deploy
model = torch.load(os.path.join(model_path, "weights/best.pt"))
File ".venv/lib/python3.9/site-packages/torch/serialization.py", line 712, in load
return _load(opened_zipfile, map_location, pickle_module, **pickle_load_args)
File ".venv/lib/python3.9/site-packages/torch/serialization.py", line 1049, in _load
result = unpickler.load()
File ".venv/lib/python3.9/site-packages/torch/serialization.py", line 1042, in find_class
return super().find_class(mod_name, name)
ModuleNotFoundError: No module named 'ultralytics.yolo'
Describe your question/issue here! (delete this when you post)
The error message you’re encountering seems to be related to the PyTorch library not being able to find the ‘ultralytics.yolo’ module. This issue is not directly related to Roboflow but rather to the dependencies of your YOLOv8 model.
However, to upload your YOLOv8 weights to Roboflow, you can follow these steps:
Ensure that you have the correct version of the Roboflow Python package. You need the roboflow>=1.0.1 Python package version to use the .deploy() command (source).
Make sure your weights are in the correct directory. According to the Roboflow blog, the weights should be in the “/runs/detect/train/weights/best.pt” folder of your project.
If you’re still encountering issues, it might be due to the version of Ultralytics you’re using. You might need to install or update the Ultralytics library in your environment. You can do this using pip:
pip install -U ultralytics
If the problem persists, it would be best to reach out to the Roboflow support team or the Ultralytics community for further assistance.
Hi! I’m Roboflow’s AI powered bot. This is an automated response powered using AI with knowledge from our docs, blog, and forum. If this solves your issue, please mark it as the solution using the checkbox icon. If this doesn’t solve your issue, please follow up with what you’ve tried/why, and the community will continue to chime in as usual.