[docs]defmain(argv:ArgsType)->None:"""Main entry point for the CLI. Example to run this script: >>> python -m vis4d.engine.run --config vis4d/zoo/faster_rcnn/faster_rcnn_coco.py With parameter sweep config: >>> python -m vis4d.engine.run fit --config vis4d/zoo/faster_rcnn/faster_rcnn_coco.py --sweep vis4d/zoo/faster_rcnn/faster_rcnn_coco.py """# Get configassertlen(argv)>1,"Mode must be specified: `fit` or `test`"mode=argv[1]assertmodein{"fit","test"},f"Invalid mode: {mode}"experiment_config:ExperimentConfig=_CONFIG.valueif_SWEEP.valueisnotNone:# Perform parameter sweeprank_zero_info("Found Parameter Sweep in config file. Running Parameter Sweep...")experiment_config=_CONFIG.valuesweep_config=instantiate_classes(_SWEEP.value)forrun_id,configinenumerate(replicate_config(experiment_config,method=sweep_config.method,sampling_args=sweep_config.sampling_args,fstring=sweep_config.get("suffix",""),)):rank_zero_info("Running experiment #%d: %s",run_id,config.experiment_name,)# Run single experimentrun_experiment(experiment_config,mode,_GPUS.value,_SHOW_CONFIG.value,_SLURM.value,)else:# Run single experimentrun_experiment(experiment_config,mode,_GPUS.value,_SHOW_CONFIG.value,_SLURM.value,_CKPT.value,_RESUME.value,)
[docs]defentrypoint()->None:"""Entry point for the CLI."""app.run(main)