pytorch

mfai.pytorch.assign(left, right)[source]

Used when loading weights coming from another training framework in to pytorch models. Checks the shapes matches and creates the learnable parameters from the supplied weights (rights). Copied from the llm from scratch repo “as-is”.

Parameters:
Return type:

Parameter

mfai.pytorch.export_to_onnx(model, sample, filepath, **kwargs)[source]

Exports a model to ONNX format.

Return type:

None

Parameters:
mfai.pytorch.onnx_load_and_infer(filepath, input)[source]

Loads a model using onnx, checks it, and performs an inference.

Return type:

ndarray

Parameters:
mfai.pytorch.to_numpy(input)[source]
Return type:

ndarray | tuple[ndarray, ...]

Parameters:

input (Tensor | tuple[Tensor, ...])

callbacks

This module contains callbacks that can be used with lightning.

dummy_dataset

lightning_modules

losses

lr_scheduler

metrics

models

namedtensor

A class based NamedTensor implementation for PyTorch, inspired from the unstable PyTorch namedtensors.

padding

transforms