Created
September 2, 2021 00:43
-
-
Save joonahn/dd437925dc2c6833e58f77be2854bc53 to your computer and use it in GitHub Desktop.
training main.py boilerplate
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import argparse | |
def str2bool(v): | |
if isinstance(v, bool): | |
return v | |
if v.lower() in ('yes', 'true', 't', 'y', '1'): | |
return True | |
elif v.lower() in ('no', 'false', 'f', 'n', '0'): | |
return False | |
else: | |
raise argparse.ArgumentTypeError('Boolean value expected.') | |
parser = argparse.ArgumentParser() | |
parser.add_argument('--expname', type=str, default=None, help='experiment name of wandb') | |
parser.add_argument('--batch_size', type=int, default=32) | |
parser.add_argument('--save_model', type=str2bool, nargs='?', const=True, default=False) | |
args = parser.parse_args() | |
def main(): | |
train(args) | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment