Path: blob/master/ColorizeTrainingStableLargeBatch.ipynb
781 views
Stable Model Training (Large Batch/Limited GPU Memory Support)
IMPORTANT: Training has -not- been verified by myself for this notebook ~jantic
NOTES:
This is "NoGAN" based training, described in the DeOldify readme.
This model prioritizes stable and reliable renderings. It does particularly well on portraits and landscapes. It's not as colorful as the artistic model.
Setup
Activate Large Model Support for PyTorch
This will allow us to fit the model within a GPU with smaller memory capacity (e.g. GTX 1070 8Gb).
Large Model Support (LMS) is a feature provided in IBM Watson Machine Learning Community Edition (WML-CE) PyTorch V1.1.0 that allows the successful training of deep learning models that would otherwise exhaust GPU memory and abort with “out-of-memory” errors. LMS manages this oversubscription of GPU memory by temporarily swapping tensors to host memory when they are not needed. One or more elements of a deep learning model can lead to GPU memory exhaustion.
Requires the use of IBM WML-CE (Available here: https://www.ibm.com/support/knowledgecenter/en/SS5SF7_1.6.1/welcome/welcome.html)
Further Reading on PyTorch with Large Model Support: https://www.ibm.com/support/knowledgecenter/en/SS5SF7_1.6.1/navigation/wmlce_getstarted_pytorch.html
Create black and white training images
Only runs if the directory isn't already created.
Pre-train generator
NOTE
Most of the training takes place here in pretraining for NoGAN. The goal here is to take the generator as far as possible with conventional training, as that is much easier to control and obtain glitch-free results compared to GAN training.
64px
128px
192px
256px
Repeatable GAN Cycle
NOTE
Best results so far have been based on repeating the cycle below a few times (about 5-8?), until diminishing returns are hit (no improvement in image quality). Each time you repeat the cycle, you want to increment that old_checkpoint_num by 1 so that new check points don't overwrite the old.
Save Generated Images
Pretrain Critic
Only need full pretraining of critic when starting from scratch. Otherwise, just finetune!
GAN
Instructions:
Find the checkpoint just before where glitches start to be introduced. This is all very new so you may need to play around with just how far you go here with keep_pct.