Questions on wgan.ipynb from Lesson 12

Hi all,

My output images are not quite right when I run wgan.ipynb from Lesson 12.

I have download the 20% sample and unzipped it under fastai/courses/dl2/ so that i have data/lsun/bedroom below dl2.

I run all the code, no error messages. The output of the first train(1, False) line is:
Loss_D [-1.53975]; Loss_G [0.77398]; D_real [-0.76954]; Loss_D_fake [0.77021]

and the second train(1, False) is:
Loss_D [-1.53432]; Loss_G [0.76891]; D_real [-0.77165]; Loss_D_fake [0.76267]

Both run in about 6 seconds. I thought that code took time to train. Do I have to run them multiple times ? If so, how many times ? And both train(1, False) ?

But my output images look like this:

Some progress, but some questions below.

After a few runs, i managed to get to that output, which starts to look like bedrooms:

I can continue to train my model, but I want to be sure that I’m running the right code in the right sequence at each loop.

So in dl2/wgan.ipynb, in the last cells, we see:

train(1, False)


fixed_noise = create_noise(bs)


set_trainable(netD, True)
set_trainable(netG, True)
optimizerD = optim.RMSprop(netD.parameters(), lr = 1e-5)
optimizerG = optim.RMSprop(netG.parameters(), lr = 1e-5)


train(1, False)


netD.eval(); netG.eval();
fake = netG(fixed_noise).data.cpu()
faked = np.clip(md.trn_ds.denorm(fake),0,1)
plt.imshow(gallery(faked, 8));

then, TMP_PATH/'netG_2.h5'), TMP_PATH/'netD_2.h5')

Is this correct that I need to run these cells in sequence, many times until i reach a good enough output ?
Can I change the 2

train(1, False)


train(20, False)

for example ? to avoid attending the code too often while it runs ? Or each train cell needs to run only once and in sequence ?
It’s not very clear from the video as Jeremy is not running the code.