{"id":8725,"library":"torchx","title":"TorchX SDK and Components","description":"TorchX is a Python SDK for MLOps that helps you compose, configure, and launch PyTorch applications on various schedulers like local, Docker, Kubernetes, and Ray. It provides a common API for distributed training, serving, and other ML workloads. The current version is 0.7.0, with major releases occurring every few months.","status":"active","version":"0.7.0","language":"python","source_language":"en","source_url":"https://github.com/pytorch/torchx","tags":["pytorch","distributed-training","mlops","orchestration","job-scheduler","ray","kubernetes"],"install":[{"cmd":"pip install torchx","lang":"bash","label":"Stable release"}],"dependencies":[{"reason":"Core dependency for defining and running PyTorch applications.","package":"torch","optional":false},{"reason":"Commonly used with TorchX for computer vision applications.","package":"torchvision","optional":false},{"reason":"Required for using the 'local_docker' scheduler.","package":"docker","optional":true}],"imports":[{"wrong":"from torchx import TorchxRunner","symbol":"IMAGE","correct":"from torchx import IMAGE"},{"symbol":"util","correct":"from torchx import util"},{"symbol":"version","correct":"from torchx import version"}],"quickstart":{"code":"from torchx import specs\nfrom torchx.runner import TorchxRunner\n\n# Define a simple application\napp = specs.AppDef(\n    name='hello-world',\n    roles=[\n        specs.Role(\n            name='worker',\n            entrypoint='echo',\n            args=['Hello, TorchX!'],\n            num_replicas=1,\n            resource=specs.Resource(cpu=1, memMB=512)\n        )\n    ]\n)\n\n# Initialize the TorchX runner\nrunner = TorchxRunner()\n\n# Launch the application on the local_cwd scheduler\n# Ensure you have a 'local_cwd' scheduler configured or just use 'local_cwd'\napp_handle = runner.run(app, scheduler='local_cwd')\nprint(f\"Application '{app.name}' launched with handle: {app_handle}\")\n\n# You can optionally wait for the application to complete\n# runner.wait(app_handle, timeout=300) # Waits up to 5 minutes\n# print(f\"Application '{app.name}' completed.\")","lang":"python","description":"This quickstart demonstrates how to define a basic `AppDef` with a single role and launch it using `TorchxRunner` on the `local_cwd` scheduler. It prints 'Hello, TorchX!' to the console via the `echo` command."},"warnings":[{"fix":"Migrate from `ddp_scheduler` to `ray_scheduler` or `kubernetes` scheduler for distributed training applications.","message":"The `torchx.schedulers.ddp_scheduler` module was removed and replaced with the `ray_scheduler` for DDP-like workloads.","severity":"breaking","affected_versions":">=0.7.0"},{"fix":"Update your CLI scripts to use `torchx launch` instead of `torchx run`.","message":"The CLI command `torchx run` was renamed to `torchx launch`.","severity":"breaking","affected_versions":">=0.6.0"},{"fix":"Remove the `scheduler` argument from `specs.Role` definitions. Pass the desired scheduler string directly to `TorchxRunner.run(app, scheduler='your_scheduler')`.","message":"The `scheduler` field was removed from `specs.Role`. Scheduler selection now happens at the `runner.run()` level.","severity":"breaking","affected_versions":">=0.5.0"},{"fix":"Ensure Docker Desktop or the Docker daemon is installed and actively running on your system before attempting to launch jobs with Docker-dependent schedulers.","message":"Using Docker-based schedulers (e.g., `local_docker`, `kubernetes` with container images) requires a running Docker daemon.","severity":"gotcha","affected_versions":"All"},{"fix":"When using components, pass their output directly to `runner.run()`, e.g., `runner.run(torchx.components.dist.ddp_torchscript(...), ...)` rather than trying to `import ddp` directly.","message":"TorchX components like `dist.ddp` are factory functions that return `AppDef` objects, not direct applications or classes.","severity":"gotcha","affected_versions":"All"}],"env_vars":null,"search_vec":"'0.7.0':47 'api':34 'applic':20 'common':33 'compon':4 'compos':15 'configur':16 'current':44 'distribut':36,57 'distributed-train':56 'docker':26 'everi':52 'help':13 'job':62 'job-schedul':61 'kubernet':27,65 'launch':18 'like':24 'local':25 'major':49 'ml':41 'mlop':11,59 'month':54 'occur':51 'orchestr':60 'provid':31 'python':8 'pytorch':19,55 'ray':29,64 'releas':50 'schedul':23,63 'sdk':2,9 'serv':38 'torchx':1,5 'train':37,58 'various':22 'version':45 'workload':42","created_at":"2026-04-16T17:03:40.468779+00:00","updated_at":"2026-04-16T17:03:40.468779+00:00","problems":null,"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"0.7.0","cli_name":"torchx","cli_version":"torchx-0.7.0","type":"library","homepage":"https://pytorch.org/torchx","github":"https://github.com/pytorch/torchx","docs":null,"changelog":null,"pypi":"https://pypi.org/project/torchx/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["ai-ml","devops","workflow","aws","gcp"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-07-03","last_verified":"2026-07-03","next_check":"2026-08-02","install_tag":null}}