{"id":13754888,"url":"https://github.com/kubeflow/pytorch-operator","last_synced_at":"2025-12-30T07:59:51.362Z","repository":{"id":41390087,"uuid":"124580675","full_name":"kubeflow/pytorch-operator","owner":"kubeflow","description":"PyTorch on Kubernetes","archived":true,"fork":false,"pushed_at":"2021-12-01T17:44:48.000Z","size":74680,"stargazers_count":309,"open_issues_count":63,"forks_count":143,"subscribers_count":28,"default_branch":"master","last_synced_at":"2025-04-19T10:08:54.680Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Jsonnet","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kubeflow.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-03-09T18:51:51.000Z","updated_at":"2025-03-12T13:55:55.000Z","dependencies_parsed_at":"2022-08-26T11:10:50.020Z","dependency_job_id":null,"html_url":"https://github.com/kubeflow/pytorch-operator","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kubeflow%2Fpytorch-operator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kubeflow%2Fpytorch-operator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kubeflow%2Fpytorch-operator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kubeflow%2Fpytorch-operator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kubeflow","download_url":"https://codeload.github.com/kubeflow/pytorch-operator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253346403,"owners_count":21894263,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-03T10:00:35.987Z","updated_at":"2025-12-14T12:53:39.875Z","avatar_url":"https://github.com/kubeflow.png","language":"Jsonnet","funding_links":[],"categories":["Jsonnet","Uncategorized"],"sub_categories":["Uncategorized"],"readme":"# Kubernetes Custom Resource and Operator for PyTorch jobs\n\n   \n## :warning: **kubeflow/pytorch-operator is not maintained**\n\nThis operator has been merged into [Kubeflow Training Operator](https://github.com/kubeflow/training-operator). This repository is not maintained and has been archived.\n\n[![Build Status](https://travis-ci.org/kubeflow/pytorch-operator.svg?branch=master)](https://travis-ci.org/kubeflow/pytorch-operator)\n[![Go Report Card](https://goreportcard.com/badge/github.com/kubeflow/pytorch-operator)](https://goreportcard.com/report/github.com/kubeflow/pytorch-operator)\n\n## Overview\n\nThis repository contains the specification and implementation of `PyTorchJob` custom resource definition. Using this custom resource, users can create and manage PyTorch jobs like other built-in resources in Kubernetes. See [CRD definition](https://github.com/kubeflow/pytorch-operator/blob/master/manifests/base/crd.yaml)\n\n## Prerequisites\n\n- Kubernetes \u003e= 1.8\n- [kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl)\n\n## Installing PyTorch Operator\n\n  Please refer to the installation instructions in the [Kubeflow user guide](https://www.kubeflow.org/docs/started/getting-started/). This installs `pytorchjob` CRD and `pytorch-operator` controller to manage the lifecycle of PyTorch jobs.\n\n## Creating a PyTorch Job\n\nYou can create PyTorch Job by defining a PyTorchJob config file. See the manifests for the [distributed MNIST example](./examples/mnist/). You may change the config file based on your requirements.\n\n```\ncat examples/mnist/v1/pytorch_job_mnist_gloo.yaml\n```\nDeploy the PyTorchJob resource to start training:\n\n```\nkubectl create -f examples/mnist/v1/pytorch_job_mnist_gloo.yaml\n```\nYou should now be able to see the created pods matching the specified number of replicas.\n\n```\nkubectl get pods -l pytorch-job-name=pytorch-dist-mnist-gloo\n```\nTraining should run for about 10 epochs and takes 5-10 minutes on a cpu cluster. Logs can be inspected to see its training progress.\n\n```\nPODNAME=$(kubectl get pods -l pytorch-job-name=pytorch-dist-mnist-gloo,pytorch-replica-type=master -o name)\nkubectl logs -f ${PODNAME}\n```\n## Monitoring a PyTorch Job\n\n```\nkubectl get -o yaml pytorchjobs pytorch-dist-mnist-gloo\n```\nSee status section to monitor the job status. Here is sample output when the job is successfully completed.\n\n```\napiVersion: v1\nitems:\n- apiVersion: kubeflow.org/v1\n  kind: PyTorchJob\n  metadata:\n    creationTimestamp: 2019-01-11T00:51:48Z\n    generation: 1\n    name: pytorch-dist-mnist-gloo\n    namespace: default\n    resourceVersion: \"2146573\"\n    selfLink: /apis/kubeflow.org/v1/namespaces/kubeflow/pytorchjobs/pytorch-dist-mnist-gloo\n    uid: 13ad0e7f-153b-11e9-b5c1-42010a80001e\n  spec:\n    pytorchReplicaSpecs:\n      Master:\n        replicas: 1\n        restartPolicy: OnFailure\n        template:\n          spec:\n            containers:\n            - args:\n              - --backend\n              - gloo\n              image: gcr.io/kubeflow-ci/pytorch-dist-mnist-test:v1.0\n              name: pytorch\n              resources:\n                limits:\n                  nvidia.com/gpu: \"1\"\n      Worker:\n        replicas: 1\n        restartPolicy: OnFailure\n        template:\n          spec:\n            containers:\n            - args:\n              - --backend\n              - gloo\n              image: gcr.io/kubeflow-ci/pytorch-dist-mnist-test:v1.0\n              name: pytorch\n              resources:\n                limits:\n                  nvidia.com/gpu: \"1\"\n  status:\n    completionTime: 2019-01-11T01:03:15Z\n    conditions:\n    - lastTransitionTime: 2019-01-11T00:51:48Z\n      lastUpdateTime: 2019-01-11T00:51:48Z\n      message: PyTorchJob pytorch-dist-mnist-gloo is created.\n      reason: PyTorchJobCreated\n      status: \"True\"\n      type: Created\n    - lastTransitionTime: 2019-01-11T00:57:22Z\n      lastUpdateTime: 2019-01-11T00:57:22Z\n      message: PyTorchJob pytorch-dist-mnist-gloo is running.\n      reason: PyTorchJobRunning\n      status: \"False\"\n      type: Running\n    - lastTransitionTime: 2019-01-11T01:03:15Z\n      lastUpdateTime: 2019-01-11T01:03:15Z\n      message: PyTorchJob pytorch-dist-mnist-gloo is successfully completed.\n      reason: PyTorchJobSucceeded\n      status: \"True\"\n      type: Succeeded\n    replicaStatuses:\n      Master:\n        succeeded: 1\n      Worker:\n        succeeded: 1\n    startTime: 2019-01-11T00:57:22Z\n```\n\n## Contributing\n\nPlease refer to the [developer_guide](developer_guide.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkubeflow%2Fpytorch-operator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkubeflow%2Fpytorch-operator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkubeflow%2Fpytorch-operator/lists"}