I've built an Encoder/Decoder model (in PyTorch), saved as two separate mlmodel
objects. I want to put these together in a coremltools.models.pipeline
, for efficiency purposes. With the two input models saved to disk, this is what I use to build the pipeline:
from coremltools.models.pipeline import *
from coremltools.models import datatypes
input_features = [('distorted_input', datatypes.Array(28*28))]
output_features = ['z_distribution', 'rectified_input']
pipeline = Pipeline(input_features, output_features)
pipeline.add_model(enc_mlmodel)
pipeline.add_model(dec_mlmodel)
pipeline_model = coremltools.models.MLModel(pipeline.spec)
pipeline_model.save('inputFixerPipeline.mlmodel')
The creation of the pipeline runs fine, but the model that's saved fails to connect the input -- i.e., looking at the model in Netron, I see that the distorted_input
node is just hanging on its own. The rest of the pipeline appears to be correct.
Any thoughts?