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 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_distributedsync_printrun_distributedget_node_infosetup_distributedcleanup_distributedget_resnet18_fashionmnistget_resnet18_cifar10
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f2099997a6244793a441f7ba772482d8d4df1c990705bbb91e930b702011470a
|
|
| MD5 |
5be02124b268ab1bedd3fe203e830047
|
|
| BLAKE2b-256 |
a2f9f2e6c5737a2ec476961efe8156c63f02502fa7f3f8cc7a9a854121a7a2c1
|