我正在尝试使用kfp.components.ComponentStore加载一些预置的gcp kubeflow组件。但是,我得到了这个错误:
line 180, in _load_component_spec_in_component_ref
if self.uri_search_template:
AttributeError: 'ComponentStore' object has no attribute 'uri_search_template'在这一行代码中:
mlengine_train_op = component_store.load_component('ml_engine/train')KFP版本:
kfp 1.8.10
kfp-pipeline-spec 0.1.13
kfp-server-api 1.7.1复制步骤
import kfp
from kfp.components import func_to_container_op
COMPONENT_URL_SEARCH_PREFIX = "https://raw.githubusercontent.com/kubeflow/pipelines/1.7.1/components/gcp/"
component_store = kfp.components.ComponentStore(
local_search_paths=None, url_search_prefixes=[COMPONENT_URL_SEARCH_PREFIX])
mlengine_train_op = component_store.load_component('ml_engine/train')
mlengine_deploy_op = component_store.load_component('ml_engine/deploy')我从一个运行在kfp 0.2.5上的示例中获得了这段代码。这可能是一个版本问题,但有人知道如何将此代码更新为更新版本吗?
发布于 2022-01-27 09:58:24
我解决了这个问题。@Kabilan也提到了他的评论。如果在创建uri_search_template时不设置ComponentStore,那么似乎存在一个bug。我通过提供它作为参数来解决这个问题,您真正传递给构造函数的内容并不重要,但是它是必需的,因为在代码中有以下内容
if self.url_search_prefixes:但是,如果不传递某个属性,则不能在构造函数中创建该属性。我把它修好了:
component_store = kfp.components.ComponentStore(
local_search_paths=["local_search_path"], url_search_prefixes=[COMPONENT_URL_SEARCH_PREFIX]), uri_search_template="{name}/"我希望这会对将来的人有所帮助。我在github问题中建议通过使错误更加清楚或更好地检查uri_search_template属性来解决这一问题。
https://stackoverflow.com/questions/70868344
复制相似问题