def save_and_export(config: PyTextConfig, task: Task, metric_channels: Optional[List[Channel]] = None) -> None: print("\n=== Saving model to: " + config.save_snapshot_path) save(config, task.model, task.data_handler.metadata_to_save()) task.export(task.model, config.export_caffe2_path, metric_channels, config.export_onnx_path)
def save_and_export(config: PyTextConfig, task: Task, summary_writer: Optional[SummaryWriter] = None) -> None: print("\n=== Saving model to: " + config.save_snapshot_path) save(config, task.model, task.data_handler.metadata_to_save()) task.export(task.model, config.export_caffe2_path, summary_writer, config.export_onnx_path)
def save_and_export(config: PyTextConfig, task: Task, metric_channels: Optional[List[Channel]] = None) -> None: print("\n=== Saving model to: " + config.save_snapshot_path) meta = None if hasattr(task, "data_handler"): meta = task.data_handler.metadata_to_save() save(config, task.model, meta) if config.export_caffe2_path: task.export( task.model, config.export_caffe2_path, metric_channels, config.export_onnx_path, ) if config.export_torchscript_path: task.torchscript_export(task.model, config.export_torchscript_path)