Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenDAS
vllm_cscc
Commits
8065a7e2
Unverified
Commit
8065a7e2
authored
Jun 20, 2024
by
Michael Goin
Committed by
GitHub
Jun 20, 2024
Browse files
[Frontend] Add FlexibleArgumentParser to support both underscore and dash in names (#5718)
parent
3f3b6b21
Changes
22
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
2 deletions
+21
-2
vllm/model_executor/model_loader/tensorizer.py
vllm/model_executor/model_loader/tensorizer.py
+2
-2
vllm/utils.py
vllm/utils.py
+19
-0
No files found.
vllm/model_executor/model_loader/tensorizer.py
View file @
8065a7e2
...
...
@@ -21,6 +21,7 @@ from vllm.model_executor.layers.quantization.base_config import (
QuantizationConfig
)
from
vllm.model_executor.layers.vocab_parallel_embedding
import
(
VocabParallelEmbedding
)
from
vllm.utils
import
FlexibleArgumentParser
tensorizer_error_msg
=
None
...
...
@@ -177,8 +178,7 @@ class TensorizerArgs:
self
.
deserializer_params
[
'encryption'
]
=
decryption_params
@
staticmethod
def
add_cli_args
(
parser
:
argparse
.
ArgumentParser
)
->
argparse
.
ArgumentParser
:
def
add_cli_args
(
parser
:
FlexibleArgumentParser
)
->
FlexibleArgumentParser
:
"""Tensorizer CLI arguments"""
# Tensorizer options arg group
...
...
vllm/utils.py
View file @
8065a7e2
import
argparse
import
asyncio
import
datetime
import
enum
...
...
@@ -775,3 +776,21 @@ def run_once(f):
wrapper
.
has_run
=
False
# type: ignore[attr-defined]
return
wrapper
class
FlexibleArgumentParser
(
argparse
.
ArgumentParser
):
"""ArgumentParser that allows both underscore and dash in names."""
def
parse_args
(
self
,
args
=
None
,
namespace
=
None
):
if
args
is
None
:
args
=
sys
.
argv
[
1
:]
# Convert underscores to dashes and vice versa in argument names
processed_args
=
[]
for
arg
in
args
:
if
arg
.
startswith
(
'--'
):
processed_args
.
append
(
'--'
+
arg
[
len
(
'--'
):].
replace
(
'_'
,
'-'
))
else
:
processed_args
.
append
(
arg
)
return
super
().
parse_args
(
processed_args
,
namespace
)
Prev
1
2
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment