Skip to content

Commit

Permalink
Fix model dir
Browse files Browse the repository at this point in the history
Fixes #10101
  • Loading branch information
Tayfun Sen committed Nov 10, 2021
1 parent 9c2cbbd commit 71006a3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 33 deletions.
4 changes: 2 additions & 2 deletions rasa/cli/scaffold.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
from rasa import telemetry
from rasa.cli import SubParsersAction
from rasa.cli.shell import shell
from rasa.cli.utils import create_output_path
from rasa.shared.utils.cli import print_success, print_error_and_exit
from rasa.shared.constants import (
DOCS_BASE_URL,
DEFAULT_CONFIG_PATH,
DEFAULT_DOMAIN_PATH,
DEFAULT_DATA_PATH,
DEFAULT_MODELS_PATH,
)


Expand Down Expand Up @@ -65,7 +65,7 @@ def print_train_or_instructions(args: argparse.Namespace) -> None:
DEFAULT_DOMAIN_PATH,
DEFAULT_CONFIG_PATH,
DEFAULT_DATA_PATH,
create_output_path(),
DEFAULT_MODELS_PATH,
)
args.model = training_result.model

Expand Down
31 changes: 0 additions & 31 deletions rasa/cli/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,39 +106,8 @@ def parse_last_positional_argument_as_model_path() -> None:
sys.argv[-2] = "--model"


def create_output_path(
output_path: Text = DEFAULT_MODELS_PATH,
prefix: Text = "",
fixed_name: Optional[Text] = None,
) -> Text:
"""Creates an output path which includes the current timestamp.
Args:
output_path: The path where the model should be stored.
fixed_name: Name of the model.
prefix: A prefix which should be included in the output path.
Returns:
The generated output path, e.g. "20191201-103002.tar.gz".
"""
import time

if output_path.endswith("tar.gz"):
return output_path
else:
if fixed_name:
name = fixed_name
else:
time_format = "%Y%m%d-%H%M%S"
name = time.strftime(time_format)
name = f"{prefix}{name}"
file_name = f"{name}.tar.gz"
return os.path.join(output_path, file_name)


def button_to_string(button: Dict[Text, Any], idx: int = 0) -> Text:
"""Create a string representation of a button."""

title = button.pop("title", "")

if "payload" in button:
Expand Down

0 comments on commit 71006a3

Please sign in to comment.