kubeflow组件 - 为什么要定义组件的多种方法以及有什么区别?
请帮助了解不同方式创建KubeFlow管道组件的有意义/重大差异以及有多种方式的原因?
from kfp.components import func_to_container_op
@func_to_container_op
def add_op(a: float, b: float) -> float:
"""Returns sum of two arguments"""
return a + b
from kfp.v2.dsl import component
@component
def add_op(a: float, b: float) -> float:
"""Returns sum of two arguments"""
return a + b
from kfp.components import create_component_from_func
@create_component_from_func
def add_op(a: float, b: float) -> float:
"""Returns sum of two arguments"""
return a + b
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
很棒的问题!我完全同意,过去的肯德基经常提供多种方法来执行相似的任务甚至相同的任务,这会引起大量的用户困惑。
在KFP SDK 2.0(当前处于Beta阶段,最新的为2.0.0b5),
func_to_to_container_op
和create_component_from_func
均被弃用。从python函数创建组件而不构建容器映像的唯一选项是使用
@component
。有关更多信息,请参见Great question! And I fully agree that KFP in the past has often offered multiple ways to do similar or even same tasks, which causes lots of user confusion.
In KFP SDK 2.0 (currently at beta stage with latest being 2.0.0b5), both
func_to_container_op
andcreate_component_from_func
are deprecated.The only option to create a component from a Python function without building a container image is to use
@component
. For more information, see https://www.kubeflow.org/docs/components/pipelines/v2/author-a-pipeline/components/