Search code examples
pythongensimfasttext

fasttext error TypeError: supervised() got an unexpected keyword argument 'pretrainedVectors'


I am trying to add pretrained vectors to a training model using fasttext and getting the below error. Code is written in python with fasttext 0.8.3.

I thought with fasttext you could add pre trained vectors to a supervised training model?

TypeError: supervised() got an unexpected keyword argument 'pretrainedVectors'

pretrainedVectors = 'vectorFile.vec'
classifier = ft.supervised(model_data, model_name, pretrainedVectors=pretrainedVectors, label_prefix=label_prefix, lr=lr, epoch=epoch, minn=minn, maxn=maxn, dim=dim, bucket=bucket)

Solution

  • According to the documentation, the named parameter to the function is called pretrained_vectors not pretrainedVectors.

    This naming convention is in line with PEP-8 style and so is normal for a Python API.