class flytekitplugins.kfpytorch.PyTorch(master=<factory>, worker=<factory>, run_policy=<factory>, num_workers=None)[source]#

Configuration for an executable PyTorch Job. Use this to run distributed PyTorch training on Kubernetes. Please notice, in most cases, you should not worry about the configuration of the master and worker groups. The default configuration should work. The only field you should change is the number of workers. Both replicas will use the same image, and the same resources inherited from task function decoration.

  • master (flytekitplugins.kfpytorch.task.Master) – Configuration for the master replica group.

  • worker (flytekitplugins.kfpytorch.task.Worker) – Configuration for the worker replica group.

  • run_policy (Optional[flytekitplugins.kfpytorch.task.RunPolicy]) – Configuration for the run policy.

  • num_workers (Optional[int]) – [DEPRECATED] This argument is deprecated. Use worker.replicas instead.

Return type




num_workers: Optional[int] = None
master: flytekitplugins.kfpytorch.task.Master
worker: flytekitplugins.kfpytorch.task.Worker
run_policy: Optional[flytekitplugins.kfpytorch.task.RunPolicy]