-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile.lithops.gpu
More file actions
97 lines (78 loc) · 2.63 KB
/
Dockerfile.lithops.gpu
File metadata and controls
97 lines (78 loc) · 2.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# Dockerfile for CoSMo PSS Lithops Runtime (GPU)
# Optimized for AWS Batch, Azure Container Instances, or GCP with GPU support
# Requires NVIDIA GPU runtime
FROM nvidia/cuda:11.8.0-cudnn8-runtime-ubuntu22.04
LABEL maintainer="CoSMo PSS Team"
LABEL description="CoSMo PSS Lithops Runtime - GPU-enabled for batch processing"
LABEL runtime_type="gpu"
LABEL cuda_version="11.8"
# Set non-interactive installation
ENV DEBIAN_FRONTEND=noninteractive
# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
python3.10 \
python3.10-dev \
python3-pip \
git \
wget \
curl \
build-essential \
libgomp1 \
libglib2.0-0 \
libsm6 \
libxext6 \
libxrender-dev \
libgl1-mesa-glx \
&& rm -rf /var/lib/apt/lists/*
# Create symlink for python
RUN ln -s /usr/bin/python3.10 /usr/bin/python
# Set working directory
WORKDIR /function
# Upgrade pip
RUN python -m pip install --no-cache-dir --upgrade pip setuptools wheel
# Install PyTorch with CUDA 11.8 support
RUN pip install --no-cache-dir \
torch==2.1.0 \
torchvision==0.16.0 \
torchaudio==2.1.0 \
--index-url https://download.pytorch.org/whl/cu118
# Install core ML dependencies
RUN pip install --no-cache-dir \
transformers==4.35.2 \
sentence-transformers==2.2.2 \
huggingface-hub==0.19.4 \
accelerate==0.25.0 \
safetensors==0.4.1 \
tokenizers==0.15.0
# Install image processing libraries
RUN pip install --no-cache-dir \
Pillow==10.1.0 \
opencv-python-headless==4.8.1.78
# Install scientific computing packages
RUN pip install --no-cache-dir \
numpy==1.24.3 \
pandas==2.1.3 \
scipy==1.11.4
# Install Lithops
RUN pip install --no-cache-dir lithops==3.3.1
# Install additional utilities
RUN pip install --no-cache-dir \
tqdm==4.66.1 \
pyyaml==6.0.1
# Copy CoSMo PSS code
COPY src/cosmo /function/cosmo
# Set Python path
ENV PYTHONPATH=/function:$PYTHONPATH
# Environment variables for model caching and GPU
ENV TRANSFORMERS_CACHE=/tmp/transformers_cache
ENV HF_HOME=/tmp/hf_home
ENV TORCH_HOME=/tmp/torch_home
ENV HF_DATASETS_OFFLINE=1
ENV TRANSFORMERS_OFFLINE=0
ENV CUDA_VISIBLE_DEVICES=0
# Create cache directories
RUN mkdir -p /tmp/transformers_cache /tmp/hf_home /tmp/torch_home
# Verify CUDA is available
RUN python -c "import torch; print(f'PyTorch version: {torch.__version__}'); print(f'CUDA available: {torch.cuda.is_available()}'); print(f'CUDA version: {torch.version.cuda if torch.cuda.is_available() else \"N/A\"}')"
# Set entrypoint for Lithops
CMD ["python", "-c", "import torch; print(f'CoSMo PSS Lithops GPU Runtime Ready - CUDA: {torch.cuda.is_available()}')"]