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

Error on train using DIET classifier autograph #7876

Closed
LoveMeWithoutAll opened this issue Feb 3, 2021 · 3 comments
Closed

Error on train using DIET classifier autograph #7876

LoveMeWithoutAll opened this issue Feb 3, 2021 · 3 comments
Labels
area:rasa-oss 🎡 Anything related to the open source Rasa framework resolution:duplicate Final state. Issue can be closed, duplicate should be referenced type:bug 🐛 Inconsistencies or issues which will cause an issue or problem for users or implementors.

Comments

@LoveMeWithoutAll
Copy link

LoveMeWithoutAll commented Feb 3, 2021

Rasa version:
2.2.9

Python version: 3.8

Tensorflow version: 2.3.1

Operating system (windows, osx, ...): MacOS

Issue: error on train

    NotImplementedError: Cannot convert a symbolic Tensor (strided_slice_6:0) to a numpy array. This error may indicate that you're trying to pass a Tensor to a NumPy call, which is not supported

Error (including full traceback):

Traceback (most recent call last):
  File "/Users/ys/dev/rasa/venv/lib/python3.8/site-packages/rasa/__main__.py", line 116, in main
    cmdline_arguments.func(cmdline_arguments)
  File "/Users/ys/dev/rasa/venv/lib/python3.8/site-packages/rasa/cli/train.py", line 58, in <lambda>
    train_parser.set_defaults(func=lambda args: train(args, can_exit=True))
  File "/Users/ys/dev/rasa/venv/lib/python3.8/site-packages/rasa/cli/train.py", line 90, in train
    training_result = rasa.train(
  File "/Users/ys/dev/rasa/venv/lib/python3.8/site-packages/rasa/train.py", line 94, in train
    return rasa.utils.common.run_in_loop(
  File "/Users/ys/dev/rasa/venv/lib/python3.8/site-packages/rasa/utils/common.py", line 308, in run_in_loop
    result = loop.run_until_complete(f)
  File "uvloop/loop.pyx", line 1456, in uvloop.loop.Loop.run_until_complete
  File "/Users/ys/dev/rasa/venv/lib/python3.8/site-packages/rasa/train.py", line 163, in train_async
    return await _train_async_internal(
  File "/Users/ys/dev/rasa/venv/lib/python3.8/site-packages/rasa/train.py", line 342, in _train_async_internal
    await _do_training(
  File "/Users/ys/dev/rasa/venv/lib/python3.8/site-packages/rasa/train.py", line 388, in _do_training
    model_path = await _train_nlu_with_validated_data(
  File "/Users/ys/dev/rasa/venv/lib/python3.8/site-packages/rasa/train.py", line 811, in _train_nlu_with_validated_data
    await rasa.nlu.train(
  File "/Users/ys/dev/rasa/venv/lib/python3.8/site-packages/rasa/nlu/train.py", line 116, in train
    interpreter = trainer.train(training_data, **kwargs)
  File "/Users/ys/dev/rasa/venv/lib/python3.8/site-packages/rasa/nlu/model.py", line 209, in train
    updates = component.train(working_data, self.config, **context)
  File "/Users/ys/dev/rasa/venv/lib/python3.8/site-packages/rasa/nlu/classifiers/diet_classifier.py", line 816, in train
    self.model.fit(
  File "/Users/ys/dev/rasa/venv/lib/python3.8/site-packages/rasa/utils/tensorflow/models.py", line 220, in fit
    ) = self._get_tf_train_functions(eager, model_data, batch_strategy)
  File "/Users/ys/dev/rasa/venv/lib/python3.8/site-packages/rasa/utils/tensorflow/models.py", line 481, in _get_tf_train_functions
    self._get_tf_call_model_function(
  File "/Users/ys/dev/rasa/venv/lib/python3.8/site-packages/rasa/utils/tensorflow/models.py", line 464, in _get_tf_call_model_function
    tf_call_model_function(next(iter(init_dataset)))
  File "/Users/ys/dev/rasa/venv/lib/python3.8/site-packages/tensorflow/python/eager/def_function.py", line 780, in __call__
    result = self._call(*args, **kwds)
  File "/Users/ys/dev/rasa/venv/lib/python3.8/site-packages/tensorflow/python/eager/def_function.py", line 823, in _call
    self._initialize(args, kwds, add_initializers_to=initializers)
  File "/Users/ys/dev/rasa/venv/lib/python3.8/site-packages/tensorflow/python/eager/def_function.py", line 696, in _initialize
    self._stateful_fn._get_concrete_function_internal_garbage_collected(  # pylint: disable=protected-access
  File "/Users/ys/dev/rasa/venv/lib/python3.8/site-packages/tensorflow/python/eager/function.py", line 2855, in _get_concrete_function_internal_garbage_collected
    graph_function, _, _ = self._maybe_define_function(args, kwargs)
  File "/Users/ys/dev/rasa/venv/lib/python3.8/site-packages/tensorflow/python/eager/function.py", line 3213, in _maybe_define_function
    graph_function = self._create_graph_function(args, kwargs)
  File "/Users/ys/dev/rasa/venv/lib/python3.8/site-packages/tensorflow/python/eager/function.py", line 3065, in _create_graph_function
    func_graph_module.func_graph_from_py_func(
  File "/Users/ys/dev/rasa/venv/lib/python3.8/site-packages/tensorflow/python/framework/func_graph.py", line 986, in func_graph_from_py_func
    func_outputs = python_func(*func_args, **func_kwargs)
  File "/Users/ys/dev/rasa/venv/lib/python3.8/site-packages/tensorflow/python/eager/def_function.py", line 600, in wrapped_fn
    return weak_wrapped_fn().__wrapped__(*args, **kwds)
  File "/Users/ys/dev/rasa/venv/lib/python3.8/site-packages/tensorflow/python/framework/func_graph.py", line 973, in wrapper
    raise e.ag_error_metadata.to_exception(e)
NotImplementedError: in user code:
    /Users/ys/dev/rasa/venv/lib/python3.8/site-packages/rasa/utils/tensorflow/models.py:293 train_on_batch  *
        prediction_loss = self.batch_loss(batch_in)
    /Users/ys/dev/rasa/venv/lib/python3.8/site-packages/rasa/nlu/classifiers/diet_classifier.py:1417 batch_loss  *
        sequence_lengths = self._get_sequence_lengths(
    /Users/ys/dev/rasa/venv/lib/python3.8/site-packages/rasa/utils/tensorflow/models.py:1112 _get_sequence_lengths  *
        sequence_lengths = tf.ones([batch_dim], dtype=tf.int32)
    /Users/ys/dev/rasa/venv/lib/python3.8/site-packages/tensorflow/python/util/dispatch.py:201 wrapper  **
        return target(*args, **kwargs)
    /Users/ys/dev/rasa/venv/lib/python3.8/site-packages/tensorflow/python/ops/array_ops.py:3041 ones
        output = _constant_if_small(one, shape, dtype, name)
    /Users/ys/dev/rasa/venv/lib/python3.8/site-packages/tensorflow/python/ops/array_ops.py:2732 _constant_if_small
        if np.prod(shape) < 1000:
    <__array_function__ internals>:5 prod
        
    /Users/ys/dev/rasa/venv/lib/python3.8/site-packages/numpy/core/fromnumeric.py:3030 prod
        return _wrapreduction(a, np.multiply, 'prod', axis, dtype, out,
    /Users/ys/dev/rasa/venv/lib/python3.8/site-packages/numpy/core/fromnumeric.py:87 _wrapreduction
        return ufunc.reduce(obj, axis, dtype, out, **passkwargs)
    /Users/ys/dev/rasa/venv/lib/python3.8/site-packages/tensorflow/python/framework/ops.py:845 __array__
        raise NotImplementedError(
    NotImplementedError: Cannot convert a symbolic Tensor (strided_slice_6:0) to a numpy array. This error may indicate that you're trying to pass a Tensor to a NumPy call, which is not supported

Command or request that led to error:

rasa train

Content of configuration file (config.yml) (if relevant):

language: ko
pipeline:
- name: WhitespaceTokenizer
- name: RegexFeaturizer
- name: LexicalSyntacticFeaturizer
- name: CountVectorsFeaturizer
- name: CountVectorsFeaturizer
  analyzer: char_wb
  min_ngram: 1
  max_ngram: 4
- name: DIETClassifier
  epochs: 100
- name: EntitySynonymMapper
- name: ResponseSelector
  epochs: 100
policies:
- name: MemoizationPolicy
- name: TEDPolicy
  max_history: 5
  epochs: 100
- name: RulePolicy
@LoveMeWithoutAll LoveMeWithoutAll added area:rasa-oss 🎡 Anything related to the open source Rasa framework type:bug 🐛 Inconsistencies or issues which will cause an issue or problem for users or implementors. labels Feb 3, 2021
@sara-tagger
Copy link
Collaborator

Thanks for raising this issue, @wochinge will get back to you about it soon✨

Please also check out the docs and the forum in case your issue was raised there too 🤗

@nsorros
Copy link

nsorros commented Feb 7, 2021

I ran into the same problem just now and it was resolved by uninstalling numpy 1.20.0 and installing numpy 1.18.0

@wochinge
Copy link
Contributor

wochinge commented Feb 8, 2021

duplicate of #7885

This is an error with older pip versions which isn't able to resolve dependencies properly.

@wochinge wochinge closed this as completed Feb 8, 2021
@wochinge wochinge added the resolution:duplicate Final state. Issue can be closed, duplicate should be referenced label Feb 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:rasa-oss 🎡 Anything related to the open source Rasa framework resolution:duplicate Final state. Issue can be closed, duplicate should be referenced type:bug 🐛 Inconsistencies or issues which will cause an issue or problem for users or implementors.
Projects
None yet
Development

No branches or pull requests

4 participants