| 43 | |
| 44 | |
| 45 | def parse_args() -> argparse.Namespace: |
| 46 | parser = argparse.ArgumentParser(description=__doc__) |
| 47 | parser.add_argument("--height", type=int, default=384, help="Requested synthetic height.") |
| 48 | parser.add_argument("--width", type=int, default=518, help="Requested synthetic width.") |
| 49 | parser.add_argument("--patch-size", type=int, default=14) |
| 50 | parser.add_argument( |
| 51 | "--adjust-to-patch", |
| 52 | choices=["floor", "ceil", "error"], |
| 53 | default="floor", |
| 54 | help="How to handle H/W not divisible by patch size.", |
| 55 | ) |
| 56 | parser.add_argument( |
| 57 | "--frame-counts", |
| 58 | type=int, |
| 59 | nargs="+", |
| 60 | default=[64, 128, 256, 512, 1024, 2048, 4096, 10000], |
| 61 | ) |
| 62 | parser.add_argument("--num-scale-frames", type=int, default=8) |
| 63 | parser.add_argument("--sliding-window", type=int, default=64) |
| 64 | parser.add_argument("--keyframe-interval", type=int, default=1) |
| 65 | parser.add_argument("--camera-num-iterations", type=int, default=4) |
| 66 | parser.add_argument( |
| 67 | "--backend", |
| 68 | choices=["flashinfer", "sdpa"], |
| 69 | default="flashinfer", |
| 70 | help="Attention backend. flashinfer matches the fast inference path.", |
| 71 | ) |
| 72 | parser.add_argument( |
| 73 | "--dtype", |
| 74 | choices=["auto", "bf16", "fp16", "fp32"], |
| 75 | default="auto", |
| 76 | help="Autocast dtype.", |
| 77 | ) |
| 78 | parser.add_argument("--device", default="cuda") |
| 79 | parser.add_argument( |
| 80 | "--num-source-images", |
| 81 | type=int, |
| 82 | default=8, |
| 83 | help="Number of synthetic tensors to cycle when --materialize-inputs is off.", |
| 84 | ) |
| 85 | parser.add_argument( |
| 86 | "--materialize-inputs", |
| 87 | action="store_true", |
| 88 | help="Allocate one distinct input tensor per frame on CPU before streaming.", |
| 89 | ) |
| 90 | parser.add_argument( |
| 91 | "--compile", |
| 92 | action="store_true", |
| 93 | help="Compile hot modules as in gct_profile.py. Mostly useful for speed, not memory.", |
| 94 | ) |
| 95 | parser.add_argument("--warmup-frames", type=int, default=16) |
| 96 | parser.add_argument( |
| 97 | "--output", |
| 98 | type=Path, |
| 99 | default=REPO_ROOT / "gct_memory_h800_synthetic.csv", |
| 100 | ) |
| 101 | parser.add_argument("--stop-on-oom", action="store_true") |
| 102 | parser.add_argument( |