rasa/core/agent.py
def _load_and_set_updated_model(agent: 'Agent',
                                model_directory: Text,
                                fingerprint: Text):
    """Load the persisted model into memory and set the model on the agent."""

    logger.debug("Found new model with fingerprint {}. Loading..."
                 "".format(fingerprint))

    stack_model_directory = _get_stack_model_directory(model_directory)
    if stack_model_directory:
        from rasa.core.interpreter import RasaNLUInterpreter
        nlu_model = os.path.join(stack_model_directory, "nlu")
        core_model = os.path.join(stack_model_directory, "core")
        interpreter = RasaNLUInterpreter(model_directory=nlu_model)
    else:
        interpreter = agent.interpreter
        core_model = model_directory

    domain_path = os.path.join(os.path.abspath(core_model), "domain.yml")
    domain = Domain.load(domain_path)

    # noinspection PyBroadException
    try:
        policy_ensemble = PolicyEnsemble.load(core_model)
        agent.update_model(domain, policy_ensemble, fingerprint, interpreter)
        logger.debug("Finished updating agent to new model.")
    except Exception:
        logger.exception("Failed to load policy and update agent. "
                         "The previous model will stay loaded instead.")
Load the persisted model into memory and set the model on the agent.
Load the persisted model into memory and set the model on the agent.
Load the persisted model into memory and set the model on the agent .
def _load_and_set_updated_model(agent: 'Agent',
                                model_directory: Text,
                                fingerprint: Text):
    logger.debug("Found new model with fingerprint {}. Loading..."
                 "".format(fingerprint))
    stack_model_directory = _get_stack_model_directory(model_directory)
    if stack_model_directory:
        from rasa.core.interpreter import RasaNLUInterpreter
        nlu_model = os.path.join(stack_model_directory, "nlu")
        core_model = os.path.join(stack_model_directory, "core")
        interpreter = RasaNLUInterpreter(model_directory=nlu_model)
    else:
        interpreter = agent.interpreter
        core_model = model_directory
    domain_path = os.path.join(os.path.abspath(core_model), "domain.yml")
    domain = Domain.load(domain_path)
    try:
        policy_ensemble = PolicyEnsemble.load(core_model)
        agent.update_model(domain, policy_ensemble, fingerprint, interpreter)
        logger.debug("Finished updating agent to new model.")
    except Exception:
        logger.exception("Failed to load policy and update agent. "
                         "The previous model will stay loaded instead.")
def _load_and_set_updated_model ( agent : 'Agent' , model_directory : Text , fingerprint : Text ) : logger . debug ( "Found new model with fingerprint {}. Loading..." "" . format ( fingerprint ) ) stack_model_directory = _get_stack_model_directory ( model_directory ) if stack_model_directory : from rasa . core . interpreter import RasaNLUInterpreter nlu_model = os . path . join ( stack_model_directory , "nlu" ) core_model = os . path . join ( stack_model_directory , "core" ) interpreter = RasaNLUInterpreter ( model_directory = nlu_model ) else : interpreter = agent . interpreter core_model = model_directory domain_path = os . path . join ( os . path . abspath ( core_model ) , "domain.yml" ) domain = Domain . load ( domain_path ) try : policy_ensemble = PolicyEnsemble . load ( core_model ) agent . update_model ( domain , policy_ensemble , fingerprint , interpreter ) logger . debug ( "Finished updating agent to new model." ) except Exception : logger . exception ( "Failed to load policy and update agent. " "The previous model will stay loaded instead." )
Load the persisted model into memory and set the model on the agent.
Load the persisted model into memory and set the model on the agent .
"""Load the persisted model into memory and set the model on the agent.""" # noinspection PyBroadException
agent
'Agent'
model_directory
Text
fingerprint
Text