Skip to content

Commit

Permalink
Edge TPU TF imports fix (#6542)
Browse files Browse the repository at this point in the history
* Edge TPU TF imports fix

Fix for #6535 (comment)

* Update common.py
  • Loading branch information
glenn-jocher authored Feb 5, 2022
1 parent cba4303 commit dc7e093
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions models/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,11 +374,11 @@ def wrap_frozen_graph(gd, inputs, outputs):
graph_def.ParseFromString(open(w, 'rb').read())
frozen_func = wrap_frozen_graph(gd=graph_def, inputs="x:0", outputs="Identity:0")
elif tflite: # https://www.tensorflow.org/lite/guide/python#install_tensorflow_lite_for_python
try: # prefer tflite_runtime if installed
try: # https://coral.ai/docs/edgetpu/tflite-python/#update-existing-tf-lite-code-for-the-edge-tpu
from tflite_runtime.interpreter import Interpreter, load_delegate
except ImportError:
import tensorflow.lite.experimental.load_delegate as load_delegate
import tensorflow.lite.Interpreter as Interpreter
import tensorflow as tf
Interpreter, load_delegate = tf.lite.Interpreter, tf.lite.experimental.load_delegate,
if 'edgetpu' in w.lower(): # Edge TPU https://coral.ai/software/#edgetpu-runtime
LOGGER.info(f'Loading {w} for TensorFlow Lite Edge TPU inference...')
delegate = {'Linux': 'libedgetpu.so.1',
Expand Down

2 comments on commit dc7e093

@Mik201199
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sir the code is showing 819 lines not committed when using this ,just thought of let you know regarding this

@glenn-jocher
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Mik201199 thanks for the feedback! I don't understand what you mean. Could you explain more or provide a screenshot please?

Please sign in to comment.