Commit eee4dfc1 authored by Tugrul Savran's avatar Tugrul Savran Committed by Facebook GitHub Bot
Browse files

D2Go Fail Fast: Move exception coming from not implemented "compare accuracy" feature to the top.

Summary:
Currently, the exporter method takes in a compare_accuracy parameter, which after all the compute (exporting etc.) raises an exception if it is set to True.

This looks like an antipattern, and causes a waste of compute.

Therefore, I am proposing to raise the exception at the very beginning of method call to let the client know in advance that this argument's functionality isn't implemented yet.

NOTE: We might also choose to get rid of the entire parameter. I am open for suggestions.

Differential Revision: D34186578

fbshipit-source-id: d7fbe7589dfe2d2f688b870885ca61e6829c9329
parent 614336e4
......@@ -34,6 +34,13 @@ def main(
compare_accuracy: bool = False,
skip_if_fail: bool = False,
):
if compare_accuracy:
raise NotImplementedError(
"compare_accuracy functionality isn't currently supported."
)
# NOTE: dict for metrics of all exported models (and original pytorch model)
# ret["accuracy_comparison"] = accuracy_comparison
cfg = copy.deepcopy(cfg)
setup_after_launch(cfg, output_dir, runner)
......@@ -72,10 +79,6 @@ def main(
raise e
ret = {"predictor_paths": predictor_paths, "accuracy_comparison": {}}
if compare_accuracy:
raise NotImplementedError()
# NOTE: dict for metrics of all exported models (and original pytorch model)
# ret["accuracy_comparison"] = accuracy_comparison
return ret
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment