pytensor_ml.models.KeyMap.load#

KeyMap.load(read, available)#

Fill every bound parameter from the checkpoint.

Tensors are handled one at a time, so the peak cost is one tensor rather than a second copy of the whole checkpoint. Each is cast to its parameter’s dtype, which the layer fixed from floatX when it built it and loading cannot change.

A bound parameter the checkpoint cannot fill raises before anything is stored – it would otherwise keep its initialization, giving a wrong model that runs. A checkpoint tensor no parameter wants is returned instead, since every parameter still got a value. A tensor whose shape is wrong raises mid-load, leaving the parameters before it filled.

Parameters:
readcallable()

Returns the checkpoint array for a key.

availableiterable of str

Every key the checkpoint holds.

Returns:
surpluslist of str

Checkpoint keys no parameter loads from, sorted.