From 8c52011aedac6a7879111bcd240fcb5ae101c6d9 Mon Sep 17 00:00:00 2001 From: floschne Date: Thu, 12 Sep 2024 08:51:24 +0000 Subject: [PATCH] docker compose for ray only --- docker/.env.ray-only.example | 40 +++++++++++++++++++++++++++ docker/docker-compose-ray-only.yml | 44 ++++++++++++++++++++++++++++++ 2 files changed, 84 insertions(+) create mode 100644 docker/.env.ray-only.example create mode 100644 docker/docker-compose-ray-only.yml diff --git a/docker/.env.ray-only.example b/docker/.env.ray-only.example new file mode 100644 index 000000000..ad75048e3 --- /dev/null +++ b/docker/.env.ray-only.example @@ -0,0 +1,40 @@ +COMPOSE_PROJECT_NAME=dats-ray-worker + +# Which user and group to use for running processes +# inside containers. +# Set this to the user and group you're using +# outside the containers to be able to read +# and write in folders mapped to volumes. +UID=1004 +GID=1004 + +#The root path to repo_root inside docker containers +SHARED_REPO_ROOT=/tmp/dats + +# Docker tag to use for pulling the ray container +DATS_RAY_DOCKER_VERSION=1.0.5 + +# Which backend config file to use when running backend or celery +DATS_BACKEND_CONFIG=configs/default.yaml + +# LOG LEVEL ('critical', 'error', 'warning', 'info', 'debug', 'trace') +LOG_LEVEL=debug + + +# Processing devices can be either "cuda" or "cpu" +# Spacy only supports cpu at the moment +RAY_PROCESSING_DEVICE_SPACY=cpu +RAY_PROCESSING_DEVICE_WHISPER=cuda +RAY_PROCESSING_DEVICE_DETR=cuda +RAY_PROCESSING_DEVICE_VIT_GPT2=cuda +RAY_PROCESSING_DEVICE_BLIP2=cuda +RAY_PROCESSING_DEVICE_COTA=cuda +# If operating blip2 on the cpu, this has to be 32 +# Otherwise, you can choose between 8, 16 and 32 +RAY_BLIP2_PRECISION_BIT=8 +RAY_PROCESSING_DEVICE_CLIP=cuda + +RAY_API_EXPOSED=43134 +RAY_DASHBOARD_EXPOSED=43135 + +RAY_GPU_DEVICE_IDS=0 diff --git a/docker/docker-compose-ray-only.yml b/docker/docker-compose-ray-only.yml new file mode 100644 index 000000000..054dd0f05 --- /dev/null +++ b/docker/docker-compose-ray-only.yml @@ -0,0 +1,44 @@ +services: + ray: + env_file: ".env.ray-only" + image: uhhlt/dats_ray:${DATS_RAY_DOCKER_VERSION} + command: /dats_code_ray/ray_model_worker_entrypoint.sh + user: ${UID:-1004}:${GID:-1004} + environment: + LOG_LEVEL: ${LOG_LEVEL:-info} + DATS_BACKEND_CONFIG: ${DATS_BACKEND_CONFIG:-/dats_code/src/configs/default.yaml} + HUGGINGFACE_HUB_CACHE: /models_cache + TRANSFORMERS_CACHE: /models_cache + TORCH_HOME: /models_cache + RAY_PROCESSING_DEVICE_SPACY: ${RAY_PROCESSING_DEVICE_SPACY} + RAY_PROCESSING_DEVICE_WHISPER: ${RAY_PROCESSING_DEVICE_WHISPER} + RAY_PROCESSING_DEVICE_DETR: ${RAY_PROCESSING_DEVICE_DETR} + RAY_PROCESSING_DEVICE_VIT_GPT2: ${RAY_PROCESSING_DEVICE_VIT_GPT2} + RAY_PROCESSING_DEVICE_BLIP2: ${RAY_PROCESSING_DEVICE_BLIP2} + RAY_PROCESSING_DEVICE_CLIP: ${RAY_PROCESSING_DEVICE_CLIP} + RAY_PROCESSING_DEVICE_COTA: ${RAY_PROCESSING_DEVICE_COTA} + RAY_BLIP2_PRECISION_BIT: ${RAY_BLIP2_PRECISION_BIT:-32} + SHARED_REPO_ROOT: ${SHARED_REPO_ROOT:-/tmp/dats} + NUMBA_CACHE_DIR: /numba_cache + volumes: + # - ../backend/src/app/preprocessing/ray_model_worker:/dats_code_ray + - ./spacy_models:/spacy_models + - ./backend_repo:${SHARED_REPO_ROOT:-/tmp/dats} + - ./models_cache:/models_cache + - ./numba_cache:/numba_cache + ports: + - "${RAY_API_EXPOSED:-8000}:8000" + - "${RAY_DASHBOARD_EXPOSED:-8265}:8265" + restart: always + shm_size: 12gb + networks: + - dats_demo_network + deploy: + resources: + reservations: + devices: + - driver: nvidia + device_ids: ["${RAY_GPU_DEVICE_IDS:-0}"] + capabilities: [gpu] +networks: + dats_demo_network: