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

New pipeline save/load features #14

Open
shijianjian opened this issue Apr 12, 2023 · 3 comments
Open

New pipeline save/load features #14

shijianjian opened this issue Apr 12, 2023 · 3 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@shijianjian
Copy link
Member

shijianjian commented Apr 12, 2023

An ideal feature but not sure if it is better for app or pipeline. A proper save/load can make the limbus serve as ONNX.

1. Save and Load

Requesting a feature to export/save and import/load a built Pipeline.

Format Candidates:

MyPipeline().save("myapp.someformat")

Then one can load and use with

Load("myapp.someformat").run(1)

2. Input/Output Information

In order to integrate the exported app/pipeline to other applications, it is better to include the input and output information like pipeline.graph.input and pipeline.graph.output.

3. Accepts I/O

Accepting input and output for the built app/pipeline.

4. A flag with if packaging models into the output or not.

We support a very big xxx.pipeline file.

Or a file structure like:

  • XXX.pipeline
    • model_a.onnx
    • model_b.tensorrt

A Proposal

Maybe having Input and Output Component.

For example:

self.c1 = Input("c1", shape=(B,))
self.t1 = Input("t1", shape=(B, 3))
self.t2 = Input("t2", shape=(B, 3))
self.stack = stack("stack")
self.out = Output("o", shape=None)

self.c1 >> self.stack.inputs.dim
self.t1>> self.stack.inputs.tensors.select(0)
self.t2>> self.stack.inputs.tensors.select(1)
self.stack.outputs.out >> self.out

pipeline = Pipeline()
pipeline.add_nodes([c1, t1, t2, stack, show])

pipeline.save("mypipeline.pipeline")

# Adding some ONNX-ish APIs
pipeline.graph.input  # returns [c1, t1, t2] and their shapes
pipeline.graph.output  # returns [o] and its shape

out = pipeline.exec([torch.tensor([0.]), np.array([[1, 2, 3.]]), ...])
@shijianjian shijianjian added enhancement New feature or request help wanted Extra attention is needed labels Apr 12, 2023
@tp-nan
Copy link

tp-nan commented Jan 15, 2024

Format Candidates:

joblib, recommended by scikit-learn. https://scikit-learn.org/stable/model_persistence.html
MyPipeline().save("myapp.someformat")

That's an interesting feature. Is there any detail for how to implement this feature?

@shijianjian
Copy link
Member Author

Format Candidates:

joblib, recommended by scikit-learn. https://scikit-learn.org/stable/model_persistence.html
MyPipeline().save("myapp.someformat")

That's an interesting feature. Is there any detail for how to implement this feature?

Not so complex if all the classes are serializable. It is more or less a pickle file only. Well, since maybe some model files are involved, we may also append those ONNX files into the pickle object.

@edgarriba
Copy link
Member

i think @lferraz was somehow serializing already pipelines

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants