class

MicroGPT::WeightStore

Inherits Reference < Object

Constructors

new(mats : Array(Mat), adam_mats : Array(Mat) | Nil = nil)

weight_mats: all trainable parameters adam_mats: corresponding Adam m/v Mats (2 per weight mat: m, v) Order: [w0_m, w0_v, w1_m, w1_v, ...]

Source

Instance methods

adam_m_offset

Adam state lives at known offsets in the same buffer

Source
adam_m_ptr(mat_idx : Int32) : Pointer(Float32)

Get Adam M pointer for a specific mat index

Source
adam_v_offset
Source
adam_v_ptr(mat_idx : Int32) : Pointer(Float32)

Get Adam V pointer for a specific mat index

Source
bulk_adam_step(grad_mats : Array(Mat), lr : Float64, t : Int32)

Bulk Adam: gather gradients, then one kernel launch for all parameters

Source
download_all

Download all weights back to CPU

Source
finalize
Source
mat_offsets
Source
mats
Source
store_ptr
Source
total_bytes
Source
total_floats
Source
weights_bytes
Source