Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to make combined mlmodel based on seperate mlmodels? adding if-else control flow #2392

Open
xueyingxin opened this issue Nov 12, 2024 · 1 comment
Labels
question Response providing clarification needed. Will not be assigned to a release. (type)

Comments

@xueyingxin
Copy link

xueyingxin commented Nov 12, 2024

❓Question

I want to use coremltools to help accomplish combining some separate coreml models to form a bigger one.
For example, I have models: main.mlmodel, if_branch.mlmodel, else_branch.mlmodel, each have so many layers.
I want to make another mlmodel based on those three. And the flow should be like this:
Inputs include input to "main" and a condition input "cond".
Input feed to "main", then output of it will go to either "if_branch" or "else_branch" based on the other input "cond".

I tried using "NeuralNetworkBuilder" to construct the bigger model. But when constructing the if layer, what kind of method(api) should I use to move all layers in "if_branch.mlmodel" to the "ifbranch" of the if layer instead of rewriting each layer into "ifbranch"?
image

@xueyingxin xueyingxin added the question Response providing clarification needed. Will not be assigned to a release. (type) label Nov 12, 2024
@TobyRoseman
Copy link
Collaborator

It sounds like you should be using more than one model. It sounds like you want to create a model pipeline.

Model pipelines allow you to create an MLModel that consists of other MLModels. Models in the pipeline can take as input earlier Model's output.

Model Pipeline Resources

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Response providing clarification needed. Will not be assigned to a release. (type)
Projects
None yet
Development

No branches or pull requests

2 participants