Package: ninesix
Nine SixUnified tools for Neural Network logging and managing.Quick StartUse pip to install Nine Six modules.pip3 install ninesixPretty LoggingfromninesiximportLogger# import loggerlogger=Logger("example_nn")# Initialize loggerif__name__=='__main__':parser=argparse.ArgumentParser()# Define your argument parser...args=parser.args()args=logger.config(args,"argparse")# Wrap the argparse object to log configlogger.msg("We're going to start training...")# Log text message...# Prepare your modelforepochinrange(args.epoch):logger.progress("epoch",epoch+1,total=args.epoch)# Record epoch as a progress variable...# Train your modellogger.value({"loss":loss,"f1":f1})# Log value(s) associated with progress variable(s)...logger.unwatch("epoch")# Unregister progress variable...logger.value({"final_f1":final_f1})# Log value(s)logger.msg("All done, have fun!")# Log text messageThe output you will get at stdout:2019-05-14 17:29:09 [Log] (log.py: 44 in __init__()):
Logger [example_nn] Initialized.

2019-05-14 17:29:09 [Config] (example.py: 189 in <module>()):
{
    "epoch": 300,
    "lr": 0.01,
    "lr_decay": 0.0001
}

2019-05-14 17:29:11 [Log] (example.py: 171 in <module>()):
We're going to start training...

2019-05-14 17:29:22 [Log] (example.py: 237 in <module>()):
epoch     : 300 / 300                                       
------------------------------------------------------------------
loss: 0.22311973571777344  f1: 90.58  

2019-05-14 17:29:22 [Log] (example.py: 247 in <module>()):
final_f1: 90.58

2019-05-14 17:29:11 [Log] (example.py: 371 in <module>()):
All done, have fun!At the same time, you'll get a JSON log file~/96log/example_nn/2019-05-14/172909.json:[{"type":"msg","tag":"Log","time":"2019-05-14 17:29:09","content":"JSON Writer Initialized."},{"type":"config","tag":"Log","time":"2019-05-14 17:29:09","content":{"lr":0.01,"lr_decay":0.0001,"epoch":300}},{"type":"msg","tag":"Log","time":"2019-05-14 17:29:11","content":"We're going to start training..."},{"type":"value","tag":"Log","time":"2019-05-14 17:29:12","content":{"progress":{"epoch":{"current":50,"max":300}},"value":{"loss":5.2108306884765625,"f1":73.26}}},{"type":"value","tag":"Log","time":"2019-05-14 17:29:13","content":{"progress":{"epoch":{"current":100,"max":300}},"value":{"loss":1.3068847656252345,"f1":85.81}}},...{"type":"value","tag":"Log","time":"2019-05-14 17:29:22","content":{"progress":{"epoch":{"current":300,"max":300}},"value":{"loss":0.22311973571777344,"f1":90.58}}},{"type":"value","tag":"Log","time":"2019-05-14 17:29:22","content":{"progress":{},"value":{"final_f1":90.58}}},{"type":"msg","tag":"Log","time":"2019-05-14 17:29:11","content":"All done, have fun!"}]You can tryexample.pywhich is a complete example.Grid SearchCommand Line:96grid -p lr 0.1 0.01 0.001 -p epoch 100 to 201 jump 50 -g 1 2 3 -c "python example.py"You can usepython3 ninesix/tool/grid.py -hfor more help.Python code:fromninesiximportGridSearchgs=GridSearch()# set environment settingsgs.cmd_env=""# set default commandgs.cmd_template="python3 example.py"# set available GPUsgs.gpus=[0]# set parameter optionsgs.param_grid={"lr":[0.1,0.01,0.001],"epoch":[100,150,200]}# generate scriptsgs.generate_grid_search()# execute scriptsgs.execute_script()