Closed alexandermittet closed 8 months ago
👋 Hello @alexandermittet, thank you for leaving an issue on Roboflow Notebooks.
If you are filing a bug report, please be as detailed as possible. This will help us more easily diagnose and resolve the problem you are facing. To learn more about contributing, check out our Contributing Guidelines.
If you require support with custom code that is not part of Roboflow Notebooks, please reach out on the Roboflow Forum or on the GitHub Discussions page associated with this repository.
Do you have more questions about Roboflow that we haven't responded to yet? Feel free to ask them on the Roboflow Discuss forum. Our developer advocates and community team actively respond to questions there.
To ask questions about Notebooks, head over to the GitHub Discussions section of this repository.
Hi @alexandermittet ! I see you say you are using ultralytics==8.0.134
. Just wanted to confirm, is that also what you used to train the model? I've seen the error you posted when someone trains with one ultralytics version, then attempts to deploy with another version.
Hi @alexandermittet ! I see you say you are using
ultralytics==8.0.134
. Just wanted to confirm, is that also what you used to train the model? I've seen the error you posted when someone trains with one ultralytics version, then attempts to deploy with another version.
That sounds very plausible. I will close the issue.
Search before asking
Notebook name
train_yolov8_object_detection_on_custom_dataset.ipynb
Bug
While trying to deploy retrained YOLOv8 weights to the Roboflow server using the version.deploy method in the notebook train_yolov8_object_detection_on_custom_dataset.ipynb, I encountered a ModuleNotFoundError for ultralytics.utils. Here is the specific cell and the traceback:
`--------------------------------------------------------------------------- ModuleNotFoundError Traceback (most recent call last) /Users/alexandermittet/GD alexandermittet/uni_life/PIP/AoM/robo-notebooks/train_yolov8_object_detection_on_custom_dataset.ipynb Cell 51 line 2 1 version = project.version(1) ----> 2 version.deploy("yolov8", "/Users/alexandermittet/GD_alexandermittet/uni_life/PIP/AoM/runs/detect/train5")
File ~/miniconda3/envs/AoM/lib/python3.10/site-packages/roboflow/core/version.py:504, in Version.deploy(self, model_type, model_path) 499 except ImportError as e: 500 raise ( 501 "The torch python package is required to deploy yolov5 models. Please install it with
pip install torch
" 502 ) --> 504 model = torch.load(os.path.join(model_path, "weights/best.pt")) 506 if isinstance(model["model"].names, list): 507 class_names = model["model"].namesFile ~/miniconda3/envs/AoM/lib/python3.10/site-packages/torch/serialization.py:809, in load(f, map_location, pickle_module, weights_only, pickle_load_args) 807 except RuntimeError as e: 808 raise pickle.UnpicklingError(UNSAFE_MESSAGE + str(e)) from None --> 809 return _load(opened_zipfile, map_location, pickle_module, pickle_load_args) 810 if weights_only: 811 try:
File ~/miniconda3/envs/AoM/lib/python3.10/site-packages/torch/serialization.py:1172, in _load(zip_file, map_location, pickle_module, pickle_file, pickle_load_args) 1170 unpickler = UnpicklerWrapper(data_file, pickle_load_args) 1171 unpickler.persistent_load = persistent_load ... 1163 pass 1164 mod_name = load_module_mapping.get(mod_name, mod_name) -> 1165 return super().find_class(mod_name, name)
ModuleNotFoundError: No module named 'ultralytics.utils'`
Environment
Python version: 3.10.12 OS: MacOS 15.5.1 ultralytics Version: 8.0.134 roboflow Version: 1.1.7
Minimal Reproducible Example
version = project.version(3) #3rd version of the dataset version.deploy("yolov8", "path/to/train5") #5th training
Additional
This error seems to arise from the torch.load method when loading the model weights. It appears that the module ultralytics.utils is required but is not available in the environment. Is there a workaround or a fix for this issue?
I've tried updating the ultralytics library but that didn't work either.
Are you willing to submit a PR?