Distributed PyTorch helpers for process setup, sync printing, and model utilities
Project description
distai
Distributed PyTorch helpers for process setup, synchronized logging, and small model utilities.
Install
From this directory (shared/):
pip install .
For local development:
pip install -e .[dev]
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
Build And Publish
- Update version in
distai/__about__.py. - Build distributions:
python -m build
- Validate metadata:
twine check dist/*
- Upload to TestPyPI:
twine upload --repository testpypi dist/*
- Upload to PyPI:
twine upload dist/*
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 Distribution
distai-0.0.1.dev0.tar.gz
(11.3 kB
view details)
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.dev0.tar.gz.
File metadata
- Download URL: distai-0.0.1.dev0.tar.gz
- Upload date:
- Size: 11.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
09a66b6af0f1726db2294d2579bf9a4a7993f3564eb8a7c0145c181e9d17e7e2
|
|
| MD5 |
896df6ff85e21809a6d9f33cee900830
|
|
| BLAKE2b-256 |
02faa157cedbd9206508db2eb912fbfe9862c754111632096a89b2107514b008
|
File details
Details for the file distai-0.0.1.dev0-py3-none-any.whl.
File metadata
- Download URL: distai-0.0.1.dev0-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.13.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c9f01319ec401df80ebf13f32599c393c8e8ab90168284e1f37638ebf8c3833e
|
|
| MD5 |
b926ac588727b94c2e010ccd4b2a3b41
|
|
| BLAKE2b-256 |
b6b2d19920de411039231c236238b3bcfd6aa90f2e7f387300788fe9c6178a6f
|