Bettmensch.AI is a Kubernetes native open source platform for GitOps based ML workloads that allows for tight CI and CD integrations.
To provision
- the S3 bucket for the Argo Workflows artifact repository
- Karpenter required infrastructure (IAM, message queues, etc.)
- a working EKS cluster
- the configured Karpenter, Argo Workflows & Volcano kubernetes installations on the cluster,
make infrastructure.build
To port forward to the ArgoWorkflow
server running on EKS, run:
make kubernetes.connect
When you're done, you can tear down the stack by running
make infrastructure.destroy
To build the bettmensch.ai
's custom dashboard's docker image, run:
make dashboard.build
To run the dashboard, run:
make dashboard.run
See the docker
section for more details.
To install the python library bettmensch_ai
with torch-pipelines
support,
run
make sdk.install EXTRAS=torch-pipelines
from the repository's top directory.
You can now start authoring Pipeline
s and start submitting Flow
s and
start monitoring them on both the ArgoWorkflow
as well as the bettmensch.ai
dashboards.
👀 A dashboard for monitoring all workloads running on the platform.
👐 To actively manage Pipeline
s, Flow
s, please see the
respective documentation of bettmensch.ai
SDK.
bettmensch.ai
comes with a python SDK for defining and executing distributed
(ML) workloads by leveraging the
ArgoWorkflows
framework and the
official hera
library.
The io
module implements the classes implementing the transfer of inputs and
outputs between a workfload's components.
Using InputParameter
and OutputParameter
for int
, float
or str
type
data:
from bettmensch_ai.io import InputParameter, OutputParameter
from bettmensch_ai.components import component
from bettmensch_ai.pipelines import pipeline
@component
def add(
a: InputParameter = 1,
b: InputParameter = 2,
sum: OutputParameter = None,
) -> None:
sum.assign(a + b)
@pipeline("test-parameter-pipeline", "argo", True)
def a_plus_b_plus_2(a: InputParameter = 1, b: InputParameter = 2) -> None:
a_plus_b = add(
"a-plus-b",
a=a,
b=b,
)
a_plus_b_plus_2 = add(
"a-plus-b-plus-2",
a=a_plus_b.outputs["sum"],
b=InputParameter("two", 2),
)
a_plus_b_plus_2.export(test_output_dir)
a_plus_b_plus_2.register()
a_plus_b_plus_2.run(a=3, b=2)
Using InputArtifact
and OutputArtifact
for all other types of data,
leveraging AWS's S3
storage service:
from bettmensch_ai.io import InputArtifact, OutputArtifact
from bettmensch_ai.components import component
from bettmensch_ai.pipelines import pipeline
@component
def convert_to_artifact(
a_param: InputParameter,
a_art: OutputArtifact = None,
) -> None:
with open(a_art.path, "w") as a_art_file:
a_art_file.write(str(a_param))
@component
def show_artifact(a: InputArtifact) -> None:
with open(a.path, "r") as a_art_file:
a_content = a_art_file.read()
print(f"Content of input artifact a: {a_content}")
@pipeline("test-artifact-pipeline", "argo", True)
def parameter_to_artifact(
a: InputParameter = "Param A",
) -> None:
convert = convert_to_artifact(
"convert-to-artifact",
a_param=a,
)
show = show_artifact(
"show-artifact",
a=convert.outputs["a_art"],
)
parameter_to_artifact.export(test_output_dir)
parameter_to_artifact.register()
parameter_to_artifact.run(a="Test value A")
NOTE: For more examples (including cross K8s node CPU and GPU torch.distributed
processes), see this repository's integration test
and k8s test
sections.
The submitted pipelines can be viewed on the dashboard's Pipelines
section:
The executed flows can be viewed on the dashboard's Flows
section:
The following sequence diagram illustrates how the creation, registration and
running of Pipeline
's is supported by the infrastructure stack initiated in
the Setup
section:
Coming soon.
Coming soon.
This platform makes liberal use of various great open source projects:
- ArgoWorkflows: Kubernetes native
workload orchestration. Also powers the popular
Kubeflow Pipelines, which inspired
the
Pipelines
&Flows
of this project. - hera: Official Argo Python SDK for defining Workflow(Template)s
- streamlit: A python library for designing
interactive dashboards
- streamlit-flow-component: A react-flow integration for streamlit
- st-pages: A nice streamlit plugin for multi-page dashboards