Skip to content

[bugfix]Add shared-prefix-len argument to parser - #438

Merged
shijieliu merged 1 commit into
NVIDIA:mainfrom
gameofdimension:patch-6
Jul 10, 2026
Merged

shijieliu merged 1 commit into
NVIDIA:mainfrom
gameofdimension:patch-6

Conversation

@gameofdimension

Copy link
Copy Markdown
Contributor

Description

The argument shared_prefix_len is required for downstream processing.

  Traceback (most recent call last):
    File ".../tools/compare_online_generate_outputs.py", line 200, in <module>
      main()
    File ".../tools/compare_online_generate_outputs.py", line 24, in main
      rows = build_workload(args)
             ^^^^^^^^^^^^^^^^^^^^
    File ".../tools/make_qwen3_beam_workload.py", line 31, in build_workload
      shared_prefix_len=args.shared_prefix_len,
                        ^^^^^^^^^^^^^^^^^^^^^^
  AttributeError: 'Namespace' object has no attribute 'shared_prefix_len'

Checklist

  • I am familiar with the Contributing Guidelines.
  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

@greptile-apps

greptile-apps Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes a one-line AttributeError crash in compare_online_generate_outputs.py by adding the missing --shared-prefix-len argument to its argparse parser. The argument was already defined (with full help text and validation) in the companion make_qwen3_beam_workload.py, but the compare script's parser never declared it, causing an AttributeError whenever build_workload tried to read args.shared_prefix_len.

  • Adds --shared-prefix-len (int, default 0) to compare_online_generate_outputs.py's parser, mirroring the definition in make_qwen3_beam_workload.py.
  • The new argument correctly defaults to 0, which preserves existing behaviour for callers that do not pass the flag.

Confidence Score: 4/5

Safe to merge — the change is a targeted one-line addition that directly fixes the reported crash with no functional side effects.

The fix is minimal and correct: the new argument matches the type and default used by the function that consumes it. The only gap is cosmetic — the companion parser in make_qwen3_beam_workload.py includes a help string and a negative-value guard that this parser does not.

No files require special attention beyond the single-line change in compare_online_generate_outputs.py.

Important Files Changed

Filename Overview
examples/sid-gr-inference/tools/compare_online_generate_outputs.py Adds the missing --shared-prefix-len argument to the argparse parser; the fix is correct and the default of 0 preserves existing behaviour, but unlike the source parser in make_qwen3_beam_workload.py it has no help= string and no guard against negative values.

Sequence Diagram

%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
    participant CLI as CLI caller
    participant CMP as compare_online_generate_outputs.py
    participant WL as make_qwen3_beam_workload.build_workload()

    CLI->>CMP: python compare_online_generate_outputs.py --shared-prefix-len N ...
    CMP->>CMP: build_parser().parse_args()
    Note over CMP: args.shared_prefix_len = N (added by this PR)
    CMP->>WL: build_workload(args)
    WL->>WL: "_deterministic_token_ids_for_request(..., shared_prefix_len=args.shared_prefix_len)"
    WL-->>CMP: rows (list of request dicts)
    CMP->>CMP: _warmup(args, rows)
    CMP->>CMP: compare(args, rows)
    CMP-->>CLI: JSON results written to --output-json
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
    participant CLI as CLI caller
    participant CMP as compare_online_generate_outputs.py
    participant WL as make_qwen3_beam_workload.build_workload()

    CLI->>CMP: python compare_online_generate_outputs.py --shared-prefix-len N ...
    CMP->>CMP: build_parser().parse_args()
    Note over CMP: args.shared_prefix_len = N (added by this PR)
    CMP->>WL: build_workload(args)
    WL->>WL: "_deterministic_token_ids_for_request(..., shared_prefix_len=args.shared_prefix_len)"
    WL-->>CMP: rows (list of request dicts)
    CMP->>CMP: _warmup(args, rows)
    CMP->>CMP: compare(args, rows)
    CMP-->>CLI: JSON results written to --output-json
Loading

Reviews (1): Last reviewed commit: "Add shared-prefix-len argument to parser" | Re-trigger Greptile

@shijieliu
shijieliu merged commit e49f9cc into NVIDIA:main Jul 10, 2026
1 check passed
@gameofdimension
gameofdimension deleted the patch-6 branch July 13, 2026 06:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants