THU-MIG / yolov10

YOLOv10: Real-Time End-to-End Object Detection [NeurIPS 2024]
https://arxiv.org/abs/2405.14458
GNU Affero General Public License v3.0
9.88k stars 975 forks source link

Can't get attribute 'SCDown' on <module 'ultralytics.nn.modules.block' from '/home/vrai/train_server/venv/lib/python3.11/site-packages/ultralytics/nn/modules/block.py'> #242

Closed boltholds closed 4 months ago

boltholds commented 4 months ago

Creating and training YOLO model Traceback (most recent call last): File "/home/vrai/train_server/core.py", line 183, in main('settings.conf') File "/home/vrai/train_server/core.py", line 169, in main trained_model_path = trainer.train_model() ^^^^^^^^^^^^^^^^^^^^^ File "/home/vrai/train_server/core.py", line 104, in train_model model = YOLO(self.model_version) ^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/vrai/train_server/venv/lib/python3.11/site-packages/ultralytics/models/yolo/model.py", line 23, in init super().init(model=model, task=task, verbose=verbose) File "/home/vrai/train_server/venv/lib/python3.11/site-packages/ultralytics/engine/model.py", line 152, in init self._load(model, task=task) File "/home/vrai/train_server/venv/lib/python3.11/site-packages/ultralytics/engine/model.py", line 241, in _load self.model, self.ckpt = attempt_load_one_weight(weights) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/vrai/train_server/venv/lib/python3.11/site-packages/ultralytics/nn/tasks.py", line 806, in attempt_load_one_weight ckpt, weight = torch_safe_load(weight) # load ckpt ^^^^^^^^^^^^^^^^^^^^^^^ File "/home/vrai/train_server/venv/lib/python3.11/site-packages/ultralytics/nn/tasks.py", line 732, in torch_safe_load ckpt = torch.load(file, map_location="cpu") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/vrai/train_server/venv/lib/python3.11/site-packages/torch/serialization.py", line 1025, in load return _load(opened_zipfile, ^^^^^^^^^^^^^^^^^^^^^ File "/home/vrai/train_server/venv/lib/python3.11/site-packages/torch/serialization.py", line 1446, in _load result = unpickler.load() ^^^^^^^^^^^^^^^^ File "/home/vrai/train_server/venv/lib/python3.11/site-packages/torch/serialization.py", line 1439, in find_class return super().find_class(mod_name, name) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: Can't get attribute 'SCDown' on <module 'ultralytics.nn.modules.block' from '/home/vrai/train_server/venv/lib/python3.11/site-packages/ultralytics/nn/modules/block.py'> This error occurs regardless of the launch from python or cli ultralytics 8.2.31 torch 2.3.1

cli command bash : yolo train data=data.yaml model=yolov10n.pt epochs=500 lr0=0.01 imgsz=640 device=0,1 batch=22 mixup=0.5 hsv_v=0.5

leonnil commented 4 months ago

Thank you for your interest! Could you please try running the following commands?

pip uninstall ultralytics
pip install -e .
boltholds commented 4 months ago

sure (venv) (base) vrai@vrai-lm-server:~/train_server$ pip uninstall ultralytics Found existing installation: ultralytics 8.2.31 Uninstalling ultralytics-8.2.31: Would remove: /home/vrai/train_server/venv/bin/ultralytics /home/vrai/train_server/venv/bin/yolo /home/vrai/train_server/venv/lib/python3.11/site-packages/tests/ /home/vrai/train_server/venv/lib/python3.11/site-packages/ultralytics-8.2.31.dist-info/ /home/vrai/train_server/venv/lib/python3.11/site-packages/ultralytics/* Would not remove (might be manually added): /home/vrai/train_server/venv/lib/python3.11/site-packages/tests/models/init.py /home/vrai/train_server/venv/lib/python3.11/site-packages/tests/models/test_instance_segmentation.py /home/vrai/train_server/venv/lib/python3.11/site-packages/tests/models/test_object_detection.py /home/vrai/train_server/venv/lib/python3.11/site-packages/tests/models/test_semantic_segmentation.py /home/vrai/train_server/venv/lib/python3.11/site-packages/tests/util/init.py /home/vrai/train_server/venv/lib/python3.11/site-packages/tests/util/dummy_module/init.py /home/vrai/train_server/venv/lib/python3.11/site-packages/tests/util/test_folderparser.py /home/vrai/train_server/venv/lib/python3.11/site-packages/tests/util/test_image_utils.py /home/vrai/train_server/venv/lib/python3.11/site-packages/tests/util/test_versions.py Proceed (Y/n)? Y Successfully uninstalled ultralytics-8.2.31 (venv) (base) vrai@vrai-lm-server:~/train_server$ pip install -e . Obtaining file:///home/vrai/train_server ERROR: file:///home/vrai/train_server does not appear to be a Python project: neither 'setup.py' nor 'pyproject.toml' found.

leonnil commented 4 months ago

Please use pip install -e . in the YOLOv10 project directory.

boltholds commented 4 months ago

Thanks for the help, all that remained was to install huggingface_hub and everything is working now.

DevMaan707 commented 4 months ago

Please use pip install -e . in the YOLOv10 project directory.

i did but it says "does not appear to be a Python project: neither 'setup.py' nor 'pyproject.toml' found."

leonnil commented 4 months ago

Please ensure you are in the yolov10 project directory containing pyproject.toml, or try running the following commands to get the project:

git clone https://github.com/THU-MIG/yolov10.git
cd yolov10
pip install -e .