mars.learn.contrib.pytorch.run_pytorch_script(script, n_workers, gpu=None, command_argv=None, retry_when_fail=False, session=None, run_kwargs=None, port=None)[source]

Run PyTorch script in Mars cluster.

  • script (str or file-like object) – script to run

  • n_workers – number of PyTorch workers

  • gpu – run PyTorch script on GPU

  • command_argv – extra command args for script

  • retry_when_fail – bool, default False. If True, retry when function failed.

  • session – Mars session, if not provided, will use default one

  • run_kwargs – extra kwargs for

  • port – port of PyTorch worker or ps, will automatically increase for the same worker


return {‘status’: ‘ok’} if succeeded, or error raised