GaoQ1 / rasa_chatbot_cn

building a chinese dialogue system based on the newest version of rasa(基于最新版本rasa搭建的对话系统)
965 stars 288 forks source link

试验 【rasa-nlu的究极形态】,环境的版本与配置问题 #73

Closed nihuizhidao closed 5 years ago

nihuizhidao commented 5 years ago

Hi @GaoQ1 大神,我看了你新写的rasa-nlu的究极形态,个人尝试了一下,对环境的配置有些疑问。

我之前尝试你的代码,使用的是windows系统,anaconda环境,conda install tensorflow-gpu安装的tf, 是可以运行的。但是这篇文章在这样的配置下就不行了,我使用的是 pip install rasa-nlu-gao==1.0.1

能否告知下一些重要库的版本和配置信息呢?

nihuizhidao commented 5 years ago

GPU现在是可以用了,但是训练的时候报错了:

Traceback (most recent call last): File "d:\anaconda3\envs\rasa\lib\runpy.py", line 193, in _run_module_as_main "main", mod_spec) File "d:\anaconda3\envs\rasa\lib\runpy.py", line 85, in _run_code exec(code, run_globals) File "D:\Anaconda3\envs\rasa\Scripts\rasa.exe__main.py", line 9, in File "d:\anaconda3\envs\rasa\lib\site-packages\rasa\main__.py", line 77, in main cmdline_arguments.func(cmdline_arguments) File "d:\anaconda3\envs\rasa\lib\site-packages\rasa\cli\train.py", line 63, in train config = _get_valid_config(args.config, CONFIG_MANDATORY_KEYS) File "d:\anaconda3\envs\rasa\lib\site-packages\rasa\cli\train.py", line 170, in _get_valid_config missing_keys = missing_config_keys(config, mandatory_keys) File "d:\anaconda3\envs\rasa\lib\site-packages\rasa\cli\utils.py", line 56, in missing_config_keys config_data = rasa.utils.io.read_config_file(path) File "d:\anaconda3\envs\rasa\lib\site-packages\rasa\utils\io.py", line 152, in read_config_file content = read_yaml(read_file(filename, "utf-8")) File "d:\anaconda3\envs\rasa\lib\site-packages\rasa\utils\io.py", line 110, in read_yaml return yaml_parser.load(content) or {} File "d:\anaconda3\envs\rasa\lib\site-packages\ruamel\yaml\main.py", line 331, in load return constructor.get_single_data() File "d:\anaconda3\envs\rasa\lib\site-packages\ruamel\yaml\constructor.py", line 109, in get_single_data node = self.composer.get_single_node() File "_ruamel_yaml.pyx", line 706, in _ruamel_yaml.CParser.get_single_node File "_ruamel_yaml.pyx", line 724, in _ruamel_yaml.CParser._compose_document File "_ruamel_yaml.pyx", line 775, in _ruamel_yaml.CParser._compose_node File "_ruamel_yaml.pyx", line 889, in _ruamel_yaml.CParser._compose_mapping_node File "_ruamel_yaml.pyx", line 773, in _ruamel_yaml.CParser._compose_node File "_ruamel_yaml.pyx", line 850, in _ruamel_yaml.CParser._compose_sequence_node File "_ruamel_yaml.pyx", line 775, in _ruamel_yaml.CParser._compose_node File "_ruamel_yaml.pyx", line 891, in _ruamel_yaml.CParser._compose_mapping_node File "_ruamel_yaml.pyx", line 904, in _ruamel_yaml.CParser._parse_next_event ruamel.yaml.parser.ParserError: while parsing a block mapping in "", line 6, column 3 did not find expected key in "", line 7, column 67

同样的环境,用下面的config.yml是可以的:

language: "zh"

pipeline:

  • name: "JiebaTokenizer" dictionary_path: extra_data/custom_dict
  • name: "rasa_nlu_gao.classifiers.kashgari_intent_classifier.KashgariIntentClassifier" bert_model_path: "D:/Projects/rasa_gao/ernie2tf/baidu_ernie", use_cudnn_cell: True epochs: 10 batch_size: 2
  • name: "rasa_nlu_gao.extractors.kashgari_entity_extractor.KashgariEntityExtractor" bert_model_path: "D:/Projects/rasa_gao/ernie2tf/baidu_ernie", use_cudnn_cell: True epochs: 10 batch_size: 2

policies:

  • name: KerasPolicy epochs: 5 max_history: 5 learning_rate: 0.05
  • name: MemoizationPolicy max_history: 5
  • name: MappingPolicyMutilAction
  • name: FallbackPolicy nlu_threshold: 0.2 core_threshold: 0.1

rasa-nlu-gao是1.0.2版本的, tf-gpu是1.14.0 这个是什么原因?

GaoQ1 commented 5 years ago

看着有点像数据格式错误问题,yaml解析出错。

nihuizhidao commented 5 years ago

这个很奇怪,我同样的数据,用之前的pipeline是可以的

GaoQ1 commented 5 years ago

不需要分词的component

QinWinner commented 5 years ago

看一下你的config的格式,这个问题我遇到过,是因为config的格式出写错了。还有参数填错了导致的。检测一下应该好了。

nihuizhidao commented 5 years ago

@QinWinner 感谢!我看了下,确实是config有问题,我在bert_model_path的路径之后加了个逗号,傻了。。。

上面的问题解决了,不过又出现了一个新的错误,跟 #75 一样的错误:

2019-10-19 11:53:18 DEBUG rasa.nlu.training_data.training_data - Validating training data... 2019-10-19 11:53:18 INFO rasa.nlu.model - Starting to train component KashgariIntentClassifier 2019-10-19 11:53:18 INFO rasa.nlu.model - Finished training component. Traceback (most recent call last): File "d:\anaconda3\envs\rasa\lib\runpy.py", line 193, in _run_module_as_main "main", mod_spec) File "d:\anaconda3\envs\rasa\lib\runpy.py", line 85, in _run_code exec(code, run_globals) File "D:\Anaconda3\envs\rasa\Scripts\rasa.exe__main.py", line 9, in File "d:\anaconda3\envs\rasa\lib\site-packages\rasa\main__.py", line 76, in main cmdline_arguments.func(cmdline_arguments) File "d:\anaconda3\envs\rasa\lib\site-packages\rasa\cli\train.py", line 77, in train kwargs=extract_additional_arguments(args), File "d:\anaconda3\envs\rasa\lib\site-packages\rasa\train.py", line 40, in train kwargs=kwargs, File "d:\anaconda3\envs\rasa\lib\asyncio\base_events.py", line 484, in run_until_complete return future.result() File "d:\anaconda3\envs\rasa\lib\site-packages\rasa\train.py", line 87, in train_async kwargs, File "d:\anaconda3\envs\rasa\lib\site-packages\rasa\train.py", line 169, in _train_async_internal kwargs=kwargs, File "d:\anaconda3\envs\rasa\lib\site-packages\rasa\train.py", line 216, in _do_training fixed_model_name=fixed_model_name, File "d:\anaconda3\envs\rasa\lib\site-packages\rasa\train.py", line 427, in _train_nlu_with_validated_data config, file_importer, _train_path, fixed_model_name="nlu" File "d:\anaconda3\envs\rasa\lib\site-packages\rasa\nlu\train.py", line 79, in train interpreter = trainer.train(training_data, **kwargs) File "d:\anaconda3\envs\rasa\lib\site-packages\rasa\nlu\model.py", line 195, in train context.update(updates) TypeError: 'coroutine' object is not iterable sys:1: RuntimeWarning: coroutine 'KashgariIntentClassifier.train' was never awaited

@GaoQ1 是不是环境配置有什么问题?可能是Kashgari,或者rasa的版本不对?

GaoQ1 commented 5 years ago

不好意思,这个在文章中有说。按文章中来做没什么问题。后面会保持更新。

nihuizhidao commented 5 years ago

感谢 @GaoQ1 ,按照你简书中提供的代码,发现是components的问题,现在已经可以了,谢谢!

QinWinner commented 5 years ago

感谢 @GaoQ1 ,按照你简书中提供的代码,发现是components的问题,现在已经可以了,谢谢!

请问下可以告知是踩坑记的第几个什么地方吗。我遇到同样的问题,没有找到。

nihuizhidao commented 5 years ago

是究极形态的那篇简书,Gao博主共享了代码