worldbank / REaLTabFormer

A suite of auto-regressive and Seq2Seq (sequence-to-sequence) transformer models for tabular and relational synthetic data generation.
https://worldbank.github.io/REaLTabFormer/
MIT License
200 stars 23 forks source link

Docker image to run REalTabFormer to support NVIDIA CUDA and GPU #38

Closed echatzikyriakidis closed 1 year ago

echatzikyriakidis commented 1 year ago

Hi @avsolatorio,

I was wondering if you have any latest docker image example from NVIDIA to support running a Python application with REalTabFormer that will utilize GPU from host machine.

Thanks!

echatzikyriakidis commented 1 year ago

I am thinking also to run the application in a Kubernetes cluster.

avsolatorio commented 1 year ago

Hello @echatzikyriakidis, Unfortunately, this is beyond the scope of support we see for the project at the moment. I am pretty sure there are a lot of resources out there for this. I encourage you to contribute your solution back here for others to benefit from as well. Thank you! 😀

echatzikyriakidis commented 1 year ago

Thank you!

Here is how I have managed to containerize it:

With docker run:

docker run --gpus 1 --rm -it --name container_name image_name:latest

With docker compose:

version: '3.8'

services:
  application:
    container_name: container_name
    build:
      context: application
      dockerfile: Dockerfile
    image: image_name
    restart: unless-stopped
    deploy:
      resources:
        reservations:
          devices:
            - driver: nvidia
              count: 1
              capabilities: [gpu]

Here is the Dockerfile:

FROM nvidia/cuda:11.6.2-cudnn8-runtime-ubuntu20.04

ENV DEBIAN_FRONTEND=noninteractive

ENV PYTHONDONTWRITEBYTECODE=1

ENV PYTHONUNBUFFERED=1

RUN apt-get update \
    && apt-get -y install --no-install-recommends \
        python3.9 \
        python3-pip
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/*

COPY requirements.txt /tmp/pip-tmp/

RUN python3.9 -m pip install --disable-pip-version-check --no-cache-dir -r /tmp/pip-tmp/requirements.txt && rm -rf /tmp/pip-tmp

WORKDIR /app

COPY . .

ENTRYPOINT ["python3.9", "main.py"]