Closed PhaneendraGunda closed 2 years ago
Hi @PhaneendraGunda you've already found the source of the error. FARM currently only supports loading from a local directory if the stored model is in FARM format. That would work for you if you load a model from the model hub and then finetune it with FARM. However, it currently does not work out-of-the-box if you finetune the model with transformers outside of FARM.
I think renaming the file path to config_file = Path(pretrained_model_name_or_path) / "config.json"
in the following line of code will not solve the problem: https://github.com/deepset-ai/FARM/blob/004ed2c6dbd9d7a2af85d57ec89a689b9363e6c1/farm/modeling/language_model.py#L138
The reason is that FARM format is slightly different than the format used on the model hub. For example, FARM uses a field called name
and accesses it here: https://github.com/deepset-ai/FARM/blob/004ed2c6dbd9d7a2af85d57ec89a689b9363e6c1/farm/modeling/language_model.py#L143
If you are interested, you're very much welcome to change the code to allow loading a local model that is not in FARM format. Could you imagine making a contribution here?
Make sense. I would love to update the code to load fine-tuned Transformers model from the local path. Let me explore FARM library further as I am new to this. Anyway we can discuss further in Haystack Slack channel if you there. Thank you for your time.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 21 days if no further activity occurs.
Describe the bug FARM conversion module Converter.convert_from_transformers is failed to load the fine-tuned Transformer model from local storage. Language Model from the FARM is looking for language_model_config.json which is not available in fine-tuned HuggingFace Transformer model.
Error message 08/27/2021 17:27:58 - INFO - farm.modeling.language_model - LOADING MODEL 08/27/2021 17:27:58 - INFO - farm.modeling.language_model - ============= 08/27/2021 17:28:08 - INFO - farm.modeling.language_model - Could not find ../models/fquad/checkpoint-19500 locally. 08/27/2021 17:28:09 - INFO - farm.modeling.language_model - Looking on Transformers Model Hub (in local cache and online)...
Find the snippet of the Language Model Load() from FARM
Expected code
System: