首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Tensorflow Extended(TFX)代码在Google Colab上运行良好,但在本地计算机上运行时抛出错误

Tensorflow Extended(TFX)代码在Google Colab上运行良好,但在本地计算机上运行时抛出错误
EN

Stack Overflow用户
提问于 2020-05-27 20:05:48
回答 1查看 329关注 0票数 1

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

代码语言:javascript
复制
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);

但是,当我运行以下代码时

回溯(最近一次调用):

文件"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导入元数据

File "/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

文件路径名,第24行,在路径名= imp.load_module('_pywrap_tf_metadata_store_serialized',fp,swig_import_helper _mod,_mod)

文件返回第242行,在load_module "/usr/local/Cellar/python/3.7.7/Frameworks/Python.framework/Versions/3.7/lib/python3.7/imp.py",load_dynamic(名称,文件名,文件)中

load_dynamic return _load(spec)中的文件返回行342

引用自: /usr/local/lib/python3.7/site-packages/ml_metadata/metadata_store/_pywrap_tf_metadata_store_serialized.so (它是为MacOSX10.15构建的)

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

apache-beam 2.20.0

张力板1.15.0

tensorflow 1.15.0

tensorflow-data-validation 0.23.0.dev0

tensorflow-估计器1.15.1

tensorflow-元数据0.22.0

tensorflow-模型分析0.21.5

tensorflow-transform 0.22.0

tfx 0.21.4

tfx-bsl 0.22.0

EN

回答 1

Stack Overflow用户

发布于 2021-05-05 18:14:57

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

代码语言:javascript
复制
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))
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/62042750

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档