Bug in predict for language_model_learner?

I trained a simple language model for musical chords (that’s why the sequences look weird :slight_smile: )

This is the simple code I’m running (df is a pandas with the input documents, my_vocabulary is the vocabulary that I pre-calculated):

dls = TextDataLoaders.from_df(df, 

learn = language_model_learner(dls, AWD_LSTM, metrics=[accuracy, Perplexity(), top_k_accuracy])

learn.fine_tune(50, freeze_epochs=2)

Then when I try to run it like this:

learn.predict('a|m e|m a|m e|m a|m g| em| a|m', n_words=1, no_unk=False)

I get this output:

'c| a|m e|m a|m e|m a|m g| c| a|m e|m'

which adds a character at the beginning as well as at the end. Why? Is this a bug or am I missing something?

1 Like