在智算云平台开发机上部署 QAnything
QAnything 是一个开源项目,旨在提供全面的问答系统解决方案。该项目的 Github 仓库地址为:https://github.com/netease-youdao/QAnything,主分支为 qanything-v2。
基础方案
我们将使用智算云平台「开发机」的 Docker 容器功能来部署 QAnything。Docker 容器(Docker in Docker, DinD)功能,允许用户在开发机内(主容器)运行其他容器,并创建挂载 GPU 的容器,测试容器化应用,从而提供更高的灵活性和隔离性。
实施障碍
在智算云平台的开发机中安装 QAnything 时,如果根据 QAnything 官方文档进行操作,可能会遇到一些障碍:
- 不支持 Docker Compose,需要改为
docker run
。 - 由于运营商网络限制,不支持直接拉取 Docker Hub 镜像,需要自行获取镜像。
- 不支持使用 docker volume 命令。
- 可使用 -v 挂载持久化存储,但不可直接挂载开发机 rootfs 上的目录。QAnything 需要的持久化存储必须依赖外部存储,例如云盘 或共享高性能存储。
- 需要手动处理文件目录权限问题。
- 不支持
--privileged
模式,需要调整相关配置。 - 容器网络配置需要特别注意,以确保各服务之间的正常通信。
Docker Compose 原始文件
以下是截止至 2024-10-22 原始的 Docker Compose 文件内容,用于部署 QAnything 2.0.0。由于智算云平台的开发机的「Docker 容器」不支持使用 Docker Compose,我们以此文件为基础,改造为 docker run
命令。
services:
elasticsearch:
container_name: es-container-local
image: docker.elastic.co/elasticsearch/elasticsearch:8.13.2
user: root
privileged: true
ports:
- "9210:9200"
restart: on-failure
environment:
- discovery.type=single-node
- xpack.security.enabled=false
- "ES_JAVA_OPTS=-Xms1024m -Xmx1024m"
volumes:
- ${DOCKER_VOLUME_DIRECTORY:-.}/third_party/es/plugins:/usr/share/elasticsearch/plugins
- ${DOCKER_VOLUME_DIRECTORY:-.}/volumes/es/data:/usr/share/elasticsearch/data
command: >
/bin/bash -c "
mkdir -p /usr/share/elasticsearch/data /usr/share/elasticsearch/plugins &&
chown -R elasticsearch:elasticsearch /usr/share/elasticsearch &&
su elasticsearch -c '/usr/share/elasticsearch/bin/elasticsearch'
"
healthcheck:
test: curl --fail http://localhost:9200/_cat/health || exit 1
interval: 10s
timeout: 20s
retries: 3
etcd:
container_name: milvus-etcd-local
image: quay.io/coreos/etcd:v3.5.5
environment:
- ETCD_AUTO_COMPACTION_MODE=revision
- ETCD_AUTO_COMPACTION_RETENTION=1000
- ETCD_QUOTA_BACKEND_BYTES=4294967296
- ETCD_SNAPSHOT_COUNT=50000
volumes:
- ${DOCKER_VOLUME_DIRECTORY:-.}/volumes/etcd:/etcd
command: etcd -advertise-client-urls=http://127.0.0.1:2379 -listen-client-urls http://0.0.0.0:2379 --data-dir /etcd
healthcheck:
test: ["CMD", "etcdctl", "endpoint", "health"]
interval: 10s
timeout: 20s
retries: 3
minio:
container_name: milvus-minio-local
image: minio/minio:RELEASE.2023-03-20T20-16-18Z
environment:
MINIO_ACCESS_KEY: minioadmin
MINIO_SECRET_KEY: minioadmin
# ports:
# - "9001:9001"
# - "9000:9000"
volumes:
- ${DOCKER_VOLUME_DIRECTORY:-.}/volumes/minio:/minio_data
command: minio server /minio_data --console-address ":9001"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
interval: 10s
timeout: 20s
retries: 3
standalone:
container_name: milvus-standalone-local
image: milvusdb/milvus:v2.4.8
logging:
driver: "json-file"
options:
max-size: "100m"
max-file: "3"
command: ["milvus", "run", "standalone"]
security_opt:
- seccomp:unconfined
environment:
ETCD_ENDPOINTS: etcd:2379
MINIO_ADDRESS: minio:9000
volumes:
- ${DOCKER_VOLUME_DIRECTORY:-.}/volumes/milvus:/var/lib/milvus
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:9091/healthz"]
interval: 10s
start_period: 90s
timeout: 20s
retries: 3
ports:
- "19540:19530"
depends_on:
- "etcd"
- "minio"
mysql:
container_name: mysql-container-local
privileged: true
image: mysql:8.4
ports:
- "3316:3306"
command: --max-connections=10000
environment:
- MYSQL_ROOT_PASSWORD=123456
volumes:
- ${DOCKER_VOLUME_DIRECTORY:-.}/volumes/mysql:/var/lib/mysql
qanything_local:
container_name: qanything-container-local
image: xixihahaliu01/qanything-linux:v1.5.1
command: /bin/bash -c "cd /workspace/QAnything && bash scripts/entrypoint.sh"
privileged: true
shm_size: '8gb'
volumes:
- ${DOCKER_VOLUME_DIRECTORY:-.}/:/workspace/QAnything/
# ports:
# - "8777:8777"
network_mode: "host"
environment:
- NCCL_LAUNCH_MODE=PARALLEL
- GPUID=${GPUID:-0}
- USER_IP=${USER_IP:-0.0.0.0}
- Gateway_IP=${Gateway_IP:-0.0.0.0}
depends_on:
standalone:
condition: service_healthy
mysql:
condition: service_started
elasticsearch:
condition: service_healthy
tty: true
stdin_open: true
#networks:
# default:
# name: QAnything
使用 docker run
安装
环境准备
创建一台开发机,要求如下:
- 推荐使用 Ubuntu 22.04 操作系统镜像
- 单卡 GPU 即可
- 确保该开发机已开启Docker 容器功能,请在创建开发机时启用「Docker 容器」开关。
- 确保该开发机拥有云盘 或共享高性能存储。注意,当前仅 A100 机型支持云盘。
以下教程以单卡 A100 开发机 + 云盘 为例。如果您的租户拥有共享高性能存储,建议使用单卡 4090 机型。
拉取 QAnything 项目代码
使用 GitHub 加速服务拉取 QAnything GitHub 代码仓库:
# 进入云盘的默认目录
cd /datadisk
# 拉取 QAnything 代码仓库
git clone https://sciproxy.com/https://github.com/netease-youdao/QAnything.git
如遇到问题,可尝试替换为其他加速服务。详见第三方学术加速服务指南。
拉取 Docker 镜像
QAnything 原始 Docker Compose 文件中定义了多个服务,使用了 Docker Hub 镜像。
由于运营商网络原因,直接拉取 Docker Hub 镜像时下载失败。智算云平台不提供官方镜像加速服务,建议您采取以下方式提前拉取镜像到本地:
- 自行使用第三方镜像加速服务,采用增加前缀的方式拉取镜像。
- 如果您的账号在智算云平台拥有租户私有仓库,可以使用加速服务拉取后,推送到私有仓库。
WARNING
请自行解决镜像问题,否则无法继续执行后续步骤。
创建目录和设置权限
首先,我们需要创建必要的目录并设置适当的权限:
cd /datadisk/QAnything
# 此处根据 QAnything 项目要求创建子目录
sudo mkdir -p /datadisk/QAnything/volumes/{es/data,etcd,minio,milvus,mysql}
# 赋予 777 权限
sudo chmod -R 777 /datadisk/QAnything
创建 Docker 网络
创建一个名为 qanything-network
的 Docker 网络,用于服务间通信:
docker network create qanything-network
启动各个服务
NOTE
以下步骤中并未直接拉取 Dock Hub 镜像,而是提前将镜像存入了租户 te-c7va2fg6uawxdzkf
的私有镜像仓库。
Elasticsearch
在启动 Elasticsearch 之前,我们需要先设置正确的目录权限:
sudo chown -R 1000:1000 /datadisk/QAnything/third_party/es/plugins
sudo chown -R 1000:1000 /datadisk/QAnything/volumes/es/data
然后使用以下命令启动 Elasticsearch:
docker run -d \
--name es-container-local \
--network qanything-network \
--user root \
-p 9210:9200 \
-e discovery.type=single-node \
-e xpack.security.enabled=false \
-e "ES_JAVA_OPTS=-Xms1024m -Xmx1024m" \
-v /datadisk/QAnything/third_party/es/plugins:/usr/share/elasticsearch/plugins \
-v /datadisk/QAnything/volumes/es/data:/usr/share/elasticsearch/data \
--health-cmd="curl --fail http://localhost:9200/_cat/health || exit 1" \
--health-interval=10s \
--health-timeout=20s \
--health-retries=3 \
--restart on-failure \
cr.infini-ai.com/te-c7va2fg6uawxdzkf/elasticsearch:8.13.2 \
/bin/bash -c "mkdir -p /usr/share/elasticsearch/data /usr/share/elasticsearch/plugins && chown -R elasticsearch:elasticsearch /usr/share/elasticsearch && su elasticsearch -c '/usr/share/elasticsearch/bin/elasticsearch'"
ETCD
使用以下命令启动 ETCD 服务:
docker run -d \
--name milvus-etcd-local \
--network qanything-network \
--user root \
-e ETCD_AUTO_COMPACTION_MODE=revision \
-e ETCD_AUTO_COMPACTION_RETENTION=1000 \
-e ETCD_QUOTA_BACKEND_BYTES=4294967296 \
-e ETCD_SNAPSHOT_COUNT=50000 \
-v /datadisk/QAnything/volumes/etcd:/etcd \
--health-cmd="etcdctl endpoint health" \
--health-interval=10s \
--health-timeout=20s \
--health-retries=3 \
cr.infini-ai.com/te-c7va2fg6uawxdzkf/etcd:v3.5.5 \
etcd -advertise-client-urls=http://127.0.0.1:2379 -listen-client-urls http://0.0.0.0:2379 --data-dir /etcd
MinIO
启动 MinIO 服务:
docker run -d \
--name milvus-minio-local \
--network qanything-network \
--user root \
-p 9000:9000 \
-p 9001:9001 \
-e MINIO_ACCESS_KEY=minioadmin \
-e MINIO_SECRET_KEY=minioadmin \
-v /datadisk/QAnything/volumes/minio:/minio_data \
--health-cmd="curl -f http://localhost:9000/minio/health/live" \
--health-interval=10s \
--health-timeout=20s \
--health-retries=3 \
cr.infini-ai.com/te-c7va2fg6uawxdzkf/minio:RELEASE.2023-03-20T20-16-18Z \
minio server /minio_data --console-address ":9001"
Milvus Standalone
启动 Milvus Standalone 服务:
docker run -d \
--name milvus-standalone-local \
--network qanything-network \
--user root \
--security-opt seccomp:unconfined \
-p 19540:19530 \
-e ETCD_ENDPOINTS=milvus-etcd-local:2379 \
-e MINIO_ADDRESS=milvus-minio-local:9000 \
-v /datadisk/QAnything/volumes/milvus:/var/lib/milvus \
--health-cmd="curl -f http://localhost:9091/healthz" \
--health-interval=10s \
--health-start-period=90s \
--health-timeout=20s \
--health-retries=3 \
--log-driver json-file \
--log-opt max-size=100m \
--log-opt max-file=3 \
cr.infini-ai.com/te-c7va2fg6uawxdzkf/milvus:v2.4.8 \
milvus run standalone
MySQL
在启动 MySQL 之前,我们需要设置正确的目录权限:
sudo chown -R 999:999 /datadisk/QAnything/volumes/mysql
然后启动 MySQL 服务:
docker run -d \
--name mysql-container-local \
--network qanything-network \
--add-host qanything-container-local:10.212.18.77 \
--user 999:999 \
-p 3316:3306 \
-e MYSQL_ROOT_PASSWORD=123456 \
-v /datadisk/QAnything/volumes/mysql:/var/lib/mysql \
cr.infini-ai.com/te-c7va2fg6uawxdzkf/mysql:8.4 \
--max-connections=10000
QAnything Local
检查依赖的服务是否正常运行。如果所有服务都正常运行,您将看到类似以下内容的输出:
root@is-daalfs5sphzhq44n-devmachine-0:/datadisk/QAnything# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
3dc736010217 cr.infini-ai.com/te-c7va2fg6uawxdzkf/mysql:8.4 "docker-entrypoint.s…" About a minute ago Up About a minute 33060/tcp, 0.0.0.0:3316->3306/tcp, :::3316->3306/tcp mysql-container-local
90a9ffad707e cr.infini-ai.com/te-c7va2fg6uawxdzkf/milvus:v2.4.8 "/tini -- milvus run…" 4 minutes ago Up 4 minutes (healthy) 0.0.0.0:19540->19530/tcp, :::19540->19530/tcp milvus-standalone-local
fd87cae590c2 cr.infini-ai.com/te-c7va2fg6uawxdzkf/minio:RELEASE.2023-03-20T20-16-18Z "/usr/bin/docker-ent…" 5 minutes ago Up 5 minutes (healthy) 0.0.0.0:9000-9001->9000-9001/tcp, :::9000-9001->9000-9001/tcp milvus-minio-local
6bac3eb09587 cr.infini-ai.com/te-c7va2fg6uawxdzkf/etcd:v3.5.5 "etcd -advertise-cli…" 6 minutes ago Up 6 minutes (healthy) 2379-2380/tcp milvus-etcd-local
ca99c124773d cr.infini-ai.com/te-c7va2fg6uawxdzkf/elasticsearch:8.13.2-amd64 "/bin/tini -- /usr/l…" 6 minutes ago Up 6 minutes (healthy) 9300/tcp, 0.0.0.0:9210->9200/tcp, :::9210->9200/tcp es-container-local
为了确保容器间正常通信,同其他服务一致,qanything-container-local
也需要运行在之前创建的 qanything-network
中。QAnything 官方已经提供相关的 Python 代码,因此仅需要替换被注释的代码:
待修改的 Python 文件路径:
/datadisk/QAnything/qanything_kernel/configs/model_config.py
具体修改位置请参考下方的代码 Diff:
import os
from dotenv import load_dotenv
load_dotenv()
# 获取环境变量GATEWAY_IP
GATEWAY_IP = os.getenv("GATEWAY_IP", "localhost")
# LOG_FORMAT = "%(levelname) -5s %(asctime)s" "-1d: %(message)s"
# logger = logging.getLogger()
# logger.setLevel(logging.INFO)
# logging.basicConfig(format=LOG_FORMAT)
# 获取项目根目录
# 获取当前脚本的绝对路径
current_script_path = os.path.abspath(__file__)
root_path = os.path.dirname(os.path.dirname(os.path.dirname(current_script_path)))
UPLOAD_ROOT_PATH = os.path.join(root_path, "QANY_DB", "content")
IMAGES_ROOT_PATH = os.path.join(root_path, "qanything_kernel/qanything_server/dist/qanything/assets", "file_images")
print("UPLOAD_ROOT_PATH:", UPLOAD_ROOT_PATH)
print("IMAGES_ROOT_PATH:", IMAGES_ROOT_PATH)
OCR_MODEL_PATH = os.path.join(root_path, "qanything_kernel", "dependent_server", "ocr_server", "ocr_models")
RERANK_MODEL_PATH = os.path.join(root_path, "qanything_kernel", "dependent_server", "rerank_server", "rerank_models")
EMBED_MODEL_PATH = os.path.join(root_path, "qanything_kernel", "dependent_server", "embed_server", "embed_models")
PDF_MODEL_PATH = os.path.join(root_path, "qanything_kernel/dependent_server/pdf_parser_server/pdf_to_markdown")
# LLM streaming reponse
STREAMING = True
SYSTEM = """
You are a helpful assistant.
You are always a reliable assistant that can answer questions with the help of external documents.
Today's date is {{today_date}}. The current time is {{current_time}}.
"""
INSTRUCTIONS = """
- Answer the question strictly based on the reference information provided between <DOCUMENTS> and </DOCUMENTS>.
- Do not attempt to modify or adapt unrelated information. If the reference information does not match the person or topic mentioned in the question, respond only with: \"抱歉,检索到的参考信息并未提供任何相关的信息,因此无法回答。\"
- Before generating the answer, please confirm the following (Let's think step by step):
1. First, check if the reference information directly matches the person or topic mentioned in the question. If no match is found, immediately return: \"抱歉,检索到的参考信息并未提供任何相关的信息,因此无法回答。\"
2. If a match is found, ensure all required key points or pieces of information from the reference are addressed in the answer.
- Now, answer the following question based on the above retrieved documents:
{{question}}
- Please format your response in a **logical and structured manner** that best fits the question. Follow these guidelines:
1. **Start with a concise and direct answer to the main question**.
2. **If necessary, provide additional details** in a structured format:
- Use **appropriate multi-level headings (##, ###, ####)** to separate different parts or aspects of the answer.
- **Use bullet points (-, *) or numbered lists (1., 2., 3.)** if multiple points need to be highlighted.
- **Highlight key information using bold or italic text** where necessary.
3. **Tailor the format to the nature of the question**. For example:
- If the question involves a list or comparison, use bullet points or tables.
- If the question requires a more narrative answer, structure the response into clear paragraphs.
4. **Avoid unnecessary or irrelevant sections**. Focus solely on presenting the required information in a clear, concise, and well-structured manner.
- Respond in the same language as the question "{{question}}".
"""
"""
- Please format your response in Markdown with a clear and complete structure:
1. **Introduction**: Briefly and directly answer the main question.
2. **Detailed Explanation** (if more relevant details are available):
- Use **second-level headings (##)** to separate different parts or aspects of the answer.
- Use **ordered lists** (1., 2.,3.) or **unordered lists** (-, *) to list multiple points or steps.
- Highlight key information using **bold** or *italic* text where appropriate.
- If the answer is extensive, conclude with a **brief summary**.
3. **Notes**:
- Respond in the **same language** as the question "{{question}}".
- Avoid including irrelevant information; ensure the answer is related to the retrieved reference information.
- Ensure the answer is well-structured and easy to understand.
"""
PROMPT_TEMPLATE = """
<SYSTEM>
{{system}}
</SYSTEM>
<INSTRUCTIONS>
{{instructions}}
</INSTRUCTIONS>
<DOCUMENTS>
{{context}}
</DOCUMENTS>
"""
CUSTOM_PROMPT_TEMPLATE = """
<USER_INSTRUCTIONS>
{{custom_prompt}}
</USER_INSTRUCTIONS>
<DOCUMENTS>
{{context}}
</DOCUMENTS>
<INSTRUCTIONS>
- All contents between <DOCUMENTS> and </DOCUMENTS> are reference information retrieved from an external knowledge base.
- Now, answer the following question based on the above retrieved documents(Let's think step by step):
{{question}}
</INSTRUCTIONS>
"""
SIMPLE_PROMPT_TEMPLATE = """
- You are a helpful assistant. You can help me by answering my questions. You can also ask me questions.
- Today's date is {{today}}. The current time is {{now}}.
- User's custom instructions: {{custom_prompt}}
- Before answering, confirm the number of key points or pieces of information required, ensuring nothing is overlooked.
- Now, answer the following question:
{{question}}
Return your answer in Markdown formatting, and in the same language as the question "{{question}}".
"""
# 缓存知识库数量
CACHED_VS_NUM = 100
# 文本分句长度
SENTENCE_SIZE = 100
# 知识库检索时返回的匹配内容条数
VECTOR_SEARCH_TOP_K = 30
VECTOR_SEARCH_SCORE_THRESHOLD = 0.3
KB_SUFFIX = '_240625'
MILVUS_HOST_LOCAL = 'milvus-standalone-local'
MILVUS_PORT = 19530
MILVUS_HOST_LOCAL = GATEWAY_IP
MILVUS_PORT = 19540
MILVUS_COLLECTION_NAME = 'qanything_collection' + KB_SUFFIX
ES_URL = 'http://es-container-local:9200/'
ES_URL = f'http://{GATEWAY_IP}:9210/'
ES_USER = None
ES_PASSWORD = None
ES_TOP_K = 30
ES_INDEX_NAME = 'qanything_es_index' + KB_SUFFIX
MYSQL_HOST_LOCAL = 'mysql-container-local'
MYSQL_PORT_LOCAL = 3306
MYSQL_HOST_LOCAL = GATEWAY_IP
MYSQL_PORT_LOCAL = 3316
MYSQL_USER_LOCAL = 'root'
MYSQL_PASSWORD_LOCAL = '123456'
MYSQL_DATABASE_LOCAL = 'qanything'
LOCAL_OCR_SERVICE_URL = "localhost:7001"
LOCAL_PDF_PARSER_SERVICE_URL = "localhost:9009"
LOCAL_RERANK_SERVICE_URL = "localhost:8001"
LOCAL_RERANK_MODEL_NAME = 'rerank'
LOCAL_RERANK_MAX_LENGTH = 512
LOCAL_RERANK_BATCH = 1
LOCAL_RERANK_THREADS = 1
LOCAL_RERANK_PATH = os.path.join(root_path, 'qanything_kernel/dependent_server/rerank_server', 'rerank_model_configs_v0.0.1')
LOCAL_RERANK_MODEL_PATH = os.path.join(LOCAL_RERANK_PATH, "rerank.onnx")
LOCAL_EMBED_SERVICE_URL = "localhost:9001"
LOCAL_EMBED_MODEL_NAME = 'embed'
LOCAL_EMBED_MAX_LENGTH = 512
LOCAL_EMBED_BATCH = 1
LOCAL_EMBED_THREADS = 1
LOCAL_EMBED_PATH = os.path.join(root_path, 'qanything_kernel/dependent_server/embedding_server', 'embedding_model_configs_v0.0.1')
LOCAL_EMBED_MODEL_PATH = os.path.join(LOCAL_EMBED_PATH, "embed.onnx")
TOKENIZER_PATH = os.path.join(root_path, 'qanything_kernel/connector/llm/tokenizer_files')
DEFAULT_CHILD_CHUNK_SIZE = 400
DEFAULT_PARENT_CHUNK_SIZE = 800
SEPARATORS = ["\n\n", "\n", "。", ",", ",", ".", ""]
MAX_CHARS = 1000000 # 单个文件最大字符数,超过此字符数将上传失败,改大可能会导致解析超时
# llm_config = {
# # 回答的最大token数,一般来说对于国内模型一个中文不到1个token,国外模型一个中文1.5-2个token
# "max_token": 512,
# # 附带的上下文数目
# "history_len": 2,
# # 总共的token数,如果遇到电脑显存不够的情况可以将此数字改小,如果低于3000仍然无法使用,就更换模型
# "token_window": 4096,
# # 如果报错显示top_p值必须在0到1,可以在这里修改
# "top_p": 1.0
# }
# Bot
BOT_DESC = "一个简单的问答机器人"
BOT_IMAGE = ""
BOT_PROMPT = """
- 你是一个耐心、友好、专业的机器人,能够回答用户的各种问题。
- 根据知识库内的检索结果,以清晰简洁的表达方式回答问题。
- 不要编造答案,如果答案不在经核实的资料中或无法从经核实的资料中得出,请回答"我无法回答您的问题。"(或者您可以修改为:如果给定的检索结果无法回答问题,可以利用你的知识尽可能回答用户的问题。)
"""
BOT_WELCOME = "您好,我是您的专属机器人,请问有什么可以帮您呢?"
最后,启动 QAnything Local 服务:
docker run -it \
--name qanything-container-local \
--network qanything-network \
--user root \
--shm-size 8gb \
-p 8777:8777 \
-v /datadisk/QAnything:/workspace/QAnything/ \
-e NCCL_LAUNCH_MODE=PARALLEL \
-e GPUID=${GPUID:-0} \
-e USER_IP=${USER_IP:-0.0.0.0} \
-e GATEWAY_IP=${GATEWAY_IP:-0.0.0.0} \
cr.infini-ai.com/te-c7va2fg6uawxdzkf/qanything-linux:v1.5.1 \
/bin/bash -c "cd /workspace/QAnything && bash scripts/entrypoint.sh"
完成以上步骤后,QAnything 的所有必要服务应该已经成功启动。如果使用 VS Code 连接开发机,在 VS Code 终端启动服务后,VS Code 会自动配置 SSH 端口转发。
在 VS Code 终端中可以切换到端口标签,查看具体的端口映射:
如果使用其他 Shell 工具,需要手动配置 SSH 端口转发。参考教程SSH 端口转发:公网访问开发机内 HTTP 服务。
SSH 端口转发配置成功后,即可在浏览器中访问 QAnything 的前端页面:http://localhost:8777/
。
已知局限
- 无法拉取 Docker Hub 镜像。如采用第三方镜像加速服务,无法保证稳定性与速率。如果提前将镜像保存至租户私有仓库,该问题将得到改善。
- 部署 QAnything 依赖持久化存储,但开发机内部容器无法挂载开发机 rootfs 上的目录。暂时必须使用云盘或共享高性能存储。
后续步骤
- 接入 GenStudio LLM API
- 科学安装 Ollama: 如果需要在同一台开发机上安装和访问 Ollama,请注意通过
OLLAMA_HOST
环境变量将 Ollama 服务绑定至0.0.0.0
。请注意通过OLLAMA_ORIGINS
环境变量允许跨域访问。请在启动qanything-container-local
服务室通过--add-host hostname:ip
将开发机的 IP 地址映射至开发机hostname
,通过hostname:11434
从容器内访问 Ollama 服务。