Skip to Content
Python Deep Learning - Second Edition
book

Python Deep Learning - Second Edition

by Ivan Vasilev, Daniel Slater, Gianmario Spacagna, Peter Roelants, Valentino Zocca
January 2019
Intermediate to advanced
386 pages
11h 13m
English
Packt Publishing
Content preview from Python Deep Learning - Second Edition

Sampling

Once the model has been trained, we can generate new text by sampling the sequences. We can initialize our sampling architecture with the same code we used to train the model, but we'll need to set batch_size to 1 and sequence_length to None. In this way, we can generate a single string and sample sequences of different lengths. Then, we can initialize the parameters of the model with the parameters that were saved after the training. To start with the sampling, we'll feed the model an initial string (prime_string) to prime the state of the network. After that, we can sample the next character based on the output distribution of the softmax. Then, we can feed the newly sampled character as a new network input and get the output distribution ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Python Deep Learning

Python Deep Learning

Valentino Zocca, Gianmario Spacagna, Daniel Slater, Peter Roelants

Publisher Resources

ISBN: 9781789348460Supplemental Content