Installation#
To use MASE, you can set up the environment using one of the following methods. uv is recommended for local development, and Docker for a fully isolated environment.
Import a model#
To import a model into MASE and use all its features, the following options are available.
Generate a MaseGraph from a torch.nn.Module instance.
Since the MASE IR is based on Torch FX, symbolic tracing limitations apply to this method, namely models with control flow cannot be traced (see documentation).
Exising Pytorch models can be patched to remove control and run symbolic tracing (see here for examples).
import torch.nn as nn
from chop import MaseGraph
class MyModel(nn.Module):
def __init__(self):
...
def forward(self):
...
model = MyModel()
mg = MaseGraph(model)