本书所用代码均在 Rasa 3.0.X 版本中完成。 读者可以使用:
pip install --no-deps -r ../full_requirements.txt
完成项目代码的依赖安装。
您需要 docker 才能使用 redis. 您可以在 https://www.docker.com/ 找到如何将 docker 安装到您的系统.
docker pull redis:6.2.5
docker run --rm -p 6379:6379 --name docker-redis redis:6.2.5
rasa train
CUDA_VISIBLE_DEVICES=-1 rasa run --endpoints ./endpoints_default.yml
为了和多 worker 模式下的 Rasa 服务器比较性能,使用 CUDA_VISIBLE_DEVICES=-1
设置,将模型加载到 CPU 上(而不是 GPU)。
rasa run actions
CUDA_VISIBLE_DEVICES=-1 SANIC_WORKERS=5 rasa run
因为通常情况下显卡的内存不足以载入多个模型,因此使用 CUDA_VISIBLE_DEVICES=-1
设置,将模型加载到 CPU 上(而不是 GPU)。
ACTION_SERVER_SANIC_WORKERS=5 rasa run actions
测试文件是 RasaPerformance.jmx (软件 Apache JMeter 5.4.1)
默认模式的性能:
多 woker 模式下的性能: