model_save_dir: The directory containing oneflow model weights. Users are expected to call check_point.save(dir), wait for the model saving finishing, and pass the argument 'dir' as model_save_dir.
onnx_filename: a string for the output filename
continue_on_error: if an op can't be processed (aka there is no mapping), continue
...
...
@@ -246,38 +246,34 @@ def Export(
"""
assertos.getenv("ENABLE_USER_OP")!="False"
assertos.path.isdir(model_save_dir)
job_set=oneflow.experimental.get_job_set()
job_name=job_func.__name__
forjobinjob_set.job:
# TODO(OYY) Modify the interface before modifying it
"Error occured when running model_proto.SerializeToString(). If the model is larger than 2GB, please specify external_data=True when calling flow.onnx.export. Original error message:\n{}".format(
e
)
)
return
raiseValueError('Cannot find job "{}" in jobset'.format(job_name))
withopen(onnx_filename,"wb")asf:
try:
f.write(model_proto.SerializeToString())
exceptValueErrorase:
raiseValueError(
"Error occured when running model_proto.SerializeToString(). If the model is larger than 2GB, please specify external_data=True when calling flow.onnx.export. Original error message:\n{}".format(