Not able to run the Fallback Model in new version

I am new to Rasa-core and currently trying to train my model with fallback policy First i tried with python -m rasa_core.train -d domain.yml -s data/stories.md -o models/current/dialogue --nlu_threshold 0.1 --core_threshold 0.1 --fallback_action action_default_fallback -c policies.yml But it didn’t worked as we need to insert Fallback policy in ensemble of policies, then as suggested in

and Implementing Default Fallback Actions I created a train.py script to train it and save the model.

training_data_file = 'data/stories.md'
model_path = 'models/dialogue'
fallback = FallbackPolicy(fallback_action_name="action_default_fallback",
                      core_threshold=0.3,
                      nlu_threshold=0.3)
agent = Agent("domain.yml",
              policies=[MemoizationPolicy(max_history=5), KerasPolicy(), fallback])

data = agent.load_data(training_data_file)
agent.train(
        data,
        augmentation_factor=50,
        epochs=500,
        batch_size=10,
        validation_split=0.2
)

agent.persist(model_path)

But now i cannot run the model using python -m rasa_core.run --enable_api --auth_token thisismysecret -o models/dialogue -d models/dialogue -u models/current/nlu --endpoints endpoints.yml

As it is giving return open(self.baseFilename, self.mode, encoding=self.encoding) PermissionError: [Errno 13] Permission denied: ‘C:\user\…\Mentor-Chatbot\models\dialogue’

I tried to give the folder all read write permission but it didn’t worked. Can anyone help me , how i can run this.

@akelad Can you please help

I have the similar problem. When I tried with

python -m rasa_core.train -d domain.yml -s data/stories.md -o models/current/dialogue --nlu_threshold 0.1 --core_threshold 0.1 --fallback_action action_default_fallback

I got error: unrecognized arguments: --nlu_threshold 0.3 --core_threshold 0.3 --fallback_action action_default_fallback.

So, what’s wrong? Any suggestions please!

@akelad

I have the same issue, it looks like it’s not possible to set thresholds through command line. Can someone confirm ?

i am not sure for the command but if it helps you can run through script -

from rasa_core.policies import FallbackPolicy, KerasPolicy, MemoizationPolicy from rasa_core.agent import Agent

this will catch predictions the model isn’t very certain about

there is a threshold for the NLU predictions as well as the action predictions

fallback = FallbackPolicy(fallback_action_name=“action_fallback”, core_threshold=0.2, nlu_threshold=0.3)

agent = Agent(‘domain_dialogue.yml’, policies=[MemoizationPolicy(), KerasPolicy(), fallback])

loading our neatly defined training dialogues

training_data = agent.load_data(‘stories/stories_nextthink_dialogue.md’)

agent.train( training_data, validation_split=0.0 )

agent.persist(‘models/dialogue’)

Hi all, so you no longer pass training arguments as flags or in the train function, but in the policy config file. Please take a look at the docs Training and Policies

1 Like