How to prevent model corruption due to remote server shtutdown
Hello I am currenlty training on an iPython notebook running on a remote server. The server sometimes shuts down unexpectedly due to timeout or other reasons. Note that I load my training data to the remote machine's disk for speed, while the models are stored in my clould drive (mounted via FUSE).
This setup generally works OK and I can do re-training i.e. I can provide an exception to the train.py script (by clicking the 'stop' button on the executing notebook shell) to stop execution gracefully and convert/resume at a later time. To enable this functionality (note that I cannot provide a KeyboardInterrupt in an IPython notebook) I have modified the code in train.py to save upon an Exception:
except Exception as e:
print('*** Exception: {}'.format(e))
model.save_weights()
print('Saved model weights and exited.')
exit(0)
The problem is that when the server crushes in an uncontrolled manner mid-training, I get the following error when trying to resume training of the partially trained model:
Failed loading existing training data.
Unable to open file (file signature not found)
Loading Trainer from Model_Original plugin...
In this case, the train.py starts training from scratch (over-writing my corrupt model) with loss functions around 0.23.
My questions are:
- Why exactly does this happen? have I misunderstood something maybe and it is a case of something else being changed/corrupted or missing?
- Is there a way to fix a model that has been quit mid-training and gives the
Failed loading existing training data? - Is there a way to keep periodic backups of the models i.e. instead of simply saving them in place, copying them to some other place?
In Linux there is cron. I used that and .sh to save my models every hour. I don't know much about IPython notebook though.
@flipflopbboi is #227 ok to solve this? Please add your review there, and continue discussion there...
Try screen tool,works great on me! 1.sudo apt install screen 2.screen -S name 3.Run the training ,ctl + a then press d 4.if you want to see the progress,screen -r -d