torchx.pipelines¶
These modules are adapters used to run TorchX components as part of a pipeline to allow for more complex behaviors as well as for continuous deployment.
The runner and schedulers are designed to launch a single component quickly where as these adapters transform the component into something understandable by the specific pipeline provider so you can assemble a full pipeline with them.
torchx.pipelines.kfp¶
This module contains adapters for converting TorchX components into KubeFlow Pipeline components.
The current KFP adapters only support single node (1 role and 1 replica) components.
- torchx.pipelines.kfp.adapter.component_from_app(app: torchx.specs.api.AppDef) → torchx.pipelines.kfp.adapter.ContainerFactory[source]¶
component_from_app takes in a TorchX component/AppDef and returns a KFP ContainerOp factory. This is equivalent to the kfp.components.load_component_from_* methods.
>>> from torchx import specs >>> from torchx.pipelines.kfp.adapter import component_from_app >>> app_def = specs.AppDef( ... name="trainer", ... roles=[specs.Role("trainer", image="foo:latest")], ... ) >>> component_from_app(app_def) <function component_from_app...>
- torchx.pipelines.kfp.adapter.component_spec_from_app(app: torchx.specs.api.AppDef) → Tuple[str, torchx.specs.api.Role][source]¶
component_spec_from_app takes in a TorchX component and generates the yaml spec for it. Notably this doesn’t apply resources or port_maps since those must be applied at runtime which is why it returns the role spec as well.
>>> from torchx import specs >>> from torchx.pipelines.kfp.adapter import component_spec_from_app >>> app_def = specs.AppDef( ... name="trainer", ... roles=[specs.Role("trainer", image="foo:latest")], ... ) >>> component_spec_from_app(app_def) ('description: ...', Role(...))