Skip to main content

Distributed PyTorch helpers for process setup, sync printing, and model utilities

Project description

distai

Package for the book Distributed AI Systems: A practical guide to building scalable training, inference, and serving systems for production AI.

Distributed AI Systems cover

Distributed PyTorch helpers for process setup, synchronized logging, and small model utilities.

Install

Install from PyPI:

pip install distai

Quick Usage

With torchrun (recommended)

torchrun --nproc_per_node=4 your_script.py
from distai import init_distributed, sync_print

rank, world_size, device, local_rank = init_distributed(use_cpu=False)
sync_print(f"Rank {rank} says hello", rank=rank, world_size=world_size)

Without torchrun

from distai import run_distributed


def my_worker(rank, world_size, device, local_rank):
    print(f"Rank {rank} running on {device}")


run_distributed(my_worker, world_size=4, use_cpu=False)

See example_no_torchrun.py for a complete runnable example.

Public API

  • init_distributed
  • sync_print
  • run_distributed
  • get_node_info
  • setup_distributed
  • cleanup_distributed
  • get_resnet18_fashionmnist
  • get_resnet18_cifar10

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

distai-0.0.1.dev1-py3-none-any.whl (11.6 kB view details)

Uploaded Python 3

File details

Details for the file distai-0.0.1.dev1-py3-none-any.whl.

File metadata

  • Download URL: distai-0.0.1.dev1-py3-none-any.whl
  • Upload date:
  • Size: 11.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for distai-0.0.1.dev1-py3-none-any.whl
Algorithm Hash digest
SHA256 f2099997a6244793a441f7ba772482d8d4df1c990705bbb91e930b702011470a
MD5 5be02124b268ab1bedd3fe203e830047
BLAKE2b-256 a2f9f2e6c5737a2ec476961efe8156c63f02502fa7f3f8cc7a9a854121a7a2c1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page