onnx-pytorch
onnx-pytorch copied to clipboard
Mistake in `output_dir` and `overwrite` parameters validation
This assert only lets in the following combination of parameter values:
-
output_dir
must exist andoverwrite=False
https://github.com/fumihwh/onnx-pytorch/blob/2902b4d7cfb0470e2a91e29595ba2dfb8dcee50f/onnx_pytorch/code_gen.py#L317-L319
From the context is seems that other combinations of parameter values should also be valid, such as:
-
output_dir
doesn't exist anoverwrite
is whatever -
output_dir
exist andoverwrite=True
I think the fix is to change the clause to:
assert not os.path.exists(
output_dir
) or overwrite, f"{output_dir} is not empty and overwrite is not True."
@Aivean Sorry for late reply. Some PR will resolve this issue.