kubeflow

Kubeflow 机器学习平台

补充说明

Kubeflow 在 Kubernetes 上提供 Notebook、Pipelines、Training Operator、Katib 和模型服务。适合团队共享 GPU 资源、编排训练流水线和做超参搜索。

常用示例

安装 Kubeflow Pipelines:

export PIPELINE_VERSION=2.4.0
kubectl apply -k "github.com/kubeflow/pipelines/manifests/kustomize/env/platform-agnostic?ref=$PIPELINE_VERSION"
kubectl -n kubeflow get pods

端口转发访问 UI:

kubectl -n kubeflow port-forward svc/ml-pipeline-ui 8080:80

提交 Pipeline:

from kfp import Client
client = Client(host="http://localhost:8080")
client.create_run_from_pipeline_func(
    pipeline_func=train_pipeline,
    arguments={"epochs": 10},
)

提交 PyTorchJob:

kubectl apply -f - <<'EOF'
apiVersion: kubeflow.org/v1
kind: PyTorchJob
metadata:
  name: mnist
spec:
  pytorchReplicaSpecs:
    Master:
      replicas: 1
      template:
        spec:
          containers:
          - name: pytorch
            image: example/mnist:latest
EOF

易错点与排错