π Python LibraryΒΆ
π OverviewΒΆ
Launch and train across all your accelerators, using your favorite framework + backend combo.
ezpz simplifies the process of:
-
Setting up + launching distributed training:
-
import ezpz as ez-
RANK =ez.setup_torch(backend=backend)[forbackend\(\in\) {DDP,deepspeed,horovod}]{.dim-text} -
RANK =ez.get_rank() -
LOCAL_RANK =ez.get_local_rank() -
WORLD_SIZE =ez.get_world_size()
[(see
ezpz/dist.pyfor more details).]{.dim-text} -
-
-
Using your favorite framework:
-
framework=pytorch+backend={DDP, deepspeed, horovod} -
framework=tensorflow+backend=horovod -
ez.get_torch_device(): {cuda,xpu,mps,cpu} -
ez.get_torch_backend(): {nccl,ccl,gloo}
2ez π.
-
-
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:
π Directory StructureΒΆ
- π
ezpz/src/ezpz/ - π
bin/:utils.sh: Shell utilities forezpz
- π
conf/:- βοΈ
config.yaml: DefaultTrainConfigobject - βοΈ
ds_config.json: DeepSpeed configuration
- βοΈ
- π
log/: Logging configuration. - π
__about__.py: Version information - π
__init__.py: Main module - π
__main__.py: Entry point - π
configs.py: Configuration module - π
cria.py: Baby Llama - π
dist.py: Distributed training module - π
history.py: History module - π
jobs.py: Jobs module - π
model.py: Model module - π
plot.py: Plot modul - π
profile.py: Profile module - π
runtime.py: Runtime module - π
test.py: Test module - π
test_dist.py: Distributed training test module - π
train.py: train module - π
trainer.py: trainer module - π
utils.py: utility module
-
Note the
--require-virtualenvisnβt strictly required, but I highly recommend to always try and work within a virtual environment, when possible. β©