Skip to content

AttributeError: module 'tensorflow._api.v2.lite' has no attribute 'load_delegate' #6535

@glenn-jocher

Description

@glenn-jocher

Search before asking

  • I have searched the YOLOv5 issues and found no similar bug report.

YOLOv5 Component

Export

Bug

@zldrobit I think recent changes to EdgeTPU inference created a bug where load_delegate import was attempted from tensorflow.lite.load_delegate instead of tensorflow.lite.experimental.load_delegate causing this error message:

AttributeError: module 'tensorflow._api.v2.lite' has no attribute 'load_delegate'

If I attempt a fix in #6536 I still see a new error message on EdgeTPU inference:

AttributeError: 'Delegate' object has no attribute '_library'

Environment

YOLOv5 🚀 v6.0-231-g9bc72a3 torch 1.10.0+cu111 CPU

Minimal Reproducible Example

In Colab Notebook
https://colab.research.google.com/github/ultralytics/yolov5/blob/master/tutorial.ipynb

!python export.py --include edgetpu
!python detect.py --weights yolov5s-int8_edgetpu.tflite

Additional

Will submit PR with fix for original error.

Are you willing to submit a PR?

  • Yes I'd like to help by submitting a PR!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions