diff --git a/.gitignore b/.gitignore index c58c45c..6949a8f 100644 --- a/.gitignore +++ b/.gitignore @@ -179,3 +179,8 @@ publish_model_to_hf.py # and can be added to the global gitignore or merged into this file. For a more nuclear # option (not recommended) you can uncomment the following to ignore the entire idea folder. #.idea/ + +.ipython +.jupyter +.local +Draft.ipynb \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..c8de74b --- /dev/null +++ b/Dockerfile @@ -0,0 +1,39 @@ +# Use the official PyTorch image as the base +FROM pytorch/pytorch:2.1.2-cuda11.8-cudnn8-devel AS build + + +# Set build arguments for UID and GID +ARG UID=1000 +ARG GID=1000 + +WORKDIR /workspace +COPY requirement.txt . +RUN pip install --no-cache-dir -r requirement.txt + + +# Create a group and user with the specified UID and GID +RUN groupadd -g ${GID} usergroup && \ + useradd -m -u ${UID} -g usergroup user + + +# Pre-final stage +FROM build AS pre + +# Set the working directory +WORKDIR /workspace + +# Copy the application code +COPY . /workspace + +RUN pip install causal-conv1d/ + +# Final stage +FROM pre AS final + +RUN pip install mamba/ + +# Set environment variables +ENV XDG_CACHE_HOME=/workspace/.cache +ENV HOME=/workspace + +EXPOSE 8888 \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..6228f2d --- /dev/null +++ b/Makefile @@ -0,0 +1,59 @@ +NAME=videomamba +COMMAND?=bash +OPTIONS?= + +GPUS?=all +ifeq ($(GPUS),none) + GPUS_OPTION= +else + GPUS_OPTION=--gpus=$(GPUS) +endif + +USER_ID := $(shell id -u) +GROUP_ID := $(shell id -g) + +.PHONY: all +all: stop build run + +.PHONY: build +build: + docker build --target final -t $(NAME) . + +.PHONY: stop +stop: + -docker stop $(NAME) + -docker rm $(NAME) + +.PHONY: run +run: + docker run --rm -dit \ + --net=host \ + --ipc=host \ + $(OPTIONS) \ + $(GPUS_OPTION) \ + --user $(USER_ID):$(GROUP_ID) \ + -v $(shell pwd):/workspace \ + --name=$(NAME) \ + $(NAME) \ + $(COMMAND) + + docker attach $(NAME) + + +.PHONY: attach +attach: + docker attach $(NAME) + + +.PHONY: notebook +notebook: + docker run --rm -it \ + --ipc=host \ + -p 8888:8888 \ + $(OPTIONS) \ + $(GPUS_OPTION) \ + --user $(USER_ID):$(GROUP_ID) \ + -v $(shell pwd):/workspace \ + --name=$(NAME)_notebook \ + $(NAME) \ + jupyter lab --ip=0.0.0.0 --port=8888 --no-browser --allow-root --notebook-dir=/workspace diff --git a/requirement.txt b/requirement.txt index fa76a87..13a610d 100644 --- a/requirement.txt +++ b/requirement.txt @@ -1,3 +1,4 @@ tensorboard mmengine -joblib \ No newline at end of file +joblib +jupyterlab \ No newline at end of file