| 1 |
# FP8 Benchmarks |
| 2 |
|
| 3 |
Comparing and running [torchao](https://github.com/pytorch/ao/tree/main/torchao/float8) FP8 with accelerate |
| 4 |
|
| 5 |
## Overview |
| 6 |
|
| 7 |
This repo provides scripts which compare native `torchao` model training against `accelerate`'s own integration. Each modeling type is segmented out via a script, supporting the following: |
| 8 |
|
| 9 |
* Single GPU training (`non_distributed.py`) |
| 10 |
* Multi-GPU training via DistributedDataParallelism (`ddp.py`) |
| 11 |
* Fully Sharded Data Parallelism (`fsdp.py`) |
| 12 |
* DeepSpeed ZeRO 1-3 (`deepspeed.py`) |
| 13 |
|
| 14 |
To run them, it's recommended to use a docker image (see the attached `Dockerfile`) and not install `torchao` manually. |
| 15 |
|
| 16 |
## Running: |
| 17 |
|
| 18 |
There are official Docker images located at `huggingface/accelerate:gpu-fp8-torchao-nightly` which can be used. |
| 19 |
|
| 20 |
You can run all scripts using the core `accelerate launch` command without any `accelerate config` being needed. |
| 21 |
|
| 22 |
For single GPU, run it via `python`: |
| 23 |
|
| 24 |
```bash |
| 25 |
python non_distributed.py |
| 26 |
``` |
| 27 |
|
| 28 |
For the rest, run it via `accelerate launch`: |
| 29 |
|
| 30 |
```bash |
| 31 |
accelerate launch ddp.py # or distrib_deepspeed.py, ddp.py |
| 32 |
``` |