usrbinenv python codingutf8 2018 the huggingface inc team c 2020 nvidia corporation licensed under the apache license version 2 0 the license you may not use this file except in compliance with the license you may obtain a copy of the license at http www apache orglicenseslicense2 0 unless required by applicable law or agreed to in writing software distributed under the license is distributed on an as is basis without warranties or conditions of any kind either express or implied see the license for the specific language governing permissions and limitations under the license benchmarking the library on inference and training in tensorflow from transformers import hfargumentparser tensorflowbenchmark tensorflowbenchmarkarguments def main parser hfargumentparsertensorflowbenchmarkarguments benchmarkargs parser parseargsintodataclasses0 benchmark tensorflowbenchmarkargsbenchmarkargs try benchmarkargs parser parseargsintodataclasses0 except valueerror as e argerrormsg arg no0 is no longer used please use no0 instead beginerrormsg joinstre split 1 fullerrormsg depreciatedargs evalstre split 1 wrongargs for arg in depreciatedargs arg2 removes if arg2 in tensorflowbenchmark deprecatedargs arg5 removes no fullerrormsg argerrormsg formatarg5 else wrongargs appendarg if lenwrongargs 0 fullerrormsg fullerrormsg beginerrormsg strwrongargs raise valueerrorfullerrormsg benchmark run if name main main usr bin env python coding utf 8 2018 the huggingface inc team c 2020 nvidia corporation licensed under the apache license version 2 0 the license you may not use this file except in compliance with the license you may obtain a copy of the license at http www apache org licenses license 2 0 unless required by applicable law or agreed to in writing software distributed under the license is distributed on an as is basis without warranties or conditions of any kind either express or implied see the license for the specific language governing permissions and limitations under the license benchmarking the library on inference and training in tensorflow arg 2 removes arg 5 removes no_
from transformers import HfArgumentParser, TensorFlowBenchmark, TensorFlowBenchmarkArguments


def main():
    parser = HfArgumentParser(TensorFlowBenchmarkArguments)
    benchmark_args = parser.parse_args_into_dataclasses()[0]
    benchmark = TensorFlowBenchmark(args=benchmark_args)
    try:
        benchmark_args = parser.parse_args_into_dataclasses()[0]
    except ValueError as e:
        arg_error_msg = "Arg --no_{0} is no longer used, please use --no-{0} instead."
        begin_error_msg = " ".join(str(e).split(" ")[:-1])
        full_error_msg = ""
        depreciated_args = eval(str(e).split(" ")[-1])
        wrong_args = []
        for arg in depreciated_args:
            
            if arg[2:] in TensorFlowBenchmark.deprecated_args:
                
                full_error_msg += arg_error_msg.format(arg[5:])
            else:
                wrong_args.append(arg)
        if len(wrong_args) > 0:
            full_error_msg = full_error_msg + begin_error_msg + str(wrong_args)
        raise ValueError(full_error_msg)
    benchmark.run()


if __name__ == "__main__":
    main()