sherjilozair / char-rnn-tensorflow

Multi-layer Recurrent Neural Networks (LSTM, RNN) for character-level language models in Python using Tensorflow
MIT License
2.64k stars 960 forks source link

Make save_dir if doesn't exist #75

Closed hugovk closed 7 years ago

hugovk commented 7 years ago

Before:

$ python train.py --save_dir save/some_sub_dir/another_sub_dir
loading preprocessed files
Traceback (most recent call last):
  File "train.py", line 116, in <module>
    main()
  File "train.py", line 48, in main
    train(args)
  File "train.py", line 79, in train
    with open(os.path.join(args.save_dir, 'config.pkl'), 'wb') as f:
IOError: [Errno 2] No such file or directory: 'save/some_sub_dir/another_sub_dir/config.pkl'

After:

$ python train.py --save_dir save/some_sub_dir/another_sub_dir
loading preprocessed files
0/22300 (epoch 0), train_loss = 4.828, time/batch = 3.988
...
hugovk commented 7 years ago

@sherjilozair Can this be merged?

ubergarm commented 7 years ago

seems reasonable, i'll give a quick test