generated from rochacbruno/python-project-template
-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(train,docker): training script and docker env created
- Loading branch information
Showing
13 changed files
with
394 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
Dockerfile | ||
.dockerignore | ||
docker-compose.yml | ||
|
||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
|
||
# C extensions | ||
*.so | ||
|
||
# Distribution / packaging | ||
.Python | ||
build/ | ||
develop-eggs/ | ||
dist/ | ||
downloads/ | ||
eggs/ | ||
.eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
wheels/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
MANIFEST | ||
|
||
# PyInstaller | ||
# Usually these files are written by a python script from a template | ||
# before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
*.manifest | ||
*.spec | ||
|
||
# Installer logs | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
|
||
# Unit test / coverage reports | ||
htmlcov/ | ||
.tox/ | ||
.coverage | ||
.coverage.* | ||
.cache | ||
nosetests.xml | ||
coverage.xml | ||
*.cover | ||
.hypothesis/ | ||
.pytest_cache/ | ||
|
||
# Translations | ||
*.mo | ||
*.pot | ||
|
||
# Django stuff: | ||
*.log | ||
local_settings.py | ||
db.sqlite3 | ||
|
||
# Flask stuff: | ||
instance/ | ||
.webassets-cache | ||
|
||
# Scrapy stuff: | ||
.scrapy | ||
|
||
# Sphinx documentation | ||
docs/_build/ | ||
|
||
# PyBuilder | ||
target/ | ||
|
||
# Jupyter Notebook | ||
.ipynb_checkpoints | ||
|
||
# pyenv | ||
.python-version | ||
|
||
# celery beat schedule file | ||
celerybeat-schedule | ||
|
||
# SageMath parsed files | ||
*.sage.py | ||
|
||
# Environments | ||
.env | ||
.venv | ||
env/ | ||
venv/ | ||
ENV/ | ||
env.bak/ | ||
venv.bak/ | ||
|
||
# Spyder project settings | ||
.spyderproject | ||
.spyproject | ||
|
||
# Rope project settings | ||
.ropeproject | ||
|
||
# mkdocs documentation | ||
/site | ||
|
||
# mypy | ||
.mypy_cache/ | ||
|
||
*.png | ||
*.pfm | ||
*.jpg | ||
*.jpeg | ||
*.pt | ||
.DS_Store | ||
|
||
nohup.out | ||
wandb/ | ||
checkpoints/ | ||
weights/ | ||
input/ | ||
output_monodepth/ | ||
output_semseg/ | ||
checkpoints_pretrained/ | ||
|
||
docker/ | ||
core |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -130,3 +130,5 @@ dmypy.json | |
|
||
# templates | ||
.github/templates/* | ||
|
||
checkpoints/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
version: "3.9" | ||
services: | ||
dev: | ||
# Will build ./docker/Dockerfile | ||
# This Dockerfile is for GPU based development | ||
|
||
build: | ||
context: . | ||
dockerfile: ./docker/Dockerfile | ||
volumes: | ||
- ./:/app | ||
- ~/.cache:/root/.cache | ||
- ~/.torch:/root/.torch | ||
- ~/.config:/root/.config | ||
- ~/.bash_history:/root/.bash_history | ||
- ~/.netrc:/root/.netrc | ||
- ~/Datasets:/root/Datasets | ||
deploy: | ||
resources: | ||
reservations: | ||
devices: | ||
- driver: nvidia | ||
device_ids: ['0'] | ||
capabilities: [gpu] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
FROM nvidia/cuda:11.8.0-devel-ubuntu20.04 | ||
|
||
|
||
ENV DEBIAN_FRONTEND noninteractive | ||
|
||
# Install dependencies | ||
RUN apt-get update && apt-get install -y software-properties-common gcc && \ | ||
add-apt-repository -y ppa:deadsnakes/ppa | ||
RUN apt-get update | ||
RUN apt-get update && apt-get upgrade -y | ||
RUN apt-get install -y software-properties-common gcc | ||
RUN apt-get install -y python3.10 python3.10-dev python3.10-distutils python3-pip python3-apt python3.10-venv | ||
RUN apt-get update && apt-get install -y git curl | ||
RUN curl -sS https://bootstrap.pypa.io/get-pip.py | python3.10 | ||
|
||
RUN /usr/bin/python3.10 -m pip install --upgrade pip | ||
# RUN curl -sS https://bootstrap.pypa.io/get-pip.py | python3.10 # install pip | ||
|
||
# Alias python3.10 to python3 | ||
RUN cp /usr/bin/python3.10 /usr/bin/python3 | ||
|
||
# Copy code in for installation | ||
COPY ./ /app | ||
WORKDIR /app | ||
|
||
# make virtualenv | ||
SHELL ["/bin/bash", "-c"] | ||
|
||
# Install LLaVA | ||
WORKDIR /app/LLaVA | ||
|
||
RUN pip install . | ||
|
||
WORKDIR /app/ | ||
|
||
# RUN \ | ||
# --mount=type=cache,target=/root/.cache/ \ | ||
# make install | ||
|
||
RUN make install | ||
|
||
RUN python3 -m pip install flash-attn --no-build-isolation --no-cache-dir | ||
RUN python3 -m pip install torch==2.1.2 torchvision==0.16.2 torchaudio==2.1.2 --index-url https://download.pytorch.org/whl/cu118 --force-reinstall | ||
|
||
# Install dependencies | ||
# RUN /usr/bin/python3.10 -m pip install --upgrade pip | ||
# RUN /usr/bin/python3.10 -m pip install torch==1.13.1+cu117 torchvision==0.14.1+cu117 torchaudio==0.13.1+cu117 --index-url https://download.pytorch.org/whl/cu117 | ||
# RUN /usr/bin/python3.10 -m pip install tqdm wandb opencv-python-headless pandas matplotlib==3.6.2 timm==0.6.12 scipy==1.9.3 | ||
|
||
# # Install requirements | ||
# RUN /usr/bin/python3.10 -m pip install -r requirements.txt | ||
# RUN /usr/bin/python3.10 -m pip install -r requirements-test.txt | ||
|
||
# Remove code, without removing env | ||
RUN find ./ ! -path './.venv*' ! -path './' -delete | ||
|
||
# RUN mkdir /app | ||
WORKDIR /app | ||
|
||
# Env vars for the nvidia-container-runtime. | ||
ENV NVIDIA_VISIBLE_DEVICES all | ||
ENV NVIDIA_DRIVER_CAPABILITIES graphics,utility,compute | ||
|
||
ENV BNB_CUDA_VERSION 118 | ||
|
||
# LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib/python3.10/dist-packages/nvidia/cuda_runtime/lib | ||
ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib/python3.10/dist-packages/nvidia/cuda_runtime/lib | ||
|
||
RUN echo 'PS1="(DLV) \[\]\[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ \[\]"' >> /root/.bashrc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Occupancy Network Docker Container | ||
|
||
## Build | ||
|
||
To build the docker container: | ||
```bash | ||
DOCKER_BUILDKIT=1 docker-compose build | ||
``` | ||
|
||
## Run | ||
|
||
Once you have built the docker container use the following command to start it up: | ||
```bash | ||
docker compose run dev | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.