|Index|SUSE AI Factory Applications|PyTorch

6 PyTorch

PyTorch (https://pytorch.org) is an open-source machine learning framework that accelerates deep learning workloads using CPUs and GPUs. Within the SUSE AI Factory stack, the PyTorch Helm chart deploys custom training or inference containers directly onto GPU-enabled cluster nodes. This integration lets you execute custom model code locally while utilizing dedicated GPU hardware for maximum performance.

6.1 How do I get the values list for PyTorch Helm chart?

Before deploying PyTorch, it is important to know more about the supported configurations.

  1. (Optional) To get the values for a specific PyTorch chart version, log in to SUSE Application Collection and identify the version. To prevent the password from being stored in the shell history, save it to the password.txt file.

    > skopeo login dp.apps.rancher.io \
      --username <APPCO-USERNAME> \
      --password-stdin < password.txt
    > skopeo list-tags docker://dp.apps.rancher.io/charts/pytorch
  2. Log in to SUSE Application Collection where PyTorch chart is stored. To prevent the password from being stored in the shell history, save it to the password.txt file.

    > helm registry login dp.apps.rancher.io \
      --username <APPCO-USERNAME> \
      --password-stdin < appco-password.txt
  3. Display all values of the PyTorch Helm chart. Omit --version to display the latest chart.

    > helm show values oci://dp.apps.rancher.io/charts/pytorch \
      --version <VERSION>

6.2 How do I install PyTorch?

You can install PyTorch either using Rancher Prime or on the command line with Helm.

6.2.1 Installing with Rancher Prime

Refer to AI application installation for a general installation procedure.

6.2.2 Installing with Helm

  1. Log in to SUSE Application Collection. To prevent the password from being stored in the shell history, save it to the password.txt file.

    > helm registry login dp.apps.rancher.io \
      --username=<APPCO-USERNAME> \
      --password-stdin < password.txt
  2. Create a namespace for PyTorch.

    > kubectl create namespace pytorch-system \
      --dry-run=client \
      -o yaml | kubectl apply -f -
  3. (Optional) If you have not created image pull secrets for SUSE Application Collection, create them now. To prevent the password from being stored in the shell history, save it to the password.txt file.

    > kubectl create secret docker-registry application-collection \
      --docker-server=dp.apps.rancher.io \
      --docker-username=<APPCO-USERNAME> \
      --docker-password="$(< password.txt)" \
      -n pytorch-system \
      --dry-run=client -o yaml | kubectl apply -f -
  4. (Optional) To override default installation values, list them in a values.yaml file. For a complete list of PyTorch chart values, refer to Section 6.1, “How do I get the values list for PyTorch Helm chart?”.

  5. Install PyTorch. To keep the default installation values, omit -f values.yaml.

    > helm install pytorch \
      oci://dp.apps.rancher.io/charts/pytorch \
      -n pytorch-system \
      -f values.yaml

6.3 What custom values examples are available for PyTorch?

To override the default values during the Helm chart installation or update, you can create a YAML file with custom values. Then, apply these values by specifying the path to the custom values file with the -f option of the helm command.

Example 6.1: Basic custom values file with GPU enabled
# pytorch_custom_overrides.yaml
global:
  imagePullSecrets:
    - application-collection 1
image:
  registry: dp.apps.rancher.io
  repository: containers/pytorch
  tag: "2.7.0-nvidia"
  pullPolicy: IfNotPresent
persistence:
  enabled: true
  storageClass: local-path 2
gpu:
  enabled: true
  type: 'nvidia'
  number: 1

1

Instructs Helm to use credentials from the SUSE Application Collection. For instructions on how to configure the image pull secrets for the SUSE Application Collection, refer to the official documentation.

2

Use local-path storage only for testing purposes. For production use, we recommend using a storage solution suitable for persistent storage, such as SUSE Storage.

Example 6.2: ConfigMap-based upload

To create a ConfigMap, run the following command:

> kubectl describe configmap \
  MY_CONFIG_MAP -n <SAIF_NAMESPACE>
# pytorch_custom_overrides.yaml
global:
  imagePullSecrets:
    - application-collection
image:
  registry: dp.apps.rancher.io 1
  repository: containers/pytorch
  tag: "2.7.0-nvidia"
  pullPolicy: IfNotPresent
persistence:
  enabled: true
  storageClass: local-path 2
gpu:
  enabled: true
  type: 'nvidia'
  number: 1

configMapExtFiles: "my-config-files" 3

1

Instructs Helm to use credentials from the SUSE Application Collection. For instructions on how to configure the image pull secrets for the SUSE Application Collection, refer to the official documentation.

2

Use local-path storage only for testing purposes. For production use, we recommend using a storage solution suitable for persistent storage, such as SUSE Storage.

3

Specifies ConfigMap files.

Example 6.3: Host-folder with files baked into the chart

Move the entrypoint.sh file plus any helper files under the scripts/ directory.

# pytorch_custom_overrides.yaml
global:
  imagePullSecrets:
    - application-collection 1
image:
  registry: dp.apps.rancher.io
  repository: containers/pytorch
  tag: "2.7.0-nvidia"
  pullPolicy: IfNotPresent
persistence:
  enabled: true
  storageClass: local-path 2
gpu:
  enabled: true
  type: 'nvidia'
  number: 1

entrypointscript:
  filename: "entrypoint.sh" 3
  arguments: [] 4

1

Instructs Helm to use credentials from the SUSE Application Collection. For instructions on how to configure the image pull secrets for the SUSE Application Collection, refer to the official documentation.

2

Use local-path storage only for testing purposes. For production use, we recommend using a storage solution suitable for persistent storage, such as SUSE Storage.

3

The file will be mounted and accessible at /workspace/entrypoint.sh.

4

Add custom command-line arguments if needed.

Example 6.4: Git repository clone: public with no authentication
# pytorch_custom_overrides.yaml
global:
  imagePullSecrets:
    - application-collection 1
image:
  registry: dp.apps.rancher.io
  repository: containers/pytorch
  tag: "2.7.0-nvidia"
  pullPolicy: IfNotPresent
persistence:
  enabled: true
  storageClass: local-path 2
gpu:
  enabled: true
  type: 'nvidia'
  number: 1

gitClone:
  enabled: true
  repository: "github.com/YOUR_ORGANIZATOIN/YOUR_REPO" 3
  revision: "main" 4

1

Instructs Helm to use credentials from the SUSE Application Collection. For instructions on how to configure the image pull secrets for the SUSE Application Collection, refer to the official documentation.

2

Use local-path storage only for testing purposes. For production use, we recommend using a storage solution suitable for persistent storage, such as SUSE Storage.

3

Do not specify the protocol, such as https://.

4

Specify a branch name, a tag name or a commit.

Example 6.5: Git repository clone: private with authentication
# pytorch_custom_overrides.yaml
global:
  imagePullSecrets:
    - application-collection 1
image:
  registry: dp.apps.rancher.io
  repository: containers/pytorch
  tag: "2.7.0-nvidia"
  pullPolicy: IfNotPresent
persistence:
  enabled: true
  storageClass: local-path 2
gpu:
  enabled: true
  type: 'nvidia'
  number: 1

gitClone:
  enabled: true
  repository: "github.com/YOUR_ORGANIZATOIN/YOUR_REPO" 3
  revision: "main" 4
  secretName: "MY_GIT_CREDENTIALS" 5

1

Instructs Helm to use credentials from the SUSE Application Collection. For instructions on how to configure the image pull secrets for the SUSE Application Collection, refer to the official documentation.

2

Use local-path storage only for testing purposes. For production use, we recommend using a storage solution suitable for persistent storage, such as SUSE Storage.

3

Do not specify the protocol, such as https://.

4

Specify a branch name, a tag name or a commit.

5

Specify a preconfigured secret with username and password (or token).

6.4 How do I upgrade PyTorch?

You can upgrade PyTorch either using Rancher Prime or on the command line with Helm.

6.4.1 Upgrading with Rancher Prime

Refer to AI application upgrade for a general upgrade procedure.

6.4.2 Upgrading with Helm

  1. Log in to SUSE Application Collection. To prevent the password from being stored in the shell history, save it to the password.txt file.

    > helm registry login dp.apps.rancher.io \
      --username=<APPCO-USERNAME> \
      --password-stdin < password.txt
  2. Upgrade PyTorch.

    > helm upgrade pytorch \
      oci://dp.apps.rancher.io/charts/pytorch \
      -n pytorch-system \
      --version <VERSION_NUMBER> \ 1
      --wait --timeout 15m \
      --force-conflicts

    1

    If you omit --version, PyTorch gets upgraded to the latest available version.

6.5 How do I remove PyTorch?

You can remove PyTorch either using Rancher Prime or on the command line with Helm.

6.5.1 Removal using Rancher Prime

Refer to AI application removal for a general removal procedure.

6.5.2 Removal using Helm

To remove PyTorch using Helm, use the following command:

> helm uninstall pytorch -n pytorch-system