背景

某些客户使用chatbi服务,会遇到chatbi服务器关机,重启的情况,目前chatbi服务cpu是可以开机自启动,但是gpu还做不到,所以需要认为手动拉起。

操作方法

启动GPU容器群

在部署GPU容器群的机器上进入stack目录,执行如下步骤:

启动gensql_tgi容器:

bash run_gensql_tgi.sh

使用如下命令查看容器的log,等待其启动完毕之后,才可以执行下一步

docker logs -f gensql_tgi

启动完毕后的log如下:

2024-03-19 09:54:45.996  INFO 27 --- [       Thread-4] com.netease.ai.Application               : 2024-03-19T09:54:45.995703Z  WARN text_generation_router: router/src/main.rs:252: Invalid hostname, defaulting to 0.0.0.0

测试gensql_tgi容器:

bash test_gensql_tgi.sh

预期输出:

{"choices": [{"text": " city that is known for its diversity, inclusivity, and progressive values. It is a city that is home to people from all over the world, and it is a city that is committed to being a place where everyone can thrive. San Francisco is a city that is full of life, energy, and possibility, and it is a city that is always looking to the future. It is a city that is proud of its history, but it is also a city that is always looking to create a"}], "code": 0}

启动nezha容器:

bash run_nezha.sh

使用如下命令查看容器的log,等待其启动完毕之后,才可以执行下一步

docker logs -f nezha

启动完毕后的log如下:

2024-03-19 11:36:20.065  INFO 13 --- [       Thread-4] com.netease.ai.Application               : {"timestamp":"2024-03-19T11:36:20.065416413Z","level":"INFO","fields":{"message":"http service is running","addr":"0.0.0.0:8000"},"target":"mosec"}

测试nezha容器:

bash test_nezha.sh

预期输出:

[0.005253942217677832, 0.004704758524894714, 0.004948839079588652, 0.004918327089399099, 0.00507087679579854, 0.0048267957754433155, 0.0035121929831802845, 0.0034969348926097155, 0.0036037347745150328, 0.003588477848097682]

启动CPU容器群

在部署CPU容器群的机器上,进入stack目录执行下面的步骤

启动swarm集群

docker stack deploy -c full_stack_cpu.yaml chatfaq

查看swarm集群中各服务状态

docker service ls | grep chatfaq

启动完毕后的显示内容如下,所有服务的REPLICAS都是1/1,启动时间一般在5分钟以内:

ID             NAME                                    MODE         REPLICAS   IMAGE                                                                                                                   PORTS
rb6dhdap6jxr   chatfaq_codeserver                      replicated   1/1        hub-inner.cn-east-p1.netease.com/deeplearning/easyai-platform/app-codeserver-standalone:5894e7573b1b39f6a1cae174d59e555bcada174e   *:7080->8080/tcp
3khj3ycmvyaz   chatfaq_gensql_app                      replicated   1/1        hub-inner.cn-east-p1.netease.com/deeplearning/ds_mosec_fastapp:v11

测试NL2SQL接口

bash test_nl2sql.sh

预期输出:

{"relevant":"yes","code":0,"sql":"SELECT \"制造商\", SUM(\"利润\") AS \"总利润\" FROM \"示例订单数据\" GROUP BY \"制造商\";","title":null,"description":"SELECT \"制造商\", SUM(\"利润\") AS \"总利润\" FROM \"示例订单数据\" GROUP BY \"制造商\";","level":null,"sql_time":0.763,"explain_time":null,"prompt":"<|begin_of_text|><|start_header_id|>user<|end_header_id|>\n\n你是一个PostgreSQL专家,你的任务是根据表格信息,用PostgreSQL语句回答用户的问题。\n\n表名'示例订单数据'对应的schema和数据示例: \n|字段名|字段类型|字段值示例|\n|-|-|-|\n|制造商|text|\"OIC\", \"Office Star\", \"Rogers\"|\n|商品名称|text|\"商业信封\", \"个人复印机\", \"炉灶\"|\n|商品子类别|text|\"书架\", \"信封\", \"器具\"|\n|商品类别|text|\"办公用品\", \"家具\", \"技术\"|\n|地区|text|\"东北\", \"中南\", \"华东\"|\n|客户名称|text|\"邵伟\", \"邵黎明\", \"邹伟\"|\n|客户类型|text|\"公司\", \"小型企业\", \"消费者\"|\n|省份|text|\"吉林\", \"天津\", \"宁夏\"|\n|订单日期|timestamp|\"2023-05-22 00:00:00\", \"2023-05-31 00:00:00\"|\n|订单编号|text|\"A1004198\", \"A1004279\", \"A1004288\"|\n|邮寄方式|text|\"一级\", \"二级\", \"当日\", \"标准级\"|\n|利润|integer|\"1015\", \"1151\"|\n|数量|integer|\"1\", \"10\"|\n|销售额|integer|\"10213\", \"11930\"|\n\n\n要求:\n同环比用TS_COMPARE(\"同环比字段\", '时间间隔', '同比或环比', \"日期字段\")表示\n\n用户问题: 每个制造商的利润是多少\n请判断能否生成PostgreSQL,如果可以则请尽量使用聚合函数,如果不行,则回复:\"抱歉,无法生成\": \n<|eot_id|><|start_header_id|>assistant<|end_header_id|>\n\n","question":"每个制造商的利润是多少","origin_sql":null,"step1_sql":null,"ai_correct":null,"ai_user_correct":null,"faq":null}

测试字段压缩接口

bash test_compress_new.sh

预期输出:返回的json很长,且code为0

按照如上步骤启动服务,且测试脚本返回的输出以及日志内容都对的上,代表chatbi服务启动没有问题。