Created
June 18, 2024 09:16
-
-
Save mpolinowski/03af35d278834055709dba18889fdb59 to your computer and use it in GitHub Desktop.
YOLOv9 and YOLOv10 https://github.com/ultralytics/ultralytics/issues/13369
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--------------------------------------------------------------------------- | |
AttributeError Traceback (most recent call last) | |
Cell In[11], line 1 | |
----> 1 model_9t = YOLO("weights/yolov9t.pt") | |
File /opt/conda/lib/python3.10/site-packages/ultralytics/models/yolo/model.py:28, in YOLO.__init__(self, model, task, verbose) | |
25 self.__dict__ = new_instance.__dict__ | |
26 else: | |
27 # Continue with default YOLO initialization | |
---> 28 super().__init__(model=model, task=task, verbose=verbose) | |
File /opt/conda/lib/python3.10/site-packages/ultralytics/engine/model.py:141, in Model.__init__(self, model, task, verbose) | |
139 self._new(model, task=task, verbose=verbose) | |
140 else: | |
--> 141 self._load(model, task=task) | |
File /opt/conda/lib/python3.10/site-packages/ultralytics/engine/model.py:230, in Model._load(self, weights, task) | |
227 weights = checks.check_model_file_from_stem(weights) # add suffix, i.e. yolov8n -> yolov8n.pt | |
229 if Path(weights).suffix == ".pt": | |
--> 230 self.model, self.ckpt = attempt_load_one_weight(weights) | |
231 self.task = self.model.args["task"] | |
232 self.overrides = self.model.args = self._reset_ckpt_args(self.model.args) | |
File /opt/conda/lib/python3.10/site-packages/ultralytics/nn/tasks.py:803, in attempt_load_one_weight(weight, device, inplace, fuse) | |
801 def attempt_load_one_weight(weight, device=None, inplace=True, fuse=False): | |
802 """Loads a single model weights.""" | |
--> 803 ckpt, weight = torch_safe_load(weight) # load ckpt | |
804 args = {**DEFAULT_CFG_DICT, **(ckpt.get("train_args", {}))} # combine model and default args, preferring model args | |
805 model = (ckpt.get("ema") or ckpt["model"]).to(device).float() # FP32 model | |
File /opt/conda/lib/python3.10/site-packages/ultralytics/nn/tasks.py:729, in torch_safe_load(weight) | |
721 try: | |
722 with temporary_modules( | |
723 { | |
724 "ultralytics.yolo.utils": "ultralytics.utils", | |
(...) | |
727 } | |
728 ): # for legacy 8.0 Classify and Pose models | |
--> 729 ckpt = torch.load(file, map_location="cpu") | |
731 except ModuleNotFoundError as e: # e.name is missing module name | |
732 if e.name == "models": | |
File /opt/conda/lib/python3.10/site-packages/torch/serialization.py:1026, in load(f, map_location, pickle_module, weights_only, mmap, **pickle_load_args) | |
1024 except RuntimeError as e: | |
1025 raise pickle.UnpicklingError(UNSAFE_MESSAGE + str(e)) from None | |
-> 1026 return _load(opened_zipfile, | |
1027 map_location, | |
1028 pickle_module, | |
1029 overall_storage=overall_storage, | |
1030 **pickle_load_args) | |
1031 if mmap: | |
1032 raise RuntimeError("mmap can only be used with files saved with " | |
1033 "`torch.save(_use_new_zipfile_serialization=True), " | |
1034 "please torch.save your checkpoint with this option in order to use mmap.") | |
File /opt/conda/lib/python3.10/site-packages/torch/serialization.py:1438, in _load(zip_file, map_location, pickle_module, pickle_file, overall_storage, **pickle_load_args) | |
1436 unpickler = UnpicklerWrapper(data_file, **pickle_load_args) | |
1437 unpickler.persistent_load = persistent_load | |
-> 1438 result = unpickler.load() | |
1440 torch._utils._validate_loaded_sparse_tensors() | |
1441 torch._C._log_api_usage_metadata( | |
1442 "torch.load.metadata", {"serialization_id": zip_file.serialization_id()} | |
1443 ) | |
File /opt/conda/lib/python3.10/site-packages/torch/serialization.py:1431, in _load.<locals>.UnpicklerWrapper.find_class(self, mod_name, name) | |
1429 pass | |
1430 mod_name = load_module_mapping.get(mod_name, mod_name) | |
-> 1431 return super().find_class(mod_name, name) | |
AttributeError: Can't get attribute 'ELAN1' on <module 'ultralytics.nn.modules.block' from '/opt/conda/lib/python3.10/site-packages/ultralytics/nn/modules/block.py'> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment