vllm_omni.utils.tracking_parser ¶
TrackingArgumentParser ¶
Bases: FlexibleArgumentParser
Drop-in replacement for FlexibleArgumentParser, which tracks keys that were explicitly passed as args on the parser namespace.
Unfortunately, Argparse does not provide an easy way of doing this without depending on a lot of internal attributes, so we implement it by instead using a 'shadow' parser, which is essentially a clone of the parser, where defaults are overridden to None. By comparing the parser against its shadow, we can tell which values were passed in a non-destructive manner.
add_argument ¶
Add an arg to the parser & the shadow, where the latter has UNSET for the default.
build_tracking_namespace ¶
build_tracking_namespace(
real_ns: Namespace, shadow_ns: Namespace
) -> TrackingNamespace
Build a tracking namespace for the real / shadow namespaces.
parse_args ¶
parse_args(
args: list[str] | None = None,
namespace: Namespace | None = None,
) -> TrackingNamespace
Parse the args on the real/shadow parser.