Hello all. I am new here and am investigating whet...
# questions
m
Hello all. I am new here and am investigating whether our company should use Kedro. We work in a highly regulated industry where we need to trian and deploy ML models in a sound, versioned, reproducable way. Kedro seems to tick a lot of boxes when it comes to clear directory structure, Node/Pipeline concepts, tagging for partial execution, datacatalog, etc. I have a succesfully built a succesful kedro package with 3 pipelines: 1) preprocesisng, 2) model training and 3) inference. (1) and (2) work perfectly but it seems that at the realtime inference I have issues. After having batch trained ML models on large datasets, I need to use the trained models for per-point inference in a hosted service. So, training is batch wise but inference is point wise. It seems that you somehow need to do this by defining the inference input as MemoryDataset and then somehow load data in that and execute the inference pipeline. However, i cant seem to find a way to do this properly via KedrioSession. I wonder if the use case that I have is actually something that is supported out of the box for Kedro? Any advice on how to do this with minimal overhead? As for now I have defined input as
MemoryDataset
as input for the inference pipeline but I get "`DatasetError: Data for MemoryDataset has not been saved`" error when running:
Copy code
with KedroSession.create() as session:
    context = session.load_context()
    context.catalog.get("input").save("mydata")
    session.run(pipeline_name="inference")
1. Is this the proper way to do it? 2. Is this a use case that is supported by Kedro or should I only use it for the batch training and use the output of those models manually in my service.
g
Hi @Martin van Hensbergen I think
MemoryDataset
is meant to pass data between nodes without having to handle saving/loading it. In your case, have you cosnidered using a parameter instead of a
MemoryDataset
? https://docs.kedro.org/en/stable/configure/parameters/
m
Hi @Gianmarco Guarnier, I have not considered using parameters because they are used for model parameters whereas the datapoints for inference should be an input. I suppose one could use parameters in a way to do this but that seems like crossing the boundary of core Kedro concepts. To me, the most logical thing that should work is create a MemoryDataset with the single datapoint to call the inference pipeline on as I try to do above but somehow the save doesn't seem to be committed. The documentation is also a bit sparse on the subject but I'll try to look for it a bit more. If I find out anything I will post it here 🙂
m
It sounds like what you need is actually injecting data into the session run at runtime (https://github.com/kedro-org/kedro/issues/2169). We have recently started looking into creating an API layer for Kedro which is related to serving your pipelines and thus allowing you to inject data at runtime too.