예제 #1
0
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)
예제 #2
0
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)
예제 #3
0
파일: workflow.py 프로젝트: yaogjim/pytext
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)