Home > Software engineering >  How to plot loss history when we do training by Python terminal commands?
How to plot loss history when we do training by Python terminal commands?

Time:05-02

I'm training on an RNN at Google Colab, but all cells are command lines from the Python terminal (as below), but I needed to plot the loss history, ROC curve and model architecture, but I have no idea of how to do when you only have terminal command lines, could someone help me with this? Infinite thanks in advance :)

Example of Google Colab Cells:

#test and train sample split wih 10% ratio
!polyphony_rnn_create_dataset \
--input=/temp/notesequences.tfrecord \
--output_dir=/content/drive/My\ Drive/RNN/sample \
--eval_ratio=0.10 \
--config='polyphony'

#Train the model!
!polyphony_rnn_train \
--run_dir=/content/drive/My\ Drive/RNN/models/polyphony/run1 \
--sequence_example_file=/content/drive/My\ Drive/RNN/sample/training_poly_tracks.tfrecord \
--num_training_steps=20000 \
--hparams="batch_size=64,rnn_layer_sizes=[128,128,128]" \
--config='polyphony' \
--num_checkpoints=10


CodePudding user response:

As far as I understand, you want to monitor the tensorboard logs.

If you have colab pro you can simply use the terminal that is provided to you along with the code blocks. So when your program is running you can also run tensorboard --logdir=/tmp/polyphony_rnn/logdir to get the plots generated by tensorboard.

In case you don't have that, you just need to wait till the execution is over. Once the model training is over you can simply run the tensorboard --logdir=/tmp/polyphony_rnn/logdir command to get check the tensorboard logs.

Note: From the github page we can see that polyphony_rnn supports tensorboard logging.

Note2: If you are not satisfied with the scalars that they log by default as part of their library you can setup an development version by cloning the repo and making changes as per your need and then running pip install -e . (link)

  • Related