@@ -49,8 +49,9 @@ def add_arguments_for_verb(parser, verb: str) -> None:
49
49
# an explicit --checkpoint-dir, --checkpoint-path, or --tokenizer-path.
50
50
51
51
if verb in INVENTORY_VERBS :
52
- _configure_artifact_inventory_args (parser , verb )
53
- return
52
+ _configure_artifact_inventory_args (parser , verb )
53
+ _add_cli_metadata_args (parser )
54
+ return
54
55
55
56
parser .add_argument (
56
57
"model" ,
@@ -200,12 +201,6 @@ def add_arguments_for_verb(parser, verb: str) -> None:
200
201
choices = allowable_dtype_names (),
201
202
help = "Override the dtype of the model (default is the checkpoint dtype). Options: bf16, fp16, fp32, fast16, fast" ,
202
203
)
203
- parser .add_argument (
204
- "-v" ,
205
- "--verbose" ,
206
- action = "store_true" ,
207
- help = "Verbose output" ,
208
- )
209
204
parser .add_argument (
210
205
"--quantize" ,
211
206
type = str ,
@@ -261,7 +256,17 @@ def add_arguments_for_verb(parser, verb: str) -> None:
261
256
default = 5000 ,
262
257
help = "Port for the web server in browser mode" ,
263
258
)
259
+ _add_cli_metadata_args (parser )
260
+
264
261
262
+ # Add CLI Args that are relevant to any subcommand execution
263
+ def _add_cli_metadata_args (parser ) -> None :
264
+ parser .add_argument (
265
+ "-v" ,
266
+ "--verbose" ,
267
+ action = "store_true" ,
268
+ help = "Verbose output" ,
269
+ )
265
270
266
271
# Configure CLI Args specific to Model Artifact Management
267
272
def _configure_artifact_inventory_args (parser , verb : str ) -> None :
@@ -314,6 +319,7 @@ def _add_evaluation_args(parser) -> None:
314
319
)
315
320
316
321
322
+ # TODO: Refactor arg_init to be more modular
317
323
def arg_init (args ):
318
324
if not (torch .__version__ > "2.3" ):
319
325
raise RuntimeError (
@@ -323,6 +329,11 @@ def arg_init(args):
323
329
if sys .version_info .major != 3 or sys .version_info .minor < 10 :
324
330
raise RuntimeError ("Please use Python 3.10 or later." )
325
331
332
+ # TODO: Don't initialize for Inventory management subcommands
333
+ # Remove when arg_init is refactored
334
+ if args .command in INVENTORY_VERBS :
335
+ return args
336
+
326
337
if hasattr (args , "quantize" ) and Path (args .quantize ).is_file ():
327
338
with open (args .quantize , "r" ) as f :
328
339
args .quantize = json .loads (f .read ())
0 commit comments