[AUTOMATED] Model Memory Requirements

#2
by model-sizer-bot - opened

Model Memory Requirements

You will need about {'dtype': 'float16/bfloat16', 'Largest Layer or Residual Group': '73.63 MB', 'Total Size': '257.88 MB', 'Training using Adam (Peak vRAM)': {'model': 540816400, 'optimizer': 1081632800, 'gradients': 811224600, 'step': 1081632800}} VRAM to load this model for inference, and {'dtype': 'int4', 'Largest Layer or Residual Group': '18.41 MB', 'Total Size': '64.47 MB', '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 147.27 MB 515.76 MB {'model': 540816400, 'optimizer': 1081632800, 'gradients': 540816400, 'step': 2163265600}
float16/bfloat16 73.63 MB 257.88 MB {'model': 540816400, 'optimizer': 1081632800, 'gradients': 811224600, 'step': 1081632800}
int8 36.82 MB 128.94 MB {'model': -1, 'optimizer': -1, 'gradients': -1, 'step': -1}
int4 18.41 MB 64.47 MB {'model': -1, 'optimizer': -1, 'gradients': -1, 'step': -1}

Sign up or log in to comment