One tensor

A tensor

A name, a dtype, a shape, and the bytes. The same arrays are stored in more than one file.

Name
model.layers.0.mlp.down.weight
Dtype
F32
Shape
2 × 4
Bytes
32

What each part means

Name

Where the tensor sits in the model. The dots are just parts of the name.

Dtype

The kind of number. F32 is a 32-bit float, four bytes per value.

Shape

The size of each dimension, outermost first. 2 × 4 is two rows of four.

Bytes

The raw values. 2 × 4 values at four bytes each is 32 bytes.

The same arrays in each file

The same arrays in the example files. A file is listed only when that array was read back out of it.

NameDtypeShapeFiles
w_f32float324 × 64safetensorsnpznpyggufonnx
b_f16float168safetensorsnpzggufonnx
e_bf16bfloat162 × 3safetensorsnpzggufonnx
i_i32int323 × 2safetensorsnpzggufonnx
s_f32float32[]safetensorsnpzonnx

How the dtype names line up

Where the bytes go

Row by row, left to right. The first row is 1, 2, 3, 4 and the second is 5, 6, 7, 8. A file may store the shape the other way round, but these values stay in this order.

 1   2   3   4
 5   6   7   8

Eight numbers, four bytes each, 32 bytes in all. A quantized file stores a smaller stand-in and rebuilds values like these on load.

Tensref rev 3.1