企业级大模型的部署
2026/7/23 5:33:40 网站建设 项目流程

1. 部署Docker

#更新软件包 sudo apt update ​ sudo apt upgrade ​ #安装docker依赖 sudo apt install software-properties-common ​ sudo apt-get install ca-certificates curl gnupg lsb-release ​ #添加Docker官方GPG密钥 curl -fsSL http://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add - ​ #添加Docker软件源(输入后根据提示按Enter) sudo add-apt-repository "deb [arch=amd64] http://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable" ​ #安装docker(输入后根据提示输入 y ) sudo apt-get install docker-ce docker-ce-cli containerd.io --fix-missing ​ #安装完毕,启动docker,并查看状态 sudo systemctl start docker ​ #看到running状态说明docker已经正常启动 sudo systemctl status docker

2. 部署Dify

  • 最低安装要求:CPU >= 2 Core and RAM >= 4 GiB

  • 官网:Dify - 构建生产级 AI 应用

  • GitHub - langgenius/dify: Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack. · GitHub

  • 文档说明:https://github.com/langgenius/dify/blob/main/README_CN.md

  • 使用 Docker Compose 部署 Dify - Dify Docs

  • 镜像源配置

sudo vi /etc/docker/daemon.json
{ "registry-mirrors": [ "https://docker.xuanyuan.me", "https://docker.1ms.run", "https://docker.m.daocloud.io", "http://hub-mirror.c.163.com", "https://docker.unsee.tech", "https://dockerpull.org", "https://docker.1panel.live", "https://dockerhub.icu", "https://docker.nju.edu.cn", "https://registry.docker-cn.com", "https://docker.mirrors.ustc.edu.cn", "https://mirror.baidubce.com", "https://5tqw56kt.mirror.aliyuncs.com", "https://docker.hpcloud.cloud", "http://mirrors.ustc.edu.cn", "https://docker.chenby.cn", "https://docker.ckyl.me", "http://mirror.azure.cn", "https://hub.rat.dev", "https://mbirror.ccs.tencentyun.com"] }
sudo systemctl daemon-reload ​ sudo systemctl restart docker
  1. 租赁Dify服务器:腾讯云 官网:腾讯云 产业智变·云启未来 - 腾讯

  2. 基础配置 登录 - 腾讯云

  3. 下载地址:Release v0.15.5 · langgenius/dify · GitHub

  4. #上传解压: sudo tar -zxvf dify-0.15.5.tar.gz ​ cd xxx/dify-0.15.5/docker ​ sudo cp .env.example .env ​ sudo docker compose up -d ​ sudo docker compose ps
  5. 访问 http://your_server_ip/install

3. 模型部署

  1. 租赁GPU服务器:AutoDL AutoDL算力云 | 弹性、好用、省钱,GPU算力零售价格新标杆 (西北地区 GPU推荐 RTX4090,3090,3080等)

  2. #开启学术资源加速 https://www.autodl.com/docs/network_turbo/ source /etc/network_turbo
  3. #部署XInference,准备conda环境**注意,智川云如果有问题可以直接问客服,只要能建立连接,就按照教程步骤走就行** #autodl 算力云 conda create -p /root/autodl-tmp/conda_envs/xinfer_env python=3.10 ​ #智川云: conda create -p /root/rivermind-data/conda_envs/xinfer_env python=3.10 ​ #初始化conda环境 conda init bash ​ source ~/.bashrc ​ #激活conda环境 conda deactivate ​ #autodl(算力云) conda activate /root/autodl-tmp/conda_envs/xinfer_env ​ #智川云 conda activate /root/rivermind-data/conda_envs/xinfer_env ​ #验证conda是否创建成功 which python ​ which pip ​ #部署XInference pip install "xinference[vllm,embedding,rerank,transformers]==1.16.0" \ --extra-index-url https://pypi.tuna.tsinghua.edu.cn/simple ​ 启动XInference服务端**在此之前执行** pip install "sentence_transformers<4.0.0" ​ XINFERENCE_MODEL_SRC=modelscope xinference-local --host 0.0.0.0 --port 6006
  4. 访问XInference WebUI , 查看AutoDL自定义服务地址 , 访问Xinference的WebUI

3.1 部署LLM

  1. #部署LLM https://inference.readthedocs.io/zh-cn/latest/models/builtin/llm/qwen3.html ​ #新起一个连接窗口:激活conda环境 conda activate /root/autodl-tmp/conda_envs/xinfer_env ​ #开启学术加速: source /etc/network_turbo ​ #启动命令云端模型 xinference launch \ --model-engine transformers \ --model-name qwen3 \ --size-in-billions 0_6 \ --model-format pytorch \ --quantization none \ --model-uid Qwen3-0.6B \ --gpu_memory_utilization 0.6 \ --max_model_len 1024 \ --endpoint http://localhost:6006 #启动命令本地模型文件**`--model-path`:模型权重本地存储路径** xinference launch \ --model-engine transforms \ --model-name qwen3 \ --size-in-billions 0_6 \ --model-format pytorch \ --quantization none \ --model-path "{your_model_dir}" \ --model-uid Qwen3-0.6B \ --gpu_memory_utilization 0.6 \ --max_model_len 1024 \ --endpoint http://localhost:6006

3.2 部署Embedding模型

#云端模型 xinference launch \ --model-name bge-small-zh-v1.5 \ --model-type embedding \ --endpoint http://localhost:6006

3.3 部署Rerank模型

xinference launch \ --model-name bge-reranker-base \ --model-type rerank \ --endpoint http://localhost:6006

3.4 查看模型部署情况

#查看模型部署情况 xinference list \ --endpoint http://localhost:6006

3.5 Dify对接XInference

  1. 安装XInference插件

  2. 添加LLM

  3. 添加Embedding模型

  4. 添加Rerank模型

需要专业的网站建设服务?

联系我们获取免费的网站建设咨询和方案报价,让我们帮助您实现业务目标

立即咨询