我目前正在使用库贝流作为我的策划人。规划器实际上是托管在GCP上的AI平台管道的一个实例。如何使用Tensorflow扩展SDK创建运行时参数?我怀疑这是我应该使用的类,但是这些文档不是很有意义,也没有提供任何示例。类型/运行参数
就像下面这张照片。

发布于 2020-10-07 10:38:51
例如,您希望将模块文件位置添加为一个运行时参数,该参数将传递给TFX管道中的transform组件。
首先设置setup_pipeline.py并定义模块文件参数:
# setup_pipeline.py
from typing import Text
from tfx.orchestration import data_types, pipeline
from tfx.orchestration.kubeflow import kubeflow_dag_runner
from tfx.components import Transform
_module_file_param = data_types.RuntimeParameter(
name='module-file',
default=
'/tfx-src/tfx/examples/iris/iris_utils_native_keras.py',
ptype=Text,
)接下来,定义一个函数,该函数指定管道中使用的组件并传递参数。
def create_pipeline(..., module_file):
# setup components:
...
transform = Transform(
...
module_file=module_file
)
...
components = [..., transform, ...]
return pipeline.Pipeline(
...,
components=components
)最后,设置Kubeflow DAG转轮,以便将参数沿create_pipeline函数传递。有关更完整的示例,请参见这里。
if __name__ == "__main__":
# instantiate a kfp_runner
...
kfp_runner = kubeflow_dag_runner.KubeflowDagRunner(
...
)
kfp_runner.run(
create_pipeline(..., module_file=_module_file_param
))然后您可以运行python -m setup_pipeline,它将生成指定管道配置的yaml文件,然后您可以将其上传到Kubeflow GCP接口。
https://stackoverflow.com/questions/64073243
复制相似问题