Log inStart free
LESSON 33.26 · 6 STAGES · 3 CONTROLS · 3 CHECKSPRO · PREVIEW

Loading model weights fast

Watch 16 GB of weights move from storage into GPU memory.


Pro lesson. Stage 1 is free to watch. Pro opens all 6 stages, 3 controls and 3 checks, in this lesson and every other.

Go Pro · $8.25/mo
EXPLAINER · 33.26 · WEIGHT LOADER4 FILES · 16.06 GB · 8.03 B WEIGHTS
01
Stage 1 of 6 · The checkpoint
The checkpoint holds 8.03 billion weights at 2 bytes each. It splits into 4 files of at most 5 GB.
Explain it simply

Each long bar is one file of the checkpoint. The ochre blocks inside it are layers of weights, in order. Together the four files hold 16.06 GB. Every byte must travel from storage into the GPU before the model can answer.

Four file bars sit side by side. File 1 holds 4.98 GB. File 2 holds 5.00 GB. File 3 holds 4.92 GB. File 4 holds 1.17 GB. Each bar is cut into layer blocks.

weightsreadsunpickle, private copycopy to GPUnot read, empty or cap
the checkpointcheckpoint · 4 files · 16.06 GBfile 1 · 4.98 GBfile 2 · 5.00 GBfile 3 · 4.92 GBfile 4 · 1.17 GBlayers emb–8layers 9–20layers 20–31layers 31–headembedding1.05 GB32 layers32 × 436.2 MB = 13.96 GBnorm + head1.05 GBthe weights by part8.03 G weights × 2 bytes (BF16) = 16.06 GBGPU memory (HBM) · 80 GB16.06 GB to fillthe checkpointcheckpoint · 4 files · 16.06 GBfile 1 · 4.98 GBfile 2 · 5.00 GBfile 3 · 4.92 GBfile 4 · 1.17 GBlayers emb–8layers 9–20layers 20–31layers 31–headembedding1.05 GB32 layers32 × 436.2 MB = 13.96 GBnorm + head1.05 GBthe weights by part8.03 G weights × 2 bytes (BF16) = 16.06 GBGPU memory (HBM) · 80 GB16.06 GB to fill
Toy: the 8B model, 4 files; tier rates are round typical numbers
STAGE 1 / 6
MATH · STAGE 1HOVER A SYMBOL OR A SHAPE
B=N⋅2 bytes\sy{b}{param}{B} = \sy{n}{param}{N} \cdot 2\,\text{bytes}
B=8.03 G⋅2=16.06 GBB = 8.03\text{ G} \cdot 2 = 16.06\text{ GB}

The bytes are the weight count times 2 bytes.

Common mix-ups

MYTHObject storage is too slow to load weights from.

The fix, and 1 more mix-up with the diagram to show them, come with Pro.

Predict, then reveal
3 CHECKS · PRO
Q01Does a pickle checkpoint load faster or slower than safetensors?

Make your guess, then test it in the diagram. All 3 checks come with Pro.

PRO LESSON · YOU WATCHED STAGE 1 OF 6
Unlock the full explainer
  • 5 more stages and 3 live controls
  • 2 mix-up cards and 3 predict-then-reveal checks
  • Watch it as a narrated video, in three voices
  • Every Pro lesson and capstone · 656 in total

$99 a year, or $15 a month. Cancel any time.