models.read_neural_weights

models.read_neural_weights(path, *, features=None, activation='relu')

Load layer weights from a .safetensors file.

Tensors are paired by name: layer0.weight with layer0.bias and so on, ordered by the numeric part. A feature list may live in the file’s metadata under features as newline-separated ids, or be supplied.

Refuses anything that is not safetensors, by extension and by content. The alternative – accepting a .pt because it happens to be there – is the arbitrary-code path this module exists to close.