Fasttext: Print out the best parameters from autotune

Created on 27 Aug 2019  路  3Comments  路  Source: facebookresearch/fastText

Hey, thank you for the new autotune feature. I was just wondering if there is a way to print out the best parameters (maybe I missed that in the docs) or to print out the whole process to track the fine-tuning that is being done.
Thanks in advance.

Most helpful comment

Hi @AhmedIdr ,
Thank you for your feedback. We will complete the docs.

You can display the parameters autotune is exploring with -verbose 3.

However, for the moment there is not a straightforward way to display the best parameters found during autotuning. A workaround for the moment could be to use dump command (./fasttext dump model_cooking.bin args) once the training has finished.

Regards,
Onur

All 3 comments

Hi @AhmedIdr ,
Thank you for your feedback. We will complete the docs.

You can display the parameters autotune is exploring with -verbose 3.

However, for the moment there is not a straightforward way to display the best parameters found during autotuning. A workaround for the moment could be to use dump command (./fasttext dump model_cooking.bin args) once the training has finished.

Regards,
Onur

Hey @Celebio,
Thank you for your quick answer.

Regards,
Ahmed

Just to update for those using Python. You can use fasttext_model_object.f.getArgs(). This returns a Python object. And all the hyperparameters are attributes of this object. Below is a short example:

ft_model = fasttext.train_supervised('train.csv')

args_obj = ft_model.f.getArgs()
for hparam in dir(args_obj):
    if not hparam.startswith('__'):
        print(f"{hparam} -> {getattr(args_obj, hparam)}")
Was this page helpful?
0 / 5 - 0 ratings