Skip to content

Commit

Permalink
Fix remove params
Browse files Browse the repository at this point in the history
  • Loading branch information
xuzhao9 committed Nov 12, 2024
1 parent f5d334d commit f4dbc04
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions tritonbench/utils/parser.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import argparse
from typing import List
from typing import List, Optional

from tritonbench.utils.env_utils import AVAILABLE_PRECISIONS
from tritonbench.utils.triton_op import DEFAULT_RUN_ITERS, DEFAULT_WARMUP, IS_FBCODE
Expand Down Expand Up @@ -192,14 +192,17 @@ def _find_param_loc(params, key: str) -> int:
def _remove_params(params, loc):
if loc == -1:
return params
if loc == len(params) - 1:
return params[:loc]
if params[loc + 1].startswith("--"):
return params[:loc] + params[loc + 1 :]
return params[:loc] + params[loc + 2 :]


def add_cmd_parameter(args: List[str], name: str, value: str) -> List[str]:
def add_cmd_parameter(args: List[str], name: str, value: Optional[str]=None) -> List[str]:
args.append(name)
args.append(value)
if value:
args.append(value)
return args


Expand Down

0 comments on commit f4dbc04

Please sign in to comment.