Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker-based Environment Setup & Define requirements.txt #65

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .env.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# docker-compose profile ex: v1,v2,v3,v4,v4neo
COMPOSE_PROFILES=v4neo
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ ipython_config.py
# pyenv
.python-version

# Allow Python requirements
!requirements.txt

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
Expand Down
32 changes: 32 additions & 0 deletions RWKV-v4/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
FROM nvidia/cuda:12.1.0-devel-ubuntu22.04

ARG workdir=/workspace
WORKDIR ${workdir}

ENV TZ=GMT0
ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update && \
apt-get install -y software-properties-common tzdata
RUN add-apt-repository ppa:deadsnakes/ppa
RUN apt-get update -y \
&& apt-get install -y make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev \
libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev xz-utils tk-dev libffi-dev \
liblzma-dev python3-openssl git less
# python
ARG python_version=3.9.13
RUN wget https://www.python.org/ftp/python/${python_version}/Python-${python_version}.tar.xz \
&& tar xJf Python-${python_version}.tar.xz && rm Python-${python_version}.tar.xz
RUN cd Python-${python_version} && ./configure && make && make install && cd ..
RUN wget https://bootstrap.pypa.io/get-pip.py\
&& python3.9 get-pip.py \
&& rm get-pip.py

# python packages
COPY requirements.txt ${workdir}
RUN pip3 install -U pip && pip3 install --no-cache-dir -r requirements.txt

# alias settings
RUN echo 'alias python="python3"' >> ~/.bashrc && \
echo 'alias pip="pip3"' >> ~/.bashrc && \
. ~/.bashrc
22 changes: 22 additions & 0 deletions RWKV-v4/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# nessesary
pytorch_lightning==1.9.0
ninja
numpy
torch
torchinfo
torchsummary
# misc
jupyter
jupyterlab
matplotlib
nbdev
pandas
pillow
pyyaml
scikit-learn
seaborn
tensorboard
tqdm
wandb
timm

32 changes: 32 additions & 0 deletions RWKV-v4neo/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
FROM nvidia/cuda:12.1.0-devel-ubuntu22.04

ARG workdir=/workspace
WORKDIR ${workdir}

ENV TZ=GMT0
ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update && \
apt-get install -y software-properties-common tzdata
RUN add-apt-repository ppa:deadsnakes/ppa
RUN apt-get update -y \
&& apt-get install -y make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev \
libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev xz-utils tk-dev libffi-dev \
liblzma-dev python3-openssl git less
# python
ARG python_version=3.9.13
RUN wget https://www.python.org/ftp/python/${python_version}/Python-${python_version}.tar.xz \
&& tar xJf Python-${python_version}.tar.xz && rm Python-${python_version}.tar.xz
RUN cd Python-${python_version} && ./configure && make && make install && cd ..
RUN wget https://bootstrap.pypa.io/get-pip.py\
&& python3.9 get-pip.py \
&& rm get-pip.py

# python packages
COPY requirements.txt ${workdir}
RUN pip3 install -U pip && pip3 install --no-cache-dir -r requirements.txt

# alias settings
RUN echo 'alias python="python3"' >> ~/.bashrc && \
echo 'alias pip="pip3"' >> ~/.bashrc && \
. ~/.bashrc
22 changes: 22 additions & 0 deletions RWKV-v4neo/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# nessesary
pytorch_lightning==1.9.0
ninja
numpy
torch
torchinfo
torchsummary
# misc
jupyter
jupyterlab
matplotlib
nbdev
pandas
pillow
pyyaml
scikit-learn
seaborn
tensorboard
tqdm
wandb
timm

46 changes: 46 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
version: "3"

x-train-base: &train-base
command: >
bash -c "export SHELL=/bin/bash && source ~/.bashrc
&& jupyter lab --allow-root --no-browser --ip=0.0.0.0 --port=8888 --NotebookApp.token='' --NotebookApp.password=''"
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: all
capabilities: [gpu]
logging:
driver: json-file
options:
max-size: 50m
restart: unless-stopped
stdin_open: true
shm_size: 2gb # shared memory setting for pytorch DataLoader
tty: true
working_dir: /workspace/prj
volumes:
- .:/workspace/prj
ports:
- "8888:8888" # jupyter lab


services:
train-v4:
<<: *train-base
container_name: train-v4
build:
context: ./RWKV-v4
dockerfile: Dockerfile
profiles: ["v4"]

train-v4neo:
<<: *train-base
container_name: train-v4neo
build:
context: ./RWKV-v4neo
dockerfile: Dockerfile
profiles: ["v4neo"]