Skip to content

Commit

Permalink
allow rasa to run without interruption when model is outdated
Browse files Browse the repository at this point in the history
  • Loading branch information
Philippe Cote-Boucher committed Jul 24, 2020
1 parent 84d4a89 commit 5faa4bb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
7 changes: 6 additions & 1 deletion rasa/core/interpreter.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,12 @@ def create(
if isinstance(obj, NaturalLanguageInterpreter):
return obj
elif isinstance(obj, str) and os.path.exists(obj):
return RasaNLUInterpreter(model_directory=obj)
from rasa.nlu.model import UnsupportedModelError
try:
return RasaNLUInterpreter(model_directory=obj)
except UnsupportedModelError as e:
logger.warning(e.message)
return RegexInterpreter()
elif isinstance(obj, str) and not os.path.exists(obj):
# user passed in a string, but file does not exist
logger.warning(
Expand Down
8 changes: 6 additions & 2 deletions rasa/core/policies/ensemble.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,11 +318,15 @@ def _ensure_loaded_policy(cls, policy, policy_cls, policy_name: Text):
)

@classmethod
def load(cls, path: Text) -> "PolicyEnsemble":
def load(cls, path: Text) -> Optional["PolicyEnsemble"]:
"""Loads policy and domain specification from storage"""

metadata = cls.load_metadata(path)
cls.ensure_model_compatibility(metadata)
try:
cls.ensure_model_compatibility(metadata)
except UnsupportedDialogueModelError as e:
logger.warning(e.message)
return None
policies = []
for i, policy_name in enumerate(metadata["policy_names"]):
policy_cls = registry.policy_from_module_path(policy_name)
Expand Down

0 comments on commit 5faa4bb

Please sign in to comment.