Skip to content

Yolov12 attribute Error #370

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

Open
DolapoSalim opened this issue Apr 1, 2025 · 5 comments
Open

Yolov12 attribute Error #370

DolapoSalim opened this issue Apr 1, 2025 · 5 comments

Comments

@DolapoSalim
Copy link

I tried to run inference on my custom YOLOV12 model but keep running into this error

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In[7], [line 1](vscode-notebook-cell:?execution_count=7&line=1)
----> [1](vscode-notebook-cell:?execution_count=7&line=1) results = model.predict(image_path)
      [2](vscode-notebook-cell:?execution_count=7&line=2) results[0].show()

File c:\Users\xxxxx\anaconda3\envs\opencv-env\Lib\site-packages\ultralytics\engine\model.py:550, in Model.predict(self, source, stream, predictor, **kwargs)
    [548](file:///C:/Users/xxxx/anaconda3/envs/opencv-env/Lib/site-packages/ultralytics/engine/model.py:548) if prompts and hasattr(self.predictor, "set_prompts"):  # for SAM-type models
    [549](file:///C:/Users/xxx/anaconda3/envs/opencv-env/Lib/site-packages/ultralytics/engine/model.py:549)     self.predictor.set_prompts(prompts)
--> [550](file:///C:/Users/x/axxxnaconda3/envs/opencv-env/Lib/site-packages/ultralytics/engine/model.py:550) return self.predictor.predict_cli(source=source) if is_cli else self.predictor(source=source, stream=stream)

File c:\Users\dolap\anaconda3\envs\opencv-env\Lib\site-packages\ultralytics\engine\predictor.py:214, in BasePredictor.__call__(self, source, model, stream, *args, **kwargs)
    [212](file:///C:/Users/xxx/anaconda3/envs/opencv-env/Lib/site-packages/ultralytics/engine/predictor.py:212)     return self.stream_inference(source, model, *args, **kwargs)
    [213](file:///C:/Users/x/xxanaconda3/envs/opencv-env/Lib/site-packages/ultralytics/engine/predictor.py:213) else:
--> [214](file:///C:/Users/xxx/anaconda3/envs/opencv-env/Lib/site-packages/ultralytics/engine/predictor.py:214)     return list(self.stream_inference(source, model, *args, **kwargs))

File c:\Users\xxxxx\anaconda3\envs\opencv-env\Lib\site-packages\torch\utils\_contextlib.py:36, in _wrap_generator.<locals>.generator_context(*args, **kwargs)
     [33](file:///C:/Users/x/axxxnaconda3/envs/opencv-env/Lib/site-packages/torch/utils/_contextlib.py:33) try:
     [34](file:///C:/Users/xxxx/anaconda3/envs/opencv-env/Lib/site-packages/torch/utils/_contextlib.py:34)     # Issuing `None` to a generator fires it up
     [35](file:///C:/Users/xxx/anaconda3/envs/opencv-env/Lib/site-packages/torch/utils/_contextlib.py:35)     with ctx_factory():
---> [36](file:///C:/Users/xxxx/anaconda3/envs/opencv-env/Lib/site-packages/torch/utils/_contextlib.py:36)         response = gen.send(None)
     [38](file:///C:/Users/xxxxx/anaconda3/envs/opencv-env/Lib/site-packages/torch/utils/_contextlib.py:38)     while True:
     [39](file:///C:/Users/xxxxx/anaconda3/envs/opencv-env/Lib/site-packages/torch/utils/_contextlib.py:39)         try:
     [40](file:///C:/Users/xxxxx/anaconda3/envs/opencv-env/Lib/site-packages/torch/utils/_contextlib.py:40)             # Forward the response to our caller and get its next request
...
-> [1928](file:///C:/Users/x/xxxxanaconda3/envs/opencv-env/Lib/site-packages/torch/nn/modules/module.py:1928) raise AttributeError(
   [1929](file:///C:/Users/xxxxx/anaconda3/envs/opencv-env/Lib/site-packages/torch/nn/modules/module.py:1929)     f"'{type(self).__name__}' object has no attribute '{name}'"
   [1930](file:///C:/Users/xxxxx/anaconda3/envs/opencv-env/Lib/site-packages/torch/nn/modules/module.py:1930) )

AttributeError: 'AAttn' object has no attribute 'qkv'
@miftahurrrizki
Copy link

I have the same problem, have you solved it? 😢

@DolapoSalim
Copy link
Author

I have the same problem, have you solved it? 😢

No, I haven’t

@mortvivant
Copy link

Could anyone solve it ? I have same problem

@panchaldhruv27223
Copy link

!! ALERT ---- URGENT

I ALSO HAVE THE SAME ISSUE.
I HAVE TRIED ALL THE POSSIBLE STEPS TO REOSLVE THIS.
MY MODEL IS LOADING FINE BUT AT THE FINETUNING TIME OR PREDICTION TIME MODEL IS GIVING THIS ERROR.
LAST TIME WHEN I USED IN MARCH MONTH IT IS WORKING FINE BUT NOW MY SCRIPT IS GIVING THIS ERRROR.
CAN ANYONE PLEASED GUIDE ME.

@SkalskiP
Copy link
Collaborator

SkalskiP commented May 5, 2025

@DolapoSalim, @miftahurrrizki, @mortvivant, @panchaldhruv27223 could any of you update installation command to pip install -q git+https://github.com/sunsmarterjie/yolov12.git@3a336a4adf3683d280e1a50d03fa24bbe7f24a5b and check if that solves the issue?

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

5 participants