Rasa 3.x 学习系列-Rasa 3.1+ ElasticSearch 7.15.0 对话机器人实战八 Elasticsearch 可视化及SpacyNLP安装部署
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Rasa 3.x 学习系列-Rasa 3.1+ ElasticSearch 7.15.0 对话机器人实战八 Elasticsearch 可视化及SpacyNLP安装部署相关的知识,希望对你有一定的参考价值。
Elasticsearch 可视化工具
ElasticHD 下载
https://github.com/qax-os/ElasticHD/releases
ElasticHD 启动
D:\\rasa_book_project>ElasticHD -p 127.0.0.1:9800
To view elasticHD console open http://127.0.0.1:9800 in browser
ElasticHD 运行效果
SpacyNLP 安装部署
(Latest_Version_Rasa) D:\\rasa_book_project\\chapter04_Rasa_Search_Movie_Book>rasa train
E:\\Users\\duanzhihua\\Anaconda3\\envs\\Latest_Version_Rasa\\lib\\site-packages\\slack\\deprecation.py:14: UserWarning: slack package is deprecated. Please use s
lack_sdk.web/webhook/rtm package instead. For more info, go to https://slack.dev/python-slack-sdk/v3-migration/
warnings.warn(message)
2023-02-02 16:06:09 WARNING rasa.shared.core.domain - You are using an experiential feature: Action action_query_knowledge_base!
C:\\Users\\duanzhihua\\AppData\\Roaming\\Python\\Python38\\site-packages\\rasa\\shared\\utils\\io.py:99: UserWarning: Found inconsistent entity synonyms while read
ing markdown, overwriting something->book with something->movie during merge.
2023-02-02 16:06:10 WARNING rasa.shared.core.domain - You are using an experiential feature: Action action_query_knowledge_base!
2023-02-02 16:06:17 WARNING rasa.shared.core.domain - You are using an experiential feature: Action action_query_knowledge_base!
2023-02-02 16:06:17 WARNING rasa.shared.core.domain - You are using an experiential feature: Action action_query_knowledge_base!
2023-02-02 16:06:17 WARNING rasa.shared.core.domain - You are using an experiential feature: Action action_query_knowledge_base!
2023-02-02 16:06:18 INFO rasa.nlu.utils.spacy_utils - Trying to load SpaCy model with name en_core_web_md.
Traceback (most recent call last):
File "C:\\Users\\duanzhihua\\AppData\\Roaming\\Python\\Python38\\site-packages\\rasa\\nlu\\utils\\spacy_utils.py", line 93, in load_model
language = spacy.load(spacy_model_name, disable=["parser"])
File "E:\\Users\\duanzhihua\\Anaconda3\\envs\\Latest_Version_Rasa\\lib\\site-packages\\spacy\\__init__.py", line 54, in load
return util.load_model(
File "E:\\Users\\duanzhihua\\Anaconda3\\envs\\Latest_Version_Rasa\\lib\\site-packages\\spacy\\util.py", line 439, in load_model
raise IOError(Errors.E050.format(name=name))
OSError: [E050] Cant find model en_core_web_md. It doesnt seem to be a Python package or a valid path to a data directory.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\\Users\\duanzhihua\\AppData\\Roaming\\Python\\Python38\\site-packages\\rasa\\engine\\graph.py", line 390, in _load_component
self._component: GraphComponent = constructor( # type: ignore[no-redef]
File "C:\\Users\\duanzhihua\\AppData\\Roaming\\Python\\Python38\\site-packages\\rasa\\nlu\\utils\\spacy_utils.py", line 121, in create
model = cls.load_model(spacy_model_name)
File "C:\\Users\\duanzhihua\\AppData\\Roaming\\Python\\Python38\\site-packages\\rasa\\nlu\\utils\\spacy_utils.py", line 96, in load_model
raise InvalidModelError(
rasa.nlu.model.InvalidModelError: Please confirm that en_core_web_md is an available spaCy model. You need to download one upfront. For example:
python -m spacy download en_core_web_md
More informaton can be found on https://rasa.com/docs/rasa/components#spacynlp
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "E:\\Users\\duanzhihua\\Anaconda3\\envs\\Latest_Version_Rasa\\lib\\runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "E:\\Users\\duanzhihua\\Anaconda3\\envs\\Latest_Version_Rasa\\lib\\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "E:\\Users\\duanzhihua\\Anaconda3\\envs\\Latest_Version_Rasa\\Scripts\\rasa.exe\\__main__.py", line 7, in <module>
File "C:\\Users\\duanzhihua\\AppData\\Roaming\\Python\\Python38\\site-packages\\rasa\\__main__.py", line 121, in main
cmdline_arguments.func(cmdline_arguments)
File "C:\\Users\\duanzhihua\\AppData\\Roaming\\Python\\Python38\\site-packages\\rasa\\cli\\train.py", line 59, in <lambda>
train_parser.set_defaults(func=lambda args: run_training(args, can_exit=True))
File "C:\\Users\\duanzhihua\\AppData\\Roaming\\Python\\Python38\\site-packages\\rasa\\cli\\train.py", line 91, in run_training
training_result = train_all(
File "C:\\Users\\duanzhihua\\AppData\\Roaming\\Python\\Python38\\site-packages\\rasa\\api.py", line 105, in train
return train(
File "C:\\Users\\duanzhihua\\AppData\\Roaming\\Python\\Python38\\site-packages\\rasa\\model_training.py", line 160, in train
return _train_graph(
File "C:\\Users\\duanzhihua\\AppData\\Roaming\\Python\\Python38\\site-packages\\rasa\\model_training.py", line 227, in _train_graph
trainer.train(
File "C:\\Users\\duanzhihua\\AppData\\Roaming\\Python\\Python38\\site-packages\\rasa\\engine\\training\\graph_trainer.py", line 105, in train
graph_runner.run(inputs=PLACEHOLDER_IMPORTER: importer)
File "C:\\Users\\duanzhihua\\AppData\\Roaming\\Python\\Python38\\site-packages\\rasa\\engine\\runner\\dask.py", line 101, in run
dask_result = dask.get(run_graph, run_targets)
File "C:\\Users\\duanzhihua\\AppData\\Roaming\\Python\\Python38\\site-packages\\dask\\local.py", line 553, in get_sync
return get_async(
File "C:\\Users\\duanzhihua\\AppData\\Roaming\\Python\\Python38\\site-packages\\dask\\local.py", line 496, in get_async
for key, res_info, failed in queue_get(queue).result():
File "E:\\Users\\duanzhihua\\Anaconda3\\envs\\Latest_Version_Rasa\\lib\\concurrent\\futures\\_base.py", line 437, in result
result = pack_exception(e, dumps)
File "C:\\Users\\duanzhihua\\AppData\\Roaming\\Python\\Python38\\site-packages\\dask\\local.py", line 220, in execute_task
result = _execute_task(task, data)
File "C:\\Users\\duanzhihua\\AppData\\Roaming\\Python\\Python38\\site-packages\\dask\\core.py", line 119, in _execute_task
return func(*(_execute_task(a, cache) for a in args))
File "C:\\Users\\duanzhihua\\AppData\\Roaming\\Python\\Python38\\site-packages\\rasa\\engine\\graph.py", line 445, in __call__
self._load_component(**constructor_kwargs)
File "C:\\Users\\duanzhihua\\AppData\\Roaming\\Python\\Python38\\site-packages\\rasa\\engine\\graph.py", line 402, in _load_component
raise GraphComponentException(
rasa.engine.exceptions.GraphComponentException: Error initializing graph component for node provide_SpacyNLP0.
https://spacy.io/models 按官网的文档安装python -m spacy download en_core_web_sm
(Latest_Version_Rasa) D:\\rasa_book_project\\chapter04_Rasa_Search_Movie_Book>python -m spacy download en_core_web_sm
2023-02-02 16:16:13.369299: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library cudart64_110.dll; dlerror:
cudart64_110.dll not found
2023-02-02 16:16:13.369642: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your mac
hine.
2023-02-02 16:16:17.636060: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library nvcuda.dll; dlerror: nvcuda
.dll not found
2023-02-02 16:16:17.636361: W tensorflow/stream_executor/cuda/cuda_driver.cc:269] failed call to cuInit: UNKNOWN ERROR (303)
2023-02-02 16:16:17.647200: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:169] retrieving CUDA diagnostic information for host: DESKTOP-NSQ5TAO
2023-02-02 16:16:17.647840: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:176] hostname: DESKTOP-NSQ5TAO
WARNING: Ignoring invalid distribution -asa (e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages)
WARNING: Ignoring invalid distribution -asa (e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages)
Collecting en-core-web-sm==3.5.0
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by SSLError(SSLEOFError(8, EOF occur
red in violation of protocol (_ssl.c:1131))): /explosion/spacy-models/releases/download/en_core_web_sm-3.5.0/en_core_web_sm-3.5.0-py3-none-any.whl
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by SSLError(SSLEOFError(8, EOF occur
red in violation of protocol (_ssl.c:1131))): /explosion/spacy-models/releases/download/en_core_web_sm-3.5.0/en_core_web_sm-3.5.0-py3-none-any.whl
Downloading https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-3.5.0/en_core_web_sm-3.5.0-py3-none-any.whl (12.8 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 12.8/12.8 MB 1.2 MB/s eta 0:00:00
Requirement already satisfied: spacy<3.6.0,>=3.5.0 in e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages (from en-core-web-sm==3.5
.0) (3.5.0)
Requirement already satisfied: wasabi<1.2.0,>=0.9.1 in e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages (from spacy<3.6.0,>=3.5.
0->en-core-web-sm==3.5.0) (0.10.1)
Requirement already satisfied: numpy>=1.15.0 in c:\\users\\duanzhihua\\appdata\\roaming\\python\\python38\\site-packages (from spacy<3.6.0,>=3.5.0->en-core-web
-sm==3.5.0) (1.19.5)
Requirement already satisfied: spacy-loggers<2.0.0,>=1.0.0 in e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages (from spacy<3.6.0
,>=3.5.0->en-core-web-sm==3.5.0) (1.0.3)
Requirement already satisfied: preshed<3.1.0,>=3.0.2 in e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages (from spacy<3.6.0,>=3.5
.0->en-core-web-sm==3.5.0) (3.0.7)
Requirement already satisfied: typer<0.8.0,>=0.3.0 in e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages (from spacy<3.6.0,>=3.5.0
->en-core-web-sm==3.5.0) (0.4.2)
Requirement already satisfied: spacy-legacy<3.1.0,>=3.0.11 in e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages (from spacy<3.6.0
,>=3.5.0->en-core-web-sm==3.5.0) (3.0.12)
Requirement already satisfied: murmurhash<1.1.0,>=0.28.0 in e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages (from spacy<3.6.0,>
=3.5.0->en-core-web-sm==3.5.0) (1.0.8)
Requirement already satisfied: cymem<2.1.0,>=2.0.2 in e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages (from spacy<3.6.0,>=3.5.0
->en-core-web-sm==3.5.0) (2.0.6)
Requirement already satisfied: pydantic!=1.8,!=1.8.1,<1.11.0,>=1.7.4 in e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages (from s
pacy<3.6.0,>=3.5.0->en-core-web-sm==3.5.0) (1.9.2)
Requirement already satisfied: catalogue<2.1.0,>=2.0.6 in e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages (from spacy<3.6.0,>=3
.5.0->en-core-web-sm==3.5.0) (2.0.8)
Requirement already satisfied: setuptools in e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages (from spacy<3.6.0,>=3.5.0->en-core
-web-sm==3.5.0) (65.6.3)
Requirement already satisfied: smart-open<7.0.0,>=5.2.1 in e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages (from spacy<3.6.0,>=
3.5.0->en-core-web-sm==3.5.0) (5.2.1)
Requirement already satisfied: srsly<3.0.0,>=2.4.3 in e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages (from spacy<3.6.0,>=3.5.0
->en-core-web-sm==3.5.0) (2.4.4)
Requirement already satisfied: jinja2 in e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages (from spacy<3.6.0,>=3.5.0->en-core-web
-sm==3.5.0) (3.1.2)
Requirement already satisfied: packaging>=20.0 in e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages (from spacy<3.6.0,>=3.5.0->en
-core-web-sm==3.5.0) (20.9)
Requirement already satisfied: pathy>=0.10.0 in e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages (from spacy<3.6.0,>=3.5.0->en-c
ore-web-sm==3.5.0) (0.10.1)
Requirement already satisfied: thinc<8.2.0,>=8.1.0 in e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages (from spacy<3.6.0,>=3.5.0
->en-core-web-sm==3.5.0) (8.1.1)
Requirement already satisfied: tqdm<5.0.0,>=4.38.0 in e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages (from spacy<3.6.0,>=3.5.0
->en-core-web-sm==3.5.0) (4.64.1)
Requirement already satisfied: requests<3.0.0,>=2.13.0 in e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages (from spacy<3.6.0,>=3
.5.0->en-core-web-sm==3.5.0) (2.28.1)
Requirement already satisfied: langcodes<4.0.0,>=3.2.0 in e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages (from spacy<3.6.0,>=3
.5.0->en-core-web-sm==3.5.0) (3.3.0)
Requirement already satisfied: pyparsing>=2.0.2 in e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages (from packaging>=20.0->spacy
<3.6.0,>=3.5.0->en-core-web-sm==3.5.0) (3.0.9)
Requirement already satisfied: typing-extensions>=3.7.4.3 in e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages (from pydantic!=1.
8,!=1.8.1,<1.11.0,>=1.7.4->spacy<3.6.0,>=3.5.0->en-core-web-sm==3.5.0) (3.7.4.3)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages (from requests<3.0.0,>=
2.13.0->spacy<3.6.0,>=3.5.0->en-core-web-sm==3.5.0) (1.26.12)
Requirement already satisfied: idna<4,>=2.5 in e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages (from requests<3.0.0,>=2.13.0->s
pacy<3.6.0,>=3.5.0->en-core-web-sm==3.5.0) (3.4)
Requirement already satisfied: charset-normalizer<3,>=2 in e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages (from requests<3.0.0
,>=2.13.0->spacy<3.6.0,>=3.5.0->en-core-web-sm==3.5.0) (2.1.1)
Requirement already satisfied: certifi>=2017.4.17 in e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages (from requests<3.0.0,>=2.1
3.0->spacy<3.6.0,>=3.5.0->en-core-web-sm==3.5.0) (2022.12.7)
Requirement already satisfied: blis<0.10.0,>=0.7.8 in e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages (from thinc<8.2.0,>=8.1.0
->spacy<3.6.0,>=3.5.0->en-core-web-sm==3.5.0) (0.9.1)
Requirement already satisfied: confection<1.0.0,>=0.0.1 in e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages (from thinc<8.2.0,>=
8.1.0->spacy<3.6.0,>=3.5.0->en-core-web-sm==3.5.0) (0.0.1)
Requirement already satisfied: colorama in e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages (from tqdm<5.0.0,>=4.38.0->spacy<3.6
.0,>=3.5.0->en-core-web-sm==3.5.0) (0.4.5)
Requirement already satisfied: click<9.0.0,>=7.1.1 in e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages (from typer<0.8.0,>=0.3.0
->spacy<3.6.0,>=3.5.0->en-core-web-sm==3.5.0) (8.1.3)
Requirement already satisfied: MarkupSafe>=2.0 in e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages (from jinja2->spacy<3.6.0,>=3
.5.0->en-core-web-sm==3.5.0) (2.1.1)
WARNING: Ignoring invalid distribution -asa (e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages)
Installing collected packages: en-core-web-sm
WARNING: Ignoring invalid distribution -asa (e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages)
Successfully installed en-core-web-sm-3.5.0
WARNING: Ignoring invalid distribution -asa (e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages)
WARNING: Ignoring invalid distribution -asa (e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages)
WARNING: Ignoring invalid distribution -asa (e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages)
✔ Download and installation successful
You can now load the package via spacy.load(en_core_web_sm)
测试
(Latest_Version_Rasa) D:\\rasa_book_project\\chapter04_Rasa_Search_Movie_Book>python
Python 3.8.16 (default, Jan 17 2023, 22:25:28) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import spacy
2023-02-02 16:21:36.050535: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library cudart64_110.dll; dlerror:
cudart64_110.dll not found
2023-02-02 16:21:36.050809: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your mac
hine.
2023-02-02 16:21:40.853039: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library nvcuda.dll; dlerror: nvcuda
.dll not found
2023-02-02 16:21:40.853471: W tensorflow/stream_executor/cuda/cuda_driver.cc:269] failed call to cuInit: UNKNOWN ERROR (303)
2023-02-02 16:21:40.866010: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:169] retrieving CUDA diagnostic information for host: DESKTOP-NSQ5TAO
2023-02-02 16:21:40.866733: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:176] hostname: DESKTOP-NSQ5TAO
>>> nlp = spacy.load("en_core_web_sm")
>>>
rasa训练仍报错
2023-02-02 16:24:12 WARNING rasa.shared.core.domain - You are using an experiential feature: Action action_query_knowledge_base!
2023-02-02 16:24:12 INFO rasa.nlu.utils.spacy_utils - Trying to load SpaCy model with name en_core_web_md.
Traceback (most recent call last):
File "C:\\Users\\duanzhihua\\AppData\\Roaming\\Python\\Python38\\site-packages\\rasa\\nlu\\utils\\spacy_utils.py", line 93, in load_model
language = spacy.load(spacy_model_name, disable=["parser"])
File "E:\\Users\\duanzhihua\\Anaconda3\\envs\\Latest_Version_Rasa\\lib\\site-packages\\spacy\\__init__.py", line 54, in load
return util.load_model(
File "E:\\Users\\duanzhihua\\Anaconda3\\envs\\Latest_Version_Rasa\\lib\\site-packages\\spacy\\util.py", line 439, in load_model
raise IOError(Errors.E050.format(name=name))
OSError: [E050] Cant find model en_core_web_md. It doesnt seem to be a Python package or a valid path to a data directory.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\\Users\\duanzhihua\\AppData\\Roaming\\Python\\Python38\\site-packages\\rasa\\engine\\graph.py", line 390, in _load_component
self._component: GraphComponent = constructor( # type: ignore[no-redef]
File "C:\\Users\\duanzhihua\\AppData\\Roaming\\Python\\Python38\\site-packages\\rasa\\nlu\\utils\\spacy_utils.py", line 121, in create
model = cls.load_model(spacy_model_name)
File "C:\\Users\\duanzhihua\\AppData\\Roaming\\Python\\Python38\\site-packages\\rasa\\nlu\\utils\\spacy_utils.py", line 96, in load_model
raise InvalidModelError(
rasa.nlu.model.InvalidModelError: Please confirm that en_core_web_md is an available spaCy model. You need to download one upfront. For example:
python -m spacy download en_core_web_md
More informaton can be found on https://rasa.com/docs/rasa/components#spacynlp
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "E:\\Users\\duanzhihua\\Anaconda3\\envs\\Latest_Version_Rasa\\lib\\runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "E:\\Users\\duanzhihua\\Anaconda3\\envs\\Latest_Version_Rasa\\lib\\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "E:\\Users\\duanzhihua\\Anaconda3\\envs\\Latest_Version_Rasa\\Scripts\\rasa.exe\\__main__.py", line 7, in <module>
File "C:\\Users\\duanzhihua\\AppData\\Roaming\\Python\\Python38\\site-packages\\rasa\\__main__.py", line 121, in main
cmdline_arguments.func(cmdline_arguments)
File "C:\\Users\\duanzhihua\\AppData\\Roaming\\Python\\Python38\\site-packages\\rasa\\cli\\train.py", line 59, in <lambda>
train_parser.set_defaults(func=lambda args: run_training(args, can_exit=True))
File "C:\\Users\\duanzhihua\\AppData\\Roaming\\Python\\Python38\\site-packages\\rasa\\cli\\train.py", line 91, in run_training
training_result = train_all(
File "C:\\Users\\duanzhihua\\AppData\\Roaming\\Python\\Python38\\site-packages\\rasa\\api.py", line 105, in train
return train(
File "C:\\Users\\duanzhihua\\AppData\\Roaming\\Python\\Python38\\site-packages\\rasa\\model_training.py", line 160, in train
return _train_graph(
File "C:\\Users\\duanzhihua\\AppData\\Roaming\\Python\\Python38\\site-packages\\rasa\\model_training.py", line 227, in _train_graph
trainer.train(
File "C:\\Users\\duanzhihua\\AppData\\Roaming\\Python\\Python38\\site-packages\\rasa\\engine\\training\\graph_trainer.py", line 105, in train
graph_runner.run(inputs=PLACEHOLDER_IMPORTER: importer)
File "C:\\Users\\duanzhihua\\AppData\\Roaming\\Python\\Python38\\site-packages\\rasa\\engine\\runner\\dask.py", line 101, in run
dask_result = dask.get(run_graph, run_targets)
File "C:\\Users\\duanzhihua\\AppData\\Roaming\\Python\\Python38\\site-packages\\dask\\local.py", line 553, in get_sync
return get_async(
File "C:\\Users\\duanzhihua\\AppData\\Roaming\\Python\\Python38\\site-packages\\dask\\local.py", line 496, in get_async
for key, res_info, failed in queue_get(queue).result():
File "E:\\Users\\duanzhihua\\Anaconda3\\envs\\Latest_Version_Rasa\\lib\\concurrent\\futures\\_base.py", line 437, in result
return self.__get_result()
File "E:\\Users\\duanzhihua\\Anaconda3\\envs\\Latest_Version_Rasa\\lib\\concurrent\\futures\\_base.py", line 389, in __get_result
raise self._exception
File "C:\\Users\\duanzhihua\\AppData\\Roaming\\Python\\Python38\\site-packages\\dask\\local.py", line 538, in submit
fut.set_result(fn(*args, **kwargs))
File "C:\\Users\\duanzhihua\\AppData\\Roaming\\Python\\Python38\\site-packages\\dask\\local.py", line 234, in batch_execute_tasks
return [execute_task(*a) for a in it]
File "C:\\Users\\duanzhihua\\AppData\\Roaming\\Python\\Python38\\site-packages\\dask\\local.py", line 234, in <listcomp>
return [execute_task(*a) for a in it]
File "C:\\Users\\duanzhihua\\AppData\\Roaming\\Python\\Python38\\site-packages\\dask\\local.py", line 225, in execute_task
result = pack_exception(e, dumps)
File "C:\\Users\\duanzhihua\\AppData\\Roaming\\Python\\Python38\\site-packages\\dask\\local.py", line 220, in execute_task
result = _execute_task(task, data)
File "C:\\Users\\duanzhihua\\AppData\\Roaming\\Python\\Python38\\site-packages\\dask\\core.py", line 119, in _execute_task
return func(*(_execute_task(a, cache) for a in args))
File "C:\\Users\\duanzhihua\\AppData\\Roaming\\Python\\Python38\\site-packages\\rasa\\engine\\graph.py", line 445, in __call__
self._load_component(**constructor_kwargs)
File "C:\\Users\\duanzhihua\\AppData\\Roaming\\Python\\Python38\\site-packages\\rasa\\engine\\graph.py", line 402, in _load_component
raise GraphComponentException(
rasa.engine.exceptions.GraphComponentException: Error initializing graph component for node provide_SpacyNLP0
使用pip install https://github.com/explosion/spacy-models/releases/download/en_c
ore_web_sm-3.0.0/en_core_web_sm-3.0.0.tar.gz 安装
(Latest_Version_Rasa) D:\\rasa_book_project\\chapter04_Rasa_Search_Movie_Book>pip install https://github.com/explosion/spacy-models/releases/download/en_c
ore_web_sm-3.0.0/en_core_web_sm-3.0.0.tar.gz
WARNING: Ignoring invalid distribution -asa (e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages)
WARNING: Ignoring invalid distribution -asa (e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages)
Collecting https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-3.0.0/en_core_web_sm-3.0.0.tar.gz
Downloading https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-3.0.0/en_core_web_sm-3.0.0.tar.gz (13.7 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 13.7/13.7 MB 208.9 kB/s eta 0:00:00
Preparing metadata (setup.py) ... done
Collecting spacy<3.1.0,>=3.0.0
Downloading spacy-3.0.9-cp38-cp38-win_amd64.whl (11.5 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 11.5/11.5 MB 345.2 kB/s eta 0:00:00
Requirement already satisfied: setuptools in e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages (from spacy<3.1.0,>=3.0.0->en-core
-web-sm==3.0.0) (65.6.3)
Requirement already satisfied: murmurhash<1.1.0,>=0.28.0 in e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages (from spacy<3.1.0,>
=3.0.0->en-core-web-sm==3.0.0) (1.0.8)
Requirement already satisfied: pathy>=0.3.5 in e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages (from spacy<3.1.0,>=3.0.0->en-co
re-web-sm==3.0.0) (0.10.1)
Requirement already satisfied: srsly<3.0.0,>=2.4.1 in e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages (from spacy<3.1.0,>=3.0.0
->en-core-web-sm==3.0.0) (2.4.4)
Requirement already satisfied: cymem<2.1.0,>=2.0.2 in e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages (from spacy<3.1.0,>=3.0.0
->en-core-web-sm==3.0.0) (2.0.6)
Collecting typer<0.4.0,>=0.3.0
Downloading typer-0.3.2-py3-none-any.whl (21 kB)
Requirement already satisfied: catalogue<2.1.0,>=2.0.4 in e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages (from spacy<3.1.0,>=3
.0.0->en-core-web-sm==3.0.0) (2.0.8)
Collecting thinc<8.1.0,>=8.0.3
Downloading thinc-8.0.17-cp38-cp38-win_amd64.whl (1.1 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.1/1.1 MB 297.8 kB/s eta 0:00:00
Requirement already satisfied: requests<3.0.0,>=2.13.0 in e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages (from spacy<3.1.0,>=3
.0.0->en-core-web-sm==3.0.0) (2.28.1)
Collecting pydantic!=1.8,!=1.8.1,<1.9.0,>=1.7.4
Downloading pydantic-1.8.2-cp38-cp38-win_amd64.whl (2.0 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.0/2.0 MB 429.8 kB/s eta 0:00:00
Requirement already satisfied: preshed<3.1.0,>=3.0.2 in e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages (from spacy<3.1.0,>=3.0
.0->en-core-web-sm==3.0.0) (3.0.7)
Requirement already satisfied: packaging>=20.0 in e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages (from spacy<3.1.0,>=3.0.0->en
-core-web-sm==3.0.0) (20.9)
Collecting blis<0.8.0,>=0.4.0
Downloading blis-0.7.9-cp38-cp38-win_amd64.whl (7.0 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 7.0/7.0 MB 489.9 kB/s eta 0:00:00
Requirement already satisfied: tqdm<5.0.0,>=4.38.0 in e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages (from spacy<3.1.0,>=3.0.0
->en-core-web-sm==3.0.0) (4.64.1)
Requirement already satisfied: jinja2 in e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages (from spacy<3.1.0,>=3.0.0->en-core-web
-sm==3.0.0) (3.1.2)
Requirement already satisfied: wasabi<1.1.0,>=0.8.1 in e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages (from spacy<3.1.0,>=3.0.
0->en-core-web-sm==3.0.0) (0.10.1)
Requirement already satisfied: spacy-legacy<3.1.0,>=3.0.5 in e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages (from spacy<3.1.0,
>=3.0.0->en-core-web-sm==3.0.0) (3.0.12)
Requirement already satisfied: numpy>=1.15.0 in c:\\users\\duanzhihua\\appdata\\roaming\\python\\python38\\site-packages (from spacy<3.1.0,>=3.0.0->en-core-web
-sm==3.0.0) (1.19.5)
Requirement already satisfied: smart-open<7.0.0,>=5.2.1 in e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages (from spacy<3.1.0,>=
3.0.0->en-core-web-sm==3.0.0) (5.2.1)
Requirement already satisfied: pyparsing>=2.0.2 in e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages (from packaging>=20.0->spacy
<3.1.0,>=3.0.0->en-core-web-sm==3.0.0) (3.0.9)
Requirement already satisfied: typing-extensions>=3.7.4.3 in e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages (from pydantic!=1.
8,!=1.8.1,<1.9.0,>=1.7.4->spacy<3.1.0,>=3.0.0->en-core-web-sm==3.0.0) (3.7.4.3)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages (from requests<3.0.0,>=
2.13.0->spacy<3.1.0,>=3.0.0->en-core-web-sm==3.0.0) (1.26.12)
Requirement already satisfied: certifi>=2017.4.17 in e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages (from requests<3.0.0,>=2.1
3.0->spacy<3.1.0,>=3.0.0->en-core-web-sm==3.0.0) (2022.12.7)
Requirement already satisfied: charset-normalizer<3,>=2 in e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages (from requests<3.0.0
,>=2.13.0->spacy<3.1.0,>=3.0.0->en-core-web-sm==3.0.0) (2.1.1)
Requirement already satisfied: idna<4,>=2.5 in e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages (from requests<3.0.0,>=2.13.0->s
pacy<3.1.0,>=3.0.0->en-core-web-sm==3.0.0) (3.4)
Requirement already satisfied: colorama in e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages (from tqdm<5.0.0,>=4.38.0->spacy<3.1
.0,>=3.0.0->en-core-web-sm==3.0.0) (0.4.5)
Collecting click<7.2.0,>=7.1.1
Downloading click-7.1.2-py2.py3-none-any.whl (82 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 82.8/82.8 kB 421.7 kB/s eta 0:00:00
Requirement already satisfied: MarkupSafe>=2.0 in e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages (from jinja2->spacy<3.1.0,>=3
.0.0->en-core-web-sm==3.0.0) (2.1.1)
Building wheels for collected packages: en-core-web-sm
Building wheel for en-core-web-sm (setup.py) ... done
Created wheel for en-core-web-sm: filename=en_core_web_sm-3.0.0-py3-none-any.whl size=13704307 sha256=66c675395fce07125d03509e4c5167bc4bef7e5c5afcfb51
77c639ac60bc7df5
Stored in directory: c:\\users\\duanzhihua\\appdata\\local\\pip\\cache\\wheels\\8b\\21\\c1\\257748af7399fdaf1b2afc39c92fb839c436f42e67b656ff7e
Successfully built en-core-web-sm
WARNING: Ignoring invalid distribution -asa (e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages)
Installing collected packages: pydantic, click, blis, typer, thinc, spacy, en-core-web-sm
Attempting uninstall: pydantic
WARNING: Ignoring invalid distribution -asa (e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages)
Found existing installation: pydantic 1.9.2
Uninstalling pydantic-1.9.2:
Successfully uninstalled pydantic-1.9.2
Attempting uninstall: click
WARNING: Ignoring invalid distribution -asa (e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages)
Found existing installation: click 8.1.3
Uninstalling click-8.1.3:
Successfully uninstalled click-8.1.3
Attempting uninstall: blis
WARNING: Ignoring invalid distribution -asa (e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages)
Found existing installation: blis 0.9.1
Uninstalling blis-0.9.1:
Successfully uninstalled blis-0.9.1
Attempting uninstall: typer
WARNING: Ignoring invalid distribution -asa (e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages)
Found existing installation: typer 0.4.2
Uninstalling typer-0.4.2:
Successfully uninstalled typer-0.4.2
Attempting uninstall: thinc
WARNING: Ignoring invalid distribution -asa (e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages)
Found existing installation: thinc 8.1.1
Uninstalling thinc-8.1.1:
Successfully uninstalled thinc-8.1.1
Attempting uninstall: spacy
WARNING: Ignoring invalid distribution -asa (e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages)
Found existing installation: spacy 3.5.0
Uninstalling spacy-3.5.0:
Successfully uninstalled spacy-3.5.0
Attempting uninstall: en-core-web-sm
WARNING: Ignoring invalid distribution -asa (e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages)
Found existing installation: en-core-web-sm 3.5.0
Uninstalling en-core-web-sm-3.5.0:
Successfully uninstalled en-core-web-sm-3.5.0
WARNING: Ignoring invalid distribution -asa (e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages)
WARNING: Ignoring invalid distribution -asa (e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages)
WARNING: Ignoring invalid distribution -asa (e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages)
WARNING: Ignoring invalid distribution -asa (e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages)
WARNING: Ignoring invalid distribution -asa (e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages)
WARNING: Ignoring invalid distribution -asa (e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages)
WARNING: Ignoring invalid distribution -asa (e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages)
ERROR: pips dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following
dependency conflicts.
flask 2.2.2 requires click>=8.0, but you have click 7.1.2 which is incompatible.
Successfully installed blis-0.7.9 click-7.1.2 en-core-web-sm-3.0.0 pydantic-1.8.2 spacy-3.0.9 thinc-8.0.17 typer-0.3.2
WARNING: Ignoring invalid distribution -asa (e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages)
WARNING: Ignoring invalid distribution -asa (e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages)
WARNING: Ignoring invalid distribution -asa (e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages)
仍报错:
改用pip install https://github.com/explosion/spacy-models/releases/download/en_core_web_md-3.0.0/en_core_web_md-3.0.0.tar.gz 安装
(Latest_Version_Rasa) D:\\rasa_book_project\\chapter04_Rasa_Search_Movie_Book>pip install https://github.com/explosion/spacy-models/releases/download/en_c
ore_web_md-3.0.0/en_core_web_md-3.0.0.tar.gz
WARNING: Ignoring invalid distribution -asa (e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages)
WARNING: Ignoring invalid distribution -asa (e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages)
Collecting https://github.com/explosion/spacy-models/releases/download/en_core_web_md-3.0.0/en_core_web_md-3.0.0.tar.gz
Downloading https://github.com/explosion/spacy-models/releases/download/en_core_web_md-3.0.0/en_core_web_md-3.0.0.tar.gz (47.0 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 47.0/47.0 MB 345.7 kB/s eta 0:00:00
Preparing metadata (setup.py) ... done
Requirement already satisfied: spacy<3.1.0,>=3.0.0 in e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages (from en-core-web-md==3.0
.0) (3.0.9)
Requirement already satisfied: smart-open<7.0.0,>=5.2.1 in e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages (from spacy<3.1.0,>=
3.0.0->en-core-web-md==3.0.0) (5.2.1)
Requirement already satisfied: spacy-legacy<3.1.0,>=3.0.5 in e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages (from spacy<3.1.0,
>=3.0.0->en-core-web-md==3.0.0) (3.0.12)
Requirement already satisfied: thinc<8.1.0,>=8.0.3 in e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages (from spacy<3.1.0,>=3.0.0
->en-core-web-md==3.0.0) (8.0.17)
Requirement already satisfied: requests<3.0.0,>=2.13.0 in e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages (from spacy<3.1.0,>=3
.0.0->en-core-web-md==3.0.0) (2.28.1)
Requirement already satisfied: tqdm<5.0.0,>=4.38.0 in e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages (from spacy<3.1.0,>=3.0.0
->en-core-web-md==3.0.0) (4.64.1)
Requirement already satisfied: murmurhash<1.1.0,>=0.28.0 in e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages (from spacy<3.1.0,>
=3.0.0->en-core-web-md==3.0.0) (1.0.8)
Requirement already satisfied: pydantic!=1.8,!=1.8.1,<1.9.0,>=1.7.4 in e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages (from sp
acy<3.1.0,>=3.0.0->en-core-web-md==3.0.0) (1.8.2)
Requirement already satisfied: blis<0.8.0,>=0.4.0 in e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages (from spacy<3.1.0,>=3.0.0-
>en-core-web-md==3.0.0) (0.7.9)
Requirement already satisfied: pathy>=0.3.5 in e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages (from spacy<3.1.0,>=3.0.0->en-co
re-web-md==3.0.0) (0.10.1)
Requirement already satisfied: preshed<3.1.0,>=3.0.2 in e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages (from spacy<3.1.0,>=3.0
.0->en-core-web-md==3.0.0) (3.0.7)
Requirement already satisfied: cymem<2.1.0,>=2.0.2 in e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages (from spacy<3.1.0,>=3.0.0
->en-core-web-md==3.0.0) (2.0.6)
Requirement already satisfied: jinja2 in e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages (from spacy<3.1.0,>=3.0.0->en-core-web
-md==3.0.0) (3.1.2)
Requirement already satisfied: packaging>=20.0 in e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages (from spacy<3.1.0,>=3.0.0->en
-core-web-md==3.0.0) (20.9)
Requirement already satisfied: typer<0.4.0,>=0.3.0 in e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages (from spacy<3.1.0,>=3.0.0
->en-core-web-md==3.0.0) (0.3.2)
Requirement already satisfied: catalogue<2.1.0,>=2.0.4 in e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages (from spacy<3.1.0,>=3
.0.0->en-core-web-md==3.0.0) (2.0.8)
Requirement already satisfied: srsly<3.0.0,>=2.4.1 in e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages (from spacy<3.1.0,>=3.0.0
->en-core-web-md==3.0.0) (2.4.4)
Requirement already satisfied: numpy>=1.15.0 in c:\\users\\duanzhihua\\appdata\\roaming\\python\\python38\\site-packages (from spacy<3.1.0,>=3.0.0->en-core-web
-md==3.0.0) (1.19.5)
Requirement already satisfied: setuptools in e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages (from spacy<3.1.0,>=3.0.0->en-core
-web-md==3.0.0) (65.6.3)
Requirement already satisfied: wasabi<1.1.0,>=0.8.1 in e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages (from spacy<3.1.0,>=3.0.
0->en-core-web-md==3.0.0) (0.10.1)
Requirement already satisfied: pyparsing>=2.0.2 in e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages (from packaging>=20.0->spacy
<3.1.0,>=3.0.0->en-core-web-md==3.0.0) (3.0.9)
Requirement already satisfied: typing-extensions>=3.7.4.3 in e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages (from pydantic!=1.
8,!=1.8.1,<1.9.0,>=1.7.4->spacy<3.1.0,>=3.0.0->en-core-web-md==3.0.0) (3.7.4.3)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages (from requests<3.0.0,>=
2.13.0->spacy<3.1.0,>=3.0.0->en-core-web-md==3.0.0) (1.26.12)
Requirement already satisfied: certifi>=2017.4.17 in e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages (from requests<3.0.0,>=2.1
3.0->spacy<3.1.0,>=3.0.0->en-core-web-md==3.0.0) (2022.12.7)
Requirement already satisfied: charset-normalizer<3,>=2 in e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages (from requests<3.0.0
,>=2.13.0->spacy<3.1.0,>=3.0.0->en-core-web-md==3.0.0) (2.1.1)
Requirement already satisfied: idna<4,>=2.5 in e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages (from requests<3.0.0,>=2.13.0->s
pacy<3.1.0,>=3.0.0->en-core-web-md==3.0.0) (3.4)
Requirement already satisfied: colorama in e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages (from tqdm<5.0.0,>=4.38.0->spacy<3.1
.0,>=3.0.0->en-core-web-md==3.0.0) (0.4.5)
Requirement already satisfied: click<7.2.0,>=7.1.1 in e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages (from typer<0.4.0,>=0.3.0
->spacy<3.1.0,>=3.0.0->en-core-web-md==3.0.0) (7.1.2)
Requirement already satisfied: MarkupSafe>=2.0 in e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages (from jinja2->spacy<3.1.0,>=3
.0.0->en-core-web-md==3.0.0) (2.1.1)
Building wheels for collected packages: en-core-web-md
Building wheel for en-core-web-md (setup.py) ... done
Created wheel for en-core-web-md: filename=en_core_web_md-3.0.0-py3-none-any.whl size=47053311 sha256=639103f34db0e345682928899364ab49956495c0e7440937
58973e4821f84009
Stored in directory: c:\\users\\duanzhihua\\appdata\\local\\pip\\cache\\wheels\\4f\\95\\56\\2ef26c6817cdcaebbee016b4f6a3c68af10bb74b20c54f976c
Successfully built en-core-web-md
WARNING: Ignoring invalid distribution -asa (e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages)
Installing collected packages: en-core-web-md
WARNING: Ignoring invalid distribution -asa (e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages)
Successfully installed en-core-web-md-3.0.0
WARNING: Ignoring invalid distribution -asa (e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages)
WARNING: Ignoring invalid distribution -asa (e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages)
WARNING: Ignoring invalid distribution -asa (e:\\users\\duanzhihua\\anaconda3\\envs\\latest_version_rasa\\lib\\site-packages)
rasa训练成功:
(Latest_Version_Rasa) D:\\rasa_book_project\\chapter04_Rasa_Search_Movie_Book>rasa train
E:\\Users\\duanzhihua\\Anaconda3\\envs\\Latest_Version_Rasa\\lib\\site-packages\\slack\\deprecation.py:14: UserWarning: slack package is deprecated. Please use s
lack_sdk.web/webhook/rtm package instead. For more info, go to https://slack.dev/python-slack-sdk/v3-migration/
warnings.warn(message)
2023-02-02 17:05:41 WARNING rasa.shared.core.domain - You are using an experiential feature: Action action_query_knowledge_base!
C:\\Users\\duanzhihua\\AppData\\Roaming\\Python\\Python38\\site-packages\\rasa\\shared\\utils\\io.py:99: UserWarning: Found inconsistent entity synonyms while read
ing markdown, overwriting something->book with something->movie during merge.
2023-02-02 17:05:42 WARNING rasa.shared.core.domain - You are using an experiential feature: Action action_query_knowledge_base!
2023-02-02 17:05:47 WARNING rasa.shared.core.domain - You are using an experiential feature: Action action_query_knowledge_base!
2023-02-02 17:05:47 WARNING rasa.shared.core.domain - You are using an experiential feature: Action action_query_knowledge_base!
2023-02-02 17:05:47 WARNING rasa.shared.core.domain - You are using an experiential feature: Action action_query_knowledge_base!
2023-02-02 17:05:48 INFO rasa.nlu.utils.spacy_utils - Trying to load SpaCy model with name en_core_web_md.
2023-02-02 17:05:49 INFO rasa.nlu.utils.spacy_utils - Trying to load SpaCy model with name en_core_web_md.
2023-02-02 17:05:51 INFO rasa.engine.training.hooks - Starting to train component RegexFeaturizer.
2023-02-02 17:05:51 INFO rasa.engine.training.hooks - Finished training component RegexFeaturizer.
2023-02-02 17:05:51 INFO rasa.engine.training.hooks - Starting to train component LexicalSyntacticFeaturizer.
2023-02-02 17:05:51 INFO rasa.engine.training.hooks - Finished training component LexicalSyntacticFeaturizer.
2023-02-02 17:05:51 INFO rasa.engine.training.hooks - Starting to train component CountVectorsFeaturizer.
2023-02-02 17:05:51 INFO rasa.nlu.featurizers.sparse_featurizer.count_vectors_featurizer - 162 vocabulary items were created for text attribute.
2023-02-02 17:05:51 INFO rasa.engine.training.hooks - Finished training component CountVectorsFeaturizer.
2023-02-02 17:05:52 INFO rasa.engine.training.hooks - Starting to train component CountVectorsFeaturizer.
2023-02-02 17:05:52 INFO rasa.nlu.featurizers.sparse_featurizer.count_vectors_featurizer - 1528 vocabulary items were created for text attribute.
2023-02-02 17:05:52 INFO rasa.engine.training.hooks - Finished training component CountVectorsFeaturizer.
2023-02-02 17:05:52 INFO rasa.engine.training.hooks - Starting to train component DIETClassifier.
C:\\Users\\duanzhihua\\AppData\\Roaming\\Python\\Python38\\site-packages\\rasa\\utils\\train_utils.py:527: UserWarning: constrain_similarities is set to `False`.
It is recommended to set it to `True` when using cross-entropy loss.
rasa.shared.utils.io.raise_warning(
Epochs: 100%|███████████████████████████████████████████████████████████| 100/100 [01:27<00:00, 1.14it/s, t_loss=2.4, i_acc=1, e_f1=0.952, r_f1=0.795]
2023-02-02 17:07:21 INFO rasa.engine.training.hooks - Finished training component DIETClassifier.
2023-02-02 17:07:21 INFO rasa.engine.training.hooks - Starting to train component EntitySynonymMapper.
C:\\Users\\duanzhihua\\AppData\\Roaming\\Python\\Python38\\site-packages\\rasa\\shared\\utils\\io.py:99: UserWarning: Found conflicting synonym definitions for so
mething. Overwriting target movie with book. Check your training data and remove conflicting synonym definitions to prevent this from happening.
More info at https://rasa.com/docs/rasa/training-data-format#synonyms
C:\\Users\\duanzhihua\\AppData\\Roaming\\Python\\Python38\\site-packages\\rasa\\shared\\utils\\io.py:99: UserWarning: Found conflicting synonym definitions for so
mething. Overwriting target book with movie. Check your training data and remove conflicting synonym definitions to prevent this from happening.
More info at https://rasa.com/docs/rasa/training-data-format#synonyms
2023-02-02 17:07:21 INFO rasa.engine.training.hooks - Finished training component EntitySynonymMapper.
2023-02-02 17:07:22 INFO rasa.engine.training.hooks - Starting to train component ResponseSelector.
2023-02-02 17:07:22 INFO rasa.nlu.selectors.response_selector - Retrieval intent parameter was left to its default value. This response selector wi
ll be trained on training examples combining all retrieval intents.
2023-02-02 17:07:22 INFO rasa.engine.training.hooks - Finished training component ResponseSelector.
Processed story blocks: 100%|█████████████████████████████████████████████████████████████████████████████| 7/7 [00:00<00:00, 987.86it/s, # trackers=1]
Processed story blocks: 100%|█████████████████████████████████████████████████████████████████████████████| 7/7 [00:00<00:00, 214.46it/s, # trackers=7]
Processed story blocks: 100%|█████████████████████████████████████████████████████████████████████████████| 7/7 [00:00<00:00, 30.25it/s, # trackers=50]
Processed story blocks: 100%|█████████████████████████████████████████████████████████████████████████████| 7/7 [00:00<00:00, 24.20it/s, # trackers=50]
Processed rules: 100%|███████████████████████████████████████████████████████████████████████████████████| 5/5 [00:00<00:00, 1404.56it/s, # trackers=1]
2023-02-02 17:07:24 INFO rasa.engine.training.hooks - Starting to train component RulePolicy.
Processed trackers: 100%|█████████████████████████████████████████████████████████████████████████████████| 5/5 [00:00<00:00, 1252.33it/s, # action=11]
Processed actions: 11it [00:00, 4509.56it/s, # examples=10]
Processed trackers: 100%|██████████████████████████████████████████████████████████████████████████████████| 7/7 [00:00<00:00, 874.65it/s, # action=27]
Processed trackers: 100%|██████████████████████████████████████████████████████████████████████████████████████████████| 5/5 [00:00<00:00, 1671.44it/s]
Processed trackers: 100%|████████████████████████████████████████████████████████████████████████████████████████████| 12/12 [00:00<00:00, 1094.38it/s]
2023-02-02 17:07:25 INFO rasa.engine.training.hooks - Finished training component RulePolicy.
Your Rasa model is trained and saved at models\\20230202-170546-blistering-canvas.tar.gz.
(Latest_Version_Rasa) D:\\rasa_book_project\\chapter04_Rasa_Search_Movie_Book>
javascript:void(0)
Rasa 智能对话机器人系列博客
- Rasa 3.x 学习系列-Rasa 3.1+ ElasticSearch 8.2.0 对话机器人实战 一
- Rasa 3.x 学习系列-Rasa 3.1+ ElasticSearch 8.2.0 对话机器人实战二
- Rasa 3.x 学习系列-Rasa 3.1+ ElasticSearch 8.2.0 对话机器人实战三
- Rasa 3.x 学习系列-Rasa 3.1+ ElasticSearch 8.2.0 对话机器人实战四
- Rasa 3.x 学习系列-Rasa 3.1+ ElasticSearch 8.2.0 对话机器人实战五
- Rasa 3.x 学习系列-Rasa 3.1+ ElasticSearch 8.2.0 对话机器人实战六
- Rasa 3.x 学习系列-Rasa 3.1+ ElasticSearch 8.2.0 对话机器人实战七
rasa学习
一、 什么是rasa
Rasa是一个用于自动文本和基于语音的对话的开源机器学习框架。了解消息,保持对话以及连接到消息传递通道和API
官方推荐安装方式(安装rasa和easa X):
pip install rasa-x --extra-index-url https://pypi.rasa.com/simple
如果您不想使用Rasa X,请改为运行
pip install rasa
注意:
如果你想确保为你可能需要的任何组件安装了依赖项,并且你不介意附加的依赖项,你可以使用以下代码安装一切
pip install -r alt_requirements/requirements_full.txt
二、创建一个新项目
1. 创建rasa项目
rasa init --no-prompt
该命令创建Rasa项目所需的所有文件。如果你遗漏了旗帜,你会被问到一些关于你希望如何设置项目的问题。
会创建以下文件:
__init__.py 一个帮助python找到你动作的空文件 actions.py 自定义操作的代码 config.yml ‘*‘ 配置NLU和Core型号 credentials.yml 连接其他服务的详细信息 data/nlu.md ‘*‘ 你的NLU训练数据 data/stories.md ‘*‘ 你的故事 domain.yml ‘*‘ 你助手的域名 endpoints.yml 连接到fb messenger等频道的详细信息 models/<timestamp>.tar.gz 你的初始模型
要检查是否已创建所有文件,请运行:
ls -l
2. 定义一个域
domain.yml文件
intents 你期望用户说的东西。
entities 您想要从消息中提取的信息片段。
actions 你的机器人可以做和说的东西
slots 在会话期间跟踪的信息(例如用户年龄)
templates 你的机器人可以说的东西的模板字符串
intents: - greet - goodbye - mood_affirm - mood_deny - mood_great - mood_unhappy actions: - utter_greet - utter_cheer_up - utter_did_that_help - utter_happy - utter_goodbye templates: utter_greet: - text: "Hey! How are you?" buttons: - title: "great" payload: "great" - title: "super sad" payload: "super sad" utter_cheer_up: - text: "Here is something to cheer you up:" image: "https://i.imgur.com/nGF1K8f.jpg" utter_did_that_help: - text: "Did that help you?" utter_happy: - text: "Great carry on!" utter_goodbye: - text: "Bye"
Rasa Core取intent,entities以及内部的对话状态,并且选择的所述一个actions应该下一个执行。如果该动作只是向用户说明,Rasa将在域中查找匹配模板(动作名称等于完全模板, utter_greet如上例所示),填写所有变量并进行响应。对于不仅仅发送消息的操作,您可以将它们定义为python类,并通过它们的模块路径在域中引用它们。
3. 定义一个解释器
解释器负责解析消息。它执行自然语言理解(NLU)并将消息转换为结构化输出。在这个例子中,我们将使用Rasa NLU来达到这个目的。
在Rasa NLU中,我们需要定义我们的机器人应该能够以Rasa NLU训练数据格式处理的用户消息。在本教程中,我们将使用Markdown格式来获取NLU训练数据。我们来创建一些意图示例data/nlu.md:
## intent:greet - hey - hello - hi - hello there - good morning - good evening - moin - hey there - let‘s go - hey dude - goodmorning - goodevening - good afternoon ## intent:goodbye - cu - good by - cee you later - good night - good afternoon - bye - goodbye - have a nice day - see you around - bye bye - see you later ## intent:mood_affirm - yes - indeed - of course - that sounds good - correct ## intent:mood_deny - no - never - I don‘t think so - don‘t like that - no way ## intent:mood_great - perfect - very good - great - amazing - feeling like a king - wonderful - I am feeling very good - I am great - I am amazing - I am going to save the world - super - extremely good - so so perfect - so good - so perfect ## intent:mood_unhappy - my day was horrible - I am sad - I don‘t feel very well - I am disappointed - super sad - I‘m so sad - sad - very sad - unhappy - not so good - not very good - extremly sad - so saad - so sad
我们现在可以使用我们的示例来训练NLU模型(确保首先 安装Rasa NLU 以及 spaCy)
4. 定义故事
到目前为止,我们已经有了一个NLU模型,一个定义我们的机器人可以采取的动作的域以及它应该处理的输入(意图和实体)。我们仍然错过了中心部分,故事告诉我们的机器人在对话的哪一点做什么。
一个故事是,对话系统训练数据样本。有两种不同的方式来创建故事(你可以混合它们):
- 手动创建故事,直接将它们写入文件
- 使用交互式学习创建故事。
我们将通过直接写入故事来创建故事stories.md。故事以##一个字符串作为标识符开始。用户操作以星号开头,机器人操作由以短划线开头的行指定。故事的结尾用换行符表示。
## happy path <!-- name of the story - just for debugging --> * greet - utter_greet * mood_great <!-- user utterance, in format _intent[entities] --> - utter_happy ## sad path 1 <!-- this is already the start of the next story --> * greet - utter_greet <!-- action of the bot to execute --> * mood_unhappy - utter_cheer_up - utter_did_that_help * mood_affirm - utter_happy ## sad path 2 * greet - utter_greet * mood_unhappy - utter_cheer_up - utter_did_that_help * mood_deny - utter_goodbye ## say goodbye * goodbye - utter_goodbye
请注意,虽然直接用手写故事比使用交互式学习要快得多,但在使用插槽时需要特别小心,因为它们需要在故事中正确设置
5. 命令
rasa init 使用示例训练数据,操作和配置文件创建新项目。
rasa train 使用您的NLU数据和故事训练模型,保存训练有素的模型./models。
rasa interactive 启动交互式学习会话,通过聊天创建新的培训数据。
rasa shell 加载训练有素的模型,并让您在命令行上与助手交谈。
rasa run 使用训练有素的模型启动Rasa服务器。有关详细信息,请参阅运行服务器文档。
rasa run actions 使用Rasa SDK启动操作服务器。
rasa visualize 可视化故事。
rasa test 使用您的测试NLU数据和故事测试训练有素的Rasa模型。
rasa data split nlu 根据指定的百分比执行NLU数据的拆分。
rasa data convert nlu 在不同格式之间转换NLU训练数据。
rasa -h 显示所有可用命令。
以上是关于Rasa 3.x 学习系列-Rasa 3.1+ ElasticSearch 7.15.0 对话机器人实战八 Elasticsearch 可视化及SpacyNLP安装部署的主要内容,如果未能解决你的问题,请参考以下文章
Transformer课程 业务对话机器人Rasa 3.x 持续集成 和持续部署
Gavin老师Transformer直播课感悟 - Rasa对话机器人项目实战之教育领域Education Bot项目架构运行测试流程分析及Rasa interactive实验分析(六十)