Unexpected process termination = corrupted model
I thought that since the weights are saved fairly regularly an unexpected power loss wouldn't be catastrophic however I lost power the other day and open reopening the training the model was completely messed up, had to start from scratch.
I don't know if I was just extremely unlucky with the timing of the power loss or if this is regular behavior but either way it'd be nice if the model file was more secure.
The files written are very large (hundreds of megabytes) and depending on your storage speed can take anywhere from 2-40 seconds to write out, power loss any time during this will cause corruption. It's a very large amount of time for a power failure to happen,. especially with fast cards, which may save every couple minutes. This is not something that we can fix in the app as it's a simple matter of not enough time to write it out to disk.
I've run into damaged outputs quite often (due to writing to a file across the network), so I wrote a script that saves a backup of the file every hour. I recommend doing something similar if you're having a very bad time of it.
We could implement a rolling backup, as I've had several models corrupt too.
copy model > model_backup save current to model.
I don't know how much this would slow things down though
Not exactly a rolling backup, but that should work just fine. Just so long as we make sure all files are written before being moved, since partial weight changes would be just as corrupting the whole model.
To be honest, I'm just throwing it out there. I tend to leave that part of the code well alone ;)
it shouldn't slow things down too much if it isn't updated too often - there's no need to save every 15 seconds or whatever, every 15 minutes would be fine.
I recommend using the Ramdisk.
Ramdisk will definitely fail during a power outage, it's not really an appropriate solution for the issue here.
thanks bryan i thought that was an odd suggestion...
@torzdf I did implement just that (only locally so far). I can send a pull request if wanted.
Yeah, you should raise a PR. Bit concerned that all of the collaborators may have gone awol though
This should be fixed in PR #349. If your model is corrupted then you can pull the last saved version out of the model_bk folder