Skip to content

Commit

Permalink
Merge branch 'master' into temp-files-train
Browse files Browse the repository at this point in the history
  • Loading branch information
federicotdn committed Jul 5, 2019
2 parents dcf57d7 + 8bc5f65 commit bdccf3c
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 19 deletions.
12 changes: 6 additions & 6 deletions docs/user-guide/running-the-server.rst
Expand Up @@ -29,12 +29,12 @@ The different parameters are:

Rasa can load your model in three different ways:

1. Load the model specified via ``-m`` from your local storage system,
2. Fetch the model from a server (see :ref:`server_fetch_from_server`), or
3. Fetch the model from a remote storage (see :ref:`cloud-storage`).
1. Fetch the model from a server (see :ref:`server_fetch_from_server`), or
2. Fetch the model from a remote storage (see :ref:`cloud-storage`).
3. Load the model specified via ``-m`` from your local storage system,

Rasa tries to load a model in the above mentioned order, i.e. it only tries to load your model from a server
if it could not find the model on your local storage system.
Rasa tries to load a model in the above mentioned order, i.e. it only tries to load your model from your local
storage system if no model server and no remote storage were configured.

.. warning::

Expand Down Expand Up @@ -66,7 +66,7 @@ You can configure the HTTP server to fetch models from another URL:

.. code-block:: bash
rasa run -m models --enable-api --log-file out.log --endpoints my_endpoints.yml
rasa run --enable-api --log-file out.log --endpoints my_endpoints.yml
The model server is specified in the endpoint configuration
(``my_endpoints.yml``), where you specify the server URL Rasa
Expand Down
3 changes: 2 additions & 1 deletion rasa/cli/run.py
Expand Up @@ -89,7 +89,8 @@ def run(args: argparse.Namespace):
except ModelNotFound:
print_error(
"No model found. Train a model before running the "
"server using `rasa train`."
"server using `rasa train` and use '--model' to provide "
"the model path."
)
return

Expand Down
24 changes: 12 additions & 12 deletions rasa/core/agent.py
Expand Up @@ -227,18 +227,7 @@ async def load_agent(
action_endpoint: Optional[EndpointConfig] = None,
):
try:
if model_path is not None and os.path.exists(model_path):
return Agent.load_local_model(
model_path,
interpreter=interpreter,
generator=generator,
tracker_store=tracker_store,
action_endpoint=action_endpoint,
model_server=model_server,
remote_storage=remote_storage,
)

elif model_server is not None:
if model_server is not None:
return await load_from_server(
Agent(
interpreter=interpreter,
Expand All @@ -262,6 +251,17 @@ async def load_agent(
model_server=model_server,
)

elif model_path is not None and os.path.exists(model_path):
return Agent.load_local_model(
model_path,
interpreter=interpreter,
generator=generator,
tracker_store=tracker_store,
action_endpoint=action_endpoint,
model_server=model_server,
remote_storage=remote_storage,
)

else:
logger.warning("No valid configuration given to load agent.")
return None
Expand Down

0 comments on commit bdccf3c

Please sign in to comment.