deepset-ai / FARM

:house_with_garden: Fast & easy transfer learning for NLP. Harvesting language models for the industry. Focus on Question Answering.
https://farm.deepset.ai
Apache License 2.0
1.73k stars 247 forks source link

AdaptiveModel.convert_to_onnx does not save float16 model conversion to output_path #845

Closed cjb06776 closed 2 years ago

cjb06776 commented 2 years ago

I think there is a small bug with AdaptiveModel.convert_to_onnx when enabling float16 conversion:

https://github.com/deepset-ai/FARM/blob/7305a17979b0a80dbe2dbebe5815450883f20627/farm/modeling/adaptive_model.py#L614-L624

The resulting model file ends up in the current working directory instead of output_path/model.onnx.

Should be something like:

            optimized_model.save_model_to_file(str(output_path/"model.onnx"))
Timoeller commented 2 years ago

Good catch, do you want to create a PR for it?