Giter VIP home page Giter VIP logo

fsdp-profiling's Introduction

Profiling FSDP with T5 and GPT2-XL

Code to reproduce the findings from this blogpost.

Because we want to profile ColossialAIs (CAI) memory manager and the PyTorch implementation, we need to make an apples-to-apples comparison with the same 1.13 PyTorch version, as CAI does not support PyTorch > 1.13 at the time of writing. Due to the slightly differing implementation of FSDP between the PyTorch versions, we have special branches for each version.

The repository is organized in five branches for each configuration:

  • t5-nightly
  • t5-1.13
    • disabled use_orig_params=True in FSDP as it's not available
    • some gpu metrics are missing, like requested_bytes.all.current
  • gpt2-nightly
  • gpt2-1.13
    • disabled use_orig_params=True in FSDP as it's not available
    • some gpu metrics are missing, like requested_bytes.all.current
  • cai
    • also uses torch==1.13

Prepare the environment

  • Install the same or higher CUDA driver for each experiment on the node.
    • PyTorch 1.13 -> CUDA 11.7
wget https://developer.download.nvidia.com/compute/cuda/11.7.0/local_installers/cuda_11.7.0_515.43.04_linux.run
  • PyTorch Nightly (2.x) -> CUDA 12.2
wget https://developer.download.nvidia.com/compute/cuda/12.2.2/local_installers/cuda_12.2.2_535.104.05_linux.run
sudo apt update
sudo apt install wget libxml2 build-essential psmisc file rsync tmux git linux-headers-`uname -r` -y
sudo sh cuda_XXX_XXX.run --silent
  • Install miniconda
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
chmod +x Miniconda3-latest-Linux-x86_64.sh
./Miniconda3-latest-Linux-x86_64.sh -b
miniconda3/bin/conda init
source ~/.bashrc
  • Clone the repository and setup the first environment
cd fsdp-profiling
conda create -n nightly python=3.9 -y
conda activate nightly
pip install -r requirements-nightly.txt
./install-nightly-torch.sh
  • Do the same for 1.13 environment
conda create -n stable-1.13 python=3.7 -y
conda activate stable-1.13
pip install -r requirements-1.13.txt
./install-1.13-torch.sh
  • And lastly for the cai environment
conda create -n cai python=3.7 -y
conda activate cai
cd cai
pip install -r requirements.txt
  • And finally, let it rip with the configuration that you want in cfg/benchmark.py for all FSDP runs, or with cai you have to modify the bash runner
  • ./run_benchmark.sh

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.