services:

  xinference:

    image: python:3.11-slim

    container_name: xinference-server

    ports:

      - "9997:9997"

    volumes:

      # 挂载本地模型缓存目录

      - C:\Users\Administrator\.xinference:/root/.xinference

      # 挂载HuggingFace缓存目录(如果存在)

      - C:\Users\Administrator\.cache\huggingface:/root/.cache/huggingface

    environment:

      - XINFERENCE_HOME=/root/.xinference

      - CUDA_VISIBLE_DEVICES=0

      - PIP_INDEX_URL=https://pypi.tuna.tsinghua.edu.cn/simple

    command: >

      bash -c "

      pip install xinference[transformers] torch --no-cache-dir &&

      xinference-local --host 0.0.0.0 --port 9997

      "

    deploy:

      resources:

        reservations:

          devices:

            - driver: nvidia

              count: 1

              capabilities: [gpu]

    restart: unless-stopped

    networks:

      - xinference-network

networks:

  xinference-network:

    driver: bridge

  • 后台启动: docker exec -d ragflow-server bash -lc "nohup python -m xinference.deploy.local --host 0.0.0.0 --port 9997 > /tmp/xinference.log 2>&1 &"

Logo

码道开发者社区,聚焦华为云码道 CodeArts 代码智能体,沉淀 Agent、Skill、鸿蒙开发实战内容,供开发者查阅资料、交流技术、分享工程实践

更多推荐