Improving Text Generation

I am trying to generate text based on a fine-tuned language model but the result are not that great. I realize that learn.predict may not be setup to give optimal results for this use case. How can I tweak it for text generation? I think one way would be to implement beam search but not sure if there is a straightforward way to do this.

1 Like

Beam search seems to be a good way to get much better result. You can find a good video by Andrew ng explaining beam search: https://www.youtube.com/watch?v=RLWuzLLSIgw
I am not aware of better ways but would be very interested if you find some.

3 Likes

Thanks! Have you seen any code to implement this in fastai and/or pytorch?

fastai v1.0.43 will have it (it’s currently in master).

2 Likes

how can we use it, I also want to create a text generator. Thanks

Hi,
Any available simple example of beam search to start with?

(just “using it” and playing with different values for top_k, beam_sz and temperature generates poor and repetitive output)

Thanks!

2 Likes