Building a chatbot from scratch

from fastai.text.all import *

path = Path('./chat.csv')

df = pd.read_csv(path)

dls = TextDataLoaders.from_df(df, text_col='question', label_col='answer')

dls.show_batch()

||text|category|
|---|---|---|
|0|xxbos xxmaj the xxmaj xxunk xxmaj xxunk , the xxunk xxunk the xxmaj xxunk xxmaj xxunk is a xxunk of the xxunk xxunk of what xxunk ?|Europe|
|1|xxbos xxmaj the xxmaj xxunk xxmaj xxunk xxmaj xxunk , xxunk xxunk xxunk xxmaj xxunk xxunk in xxunk , is xxunk xxunk what xxmaj american xxunk ?|Edwin Hubble|
|2|xxbos a xxunk xxunk , in which the xxunk of xxunk xxunk is xxunk xxunk xxunk xxunk xxunk of the xxunk , is xxunk what ?|A gyroscope.|
|3|xxbos xxmaj what is the name of the xxunk xxunk xxunk to the xxmaj xxunk xxmaj xxunk ?|The Andromeda Galaxy.|


learn = text_classifier_learner(dls, AWD_LSTM, drop_mult=0.5, metrics=accuracy)

learn.fit_one_cycle(1, 2e-2)

Gives Error

--------------------------------------------------------------------------- KeyError Traceback (most recent call last) File /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/fastai/data/transforms.py:261, in Categorize.encodes(self, o) 260 try: → 261 return TensorCategory(self.vocab.o2i[o]) 262 except KeyError as e: KeyError: ‘The United Kingdom of Great Britain’ The above exception was the direct cause of the following exception:*