Open murali1996 opened 3 years ago
@vijay120
Could we do something analogous to this:
GoogleTranslator._check_credential_exists()
try:
translate_v2 = importlib.import_module("google.cloud.translate_v2")
return translate_v2.Client()
except ModuleNotFoundError as error:
raise ModuleNotFoundError(
"Library not found: 'google-cloud'. Run 'pip install mindmeld[language_annotator]'"
" to install."
) from error
Yeah. I'll add a solution like you suggested in the create_embedder_model
method in componenets/helpers.py by caching the ImportError from the embedder_models.py classes. Will reflect this modification in PR #341
When a user tries to create a QuestionAnswerer without installing the extra [bert], the error message raised is
ValueError: Invalid model configuration: Unknown embedder type 'bert'
. This message is misleading as the user's input config might be correct but the bert requirements are not installed. Following is the example snippet that produces the error even when inputs are correct but the requirements are not satisfied:Possible solution(s):
EMBEDDER_MAP
in helpers.py file. Check for those installs increate_embedder_model
method.create_embedder_model
but going forward, use something likeEmbedderModelFactory.create_model(config=...)