I am trying to predict the sentiment of a sentence by using learn.predict(message). But I am getting the following error -
-
result_test = learn.predict(message)
File “/usr/local/lib/python3.7/site-packages/fastai/basic_train.py” in predict
382. y = ds.y.reconstruct(pred, x) if has_arg(ds.y.reconstruct, ‘x’) else ds.y.reconstruct(pred)
File “/usr/local/lib/python3.7/site-packages/fastai/text/data.py” in reconstruct
341. return Text(t[idx_min:idx_max+1], self.vocab.textify(t[idx_min:idx_max+1]))
File “/usr/local/lib/python3.7/site-packages/fastai/text/transform.py” in textify
134. return sep.join([self.itos[i] for i in nums]) if sep is not None else [self.itos[i] for i in nums]
File “/usr/local/lib/python3.7/site-packages/fastai/text/transform.py” in
134. return sep.join([self.itos[i] for i in nums]) if sep is not None else [self.itos[i] for i in nums]
Exception Type: TypeError at /test_sent/
Exception Value: only integer tensors of a single element can be converted to an index
Can someone please help me with this?