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
floatXwhen 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:
- read
callable() Returns the checkpoint array for a key.
- availableiterable of
str Every key the checkpoint holds.
- read
- Returns: