pipeline.objects.pipeline.Pipeline( new_pipeline_name: str, compute_type: str = "gpu", min_gpu_vram_mb: int = None, )
Pipeline class is used to either start a new context manager session to create a graph, or to interact with graph objects currently stored in
Pipeline. As it acts as both a context manager and object store there are various static and non static functions used in both situations.
When the context manager is closed, the resultant computational graph is stored inside of the
Pipeline object and must be retrieved.
str) - the name of the pipeline graph to be created, this is used to obtain the graph later.
str, optional) - the compute resource required for this pipeline, either
gpu. This is only used when running the pipeline on an external service.
int, optional) - the minimum required amount of GPU memory required to run the pipeline. This is only used when running the pipeline on an external service.
Variable objects to the output list for the pipeline. When the pipeline graph finishes executing via the run call, the real value of these
Variable objects that have been computed from the graph are returned.
Variable) - an arbitrary number of
Retrieves a pipeline graph based on it's name. Typically this will be used shortly after the context manager.
str) - the name of the pipeline.
Adds a variable to the graph being constructed inside of the context manager. this function cannot be called outside of the context manager.
Variable) - the variable to be added.
The same as
add_variable but accepts an arbitrary number of inputs.
Variable) - an arbitrary list of
Variableobjects to be added.
This should not be used by a user and is called automatically when a function is called in the context manager to add it to the graph.
Function) - the function object to be added to the graph.
This is should not be used by a user and is called automatically when a function is called in the context manager as the input, output, and function are all used to construct the node.
GraphNode) - the
GraphNodeobject to be added to the graph.
Basic usage of
Pipeline context manager.
from pipeline import Pipeline, Variable, pipeline_function @pipeline_function def add_numbers(a: int, b: int) -> int: return a + b with Pipeline("add-numbers") as pipeline: a = Variable(type_class=int, is_input=True) b = Variable(type_class=int, is_input=True) pipeline.add_variables(a, b) c = add_numbers(a, b) pipeline.output(c)
Updated 18 days ago