How can I use dump stories from script

Hi, I want to use the dump stories flags from a script. I am currently calling train method from rasa:

from rasa import train

train(
            domain=os.path.join(TRAINING_DATA_DIR, DOMAIN_FILE),
            config=self.pipeline,
            output=os.path.join(MODEL_PATH, self.project_name, self.model_name),
            training_files=TRAINING_NLU_DATA_DIR,
        )

As I dig into rasa code I find that in _train_core_with_validated_data you call to rasa.core.train like this:

await rasa.core.train(
            domain_file=domain,
            training_resource=file_importer,
            output_path=os.path.join(_train_path, "core"),
            policy_config=config,
            kwargs=kwargs,
        )

And is this method the one that should receive dump stories as an argument following this definition on core\train.py:

async def train(
    domain_file: Union[Domain, Text],
    training_resource: Union[Text, "TrainingDataImporter"],
    output_path: Text,
    interpreter: Optional["NaturalLanguageInterpreter"] = None,
    endpoints: "AvailableEndpoints" = None,
    dump_stories: bool = False,
    policy_config: Optional[Union[Text, Dict]] = None,
    exclusion_percentage: int = None,
    kwargs: Optional[Dict] = None,
)

I don’t know why is separated from the kwargs. Any help on this?

Thank you

Cheers

I’m not sure I’m understanding you correctly, but if you want to pass dump_stories to rasa.train you will have to pass kwargs={"dump_stories": True} as kwargs is simply a keyword argument here, not the usual variable capturing additional keyword arguments.

Did that answer your question?

PS: We realize this is a somewhat confusing name and will change it in the future.

Nope, I tried that, the thing is that if you llok at the definition of the methods, kwargs is passed to rasa.core.train but that train method has dump_stories as an argument and kwargs, so it never extract dump stories from kwargs.I don’t know if I am being clear on this point. It is like dump stories is never passed to train, and evn tough it was passed in kwargs, at the end, rasa.core.train won’t use it cause it is an individual parameter.

You are completely right. To your original question: I don’t think there is a reason for this; it’s just a bug :frowning_face:. I created an issue about this on github here. If you already have a fix please add it to rasa on github, or if you have any more comments add them to the issue.