diff --git a/.env.sample b/.env.sample new file mode 100644 index 000000000..5bf474b99 --- /dev/null +++ b/.env.sample @@ -0,0 +1,2 @@ +# docker-compose profile ex: v1,v2,v3,v4,v4neo +COMPOSE_PROFILES=v4neo diff --git a/.gitignore b/.gitignore index 3c9a4ff8c..3f93d77d0 100644 --- a/.gitignore +++ b/.gitignore @@ -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 diff --git a/RWKV-v4/Dockerfile b/RWKV-v4/Dockerfile new file mode 100644 index 000000000..e055bb65a --- /dev/null +++ b/RWKV-v4/Dockerfile @@ -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 diff --git a/RWKV-v4/requirements.txt b/RWKV-v4/requirements.txt new file mode 100644 index 000000000..4773626cd --- /dev/null +++ b/RWKV-v4/requirements.txt @@ -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 + diff --git a/RWKV-v4neo/Dockerfile b/RWKV-v4neo/Dockerfile new file mode 100644 index 000000000..e055bb65a --- /dev/null +++ b/RWKV-v4neo/Dockerfile @@ -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 diff --git a/RWKV-v4neo/requirements.txt b/RWKV-v4neo/requirements.txt new file mode 100644 index 000000000..4773626cd --- /dev/null +++ b/RWKV-v4neo/requirements.txt @@ -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 + diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 000000000..a09275dda --- /dev/null +++ b/docker-compose.yml @@ -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"] + +