GaoQ1/rasa_chatbot_cn

训练时config报错

Closed this issue · 2 comments

我的配置文件:

language: "zh"

pipeline:

  • name: "JiebaTokenizer"
  • name: "CountVectorsFeaturizer"
    token_pattern: "(?u)\b\w+\b"
  • name: "EmbeddingIntentClassifier"
  • name: "rasa_nlu_gao.extractors.bilstm_crf_entity_extractor.BilstmCRFEntityExtractor"
    lr: 0.001
    char_dim: 100
    lstm_dim: 100
    batches_per_epoch: 10
    seg_dim: 20
    num_segs: 4
    batch_size: 200
    tag_schema: "iobes"
    model_type: "bilstm"
    clip: 5
    optimizer: "adam"
    dropout_keep: 0.5
    steps_check: 100
    dictionary_path: extra_data/custom_dict

policies:

  • name: "policy.attention_policy.AttentionPolicy"
    epochs: 300
    lr: 0.001
    featurizer:
    • name: MaxHistoryTrackerFeaturizer
      max_history: 3
      state_featurizer:
      • name: LabelTokenizerSingleStateFeaturizer
        tf_config: {
        "inter_op_parallelism_threads": 0,
        "intra_op_parallelism_threads": 0,
        "gpu_options": {"allow_growth": True}
        }
  • name: FallbackPolicy
    fallback_action_name: 'action_default_fallback'
    nlu_threshold: 0.5
    core_threshold: 0.3
  • name: MemoizationPolicy
    max_history: 3

然后在 make train 的时候出现错误:

Traceback (most recent call last):
File "d:\anaconda3\envs\rasa_gao\lib\site-packages\rasa\utils\io.py", line 110, in read_yaml
return yaml_parser.load(content) or {}
File "d:\anaconda3\envs\rasa_gao\lib\site-packages\ruamel\yaml\main.py", line 331, in load
return constructor.get_single_data()
File "d:\anaconda3\envs\rasa_gao\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 889, in _ruamel_yaml.CParser._compose_mapping_node
File "_ruamel_yaml.pyx", line 731, in _ruamel_yaml.CParser._compose_node
File "_ruamel_yaml.pyx", line 904, in _ruamel_yaml.CParser._parse_next_event
ruamel.yaml.scanner.ScannerError: while parsing a quoted scalar
in "", line 6, column 20
found unknown escape character
in "", line 6, column 27

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "d:\anaconda3\envs\rasa_gao\lib\runpy.py", line 193, in run_module_as_main
"main", mod_spec)
File "d:\anaconda3\envs\rasa_gao\lib\runpy.py", line 85, in run_code
exec(code, run_globals)
File "D:\Anaconda3\envs\rasa_gao\Scripts\rasa.exe_main
.py", line 9, in
File "d:\anaconda3\envs\rasa_gao\lib\site-packages\rasa_main
.py", line 76, in main
cmdline_arguments.func(cmdline_arguments)
File "d:\anaconda3\envs\rasa_gao\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_gao\lib\site-packages\rasa\cli\train.py", line 169, in _get_valid_config
missing_keys = missing_config_keys(config, mandatory_keys)
File "d:\anaconda3\envs\rasa_gao\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_gao\lib\site-packages\rasa\utils\io.py", line 153, in read_config_file
content = read_yaml(read_file(filename, "utf-8"))
File "d:\anaconda3\envs\rasa_gao\lib\site-packages\rasa\utils\io.py", line 122, in read_yaml
return yaml_parser.load(content) or {}
File "d:\anaconda3\envs\rasa_gao\lib\site-packages\ruamel\yaml\main.py", line 331, in load
return constructor.get_single_data()
File "d:\anaconda3\envs\rasa_gao\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 889, in _ruamel_yaml.CParser._compose_mapping_node
File "_ruamel_yaml.pyx", line 731, in _ruamel_yaml.CParser._compose_node
File "_ruamel_yaml.pyx", line 904, in _ruamel_yaml.CParser._parse_next_event
ruamel.yaml.scanner.ScannerError: while parsing a quoted scalar
in "", line 6, column 20
found unknown escape character
in "", line 6, column 27

请问这个是什么问题?config.yml的编码是utf-8。

BI4O commented

一样的问题呢,求解

这个是我的问题,

dictionary_path: extra_data/custom_dict

应该放在结巴分词那个component下,其实就是config.yml的问题,类似的错误也是这个原因,可以多仔细看下config文件有没有问题。