1

我有以下使用 Tensorflow Extended(TFX) 的代码

from tfx.utils.dsl_utils import csv_input
from tfx.components.example_gen.csv_example_gen.component import CsvExampleGen

examples = csv_input(os.path.join(base_dir, 'data/simple'))
example_gen = CsvExampleGen(input=examples);

当我在 Google Colab 上执行此代码时,它工作正常。但是,当我运行这个

回溯(最后一次调用):
文件“tfx_sample.py”,第 4 行,
从 tfx.components.example_gen.csv_example_gen.component 导入 CsvExampleGen
文件“/Users/sv/tfx_env/lib/python3.7/site-packages/ tfx/components/init.py”,第 20 行,
从 tfx.components.bulk_inferrer.component 导入 BulkInferrer
文件“/Users/sv/tfx_env/lib/python3.7/site-packages/tfx/components/bulk_inferrer/component. py”,
第 24 行,
从 tfx.components.base 导入 base_component
文件“/Users/sv/tfx_env/lib/python3.7/site-packages/tfx/components/base/base_component.py”,第 28 行,
从tfx.components.base 导入 base_driver
文件“/Users/sv/tfx_env/lib/python3.7/site-packages/tfx/components/base/base_driver.py”,第 28 行,在
从 tfx.orchestration 导入元数据
文件“/Users/sv/tfx_env/lib/python3.7/site-packages/tfx/orchestration/metadata.py”,第 36 行,从 ml_metadata.metadata_store 导入元数据存储
文件“/usr/local /lib/python3.7/site-packages/ml_metadata/metadata_store/init.py”,第 15 行,从 ml_metadata.metadata_store.metadata_store 导入 MetadataStore
文件“/usr/local/lib/python3.7/site-packages/ml_metadata /metadata_store/metadata_store.py”,第 32 行,从 ml_metadata.metadata_store 导入 pywrap_tf_metadata_store_serialized 作为 metadata_store_serialized
文件“/usr/local/lib/python3.7/site-packages/ml_metadata/metadata_store/pywrap_tf_metadata_store_serialized.py”,第 28 行,在_pywrap_tf_metadata_store_serialized = swig_import_helper()
文件“/usr/local/lib/python3.7/site-packages/ml_metadata/metadata_store/pywrap_tf_metadata_store_serialized.py”,第 24 行,在 swig_import_helper _mod = imp.load_module('_pywrap_tf_metadata_store_serialized', fp, pathname, description)
File "/ usr/local/Cellar/python/3.7.7/Frameworks/Python.framework/Versions/3.7/lib/python3.7/imp.py",第 242 行,在 load_module 返回 load_dynamic(name, filename, file)
File"/ usr/local/Cellar/python/3.7.7/Frameworks/Python.framework/Versions/3.7/lib/python3.7/imp.py”,第 342 行,在 load_dynamic 返回 _load(spec)
ImportError: dlopen(/usr/ local/lib/python3.7/site-packages/ml_metadata/metadata_store/_pywrap_tf_metadata_store_serialized.so,2):找不到符号:____chkstk_darwin
引用自:/usr/local/lib/python3.7/site-packages/ml_metadata/metadata_store/_pywrap_tf_metadata_store_serialized.so(专为 Mac OS X 10.15 构建)
预期在:/usr/lib/libSystem.B.dylib in / usr/local/lib/python3.7/site-packages/ml_metadata/metadata_store/_pywrap_tf_metadata_store_serialized.so

这是已安装软件包的版本详细信息

apache-beam 2.20.0
tensorboard 1.15.0
tensorboard-plugin-wit 1.6.0.post3
tensorflow 1.15.0
tensorflow-data-validation 0.23.0.dev0
tensorflow-estimator 1.15.1
tensorflow-metadata 0.22.0
tensorflow-model-分析 0.21.5
tensorflow-serving-api 2.1.0
tensorflow-transform 0.22.0
tfx 0.21.4
tfx-bsl 0.22.0

4

1 回答 1

0

请使用可用于 tfx 的最新版本(0.29.0)。解决问题的工作代码:-

import os
import tfx
from tfx.utils.dsl_utils import external_input
from tfx.components.example_gen.csv_example_gen.component import CsvExampleGen
import tempfile
import urllib

_data_root = tempfile.mkdtemp(prefix='tfx-data')
DATA_PATH = 'https://raw.githubusercontent.com/tensorflow/tfx/master/tfx/examples/chicago_taxi_pipeline/data/simple/data.csv'
_data_filepath = os.path.join(_data_root, "data.csv")
urllib.request.urlretrieve(DATA_PATH, _data_filepath)

example_gen = CsvExampleGen(input_base=(_data_filepath))
于 2021-05-05T10:14:56.950 回答