[Python] AttributeError: 'AAttn' object has no attribute 'qkv' when running inference on...

Discussão em 'Python' iniciado por Stack, Abril 5, 2025.

  1. Stack

    Stack Membro Participativo

    I'm currently trying to run inference using my YOLOv12 model, but I encountered the following error:

    AttributeError: 'AAttn' object has no attribute 'qkv'

    this is my code:

    from ultralytics import YOLO

    model = YOLO(r"D:\a\b\Model\newDatasetVersion\12\m\best.pt")

    img = r"D:\a\br\Program\Scrapping\Frames_Kopo\Kopo0_20250228_111522_frame_1.jpg"
    results = model(img, save=False)


    I'm not entirely sure what's causing this. Here's a bit of context:

    • I'm using YOLOv12 (custom-trained).
    • The error occurs during inference, not training.

    I tried loading my YOLOv12 model and running inference on an image. I expected the model to return predictions (bounding boxes, classes, etc.) as usual. However, instead of getting the output, I got that error.

    I didn’t modify the model architecture manually, just trained my custom dataset with yolo12m.pt, so I’m not sure why this is happening. I expected the inference to run normally as it did previously.

    What might be causing this or how can I fix it?

    Continue reading...

Compartilhe esta Página