Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does not run with custom model #2

Open
netrosec opened this issue Jun 20, 2023 · 1 comment
Open

Does not run with custom model #2

netrosec opened this issue Jun 20, 2023 · 1 comment

Comments

@netrosec
Copy link

the code does not run with a custom model. it throws this error: ` File "predict.py", line 127, in predict
predictor()
File "/Users/iosph/miniforge3/envs/ml/lib/python3.8/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context
return func(*args, **kwargs)
File "/Users/iosph/Documents/FireDetectionYOLOv8/ultralytics/yolo/engine/predictor.py", line 164, in call
model = self.model if self.done_setup else self.setup(source, model)
File "/Users/iosph/Documents/FireDetectionYOLOv8/ultralytics/yolo/engine/predictor.py", line 121, in setup
model = AutoBackend(model, device=device, dnn=self.args.dnn, fp16=self.args.half)
File "/Users/iosph/Documents/FireDetectionYOLOv8/ultralytics/nn/autobackend.py", line 73, in init
model = attempt_load_weights(weights if isinstance(weights, list) else w,
File "/Users/iosph/Documents/FireDetectionYOLOv8/ultralytics/nn/tasks.py", line 303, in attempt_load_weights
ckpt = torch.load(attempt_download(w), map_location='cpu') # load
File "/Users/iosph/miniforge3/envs/ml/lib/python3.8/site-packages/torch/serialization.py", line 712, in load
return _load(opened_zipfile, map_location, pickle_module, **pickle_load_args)
File "/Users/iosph/miniforge3/envs/ml/lib/python3.8/site-packages/torch/serialization.py", line 1049, in _load
result = unpickler.load()
File "/Users/iosph/miniforge3/envs/ml/lib/python3.8/site-packages/torch/serialization.py", line 1042, in find_class
return super().find_class(mod_name, name)
AttributeError: Can't get attribute 'IterableSimpleNamespace' on <module 'ultralytics.yolo.utils' from '/Users/iosph/Documents/FireDetectionYOLOv8/ultralytics/yolo/utils/init.py'>

Set the environment variable HYDRA_FULL_ERROR=1 for a complete stack trace.`

@Abonia1
Copy link
Owner

Abonia1 commented Jan 19, 2025

Hi @netrosec ,
The error occurs when trying to load the weights for the custom model. Specifically, it's failing to deserialize the model weights due to an AttributeError involving IterableSimpleNamespace.

please do try updating the packages:

pip install --upgrade torch torchvision torchaudio ultralytics

If it doesnt work please do try:
-Try re-downloading the model weights using the attempt_download function.
-Ensure that the custom model is compatible with the YOLOv8 framework.

Hope this helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants