Skip to content

🐍 Python Library

πŸ‘€ Overview

Launch and train across all your accelerators, using your favorite framework + backend combo.

ezpz simplifies the process of:

  • Using your favorite framework:

    2ez 😎. (see frameworks for additional details)

  • Writing device agnostic code:

    • ezpz.get_torch_device()

       1
       2
       3
       4
       5
       6
       7
       8
       9
      10
      ```pycon
      >>> import ezpz as ez
      >>> DEVICE = ez.get_torch_device()
      >>> model = torch.nn.Linear(10, 10)
      >>> model.to(DEVICE)
      >>> x = torch.randn((10, 10), device=DEVICE)
      >>> y = model(x)
      >>> y.device
      device(type='mps', index=0)
      ```
      
  • Using wandb:

    • ez.setup_wandb(project_name='ezpz')
  • Full support for any {device + framework + backend}:
  • device: {GPU, XPU, MPS, CPU}
  • framework: {torch, deepspeed, horovod, tensorflow}
  • backend: {DDP, deepspeed, horovod}

Install

To install1:

python3 -m pip install -e "git+https://github.com/saforem2/ezpz#egg=ezpz" --require-virtualenv

πŸ“‚ Directory Structure

πŸ“‚ /ezpz/src/ezpz/
┣━━ πŸ“‚ bin/
┃   ┣━━ πŸ“„ affinity.sh
┃   ┣━━ πŸ“„ getjobenv
┃   ┣━━ πŸ“„ savejobenv
┃   ┣━━ πŸ“„ saveslurmenv
┃   ┣━━ πŸ“„ setup.sh
┃   ┣━━ πŸ“„ train.sh
┃   ┗━━ πŸ“„ utils.sh
┣━━ πŸ“‚ conf/
┃   ┣━━ πŸ“‚ hydra/
┃   ┃   ┗━━ πŸ“‚ job_logging/
┃   ┃       ┣━━ βš™οΈ colorlog1.yaml
┃   ┃       ┣━━ βš™οΈ custom.yaml
┃   ┃       ┗━━ βš™οΈ enrich.yaml
┃   ┣━━ πŸ“‚ logdir/
┃   ┃   ┗━━ βš™οΈ default.yaml
┃   ┣━━ βš™οΈ config.yaml
┃   ┣━━ πŸ“„ ds_config.json
┃   ┗━━ βš™οΈ ds_config.yaml
┣━━ πŸ“‚ log/
┃   ┣━━ πŸ“‚ conf/
┃   ┃   ┗━━ πŸ“‚ hydra/
┃   ┃       ┗━━ πŸ“‚ job_logging/
┃   ┃           ┗━━ βš™οΈ enrich.yaml
┃   ┣━━ 🐍 __init__.py
┃   ┣━━ 🐍 __main__.py
┃   ┣━━ 🐍 config.py
┃   ┣━━ 🐍 console.py
┃   ┣━━ 🐍 handler.py
┃   ┣━━ 🐍 style.py
┃   ┣━━ 🐍 test.py
┃   ┗━━ 🐍 test_log.py
┣━━ 🐍 __about__.py
┣━━ 🐍 __init__.py
┣━━ 🐍 __main__.py
┣━━ 🐍 configs.py
┣━━ 🐍 cria.py
┣━━ 🐍 dist.py
┣━━ 🐍 history.py
┣━━ 🐍 jobs.py
┣━━ 🐍 loadjobenv.py
┣━━ 🐍 model.py
┣━━ 🐍 plot.py
┣━━ 🐍 profile.py
┣━━ 🐍 runtime.py
┣━━ 🐍 savejobenv.py
┣━━ 🐍 test.py
┣━━ 🐍 test_dist.py
┣━━ 🐍 train.py
┣━━ 🐍 trainer.py
┗━━ 🐍 utils.py

  1. Note the --require-virtualenv isn’t strictly required, but I highly recommend to always try and work within a virtual environment, when possible.