Parse command line arguments for the benchmarking CLI.
()
| 318 | |
| 319 | |
| 320 | def parse_arguments() -> tuple[str, str, str, str, bool, str]: |
| 321 | """ |
| 322 | Parse command line arguments for the benchmarking CLI. |
| 323 | """ |
| 324 | parser = argparse.ArgumentParser(description="CLI for benchmarking the huggingface/transformers.") |
| 325 | |
| 326 | parser.add_argument( |
| 327 | "repository", |
| 328 | type=str, |
| 329 | help="The repository name on which the benchmarking is performed.", |
| 330 | ) |
| 331 | |
| 332 | parser.add_argument( |
| 333 | "branch", |
| 334 | type=str, |
| 335 | help="The branch name on which the benchmarking is performed.", |
| 336 | ) |
| 337 | |
| 338 | parser.add_argument( |
| 339 | "commit_id", |
| 340 | type=str, |
| 341 | help="The commit hash on which the benchmarking is performed.", |
| 342 | ) |
| 343 | |
| 344 | parser.add_argument( |
| 345 | "commit_msg", |
| 346 | type=str, |
| 347 | help="The commit message associated with the commit, truncated to 70 characters.", |
| 348 | ) |
| 349 | |
| 350 | parser.add_argument("--csv", action="store_true", default=False, help="Enable CSV output files generation.") |
| 351 | |
| 352 | parser.add_argument( |
| 353 | "--csv-output-dir", |
| 354 | type=str, |
| 355 | default="benchmark_results", |
| 356 | help="Directory for CSV output files (default: benchmark_results).", |
| 357 | ) |
| 358 | |
| 359 | args = parser.parse_args() |
| 360 | |
| 361 | # CSV is disabled by default, only enabled when --csv is used |
| 362 | generate_csv = args.csv |
| 363 | |
| 364 | return args.repository, args.branch, args.commit_id, args.commit_msg, generate_csv, args.csv_output_dir |
| 365 | |
| 366 | |
| 367 | def import_from_path(module_name, file_path): |
no outgoing calls
no test coverage detected