ValueError(f"Data of type {type(v)} is not allowed only {allowed_types} is accepted for {k}.")

Hi, I am migrating my bot from 1.x to 2.x, and I followed the tutorials here: Migrating your Rasa 1.x assistant to Rasa 2.0 | The Rasa Blog | Rasa

I didn’t go in and change any files, because I’m still confused about how I should change forms. I tried training the bot and am getting an error:

c:\users\user\anaconda3\lib\site-packages\rasa\shared\utils\io.py:93: UserWarning: Intent ‘nlu_fallback’ has only 1 training examples! Minimum is 2, training may fail.

c:\users\user\anaconda3\lib\site-packages\rasa\shared\utils\io.py:93: UserWarning: Intent ‘user_Name’ has only 1 training examples! Minimum is 2, training may fail.

c:\users\user\anaconda3\lib\site-packages\rasa\shared\utils\io.py:93: UserWarning: Intent ‘user_doorNo’ has only 1 training examples! Minimum is 2, training may fail.

c:\users\user\anaconda3\lib\site-packages\rasa\shared\utils\io.py:93: UserWarning: Intent ‘user_street’ has only 1 training examples! Minimum is 2, training may fail.

2020-12-21 18:03:18 INFO rasa.nlu.model - Starting to train component HFTransformersNLP

Traceback (most recent call last):

File “c:\users\user\anaconda3\lib\runpy.py”, line 194, in _run_module_as_main

return _run_code(code, main_globals, None,

File “c:\users\user\anaconda3\lib\runpy.py”, line 87, in _run_code

exec(code, run_globals)

File “C:\Users\USER\anaconda3\Scripts\rasa.exe_main_.py”, line 7, in

File “c:\users\user\anaconda3\lib\site-packages\rasa_main_.py”, line 116, in main

cmdline_arguments.func(cmdline_arguments)

File “c:\users\user\anaconda3\lib\site-packages\rasa\cli\train.py”, line 58, in

train_parser.set_defaults(func=lambda args: train(args, can_exit=True))

File “c:\users\user\anaconda3\lib\site-packages\rasa\cli\train.py”, line 90, in train

training_result = rasa.train(

File “c:\users\user\anaconda3\lib\site-packages\rasa\train.py”, line 94, in train

return rasa.utils.common.run_in_loop(

File “c:\users\user\anaconda3\lib\site-packages\rasa\utils\common.py”, line 308, in run_in_loop

result = loop.run_until_complete(f)

File “c:\users\user\anaconda3\lib\asyncio\base_events.py”, line 616, in run_until_complete

return future.result()

File “c:\users\user\anaconda3\lib\site-packages\rasa\train.py”, line 163, in train_async

return await _train_async_internal(

File “c:\users\user\anaconda3\lib\site-packages\rasa\train.py”, line 342, in _train_async_internal

await _do_training(

File “c:\users\user\anaconda3\lib\site-packages\rasa\train.py”, line 388, in _do_training

model_path = await _train_nlu_with_validated_data(

File “c:\users\user\anaconda3\lib\site-packages\rasa\train.py”, line 811, in _train_nlu_with_validated_data

await rasa.nlu.train(

File “c:\users\user\anaconda3\lib\site-packages\rasa\nlu\train.py”, line 116, in train

interpreter = trainer.train(training_data, **kwargs)

File “c:\users\user\anaconda3\lib\site-packages\rasa\nlu\model.py”, line 209, in train

updates = component.train(working_data, self.config, **context)

File “c:\users\user\anaconda3\lib\site-packages\rasa\nlu\utils\hugging_face\hf_transformers.py”, line 720, in train

batch_docs = self._get_docs_for_batch(batch_messages, attribute)

File “c:\users\user\anaconda3\lib\site-packages\rasa\nlu\utils\hugging_face\hf_transformers.py”, line 670, in _get_docs_for_batch

) = self._get_model_features_for_batch(

File “c:\users\user\anaconda3\lib\site-packages\rasa\nlu\utils\hugging_face\hf_transformers.py”, line 602, in _get_model_features_for_batch

sequence_hidden_states = self._compute_batch_sequence_features(

File “c:\users\user\anaconda3\lib\site-packages\rasa\nlu\utils\hugging_face\hf_transformers.py”, line 456, in _compute_batch_sequence_features

model_outputs = self.model(

File “C:\Users\USER\AppData\Roaming\Python\Python38\site- packages\tensorflow\python\keras\engine\base_layer.py”, line 1012, in call

outputs = call_fn(inputs, *args, **kwargs)

File “C:\Users\USER\AppData\Roaming\Python\Python38\site- packages\transformers\models\bert\modeling_tf_bert.py”, line 844, in call

inputs = input_processing(

File “C:\Users\USER\AppData\Roaming\Python\Python38\site- packages\transformers\modeling_tf_utils.py”, line 357, in input_processing

raise ValueError(f"Data of type {type(v)} is not allowed only {allowed_types} is accepted for {k}.")

ValueError: Data of type <class ‘numpy.ndarray’> is not allowed only (<class ‘tensorflow.python.framework.ops.Tensor’>, <class ‘bool’>, <class ‘int’>, <class ‘transformers.file_utils.ModelOutput’>, <class ‘tuple’>, <class ‘list’>, <class ‘dict’>) is accepted for attention_mask.

Help?

please someone help me, i’m freaking out. the problem is with tensorflow input perhaps, but I cant change that :frowning: @Juste perhaps you can show me the way

Any solution yet?

Got similar issue: raise ValueError(f"Data of type {type(v)} is not allowed only {allowed_types} is accepted for {k}.") ValueError: Data of type <class ‘numpy.ndarray’> is not allowed only (<class ‘tensorflow.python.framework.ops.Tensor’>, <class ‘bool’>, <class ‘int’>, <class ‘transformers.file_utils.ModelOutput’>, <class ‘tuple’>, <class ‘list’>, <class ‘dict’>) is accepted for attention_mask.

Hi @arkaprabha-majumdar. Would it be possible to share your domain.yml, nlu.yml and stories.yml files? After you did the migration steps?

Also, which Rasa 1.x version are you migrating from?

I encounter the same error. I just add LanguageModelFeaturizer in the config.yml

The whole error message is as below: File “/home/sunwei/venv-rasa1/lib/python3.6/site-packages/transformers/modeling_tf_utils.py”, line 357, in input_processing raise ValueError(f"Data of type {type(v)} is not allowed only {allowed_types} is accepted for {k}.") ValueError: Data of type <class ‘numpy.ndarray’> is not allowed only (<class ‘tensorflow.python.framework.ops.Tensor’>, <class ‘bool’>, <class ‘int’>, <class ‘transformers.file_utils.ModelOutput’>, <class ‘tuple’>, <class ‘list’>, <class ‘dict’>) is accepted for attention_mask.

Yes, I rechecked my domain and story files… they had indentation problems… Check for pipes and indents…

Still if you get the error, try the rasa nlu convert functions. This is an error on our part, not rasa. Sorry for the panic @Juste :slight_smile:

do a rasa init and you can also recheck the syntax with that… let me know if it works for you guys