MCPcopy Create free account
hub / github.com/Arm-Examples/ML-examples / export

Function export

kleidiai-examples/audiogen/scripts/export_sao.py:120–151  ·  view source on GitHub ↗
(args)

Source from the content-addressed store, hash-verified

118 logging.info("AutoEncoder Encoder model has been saved to %s", os.path.abspath(os.path.join(output_path, "autoencoder_encoder_model.tflite")))
119
120def export(args) -> None:
121
122 torch.manual_seed(0)
123 device = torch.device("cpu")
124
125 # Load the model configuration
126 logging.info("Loading the AudioGen Checkpoint...")
127 with open(args.model_config, encoding="utf-8") as f:
128 model_config = json.load(f)
129
130 # Load the model
131 model, model_config = load_model(
132 model_config = model_config,
133 model_ckpt_path = args.ckpt_path,
134 pretrained_name=None,
135 device=device,
136 )
137 logging.info("Model is loaded...")
138
139 # --------- Conditioners Model ---------
140 export_conditioners(model, args.output_path)
141
142 # --------- DiT Model ----------------
143 export_dit(model, args.output_path)
144
145 # --------- AutoEncoder Model ---------
146
147 # Removing weight norm from the model as it is causing issues during export
148 remove_weight_norm_from_model(model.pretransform)
149
150 export_autoencoder(model, args.output_path)
151 export_autoencoder_encoder(model, args.output_path)
152
153def main():
154 parser = argparse.ArgumentParser()

Callers 2

mainFunction · 0.90
mainFunction · 0.70

Calls 5

load_modelFunction · 0.90
export_conditionersFunction · 0.70
export_ditFunction · 0.70
export_autoencoderFunction · 0.70

Tested by

no test coverage detected