在 Kedro 中,我们可以流水线化不同的节点并部分运行一些节点。当我们部分运行一些节点时,我们需要将一些节点的输入保存在某个地方,以便当另一个节点运行时,它可以访问前一个节点生成的数据。但是,我们在哪个文件中编写代码——pipeline.py、run.py 还是nodes.py?
例如,我试图将 dir 路径直接保存到变量名“model_path”下的 DataCatalog。
来自 pipeline.py 的片段:
# A mapping from a pipeline name to a ``Pipeline`` object.
def create_pipelines(**kwargs) -> Dict[str, Pipeline]:
io = DataCatalog(dict(
model_path=MemoryDataSet()
))
io.save('model_path', "data/06_models/model_test")
print('****', io.exists('model_path'))
pipeline = Pipeline([
node(
split_files,
["data_csv", "parameters"],
["train_filenames", "val_filenames", "train_labels", "val_labels"],
name="splitting filenames"
),
# node(
# create_and_train,
# ["train_filenames", "val_filenames", "train_labels", "val_labels", "parameters"],
# "model_path",
# name="Create Dataset, Train and Save Model"
# ),
node(
validate_model,
["val_filenames", "val_labels", "model_path"],
None,
name="Validate Model",
)
]).decorate(decorators.log_time, decorators.mem_profile)
return {
"__default__": pipeline
}
但是,当我运行 Kedro 时出现以下错误:
ValueError: Pipeline input(s) {'model_path'} not found in the DataCatalog