Last active
April 22, 2021 16:15
-
-
Save nsorros/34e610696b4b8d501aa5ad32377867bd to your computer and use it in GitHub Desktop.
Train with config
This file contains 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 configparser | |
import argparse | |
def train(data_path, model_path, learning_rate, batch_size): | |
... | |
if __name__ == "__main__": | |
argparser = argparse.ArgumentParser() | |
argparser.add_argument("--config", type=str, help="path to config file") | |
args = argparser.parse_args() | |
cfg = configReader | |
cfg.read(args.config) | |
data_path = cfg["train"]["data_path"] | |
model_path = cfg["train"]["model_path"] | |
learning_rate cfg["train"].getfloat("learning_rate") | |
batch_size = cfg["train"].getint("batch_size") | |
train(data_path, model_path, learning_rate, batch_size) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment