openEuler Copilot System常见问题与解决方法-网络环境下部署
问题1:huggingface 使用报错
text
File "/usr/lib/python3.9/site-packages/urllib3/connection.py", line 186, in _new_conn
raise NewConnectionError(
urllib3.exceptions.eanconectionError: <urlib3.comnection.Hipscomnection object at exfblab6490>: Failed to establish a new conmection: [Errno 101] Network is unreachable
- 解决办法
bash
pip3 install -U huggingface_hub
export HF_ENDPOINT=https://hf-mirror.com
问题2:如何在 RAG 容器中调用获取问答结果的接口
- 请先进入到 RAG 对应 Pod
bash
curl -k -X POST "http://localhost:8005/kb/get_answer" -H "Content-Type: application/json" -d '{ \
"question": "", \
"kb_sn": "default_test", \
"fetch_source": true }'
问题3:执行 helm upgrade
报错
text
Error: INSTALLATI0N FAILED: Kubernetes cluster unreachable: Get "http:/localhost:880/version": dial tcp [:1:8089: connect: connection refused
或者
text
Error: UPGRADE FAILED: Kubernetes cluster unreachable: the server could not find the requested resource
- 解决办法
bash
export KUBECONFIG=/etc/rancher/k3s/k3s.yaml
问题4:无法查看 Pod 日志
text
[root@localhost euler-copilot]# kubectl logs rag-deployservice65c75c48d8-44vcp-n euler-copilotDefaulted container "rag" out of: rag.rag-copy secret (init)Error from server: Get "https://172.21.31.11:10250/containerlogs/euler copilot/rag deploy"service 65c75c48d8-44vcp/rag": Forbidden
- 解决办法 如果设置了代理,需要将本机的网络 IP 从代理中剔除
bash
cat /etc/systemd/system/k3s.service.env
http_proxy="http://172.21.60.51:3128"
https_proxy="http://172.21.60.51:3128"
no_proxy=172.21.31.10 # 代理中剔除本机IP
问题5:GPU环境部署大模型时出现无法流式回复
在服务执行 curl 大模型失败,但是将 "stream": true
改为 "stream": false
就可以 curl 通?
bash
curl http://localhost:30000/v1/chat/completions -H "Content-Type: application/json" -H "Authorization: Bearer sk-123456" -d '{
"model": "qwen1.5",
"messages": [
{
"role": "system",
"content": "你是情感分析专家,你的任务是xxxx"
},
{
"role": "user",
"content": "你好"
}
],
"stream": true,
"n": 1,
"max_tokens": 32768
}'
- 解决办法:
bash
pip install Pydantic=1.10.13
问题6:如何部署sglang
bash
# 1. 激活 Conda 环境, 并激活 Python 3.10 的 Conda 环境。假设你的环境名为 `myenv`:
conda activate myenv
# 2. 在激活的环境中,安装 sglang[all] 和 flashinfer
pip install sglang[all]==0.3.0
pip install flashinfer -i https://flashinfer.ai/whl/cu121/torch2.4/
# 3. 启动服务器
python -m sglang.launch_server --served-model-name Qwen2.5-32B --model-path Qwen2.5-32B-Instruct-AWQ --host 0.0.0.0 --port 8001 --api-key sk-12345 --mem-fraction-static 0.5 --tp 8
- 验证安装
bash
pip show sglang
pip show flashinfer
- 注意:
- API Key:请确保
--api-key
参数中的 API 密钥是正确的 - 模型路径: 确保
--model-path
参数中的路径是正确的,并且模型文件存在于该路径下。 - CUDA 版本:确保你的系统上安装了 CUDA 12.1 和 PyTorch 2.4,因为
flashinfer
包依赖于这些特定版本。 - 线程池大小:根据你的GPU资源和预期负载调整线程池大小。如果你有 8 个 GPU,那么可以选择 --tp 8 来充分利用这些资源。
问题7:如何 curl embedding
bash
curl -k -X POST http://$IP:8001/embedding \
-H "Content-Type: application/json" \
-d '{"texts": ["sample text 1", "sample text 2"]}'
# $IP为vectorize的Embedding的内网地址
问题8:如何生成证书
bash
下载地址: https://github.com/FiloSottile/mkcert/releases
# 1. 下载 mkcert
# x86_64
wget https://github.com/FiloSottile/mkcert/releases/download/v1.4.4/mkcert-v1.4.4-linux-amd64
# arm64
wget https://github.com/FiloSottile/mkcert/releases/download/v1.4.4/mkcert-v1.4.4-linux-arm64
# 2. 执行下面的命令生成秘钥
mkcert -install
# mkcert 可直接接域名或 IP, 生成证书和秘钥
mkcert example.com
# 3. 将证书和秘钥拷贝到 `/home/euler-copilot-framework_openeuler/euler-copilot-helm/chart_ssl/traefik-secret.yaml` 中, 并执行下面命令使其生效。
kubectl apply -f traefik-secret.yaml
文档捉虫