【问题标题】:In Tensorflow, I'm getting errors converting Google's BigTransfer model into Tensorflow Lite在 Tensorflow 中,将 Google 的 BigTransfer 模型转换为 Tensorflow Lite 时出现错误
【发布时间】:2021-04-16 02:14:27
【问题描述】:

我想在设备上使用 Google BigTransfer 论文中的模型。

纸张: https://arxiv.org/abs/1912.11370

代码: https://github.com/google-research/big_transfer/blob/master/colabs/big_transfer_tf2.ipynb

这是我的 TF Lite 代码:

def representative_data_gen():
  for x, _ in validation_ds.take(QUANTIZATION_REPRESENTATIVE_DATASET_SIZE):
    yield [x]
    
converter = tf.lite.TFLiteConverter.from_saved_model(MODEL_DIR)
converter.optimizations = [tf.lite.Optimize.DEFAULT]
converter.representative_dataset = representative_data_gen

tflite_model = converter.convert()

这是我得到的错误:

<unknown>:0: error: failed while converting: 'main': Ops that can be supported by the flex runtime (enabled via setting the -emit-select-tf-ops flag):
        tf.SquaredDifference {device = ""}

看起来 Tensorflow Lite 无法执行 group_norm,因为 tf.SquaredDifference 没有操作。关于如何将 Google 的 BiT 模型转换为 Tensorflow Lite 的任何想法?

【问题讨论】:

  • 试试TF select ops 但在这种情况下你不能使用量化。而且模型转换的可能性不是 100%。

标签: tensorflow tensorflow-lite quantization


【解决方案1】:

尝试使用TF select ops。但是,您可能需要确保您的 TFLite 解释器具有这些选择操作以进行推理。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-05-14
    • 2019-12-22
    • 2018-06-14
    • 2020-12-03
    相关资源
    最近更新 更多