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.
| Name | Dtype | Shape | Files |
|---|---|---|---|
| w_f32 | float32 | 4 × 64 | safetensorsnpznpyggufonnx |
| b_f16 | float16 | 8 | safetensorsnpzggufonnx |
| e_bf16 | bfloat16 | 2 × 3 | safetensorsnpzggufonnx |
| i_i32 | int32 | 3 × 2 | safetensorsnpzggufonnx |
| s_f32 | float32 | [] | safetensorsnpzonnx |
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.