Closed BeWe11 closed 5 years ago
This issue only occurs when I do rasa train
for training both nlu and core. It works with rasa train nlu
for training nlu model specifically. The problem I find is from this part of composite_entity_extractor.py:
@staticmethod
def _get_train_files_cmd():
"""Get the raw train data by fetching the train file given in the
command line arguments to the train script.
"""
cmdline_args = create_argument_parser().parse_args()
files = utils.list_files(cmdline_args.nlu)
return [file for file in files if _guess_format(file) == RASA_NLU]
When we do rasa train nlu
, there will be an "nlu" argument in "cmdline_args" with the correct path to nlu training file. However, under the case of rasa train
, "cmdline_args" will not have that "nlu" argument and the "data" argument is the parent path of both "nlu.json" and "stories.md", which is "data/" in my case.
My fix to this is simply hardcode my path of nlu training file to "nlu" if not exist:
if not cmdline_args.__contains__("nlu"):
cmdline_args.nlu = 'data/nlu.json'
and then extract cmdline_args.nlu
This is not a elegant way to resolving this, but I think this can give you some idea about my issue.
Thanks!
@BrianYing would you mind sharing your ‘nlu.json’ and your ‘stories.md’ files? That would save me some time debugging.
@BeWe11 Sent to your email!
Ok, there were two issues:
rasa train
) instead of just a NLU model (via rasa train nlu
). This has been fixed by c86250080e5f332d94ba93c983eaef26b4a2a4b1@BrianYing can you please confirm this on your machine? First, run pip install -U rasa-composite-entities
to get the fix for point 1 (version 0.4.2), then try creating a new training file with identical content and see if you can train successfully.
By the way, I don't think it's possible right now to use this component with rasa X. It seems rasa X only directly reads markdown files. When I import my JSON file, the composite patterns get stripped and a markdown file is being saved. So right now, you have to use the training scripts from the command line I guess :/
@BeWe11 It works! Yeah rasa x UI does not support reading json file, but using command line works fine. Thank you so much!
Glad it’s working now! I’m gonna close this issue and add another one for the rasa X thing.
Rasa X doesn't seem to accept the modified training file and raises an error:
The composite entity extractor throws a warning that the train file couldn't be loaded.
Both errors are due to rasa's "_guess_format" method not being able to infer the format of the modified train file.