Rasa课程、Rasa培训、Rasa面试、Rasa实战系列之Docker Tracker Store Redis服务部署
Redis 是一种内存数据结构存储,用作分布式内存 键值 数据库、缓存和消息代理, Redis 支持不同类型的抽象数据结构,例如字符串、列表、映射、集合、排序集、 位图、 空间索引。本文使用Redis服务部署Rasa Track Store及Rasa Lock Store。
查询Redis下载地址
https://hub.docker.com/_/redis
安装redis服务
(base) [root@localhost ~]# conda env list
# conda environments:
#
base * /root/anaconda
rasa_2816_env /root/anaconda/envs/rasa_2816_env
(base) [root@localhost ~]#
(base) [root@localhost ~]# source deactivate base
DeprecationWarning: 'source deactivate' is deprecated. Use 'conda deactivate'.
安装redis
docker pull redis
[root@localhost ~]# docker pull redis
Using default tag: latest
latest: Pulling from library/redis
a2abf6c4d29d: Already exists
c7a4e4382001: Pull complete
4044b9ba67c9: Pull complete 。。。
Digest: sha256:db485f2e245b5b3329fdc7eff4eb00f913e09d8feb9ca720788059fdc2ed8339
Status: Downloaded newer image for redis:latest
docker.io/library/redis:latest
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
nginx latest 605c77e624dd 3 months ago 141MB
redis latest 7614ae9453d1 4 months ago 113MB
rasa/duckling latest 49acc1a38992 6 months ago 165MB
[root@localhost ~]#
启动Redis
[root@localhost ~]# docker run --name=my_rasa_redis -d --restart=always -p 6379:6379 redis
674158b6b7b188d750b5257a42909b31be3a3395ef7f5633767f120bb2e72c1d
[root@localhost ~]#
redis部署成功
[root@localhost ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
674158b6b7b1 redis "docker-entrypoint.s…" 41 seconds ago Up 40 seconds 0.0.0.0:6379->6379/tcp, :::6379->6379/tcp my_rasa_redis
22e4bb6c4929 nginx "/docker-entrypoint.…" 3 weeks ago Up 9 minutes 0.0.0.0:88->80/tcp, :::88->80/tcp mynginx
9ab047feff74 rasa/duckling "duckling-example-ex…" 3 weeks ago Up 9 minutes 0.0.0.0:8000->8000/tcp, :::8000->8000/tcp my_rasa_duckling
测试redis链接,测试成功
[root@localhost ~]# docker exec -it my_rasa_redis /bin/bash
root@674158b6b7b1:/data# redis-cli
127.0.0.1:6379>
127.0.0.1:6379>
127.0.0.1:6379>
root@674158b6b7b1:/data# ls
root@674158b6b7b1:/data# pwd
/data
root@674158b6b7b1:/data# ls
root@674158b6b7b1:/data#
Track Store:使用redis的第1个数据库
tracker_store:
type: redis
# url: localhost 192.168.28.6
url: 192.168.28.6
port: 6379
db: 1
password:
Rasa配置Redis Lock Store服务器
Lock Store :使用redis的第0个数据库
lock_store:
type: redis
url: 192.168.28.6
port: 6379
password:
db: 0
key_prefix: rasa
Rasa Redis 运行效果
运行脚本:select 1 选择track store 数据库:
运行脚本:keys * 查询keys的值
127.0.0.1:6379[1]> select 1
OK
127.0.0.1:6379[1]> keys *
tracker:562b38aacc364ded849b929757368fb9
tracker:52bb8a257a9c44508e6dd3d7e99dc502
tracker:361650eb22d6416ebee86b995311de9f
127.0.0.1:6379[1]>
获取key对应的值
{
"events": [{
"event": "action",
"timestamp": 1650872076.3043623,
"metadata": {
"model_id": "27bdda6c44024b83a230a16cb66663b5"
},
"name": "action_session_start",
"policy": null,
"confidence": 1.0,
"action_text": null,
"hide_rule_turn": false
}, {
"event": "session_started",
"timestamp": 1650872076.3063557,
"metadata": {
"model_id": "27bdda6c44024b83a230a16cb66663b5"
}
}, {
"event": "action",
"timestamp": 1650872076.3063557,
"metadata": {
"model_id": "27bdda6c44024b83a230a16cb66663b5"
},
"name": "action_listen",
"policy": null,
"confidence": null,
"action_text": null,
"hide_rule_turn": false
}, {
"event": "user",
"timestamp": 1650872078.3421326,
"metadata": {
"model_id": "27bdda6c44024b83a230a16cb66663b5"
},
"text": "hello",
"parse_data": {
"intent": {
"name": "greet",
"confidence": 0.9999662637710571
},
"entities": [],
"text": "hello",
"message_id": "1a49f34fa81046f7960706962e4bb3ec",
"metadata": {},
"text_tokens": [
[0, 5]
],
"intent_ranking": [{
"name": "greet",
"confidence": 0.9999662637710571
}, {
"name": "goodbye",
"confidence": 1.8412820281810127e-05
}, {
"name": "image_route_diagnosis_query",
"confidence": 6.356640824378701e-06
}, {
"name": "out_of_scope",
"confidence": 4.309453288442455e-06
}, {
"name": "image_file_name",
"confidence": 4.0408276618109085e-06
}, {
"name": "chitchat",
"confidence": 7.444671723533247e-07
}],
"response_selector": {
"all_retrieval_intents": ["chitchat"],
"default": {
"response": {
"responses": [{
"text": "你好,我是TeleBot机器人,一个专注路由图像故障诊断定位的对话机器人。"
}],
"confidence": 1.0,
"intent_response_key": "chitchat/whoyouare",
"utter_action": "utter_chitchat/whoyouare"
},
"ranking": [{
"confidence": 1.0,
"intent_response_key": "chitchat/whoyouare"
}, {
"confidence": 1.7017569575727975e-09,
"intent_response_key": "chitchat/whatyoucando"
}]
}
}
},
"input_channel": "cmdline",
"message_id": "1a49f34fa81046f7960706962e4bb3ec"
}, {
"event": "user_featurization",
"timestamp": 1650872078.4045298,
"metadata": {
"model_id": "27bdda6c44024b83a230a16cb66663b5"
},
"use_text_for_featurization": false
}, {
"event": "action",
"timestamp": 1650872078.4045298,
"metadata": {
"model_id": "27bdda6c44024b83a230a16cb66663b5"
},
"name": "utter_greet",
"policy": "RulePolicy",
"confidence": 1.0,
"action_text": null,
"hide_rule_turn": false
}, {
"event": "bot",
"timestamp": 1650872078.4065237,
"metadata": {
"utter_action": "utter_greet",
"model_id": "27bdda6c44024b83a230a16cb66663b5"
},
"text": "你好,我是TeleBot,我可以帮你诊断路由故障信息!。你可以对我说「请诊断一下路由图像的故障信息」",
"data": {
"elements": null,
"quick_replies": null,
"buttons": null,
"attachment": null,
"image": null,
"custom": null
}
}, {
"event": "action",
"timestamp": 1650872078.4464154,
"metadata": {
"model_id": "27bdda6c44024b83a230a16cb66663b5"
},
"name": "action_listen",
"policy": "RulePolicy",
"confidence": 1.0,
"action_text": null,
"hide_rule_turn": false
}, {
"event": "user",
"timestamp": 1650872090.9422488,
"metadata": {
"model_id": "27bdda6c44024b83a230a16cb66663b5"
},
"text": "请诊断一下路由图像",
"parse_data": {
"intent": {
"name": "image_route_diagnosis_query",
"confidence": 0.9999964237213135
},
"entities": [],
"text": "请诊断一下路由图像",
"message_id": "e38f159047ff475fb4243c196ba0801e",
"metadata": {},
"text_tokens": [
[0, 1],
.......
],
"intent_ranking": [{
"name": "image_route_diagnosis_query",
"confidence": 0.9999964237213135
}, {
"name": "greet",
"confidence": 2.3633494947716827e-06
}, {
"name": "image_file_name",
"confidence": 8.946989282776485e-07
}, {
"name": "chitchat",
"confidence": 1.8596077211441298e-07
}, {
"name": "goodbye",
"confidence": 1.0685715778890881e-07
}, {
"name": "out_of_scope",
"confidence": 1.1204789096552759e-08
}],
"response_selector": {
"all_retrieval_intents": ["chitchat"],
"default": {
"response": {
"responses": [{
"text": "你好,我是TeleBot机器人,一个专注路由图像故障诊断定位的对话机器人。"
}],
"confidence": 1.0,
"intent_response_key": "chitchat/whoyouare",
"utter_action": "utter_chitchat/whoyouare"
},
"ranking": [{
"confidence": 1.0,
"intent_response_key": "chitchat/whoyouare"
}, {
"confidence": 0.0,
"intent_response_key": "chitchat/whatyoucando"
}]
}
}
},
"input_channel": "cmdline",
"message_id": "e38f159047ff475fb4243c196ba0801e"
}, {
"event": "user_featurization",
"timestamp": 1650872091.0290265,
"metadata": {
"model_id": "27bdda6c44024b83a230a16cb66663b5"
},
"use_text_for_featurization": false
}, {
"event": "action",
"timestamp": 1650872091.0290265,
"metadata": {
"model_id": "27bdda6c44024b83a230a16cb66663b5"
},
"name": "image_encryption_form",
"policy": "AugmentedMemoizationPolicy",
"confidence": 1.0,
"action_text": null,
"hide_rule_turn": false
}, {
"event": "active_loop",
"timestamp": 1650872091.0310218,
"metadata": {
"model_id": "27bdda6c44024b83a230a16cb66663b5"
},
"name": "image_encryption_form"
}, {
"event": "slot",
"timestamp": 1650872091.0310218,
"metadata": {
"model_id": "27bdda6c44024b83a230a16cb66663b5"
},
"name": "requested_slot",
"value": "image_encryption_slot"
}, {
"event": "bot",
"timestamp": 1650872091.0310218,
"metadata": {
"utter_action": "utter_ask_image_encryption_form_image_encryption_slot",
"model_id": "27bdda6c44024b83a230a16cb66663b5"
},
"text": "请上传路由图片![utter_ask_form_slot]",
"data": {
"elements": null,
"quick_replies": null,
"buttons": null,
"attachment": null,
"image": null,
"custom": null
}
}, {
"event": "action",
"timestamp": 1650872091.0764616,
"metadata": {
"model_id": "27bdda6c44024b83a230a16cb66663b5"
},
"name": "action_listen",
"policy": "RulePolicy",
"confidence": 1.0,
"action_text": null,
"hide_rule_turn": false
}, {
"event": "user",
"timestamp": 1650873227.1691988,
"metadata": {
"model_id": "27bdda6c44024b83a230a16cb66663b5"
},
"text": "/restart",
"parse_data": {
"intent": {
"name": "restart",
"confidence": 1.0
},
"entities": [],
"text": "/restart",
"message_id": "0db4d76bb05e4e8da01b2de1015a64ed",
"metadata": {},
"intent_ranking": [{
"name": "restart",
"confidence": 1.0
}]
},
"input_channel": "cmdline",
"message_id": "0db4d76bb05e4e8da01b2de1015a64ed"
}, {
"event": "user_featurization",
"timestamp": 1650873227.2462513,
"metadata": {
"model_id": "27bdda6c44024b83a230a16cb66663b5"
},
"use_text_for_featurization": false
}, {
"event": "action",
"timestamp": 1650873227.2462513,
"metadata": {
"model_id": "27bdda6c44024b83a230a16cb66663b5"
},
"name": "action_restart",
"policy": "RulePolicy",
"confidence": 1.0,
"action_text": null,
"hide_rule_turn": true
}, {
"event": "bot",
"timestamp": 1650873227.248245,
"metadata": {
"utter_action": "utter_restart",
"model_id": "27bdda6c44024b83a230a16cb66663b5"
},
"text": "... 😉",
"data": {
"elements": null,
"quick_replies": null,
"buttons": null,
"attachment": null,
"image": null,
"custom": null
}
}, {
"event": "restart",
"timestamp": 1650873227.248245,
"metadata": {
"model_id": "27bdda6c44024b83a230a16cb66663b5"
}
}, {
"event": "action",
"timestamp": 1650873227.2542272,
"metadata": {
"model_id": "27bdda6c44024b83a230a16cb66663b5"
},
"name": "action_session_start",
"policy": "followup_action",
"confidence": 1.0,
"action_text": null,
"hide_rule_turn": false
}, {
"event": "session_started",
"timestamp": 1650873227.2572186,
"metadata": {
"model_id": "27bdda6c44024b83a230a16cb66663b5"
}
}, {
"event": "action",
"timestamp": 1650873227.2572186,
"metadata": {
"model_id": "27bdda6c44024b83a230a16cb66663b5"
},
"name": "action_listen",
"policy": null,
"confidence": null,
"action_text": null,
"hide_rule_turn": false
}],
"name": "361650eb22d6416ebee86b995311de9f"
}
Rasa运行日志
2022-04-25 16:25:48 DEBUG urllib3.connectionpool - 。。HTTPSConnectionPool(host='api.segment.io', port=443): Max retries exceeded wit
h url: /v1/track (Caused by SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:1125)')))
2022-04-25 16:25:48 DEBUG rasa.core.tracker_store - Connected to RedisTrackerStore.
2022-04-25 16:25:48 DEBUG rasa.core.lock_store - Connected to lock store 'RedisLockStore'.
2022-04-25 16:25:48 DEBUG rasa.core.nlg.generator - Instantiated NLG to 'TemplatedNaturalLanguageGenerator'.
2022-04-25 16:25:48 INFO rasa.core.processor - Loading model models\20220425-160933-aged-discriminant.tar.gz...
Rasa课程、Rasa培训、Rasa面试、Rasa实战系列之Docker Duckling服务部署
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)