pytorch

by joaquinito2051

Helm chartv0.0.1App 1.1.0

Deep learning platform that accelerates the transition from research prototyping to production deployment

About this chart

PyTorch

PyTorch is a deep learning platform that accelerates the transition from research prototyping to production deployment. It is built for full integration into Python that enables you to use it with its libraries and main packages.

TL;DR;

$ helm install <helm-repo>/pytorch

$ helm install bitnami/pytorch

Introduction

This chart bootstraps a PyTorch deployment on a Kubernetes cluster using the Helm package manager.

Bitnami charts can be used with Kubeapps for deployment and management of Helm Charts in clusters. This Helm chart has been tested on top of Bitnami Kubernetes Production Runtime (BKPR). Deploy BKPR to get automated TLS certificates, logging and monitoring for your applications.

Prerequisites

  • Kubernetes 1.8+ with Beta APIs enabled
  • PV provisioner support in the underlying infrastructure

Installing the Chart

To install the chart with the release name my-release:

$ helm install --name my-release <helm-repo>/pytorch

$ helm install --name my-release bitnami/pytorch The command deploys PyTorch on the Kubernetes cluster in the default configuration. The configuration section lists the parameters that can be configured.

Tip: List all releases using helm list

Uninstalling the Chart

To uninstall/delete the my-release deployment:

$ helm delete my-release

The command removes all the Kubernetes components associated with the chart and deletes the release.

Configuration

The following table lists the configurable parameters of the MinIO chart and their default values.

ParameterDescriptionDefault
global.imageRegistryGlobal Docker image registrynil
global.imagePullSecretsGlobal Docker registry secret names as an array[] (does not add image pull secrets to deployed pods)
image.registryPyTorch image registrydocker.io
image.repositoryPyTorch image namebitnami/pytorch
image.tagPyTorch image tag{VERSION}
image.pullPolicyImage pull policyIfNotPresent
image.pullSecretsSpecify docker-registry secret names as an array[] (does not add image pull secrets to deployed pods)
image.debugSpecify if debug logs should be enabledfalse
git.registryGit image registrydocker.io
git.repositoryGit image namebitnami/git
git.tagGit image taglatest
git.pullPolicyGit image pull policyAlways
git.pullSecretsSpecify docker-registry secret names as an array[] (does not add image pull secrets to deployed pods)
entrypoint.fileMain entrypoint to your application''
entrypoint.argsArgs required by your entrypointnil
modeRun PyTorch in standalone or distributed mode (possible values: standalone, distributed)standalone
worldSizeNumber of nodes that will execute your codenil
portPyTorch master port49875
configMapConfig map that contains the files you want to load in PyTorchnil
cloneFilesFromGit.enabledEnable in order to download files from git repositoryfalse
cloneFilesFromGit.repositoryRepository that holds the filesnil
cloneFilesFromGit.revisionRevision from the repository to checkoutmaster
extraEnvVarsExtra environment variables to add to master and workers podsnil
nodeSelectorNode labels for pod assignment{}
tolerationsToleration labels for pod assignment[]
affinityMap of node/pod affinities{}
resourcesPod resources{}
securityContext.enabledEnable security contexttrue
securityContext.fsGroupGroup ID for the container1001
securityContext.runAsUserUser ID for the container1001
livenessProbe.enabledEnable/disable the Liveness probetrue
livenessProbe.initialDelaySecondsDelay before liveness probe is initiated5
livenessProbe.periodSecondsHow often to perform the probe5
livenessProbe.timeoutSecondsWhen the probe times out5
livenessProbe.successThresholdMinimum consecutive successes for the probe to be considered successful after having failed.1
livenessProbe.failureThresholdMinimum consecutive failures for the probe to be considered failed after having succeeded.5
readinessProbe.enabledEnable/disable the Readiness probetrue
readinessProbe.initialDelaySecondsDelay before readiness probe is initiated5
readinessProbe.periodSecondsHow often to perform the probe5
readinessProbe.timeoutSecondsWhen the probe times out1
readinessProbe.successThresholdMinimum consecutive successes for the probe to be considered successful after having failed.1
readinessProbe.failureThresholdMinimum consecutive failures for the probe to be considered failed after having succeeded.5
persistence.enabledUse a PVC to persist datatrue
persistence.mountPathPath to mount the volume at/bitnami/pytorch
persistence.storageClassStorage class of backing PVCnil (uses alpha storage class annotation)
persistence.accessModeUse volume as ReadOnly or ReadWriteReadWriteOnce
persistence.sizeSize of data volume8Gi
persistence.annotationsPersistent Volume annotations{}

Specify each parameter using the --set key=value[,key=value] argument to helm install. For example,

Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example,
$ helm install --name my-release \
  --set mode=distributed \
  --set worldSize=4 \
$ helm install --name my-release \
    bitnami/pytorch

The above command create 4 pods for PyTorch: one master and three workers.

Alternatively, a YAML file that specifies the values for the parameters can be provided while installing the chart. For example,

$ helm install --name my-release -f values.yaml <helm-repo>/pytorch

$ helm install --name my-release -f values.yaml bitnami/pytorch

Tip: You can use the default values.yaml

Loading your files

The PyTorch chart supports three different ways to load your files. In order of priority, they are:

  1. Existing config map
  2. Files under the files directory
  3. Cloning a git repository

This means that if you specify a config map with your files, it won't look for the files/ directory nor the git repository.

In order to use use an existing config map:

$ helm install --name my-release \
  --set configMap=my-config-map \
  <helm-repo>/pytorch
$ helm install --name my-release \

To load your files from the files/ directory you don't have to set any option. Just copy your files inside and don't specify a ConfigMap:

$ helm install --name my-release \
  <helm-repo>/pytorch

$ helm install --name my-release \

Finally, if you want to clone a git repository:

$ helm install --name my-release \
  --set cloneFilesFromGit.enabled=true \
  --set cloneFilesFromGit.repository=https://github.com/my-user/my-repo \
$ helm install --name my-release \
  --set cloneFilesFromGit.revision=master \
  bitnami/pytorch

Persistence

The Bitnami PyTorch image can persist data. If enabled, the persisted path is /bitnami/pytorch by default.

The chart mounts a Persistent Volume at this location. The volume is created using dynamic volume provisioning.

Deploy pytorch with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has pytorch on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartpytorch is pinned at v0.0.1 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply