fasttext says cannot be opened for training

Viewed 1376

this is the code.where i want to train my unsupervised data.which is xlsx format.sentence column contains raw string data.

d1 = pd.read_excel('/content/drive/dataset.xlsx')
X=df1['sentence']
import fasttext
model=fasttext.train_unsupervised('X',model='skipgram')

---------------------------------------------------------------------------

ValueError                                Traceback (most recent call last)

<ipython-input-27-0590db630257> in <module>()
      1 import fasttext
----> 2 model=fasttext.train_unsupervised('X',model='skipgram')

/usr/local/lib/python3.6/dist-packages/fasttext/FastText.py in train_unsupervised(*kargs, **kwargs)
    557     a = _build_args(args, manually_set_args)
    558     ft = _FastText(args=a)
--> 559     fasttext.train(ft.f, a)
    560     ft.set_args(ft.f.getArgs())
    561     return ft

ValueError: X cannot be opened for training!
1 Answers

The problem here is that the train methods from fasttext expect a training file, and you are sending a string instead of a file path. Check the small documentation and the example for more details on that.

Related