rasa/core/agent.py
def load(cls,
             path: Text,
             interpreter: Optional[NaturalLanguageInterpreter] = None,
             generator: Union[EndpointConfig, 'NLG'] = None,
             tracker_store: Optional['TrackerStore'] = None,
             action_endpoint: Optional[EndpointConfig] = None
             ) -> 'Agent':
        """Load a persisted model from the passed path."""

        if not path:
            raise ValueError("You need to provide a valid directory where "
                             "to load the agent from when calling "
                             "`Agent.load`.")

        if os.path.isfile(path):
            raise ValueError("You are trying to load a MODEL from a file "
                             "('{}'), which is not possible. \n"
                             "The persisted path should be a directory "
                             "containing the various model files. \n\n"
                             "If you want to load training data instead of "
                             "a model, use `agent.load_data(...)` "
                             "instead.".format(path))

        domain = Domain.load(os.path.join(path, "domain.yml"))
        ensemble = PolicyEnsemble.load(path) if path else None

        # ensures the domain hasn't changed between test and train
        domain.compare_with_specification(path)

        return cls(domain=domain,
                   policies=ensemble,
                   interpreter=interpreter,
                   generator=generator,
                   tracker_store=tracker_store,
                   action_endpoint=action_endpoint)
Load a persisted model from the passed path.
Load a persisted model from the passed path.
Load a persisted model from the passed path .
def load(cls,
             path: Text,
             interpreter: Optional[NaturalLanguageInterpreter] = None,
             generator: Union[EndpointConfig, 'NLG'] = None,
             tracker_store: Optional['TrackerStore'] = None,
             action_endpoint: Optional[EndpointConfig] = None
             ) -> 'Agent':
        if not path:
            raise ValueError("You need to provide a valid directory where "
                             "to load the agent from when calling "
                             "`Agent.load`.")
        if os.path.isfile(path):
            raise ValueError("You are trying to load a MODEL from a file "
                             "('{}'), which is not possible. \n"
                             "The persisted path should be a directory "
                             "containing the various model files. \n\n"
                             "If you want to load training data instead of "
                             "a model, use `agent.load_data(...)` "
                             "instead.".format(path))
        domain = Domain.load(os.path.join(path, "domain.yml"))
        ensemble = PolicyEnsemble.load(path) if path else None
        domain.compare_with_specification(path)
        return cls(domain=domain,
                   policies=ensemble,
                   interpreter=interpreter,
                   generator=generator,
                   tracker_store=tracker_store,
                   action_endpoint=action_endpoint)
def load ( cls , path : Text , interpreter : Optional [ NaturalLanguageInterpreter ] = None , generator : Union [ EndpointConfig , 'NLG' ] = None , tracker_store : Optional [ 'TrackerStore' ] = None , action_endpoint : Optional [ EndpointConfig ] = None ) -> 'Agent' : if not path : raise ValueError ( "You need to provide a valid directory where " "to load the agent from when calling " "`Agent.load`." ) if os . path . isfile ( path ) : raise ValueError ( "You are trying to load a MODEL from a file " "('{}'), which is not possible. \n" "The persisted path should be a directory " "containing the various model files. \n\n" "If you want to load training data instead of " "a model, use `agent.load_data(...)` " "instead." . format ( path ) ) domain = Domain . load ( os . path . join ( path , "domain.yml" ) ) ensemble = PolicyEnsemble . load ( path ) if path else None domain . compare_with_specification ( path ) return cls ( domain = domain , policies = ensemble , interpreter = interpreter , generator = generator , tracker_store = tracker_store , action_endpoint = action_endpoint )
Load a persisted model from the passed path.
Load a persisted model from the passed path .
"""Load a persisted model from the passed path.""" # ensures the domain hasn't changed between test and train
cls
path
Text
interpreter
Optional[NaturalLanguageInterpreter]
generator
Union[EndpointConfig, 'NLG']
tracker_store
Optional['TrackerStore']
action_endpoint
Optional[EndpointConfig]