It doesn't reflect the latest API anymore: the experiment.log_metric1 signature has swappedxandy`.
When using multiprocessing for data loading (that's common practice with PyTorch's torch.utils.data.DataLoader), its problematic to execute expressions outside an if __name__ == '__main__' clause (at least on Windows): it starts multiple experiments...
I usually want to have my training script also be possible to launch from console. What do you think of the proposed snipped for merging both sets of arguments/options?
from collections import ChainMap
def main():
# Training settings
parser = argparse.ArgumentParser(description='PyTorch MNIST Example',
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument('--batch-size', type=int, default=64, metavar='N',
help='input batch size for training')
# More arguments...
args = parser.parse_args()
experiment = deepkit.experiment()
# Merge CLI arguments (low priority) with experiment hyperparameters (high priority)
args = argparse.Namespace(**ChainMap(experiment.full_config(), vars(args)))
# Update merged arguments back to experiment server
for key, val in vars(args).items():
experiment.set_config(key, val)
# Capsule the experiment handle into `args` as well, so distribution to train() and test() methods is easy
args.experiment = experiment
The PyTorch example could use some improvement:
experiment.log_metric1 signature has swapped
xand
y`.torch.utils.data.DataLoader
), its problematic to execute expressions outside anif __name__ == '__main__'
clause (at least on Windows): it starts multiple experiments...