Home / Function/ parse_cmd_args() — pytorch Function Reference

parse_cmd_args() — pytorch Function Reference

Architecture documentation for the parse_cmd_args() function in cachebench.py from the pytorch codebase.

Entity Profile

Dependency Diagram

graph TD
  934ad498_2c6a_2ef7_e5d8_072d31076c44["parse_cmd_args()"]
  e68c7f5d_5584_dd88_8af3_2bcda2115580["main()"]
  e68c7f5d_5584_dd88_8af3_2bcda2115580 -->|calls| 934ad498_2c6a_2ef7_e5d8_072d31076c44
  style 934ad498_2c6a_2ef7_e5d8_072d31076c44 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

benchmarks/dynamo/cachebench.py lines 187–228

def parse_cmd_args() -> argparse.Namespace:
    parser = argparse.ArgumentParser(description="Run a TorchCache benchmark.")
    parser.add_argument(
        "-m",
        "--model",
        help="Name of the model to run",
    )
    parser.add_argument(
        "--dynamic",
        action="store_true",
        help="Whether to run with dynamic enabled",
    )
    parser.add_argument(
        "--benchmark",
        choices=("torchbench", "huggingface"),
        required=True,
        help="Name of benchmark suite to run",
    )
    parser.add_argument(
        "--mode",
        choices=("inference", "training"),
        default="training",
    )
    parser.add_argument(
        "--device",
        default="cuda",
        choices=("cuda", "cpu"),
    )
    parser.add_argument(
        "--output",
        required=True,
        help="The output filename (json)",
    )
    parser.add_argument(
        "--repeat",
        type=int,
        default=1,
        choices=range(1, 10),
        help="Number of times to repeat the compilation (reduce noise)",
    )
    args, _ = parser.parse_known_args()
    return args

Subdomains

Called By

Frequently Asked Questions

What does parse_cmd_args() do?
parse_cmd_args() is a function in the pytorch codebase.
What calls parse_cmd_args()?
parse_cmd_args() is called by 1 function(s): main.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free