Rasa-demo tutorial Step 4: join() argument must be str or bytes, not 'NoneType'

Hi all

I am following this tutorial until under rasa_nlu step 4.

The training command docker run -v $(pwd)/models:/app/models -v $(pwd)/project:/app/project rasa/rasa_nlu:latest-tensorflow run python -m rasa_nlu.train -c project/config_tf.yml --data project/data_nlu.md -o models --fixed_model_name nlu --project current --verbose

is run successrfully

And under <current_dir>/models/current/nlu, I have the following:

[root@lnxcent7chatbotnlp rasa]# tree models/current/nlu/
models/current/nlu/
β”œβ”€β”€ checkpoint
β”œβ”€β”€ intent_classifier_tensorflow_embedding.ckpt.data-00000-of-00001
β”œβ”€β”€ intent_classifier_tensorflow_embedding.ckpt.index
β”œβ”€β”€ intent_classifier_tensorflow_embedding.ckpt.meta
β”œβ”€β”€ intent_classifier_tensorflow_embedding_encoded_all_intents.pkl
β”œβ”€β”€ intent_classifier_tensorflow_embedding_inv_intent_dict.pkl
β”œβ”€β”€ intent_featurizer_count_vectors.pkl
β”œβ”€β”€ metadata.json
└── training_data.json

0 directories, 9 files
[root@lnxcent7chatbotnlp rasa]#

seems OK…

Here is the problem:

Until I use a test script: python testbot.py

## testbot.py

from rasa_nlu.model import Metadata, Interpreter
import json

def pprint(o):
 # small helper to make dict dumps a bit prettier
    print(json.dumps(o, indent=2))

interpreter = Interpreter.load('./models/current/nlu')
pprint(interpreter.parse(u"Cost of Blood Check"))

It returns:

[root@lnxcent7chatbotnlp rasa]# python testbot.py
/usr/lib64/python3.6/site-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.
  from ._conv import register_converters as _register_converters
Traceback (most recent call last):
  File "testbot.py", line 8, in <module>
    interpreter = Interpreter.load('./models/current/nlu')
  File "/usr/lib/python3.6/site-packages/rasa_nlu/model.py", line 293, in load
    skip_validation)
  File "/usr/lib/python3.6/site-packages/rasa_nlu/model.py", line 320, in create
    model_metadata, **context)
  File "/usr/lib/python3.6/site-packages/rasa_nlu/components.py", line 419, in load_component
    cached_component, **context)
  File "/usr/lib/python3.6/site-packages/rasa_nlu/registry.py", line 134, in load_component_by_name
    return component_clz.load(model_dir, metadata, cached_component, **kwargs)
  File "/usr/lib/python3.6/site-packages/rasa_nlu/extractors/entity_synonyms.py", line 78, in load
    entity_synonyms_file = os.path.join(model_dir, file_name)
  File "/usr/lib64/python3.6/posixpath.py", line 94, in join
    genericpath._check_arg_types('join', a, *p)
  File "/usr/lib64/python3.6/genericpath.py", line 149, in _check_arg_types
    (funcname, s.__class__.__name__)) from None
TypeError: join() argument must be str or bytes, not 'NoneType'

To me it seems that the model dir cannot find a file, but I am not sure what it means.

I am sure that rasa_* has been updated to latest version.

Can anyone please help me on this?

Thank you very much.

Solve?

Here is what I have done, I don’t use Docker command.

I use:

python -m rasa_nlu.train -c project/config_tf.yml --data project/data_nlu.md -o models --fixed_model_name nlu --project current --verbose

As you can see, I just remove the docker command.

And i update the testbot.py:

from rasa_nlu.model import Metadata, Interpreter
import json

def pprint(o):
 # small helper to make dict dumps a bit prettier
    print(json.dumps(o, indent=2))

# Change from "current" to "default"
interpreter = Interpreter.load('./models/default/nlu')
pprint(interpreter.parse(u"Cost of Blood Check"))

It works.

1 Like