Getting "array_record_module" ImportError: dlopen in Tensor Flow Lite

问题描述 投票:0回答:0

我正在尝试按照以下示例中提到的下面的tensorflow代码运行(https://www.tensorflow.org/lite/models/modify/model_maker

from tflite_model_maker import image_classifier
from tflite_model_maker.image_classifier import DataLoader

# Load input data specific to an on-device ML app.
data = DataLoader.from_folder('flower_photos/')
train_data, test_data = data.split(0.9)

# Customize the TensorFlow model.
model = image_classifier.create(train_data)

# Evaluate the model.
loss, accuracy = model.evaluate(test_data)

# Export to Tensorflow Lite model and label file in `export_dir`.
model.export(export_dir='/tmp/')

但我收到如下错误

2023-05-14 13:43:07.639151: I tensorflow/core/platform/cpu_feature_guard.cc:193] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations:  AVX2 FMA
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
/usr/local/lib/python3.9/site-packages/tensorflow_addons/utils/tfa_eol_msg.py:23: UserWarning: 

TensorFlow Addons (TFA) has ended development and introduction of new features.
TFA has entered a minimal maintenance and release mode until a planned end of life in May 2024.
Please modify downstream libraries to take dependencies from other repositories in our TensorFlow community (e.g. Keras, Keras-CV, and Keras-NLP). 

For more information see: https://github.com/tensorflow/addons/issues/2807 

  warnings.warn(
Traceback (most recent call last):
  File "/Users/apple/Documents/modelmakersrc/maketflitemodel.py", line 3, in <module>
    from tflite_model_maker import model_spec
  File "/usr/local/lib/python3.9/site-packages/tflite_model_maker/__init__.py", line 44, in <module>
    from tflite_model_maker import audio_classifier
  File "/usr/local/lib/python3.9/site-packages/tflite_model_maker/audio_classifier/__init__.py", line 24, in <module>
    from tensorflow_examples.lite.model_maker.core.data_util.audio_dataloader import DataLoader
  File "/usr/local/lib/python3.9/site-packages/tensorflow_examples/lite/model_maker/core/data_util/audio_dataloader.py", line 27, in <module>
    from tensorflow_examples.lite.model_maker.core.task.model_spec import audio_spec
  File "/usr/local/lib/python3.9/site-packages/tensorflow_examples/lite/model_maker/core/task/model_spec/__init__.py", line 24, in <module>
    from tensorflow_examples.lite.model_maker.core.task.model_spec import text_spec
  File "/usr/local/lib/python3.9/site-packages/tensorflow_examples/lite/model_maker/core/task/model_spec/text_spec.py", line 44, in <module>
    from official.nlp.data import classifier_data_lib
  File "/usr/local/lib/python3.9/site-packages/official/nlp/data/classifier_data_lib.py", line 28, in <module>
    import tensorflow_datasets as tfds
  File "/usr/local/lib/python3.9/site-packages/tensorflow_datasets/__init__.py", line 43, in <module>
    import tensorflow_datasets.core.logging as _tfds_logging
  File "/usr/local/lib/python3.9/site-packages/tensorflow_datasets/core/__init__.py", line 22, in <module>
    from tensorflow_datasets.core import community
  File "/usr/local/lib/python3.9/site-packages/tensorflow_datasets/core/community/__init__.py", line 18, in <module>
    from tensorflow_datasets.core.community.huggingface_wrapper import mock_builtin_to_use_gfile
  File "/usr/local/lib/python3.9/site-packages/tensorflow_datasets/core/community/huggingface_wrapper.py", line 31, in <module>
    from tensorflow_datasets.core import dataset_builder
  File "/usr/local/lib/python3.9/site-packages/tensorflow_datasets/core/dataset_builder.py", line 34, in <module>
    from tensorflow_datasets.core import dataset_info
  File "/usr/local/lib/python3.9/site-packages/tensorflow_datasets/core/dataset_info.py", line 47, in <module>
    from tensorflow_datasets.core import file_adapters
  File "/usr/local/lib/python3.9/site-packages/tensorflow_datasets/core/file_adapters.py", line 29, in <module>
    from array_record.python import array_record_module
ImportError: dlopen(/usr/local/lib/python3.9/site-packages/array_record/python/array_record_module.so, 0x0002): tried: '/usr/local/lib/python3.9/site-packages/array_record/python/array_record_module.so' (not a mach-o file)

以下安装的 pip 包

打包版本


absl-py 1.4.0 数组记录 0.2.0 astunparse 1.6.3 属性 23.1.0 自动售货机 22.10.0 博尔顿 23.0.0 布罗利皮 0.7.0 缓存工具 5.3.0 证书 2023.5.7 cffi 1.15.1 字符集标准化器 2.0.4 点击 8.1.3 康达 23.3.1 康达内容信任 0.1.3 康达包处理 2.0.2 conda_package_streaming 0.7.0 不断 15.1.0 构建 2.10.68 密码学 39.0.1 dm树0.1.8 etils 1.3.0 平面缓冲区 23.5.9 加斯特0.4.0 谷歌授权 2.18.0 谷歌认证 oauthlib 1.0.0 谷歌意大利面 0.2.0 googleapis-common-protos 1.59.0 grpcio 1.54.2 h5py 3.8.0 超链接 21.0.0 idna 3.4 importlib-资源 5.12.0 增量 22.10.0 贾克斯0.4.10 jsonpatch 1.32 jsonpointer 2.1 喀拉斯 2.12.0 Keras-预处理1.1.2 libclang 16.0.0 降价 3.4.3 标记安全 2.1.2 ml-dtypes 0.1.0 麻木 1.23.5 oauthlib 3.2.2 opt-einsum 3.3.0 包装 23.0 点子 23.1.2 塞子 1.0.0 层数 3.11 承诺 2.3 protobuf 4.23.0 psutil 5.9.5 pyasn1 0.5.0 pyasn1-模块0.3.0 pybind11 2.10.4 卫星0.6.4 pycparser 2.21 pycryptodomex 3.17 pyOpenSSL 23.0.0 pysmi 0.3.4 pysnmp 4.4.12 PySocks 1.7.1 PyYAML 6.0 请求 2.28.1 请求-oauthlib 1.3.1 RSA 4.9 ruamel.yaml 0.17.21 ruamel.yaml.clib 0.2.6 科学 1.10.1 安装工具 65.6.3 六个 1.16.0 张量 0.3.6 张量板 2.12.3 张量板数据服务器 0.7.0 张量板插件机智 1.8.1 张量流 2.12.0 张量流数据集 4.9.1 张量流估计器 2.11.0 tensorflow-io-gcs-文件系统 0.32.0 张量流元数据 1.13.1 术语颜色 2.3.0 tflite 支持 0.1.0a1 toml 0.10.2 工具z 0.12.0 tqdm 4.65.0 扭曲 22.10.0 类型守卫 2.13.3 打字扩展 4.5.0 urllib3 1.26.15 Werkzeug 2.3.4 车轮 0.38.4 包装 1.14.1 压缩包 3.15.0 zope.interface 6.0 z标准0.19.0

我已经尝试了以下站点中提到的所有步骤(https://www.tensorflow.org/lite/models/modify/model_maker),但我遇到了错误。

python tensorflow machine-learning artificial-intelligence tensorflow-lite
© www.soinside.com 2019 - 2024. All rights reserved.