MCPcopy Create free account
hub / github.com/OpenDriveLab/DriveAdapter / str2bool

Function str2bool

open_loop_training/train.py:32–40  ·  view source on GitHub ↗
(v)

Source from the content-addressed store, hash-verified

30torch.hub.set_dir("./ckpt")
31
32def str2bool(v):
33 if isinstance(v, bool):
34 return v
35 if v.lower() in ('yes', 'true', 't', 'y', '1'):
36 return True
37 elif v.lower() in ('no', 'false', 'f', 'n', '0'):
38 return False
39 else:
40 raise argparse.ArgumentTypeError('Boolean value expected.')
41
42
43def parse_args():

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected