Skip to main content

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_distributed
  • sync_print
  • run_distributed
  • get_node_info
  • setup_distributed
  • cleanup_distributed
  • get_resnet18_fashionmnist
  • get_resnet18_cifar10

Build And Publish

  1. Update version in distai/__about__.py.
  2. Build distributions:
python -m build
  1. Validate metadata:
twine check dist/*
  1. Upload to TestPyPI:
twine upload --repository testpypi dist/*
  1. Upload to PyPI:
twine upload dist/*

Project details


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)

Uploaded Source

Built Distribution

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

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

Uploaded Python 3

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

Hashes for distai-0.0.1.dev0.tar.gz
Algorithm Hash digest
SHA256 09a66b6af0f1726db2294d2579bf9a4a7993f3564eb8a7c0145c181e9d17e7e2
MD5 896df6ff85e21809a6d9f33cee900830
BLAKE2b-256 02faa157cedbd9206508db2eb912fbfe9862c754111632096a89b2107514b008

See more details on using hashes here.

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

Hashes for distai-0.0.1.dev0-py3-none-any.whl
Algorithm Hash digest
SHA256 c9f01319ec401df80ebf13f32599c393c8e8ab90168284e1f37638ebf8c3833e
MD5 b926ac588727b94c2e010ccd4b2a3b41
BLAKE2b-256 b6b2d19920de411039231c236238b3bcfd6aa90f2e7f387300788fe9c6178a6f

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