参考的这个文章
https://blog.csdn.net/ITdaka/article/details/138863017?spm=1001.2014.3001.5501
openai快捷下载:https://download.csdn.net/download/qq_43767886/89876720
然后我打算训练coco数据集,遇到了以下的问题
问题一
原因:错误提示表明你缺少 transformers 库,并且 PYTHONPATH 未正确配置,导致 Python 无法找到自定义模块 yolo_world。
安装 transformers;
yolo_world参考上面文章的链接
pip install transformers
Traceback (most recent call last):
File "/home/rycc/anaconda3/envs/yolo-world/lib/python3.9/site-packages/mmengine/utils/misc.py", line 77, in import_modules_from_strings
imported_tmp = import_module(imp)
File "/home/rycc/anaconda3/envs/yolo-world/lib/python3.9/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 790, in exec_module
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "/home/rycc/cc/yolo-world/yolo_world/__init__.py", line 10, in <module>
from .models import * # noqa
File "/home/rycc/cc/yolo-world/yolo_world/models/__init__.py", line 2, in <module>
from .backbones import * # noqa
File "/home/rycc/cc/yolo-world/yolo_world/models/backbones/__init__.py", line 5, in <module>
from .mm_backbone import (
File "/home/rycc/cc/yolo-world/yolo_world/models/backbones/mm_backbone.py", line 10, in <module>
from transformers import (AutoTokenizer, AutoModel, CLIPTextConfig)
ModuleNotFoundError: No module named 'transformers'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/rycc/anaconda3/envs/yolo-world/lib/python3.9/site-packages/mmengine/config/config.py", line 466, in fromfile
import_modules_from_strings(**cfg_dict['custom_imports'])
File "/home/rycc/anaconda3/envs/yolo-world/lib/python3.9/site-packages/mmengine/utils/misc.py", line 84, in import_modules_from_strings
raise ImportError(f'Failed to import {imp}')
ImportError: Failed to import yolo_world
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/rycc/cc/yolo-world/train.py", line 127, in <module>
main()
File "/home/rycc/cc/yolo-world/train.py", line 65, in main
cfg = Config.fromfile(args.config)
File "/home/rycc/anaconda3/envs/yolo-world/lib/python3.9/site-packages/mmengine/config/config.py", line 478, in fromfile
raise ImportError(err_msg) from e
ImportError: Failed to import custom modules from {'imports': ['yolo_world'], 'allow_failed_imports': False}, the current sys.path is:
/home/rycc/cc/yolo-world
/home/rycc/anaconda3/envs/yolo-world/lib/python39.zip
/home/rycc/anaconda3/envs/yolo-world/lib/python3.9
/home/rycc/anaconda3/envs/yolo-world/lib/python3.9/lib-dynload
/home/rycc/anaconda3/envs/yolo-world/lib/python3.9/site-packages
/tmp/tmpo38nms2p
You should set PYTHONPATH to make sys.path include the directory which contains your custom module
问题二
原因:/openai/clip-vit-base-patch32文件路径不对。
OSError: Incorrect path_or_model_id: '../openai/clip-vit-base-patch32'. Please provide either the path to a local folder or the repo_id of a model on the Hub.
解决方法:
问题三
原因:albumentations安装的版本不对
解决方法:pip 安装 albumentations==1.3.1
Traceback (most recent call last):
File "/home/rycc/anaconda3/envs/yolo-world/lib/python3.9/site-packages/torch/utils/data/_utils/worker.py", line 308, in _worker_loop
data = fetcher.fetch(index)
File "/home/rycc/anaconda3/envs/yolo-world/lib/python3.9/site-packages/torch/utils/data/_utils/fetch.py", line 51, in fetch
data = [self.dataset[idx] for idx in possibly_batched_index]
File "/home/rycc/anaconda3/envs/yolo-world/lib/python3.9/site-packages/torch/utils/data/_utils/fetch.py", line 51, in <listcomp>
data = [self.dataset[idx] for idx in possibly_batched_index]
File "/home/rycc/cc/yolo-world/yolo_world/datasets/mm_dataset.py", line 86, in __getitem__
return self.pipeline(data_info)
File "/home/rycc/anaconda3/envs/yolo-world/lib/python3.9/site-packages/mmengine/dataset/base_dataset.py", line 60, in __call__
data = t(data)
File "/home/rycc/anaconda3/envs/yolo-world/lib/python3.9/site-packages/mmcv/transforms/base.py", line 12, in __call__
return self.transform(results)
File "/home/rycc/anaconda3/envs/yolo-world/lib/python3.9/site-packages/mmdet/structures/bbox/box_type.py", line 267, in wrapper
return func(self, results)
File "/home/rycc/anaconda3/envs/yolo-world/lib/python3.9/site-packages/mmdet/datasets/transforms/transforms.py", line 1507, in transform
results = self.aug(**results)
File "/home/rycc/anaconda3/envs/yolo-world/lib/python3.9/site-packages/albumentations/core/composition.py", line 346, in __call__
self.preprocess(data)
File "/home/rycc/anaconda3/envs/yolo-world/lib/python3.9/site-packages/albumentations/core/composition.py", line 373, in preprocess
raise ValueError(msg)
ValueError: Key img_path is not in available keys.
我的目录文件配置