question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Exception: Passing policy configuration parameters to `agent.train(...)` is not supported anymore.

See original GitHub issue

Rasa version: 13.3

Python version: 3.6

Operating system (windows, osx, …): Windows 10

Issue: I am keep getting this issue i don’t understand how to configure it manually just like it asks me to, I have tried to configure the rasa policy to resolve this but no effect so far, please help

Content of configuration file (config.yml):

 language: "en"

 pipeline:
 - name: "nlp_spacy"
   model: "en"
 - name: "tokenizer_spacy"
 - name: "ner_crf"
 - name: "intent_featurizer_spacy"
 - name: "intent_classifier_sklearn"

Content of domain file (domain.yml) (if used & relevant):

intents:
    - schedule_meeting
    - search_for_meeting
    - greet

entities:
    - meeting
    - time

slots:
    size:
         type: text
    toppings:
        type: text

templates:
    utter_greet:
        - 'Hello, how can I help you?'
        - 'Hi, I am here to help.'
    utter_ask_meeting_day:
        - 'What time would you like me to schedule your meeting?'
    utter_ask_meeting_time:
        - 'What time would you like me to schedule your meeting?'
    utter_get_meeting_time_place:
        - 'here are your meetings for today'
actions:
    - utter_greet
    - utter_ask_meeting_time
    - utter_ask_meeting_day
    - utter_get_meeting_time_place
    - actions.ActionShowMeeting
policies:
  - name: KerasPolicy
    epochs: 100
    max_history: 5
  - name: FallbackPolicy
    fallback_action_name: 'action_default_fallback'
  - name: MemoizationPolicy
    max_history: 5
  - name: FormPolicy

**Content of dialogue.py **:

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals


import logging
from rasa_core.agent import Agent
from rasa_core.domain import Domain
from rasa_core.featurizers import MaxHistoryTrackerFeaturizer, BinarySingleStateFeaturizer
from rasa_core.policies.keras_policy import KerasPolicy
from rasa_core.policies.memoization import MemoizationPolicy

if __name__ == '__main__':
    logging.basicConfig(level='INFO')
    dialog_training_data_file = './data/stories.md'
    path_to_model = './models/dialogue'
    # domain = Domain()
    featurizer = MaxHistoryTrackerFeaturizer(BinarySingleStateFeaturizer(), max_history=5)
    agent = Agent('chat_domain.yml',  policies=[MemoizationPolicy(max_history=5),
                        KerasPolicy(featurizer)])

    agent.train(
        dialog_training_data_file,
        augmentation_factor=50,
        max_history=2,
        epochs=500,
        batch_size=10,
        validation_split=0.2)
    agent.persist(path_to_model)

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
erohmensingcommented, Apr 4, 2019

Hi @HovHak, here

agent.train(
        dialog_training_data_file,
        augmentation_factor=50,
        max_history=2,
        epochs=500,
        batch_size=10,
        validation_split=0.2)

you need to move policy-specific configuration parameters to the policy itself. For example, epochs and batch_size are only for the KerasPolicy, so these would be moved by placing them in

agent = Agent('chat_domain.yml',  policies=[MemoizationPolicy(max_history=5),
                        KerasPolicy(featurizer, epochs=500, batch_size=10)])

basically if you take inspiration from our default configuration, it’s easier to understand what goes where. If you find it easier to just write it in a yaml file and load from there, you should be able to do it like this:

from rasa_core import config as policy_config
from rasa_core.agent import Agent

policies = policy_config.load("policies.yml")
agent = Agent("domain.yml", policies=policies)
0reactions
erohmensingcommented, Jun 18, 2019

@abhiyushshrestha in your code you are still passing policy configuration parameters to agent.train(), you just have to get rid of them. Where did you find this code? It must be over a year old and very out of date with your Rasa version. I recommend following the tutorial in our docs for instructions on how to use Rasa.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Passing policy configuration parameters to `agent.train(...)` is ...
Hi everyone, I am trying to run a notebook similar to this one rasa-workshop-pydata-nyc/rasa-pydatanyc-workshop-executed.ipynb at master ...
Read more >
Exception: Passing policy configuration parameters to `agent.train ...
Exception : Passing policy configuration parameters to `agent.train(...)` is not supported anymore.
Read more >
Deprecations by version - GitLab Docs
The support for registration tokens and certain runner configuration arguments in the POST method operation on the /api/v4/runners endpoint is deprecated. This ...
Read more >
master PDF - Stable Baselines3 Documentation
Note: if you are using a proxy, you need to pass extra params during build and ... Note: Tuple observation spaces are not...
Read more >
National Defense Authorization Act for Fiscal Year 2020
Department of Defense-wide policy and military department- specific ... or permanent disabled retirement lists in military adaptive sports programs. Sec.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found