Skip to content

Commit

Permalink
docker compose for ray only
Browse files Browse the repository at this point in the history
  • Loading branch information
floschne committed Sep 12, 2024
1 parent f5678b7 commit 8c52011
Show file tree
Hide file tree
Showing 2 changed files with 84 additions and 0 deletions.
40 changes: 40 additions & 0 deletions docker/.env.ray-only.example
Original file line number Diff line number Diff line change
@@ -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
44 changes: 44 additions & 0 deletions docker/docker-compose-ray-only.yml
Original file line number Diff line number Diff line change
@@ -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:

0 comments on commit 8c52011

Please sign in to comment.