Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Composite Entities: got an unexpected keyword argument 'composite_patterns_path' #20

Open
nikolaydmukha opened this issue Oct 14, 2021 · 2 comments

Comments

@nikolaydmukha
Copy link

nikolaydmukha commented Oct 14, 2021

Hello.
I am trying to install rasa-composite-entites.
I have installed according to your instruction but when I start rasa train I get the exception:

Training Core model...
Traceback (most recent call last):
  File "/home/ndmukha/.pyenv/versions/3.7.0/lib/python3.7/site-packages/rasa/core/policies/ensemble.py", line 444, in from_dict
    policy_object = constr_func(**policy)
TypeError: __init__() got an unexpected keyword argument 'composite_patterns_path'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/ndmukha/.pyenv/versions/3.7.0/bin/rasa", line 8, in <module>
    sys.exit(main())
  File "/home/ndmukha/.pyenv/versions/3.7.0/lib/python3.7/site-packages/rasa/__main__.py", line 118, in main
    cmdline_arguments.func(cmdline_arguments)
  File "/home/ndmukha/.pyenv/versions/3.7.0/lib/python3.7/site-packages/rasa/cli/train.py", line 59, in <lambda>
    train_parser.set_defaults(func=lambda args: run_training(args, can_exit=True))
  File "/home/ndmukha/.pyenv/versions/3.7.0/lib/python3.7/site-packages/rasa/cli/train.py", line 103, in run_training
    finetuning_epoch_fraction=args.epoch_fraction,
  File "/home/ndmukha/.pyenv/versions/3.7.0/lib/python3.7/site-packages/rasa/api.py", line 124, in train
    loop,
  File "/home/ndmukha/.pyenv/versions/3.7.0/lib/python3.7/site-packages/rasa/utils/common.py", line 296, in run_in_loop
    result = loop.run_until_complete(f)
  File "uvloop/loop.pyx", line 1456, in uvloop.loop.Loop.run_until_complete
  File "/home/ndmukha/.pyenv/versions/3.7.0/lib/python3.7/site-packages/rasa/model_training.py", line 119, in train_async
    finetuning_epoch_fraction=finetuning_epoch_fraction,
  File "/home/ndmukha/.pyenv/versions/3.7.0/lib/python3.7/site-packages/rasa/model_training.py", line 299, in _train_async_internal
    finetuning_epoch_fraction=finetuning_epoch_fraction,
  File "/home/ndmukha/.pyenv/versions/3.7.0/lib/python3.7/site-packages/rasa/model_training.py", line 361, in _do_training
    finetuning_epoch_fraction=finetuning_epoch_fraction,
  File "/home/ndmukha/.pyenv/versions/3.7.0/lib/python3.7/site-packages/rasa/model_training.py", line 556, in _train_core_with_validated_data
    model_to_finetune=model_to_finetune,
  File "/home/ndmukha/.pyenv/versions/3.7.0/lib/python3.7/site-packages/rasa/core/train.py", line 45, in train
    policies = config.load(policy_config)
  File "/home/ndmukha/.pyenv/versions/3.7.0/lib/python3.7/site-packages/rasa/core/config.py", line 49, in load
    return PolicyEnsemble.from_dict(config_data)
  File "/home/ndmukha/.pyenv/versions/3.7.0/lib/python3.7/site-packages/rasa/core/policies/ensemble.py", line 446, in from_dict
    raise Exception(f"Could not initialize {policy_name}. {e}") from e
Exception: Could not initialize rasa_composite_entities.CompositeEntityExtractor. __init__() got an unexpected keyword argument 'composite_patterns_path'

My rasa version:

Rasa Version      :         2.8.9
Minimum Compatible Version: 2.8.9
Rasa SDK Version  :         2.8.2
Rasa X Version    :         None
Python Version    :         3.7.0
Operating System  :         Linux-5.4.0-84-generic-x86_64-with-debian-bullseye-sid
Python Path       :         /home/ndmukha/.pyenv/versions/3.7.0/bin/python3.7

Can you help me please with fix this issue?
Thanks.

@BeWe11
Copy link
Owner

BeWe11 commented Oct 17, 2021

Thank you for the report.

I couldn't reproduce this training a NLU model using the example given in the repo. You seem to be training a full agent. Would you mind sharing you training configuration? Thanks!

@nikolaydmukha
Copy link
Author

nikolaydmukha commented Oct 17, 2021

Hello Benjamin.
Here is my config.yml:

language: ru
pipeline:
  - name: WhitespaceTokenizer
  - name: RegexFeaturizer
  - name: LexicalSyntacticFeaturizer
  - name: CountVectorsFeaturizer
    analyzer: "char_wb"
    min_ngram: 1
    max_ngram: 4
  - name: DIETClassifier
    epochs: 100
  - name: EntitySynonymMapper
  - name: "DucklingEntityExtractor"
    url: "http://localhost:8000"
    dimensions: ["time", "duration", "number"]
    locale: "ru_GB"
    timezone: "Europe/Moscow"
    timeout : 1
policies:
  - name: AugmentedMemoizationPolicy
    max_history: 4
  - name: TEDPolicy
    max_history: 4
    epochs: 300
    nlu_threshold: 0.7
    core_threshold: 0.4
    ambiguity_threshold: 0.1
    fallback_action_name: action_my_fallback
  - name: RulePolicy
  - name: rasa_composite_entities.CompositeEntityExtractor
    composite_patterns_path: composite_entity_patterns.json

composite_entity_patterns.json is in the same path as config.yml:

{
  "composite_entities": [
    {
      "name": "order_drinks",
      "patterns": [
        "@quantity cups of @black_tea_qty",
        "@quantity bottles of @water_qty",
        "@quantity @coffee_qty",
      ]
    }
  ]
}

And my order_drinks.yml:

version: "2.0"
nlu:
- intent: order_drinks
  examples: |
    - [two](quantity) cups of [black tea]{"entity":"black_tea_qty", "value":"2", "role":"order_black_tea"} and [three](quantity) bottles of [water] {"entity":"water_qty", "value":"3", "role":"order_water"}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants