(args)
| 118 | logging.info("AutoEncoder Encoder model has been saved to %s", os.path.abspath(os.path.join(output_path, "autoencoder_encoder_model.tflite"))) |
| 119 | |
| 120 | def 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 | |
| 153 | def main(): |
| 154 | parser = argparse.ArgumentParser() |
no test coverage detected