YOLOE: Fix model text embedding fusing (#21277)

Co-authored-by: UltralyticsAssistant <web@ultralytics.com>
Co-authored-by: Jing Qiu <61612323+Laughing-q@users.noreply.github.com>
Co-authored-by: Laughing-q <1185102784@qq.com>
This commit is contained in:
XH 2025-07-06 12:48:43 +08:00 committed by GitHub
parent 1b385a1251
commit 0f5d2bb273
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -249,6 +249,8 @@ class BaseModel(torch.nn.Module):
m.forward = m.forward_fuse
if isinstance(m, v10Detect):
m.fuse() # remove one2many head
if isinstance(m, YOLOEDetect) and hasattr(self, "pe"):
m.fuse(self.pe.to(next(self.model.parameters()).device))
self.info(verbose=verbose)
return self