背景
百度开源了自己的智能客服系统AnyQ,也是最近才发现。在安装的过程中也是遇到很多问题。在github上它的安装md文件写的相当简单,特此记录一下。
已经编译好的镜像,也推送到docerhub了,可直接使用:
1 | docker pull keejo/anyq |
基本硬件要求
如果编译安装,内存至少需要6G!
编译完之后运行,内存不需要这么多。
安装过程
根据官方说明,采用docker方式安装,拉取paddle
1 | # paddle国内镜像 |
注:这里的paddle是百度开源的深度学习平台,而非完整的AnyQ系统,该docker是一个安装好一些基础环境的Ubuntu环境。
打开docker镜像:
1 | docker run -t -i hub.baidubce.com/paddlepaddle/paddle:latest-dev /bin/bash |
拉取AnyQ代码:
1 | git clone https://github.com/keejo125/AnyQ.git |
注:这里没有使用原版代码了,因为原版代码的cmake中xgboost部分未指定版本,会导致后面编译出错。
如果拉取了原版git,那么需要进行如下修改:
1 | 安装vim |
修改部分为:
1 | DOWNLOAD_COMMAND git clone --recursive https://github.com/dmlc/xgboost.git && cd xgboost && git checkout v0.81 |
创建并进入build目录
1 | mkdir build && cd build |
cmake
1 | cmake .. |
编译
1 | make |
这个过程会clone很多第三方项目,所以很慢,也要确保科学上网,可参考后面的说明
安装jdk1.8
1 | cd /tmp |
注:jdk文件需自行下载
配置
1 | 获取anyq定制solr,anyq示例配置 |
启动
1 | ./run_server |
浏览器访问
1 | http://localhost:8999/anyq?question=付费 |
编写启动文件
编写run.sh
1 | vim /home/run.sh |
增加内容:
1 | !/bin/bash |
提交镜像
1 | docker commit 50f6af712d06 keejo/anyq:1.0 |
启动AnyQ
后续可直接通过镜像启动AnyQ
1 | docker run -d -p 8999:8999 keejo/anyq:1.0 /home/run.sh |
编译过程中可能出现的问题
问题1:
1
2
3
4
5
6
7
8
9c++: internal compiler error: Killed (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.8/README.Bugs> for instructions.
paddle/fluid/operators/math/CMakeFiles/context_project.dir/build.make:62: recipe for target 'paddle/fluid/operators/math/CMakeFiles/context_project.dir/context_project.cc.o' failed
make[5]: *** [paddle/fluid/operators/math/CMakeFiles/context_project.dir/context_project.cc.o] Error 4
CMakeFiles/Makefile2:19906: recipe for target 'paddle/fluid/operators/math/CMakeFiles/context_project.dir/all' failed
make[4]: *** [paddle/fluid/operators/math/CMakeFiles/context_project.dir/all] Error 2
make[4]: *** Waiting for unfinished jobs....解决办法:
增加docker容器的内存,也就是前面说的必须保证6G及以上,增加方法可参考:
问题2:
1
2
3
4
5
6
7
8
9[ 28%] Built target context_project
Makefile:105: recipe for target 'all' failed
make[3]: *** [all] Error 2
CMakeFiles/extern_paddle.dir/build.make:111: recipe for target 'third_party/paddle/src/extern_paddle-stamp/extern_paddle-build' failed
make[2]: *** [third_party/paddle/src/extern_paddle-stamp/extern_paddle-build] Error 2
CMakeFiles/Makefile2:511: recipe for target 'CMakeFiles/extern_paddle.dir/all' failed
make[1]: *** [CMakeFiles/extern_paddle.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2解决办法:
多试几次
问题3:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15[ 32%] Performing build step for 'extern_lac'
-- CXX compiler: /usr/bin/c++, version: GNU 4.8.5
-- C compiler: /usr/bin/cc, version: GNU 4.8.5
CMake Error at CMakeLists.txt:12 (message):
A gcc compiler with a version >= 4.8.2 is needed.
-- Configuring incomplete, errors occurred!
See also "/home/AnyQ/build/third_party/lac/src/lac/CMakeFiles/CMakeOutput.log".
CMakeFiles/extern_lac.dir/build.make:111: recipe for target 'third_party/lac/src/extern_lac-stamp/extern_lac-build' failed
make[2]: *** [third_party/lac/src/extern_lac-stamp/extern_lac-build] Error 1
CMakeFiles/Makefile2:585: recipe for target 'CMakeFiles/extern_lac.dir/all' failed
make[1]: *** [CMakeFiles/extern_lac.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2解决办法:
修改CmakeLists.txt文件:
1
2cd /home/AnyQ/build/third_party/lac/src/lac/
vim CMakeLists.txt将11行修改为:
1
if (GCC_VERSION VERSION_LESS 4.8)
参考说明:https://github.com/baidu/lac/issues/5