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

魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。

更多推荐