[AUTOMATED] Model Memory Requirements

#9
by model-sizer-bot - opened

Model Memory Requirements

You will need about {'dtype': 'float16/bfloat16', 'Largest Layer or Residual Group': '418.02 MB', 'Total Size': '19.91 GB', 'Training using Adam (Peak vRAM)': {'model': 42749947904, 'optimizer': 85499895808, 'gradients': 64124921856, 'step': 85499895808}} VRAM to load this model for inference, and {'dtype': 'int4', 'Largest Layer or Residual Group': '104.5 MB', 'Total Size': '4.98 GB', 'Training using Adam (Peak vRAM)': {'model': -1, 'optimizer': -1, 'gradients': -1, 'step': -1}} VRAM to train it using Adam.

These calculations were measured from the Model Memory Utility Space on the Hub.

The minimum recommended vRAM needed for this model assumes using Accelerate or device_map="auto" and is denoted by the size of the "largest layer".
When performing inference, expect to add up to an additional 20% to this, as found by EleutherAI. More tests will be performed in the future to get a more accurate benchmark for each model.

When training with Adam, you can expect roughly 4x the reported results to be used. (1x for the model, 1x for the gradients, and 2x for the optimizer).

Results:

dtype Largest Layer or Residual Group Total Size Training using Adam (Peak vRAM)
float32 836.03 MB 39.81 GB {'model': 42749947904, 'optimizer': 85499895808, 'gradients': 42749947904, 'step': 170999791616}
float16/bfloat16 418.02 MB 19.91 GB {'model': 42749947904, 'optimizer': 85499895808, 'gradients': 64124921856, 'step': 85499895808}
int8 209.01 MB 9.95 GB {'model': -1, 'optimizer': -1, 'gradients': -1, 'step': -1}
int4 104.5 MB 4.98 GB {'model': -1, 'optimizer': -1, 'gradients': -1, 'step': -1}

Sign up or log in to comment