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.
(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.txtfile.> skopeo login dp.apps.rancher.io \ --username <APPCO-USERNAME> \ --password-stdin < password.txt > skopeo list-tags docker://dp.apps.rancher.io/charts/pytorchLog 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.txtfile.> helm registry login dp.apps.rancher.io \ --username <APPCO-USERNAME> \ --password-stdin < appco-password.txtDisplay all values of the PyTorch Helm chart. Omit
--versionto 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 #
Log in to SUSE Application Collection. To prevent the password from being stored in the shell history, save it to the
password.txtfile.> helm registry login dp.apps.rancher.io \ --username=<APPCO-USERNAME> \ --password-stdin < password.txtCreate a namespace for PyTorch.
> kubectl create namespace pytorch-system \ --dry-run=client \ -o yaml | kubectl apply -f -(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.txtfile.> 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 -(Optional) To override default installation values, list them in a
values.yamlfile. For a complete list of PyTorch chart values, refer to Section 6.1, “How do I get the values list for PyTorch Helm chart?”.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.
# 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: 1Instructs 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. | |
Use |
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" 3Instructs 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. | |
Use | |
Specifies ConfigMap files. |
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: [] 4Instructs 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. | |
Use | |
The file will be mounted and accessible at | |
Add custom command-line arguments if needed. |
# 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" 4Instructs 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. | |
Use | |
Do not specify the protocol, such as | |
Specify a branch name, a tag name or a commit. |
# 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" 5Instructs 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. | |
Use | |
Do not specify the protocol, such as | |
Specify a branch name, a tag name or a commit. | |
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 #
Log in to SUSE Application Collection. To prevent the password from being stored in the shell history, save it to the
password.txtfile.> helm registry login dp.apps.rancher.io \ --username=<APPCO-USERNAME> \ --password-stdin < password.txtUpgrade PyTorch.
> helm upgrade pytorch \ oci://dp.apps.rancher.io/charts/pytorch \ -n pytorch-system \ --version <VERSION_NUMBER> \ 1 --wait --timeout 15m \ --force-conflictsIf 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