1515from build .utils import allowable_dtype_names , allowable_params_table , get_device_str
1616from download import download_and_convert , is_model_downloaded
1717
18- logging .basicConfig (level = logging .INFO ,format = "%(message)s" )
18+ logging .basicConfig (level = logging .INFO , format = "%(message)s" )
1919logger = logging .getLogger (__name__ )
2020
2121default_device = os .getenv ("TORCHCHAT_DEVICE" , "fast" )
2424).expanduser ()
2525
2626
27- # Subcommands related to downloading and managing model artifacts
27+ # Subcommands related to downloading and managing model artifacts
2828INVENTORY_VERBS = ["download" , "list" , "remove" , "where" ]
2929
3030# List of all supported subcommands in torchchat
3131KNOWN_VERBS = ["chat" , "browser" , "generate" , "eval" , "export" ] + INVENTORY_VERBS
3232
33+
3334# Handle CLI arguments that are common to a majority of subcommands.
3435def check_args (args , verb : str ) -> None :
3536 # Handle model download. Skip this for download, since it has slightly
3637 # different semantics.
3738 if (
38- verb not in INVENTORY_VERBS
39+ verb not in INVENTORY_VERBS
3940 and args .model
4041 and not is_model_downloaded (args .model , args .model_directory )
4142 ):
@@ -47,11 +48,11 @@ def add_arguments_for_verb(parser, verb: str) -> None:
4748 # A model can be specified using a positional model name or HuggingFace
4849 # path. Alternatively, the model can be specified via --gguf-path or via
4950 # an explicit --checkpoint-dir, --checkpoint-path, or --tokenizer-path.
50-
51+
5152 if verb in INVENTORY_VERBS :
5253 _configure_artifact_inventory_args (parser , verb )
5354 _add_cli_metadata_args (parser )
54- return
55+ return
5556
5657 parser .add_argument (
5758 "model" ,
@@ -164,10 +165,10 @@ def add_arguments_for_verb(parser, verb: str) -> None:
164165 choices = ["fast" , "cpu" , "cuda" , "mps" ],
165166 help = "Hardware device to use. Options: cpu, cuda, mps" ,
166167 )
167-
168+
168169 if verb == "eval" :
169170 _add_evaluation_args (parser )
170-
171+
171172 parser .add_argument (
172173 "--hf-token" ,
173174 type = str ,
@@ -350,7 +351,7 @@ def arg_init(args):
350351 )
351352
352353 if sys .version_info .major != 3 or sys .version_info .minor < 10 :
353- raise RuntimeError ("Please use Python 3.10 or later." )
354+ raise RuntimeError ("Please use Python 3.10 or later." )
354355
355356 if hasattr (args , "quantize" ) and Path (args .quantize ).is_file ():
356357 with open (args .quantize , "r" ) as f :
0 commit comments