09.05.2023 Views

pdfcoffee

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Recurrent Neural Networks

# callbacks=[checkpoint_callback, tensorboard_callback]

)

checkpoint_file = os.path.join(

CHECKPOINT_DIR, "model_epoch_{:d}".format(i+1))

model.save_weights(checkpoint_file)

# create generative model using the trained model so far

gen_model = CharGenModel(vocab_size, seq_length, embedding_dim,

rnn_output_dim)

gen_model.load_weights(checkpoint_file)

gen_model.build(input_shape=(1, seq_length))

print("after epoch: {:d}".format(i+1)*10)

print(generate_text(gen_model, "Alice ", char2idx, idx2char))

print("---")

The output after the very first epoch of training contains words that are completely

undecipherable:

Alice nIPJtce otaishein r. henipt il nn tu t hen mlPde hc efa

hdtioDDeteeybeaewI teu"t e9B ce nd ageiw eai rdoCr ohrSI ey

Pmtte:vh ndte taudhor0-gu s5'ria,tr gn inoo luwomg Omke dee sdoohdn

ggtdhiAoyaphotd t- kta e c t- taLurtn hiisd tl'lpei od y' tpacoe dnlhr

oG mGhod ut hlhoy .i, sseodli., ekngnhe idlue'aa' ndti-rla nt d'eiAier

adwe ai'otteniAidee hy-ouasq"plhgs tuutandhptiw oohe.Rastnint:e,o

odwsir"omGoeuall1*g taetphhitoge ds wr li,raa, h$jeuorsu h cidmdg't

ku..n,HnbMAsn nsaathaa,' ase woe ehf re ig"hTr ddloese eod,aed toe rh k.

nalf bte seyr udG n,ug lei hn icuimty"onw Qee ivtsae zdrye g eut rthrer n

sd,Zhqehd' sr caseruhel are fd yse e kgeiiday odW-ldmkhNw endeM[harlhroa

h Wydrygslsh EnilDnt e "lue "en wHeslhglidrth"ylds rln n iiato taue flitl

nnyg ittlno re 'el yOkao itswnadoli'.dnd Akib-ehn hftwinh yd ee tosetf

tonne.;egren t wf, ota nfsr, t&he desnre e" oo fnrvnse aid na tesd is

ioneetIf ·itrn tttpakihc s nih'bheY ilenf yoh etdrwdplloU ooaeedo,,dre

snno'ofh o epst. lahehrw

However, after about 30 epochs of training, we begin to see words that look familiar:

Alice Red Queen. He best I had defores it,' glily do flose time it makes

the talking of find a hand mansed in she loweven to the rund not bright

prough: the and she a chill be the sand using that whever sullusn--the

dear of asker as 'IS now-- Chich the hood." "Oh!"' '_I'm num about-

-again was wele after a WAG LoANDE BITTER OF HSE!0 UUL EXMENN 1*.t,

this wouldn't teese to Dumark THEVER Project Gutenberg-tmy of himid

out flowal woulld: 'Nis song, Eftrin in pully be besoniokinote. "Com,

contimemustion--of could you knowfum to hard, she can't the with talking

to alfoeys distrint, for spacemark!' 'You gake to be would prescladleding

readieve other togrore what it mughturied ford of it was sen!" You squs,

_It I hap: But it was minute to the Kind she notion and teem what?" said

[ 298 ]

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!