modified configs and modules to test and train yolov5, a error occurs here
Search before asking
- [X] I have searched the YOLOv8 issues and discussions and found no similar questions.
Question
I modified some configs and modules on the ultralytics repo to test and train yolov5, and the following errors occurred:
File "/home/linxu/PycharmProjects/ultralytics/ultralytics/nn/tasks.py", line 291, in attempt_load_weights
args = {**DEFAULT_CONFIG_DICT, **ckpt['train_args']} # combine model and default args, preferring model args
KeyError: 'train_args'

Additional
No response
@isLinXu oh that's because train_args is designed for yolov8 weights, yolov5 weights don't have this key.
Can you try again with weights=''? or just don't set weights, just use yaml file of model.
Um, I also found this problem, I will try the way you said

@isLinXu We'll make other models i.e yolov5 compatible with this. Once we support it I'll let you know. :)
Okay,I got it. And I tried what you said, and it didn't seem to work. Look forward to your follow-up work,thanks
@AyushExel can you take a look at this one?
I am facing the same issue; albeit from a different file. I have converted a weights file from a pre-trained YoLov4 model to a .pt file via this repo. I'm facing the concerned issue of using that file.
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\Microsoft\miniconda3\envs\ultralytics_dev\lib\site-packages\ultralytics\yolo\engine\model.py", line 55, in __init__
{'.pt': self._load, '.yaml': self._new}[Path(model).suffix](model)
File "C:\Users\Microsoft\miniconda3\envs\ultralytics_dev\lib\site-packages\ultralytics\yolo\engine\model.py", line 83, in _load
self.model, self.ckpt = attempt_load_one_weight(weights)
File "C:\Users\Microsoft\miniconda3\envs\ultralytics_dev\lib\site-packages\ultralytics\nn\tasks.py", line 345, in attempt_load_one_weight
args = {**DEFAULT_CONFIG_DICT, **ckpt['train_args']} # combine model and default args, preferring model args
KeyError: 'train_args'
@Laughing-q @isLinXu I think we'll need to train YOLOv5 from scratch on this repo to fix this problem.. Or can we just transfer weights as a temporary solution?
@AyushExel for now I think latter could be fine.
@Laughing-q How can weights transfer be implemented while creating an instance of YOLO? I have access to a weights file as well as it's equivalent .pt file.
👋 Hello there! We wanted to give you a friendly reminder that this issue has not had any recent activity and may be closed soon, but don't worry - you can always reopen it if needed. If you still have any questions or concerns, please feel free to let us know how we can help.
For additional resources and information, please see the links below:
- Docs: https://docs.ultralytics.com
- HUB: https://hub.ultralytics.com
- Community: https://community.ultralytics.com
Feel free to inform us of any other issues you discover or feature requests that come to mind in the future. Pull Requests (PRs) are also always welcomed!
Thank you for your contributions to YOLO 🚀 and Vision AI ⭐
@AyushExel can you take a look at this one?
@isLinXu We'll make other models i.e yolov5 compatible with this. Once we support it I'll let you know. :)
Can't the weight files(best.pt) generated by YOLOv5 training be used as pre-training weights for YOLOv8?