From 77d54052108fcc4ab124be9c1b7b9cbfd3e24414 Mon Sep 17 00:00:00 2001 From: Maki Date: Wed, 20 Nov 2024 20:37:59 +0900 Subject: [PATCH 1/5] =?UTF-8?q?=F0=9F=93=9D=20[chore]=20Add=20.dockerignor?= =?UTF-8?q?e=20file=20for=20container=20optimization?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Exclude unnecessary files and directories from Docker context - Prevent copying of development artifacts and cache files - Optimize build process and reduce image size --- .dockerignore | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..bee6953 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,13 @@ +__pycache__ +*.pyc +.git +.gitignore +.env +*.md +.pytest_cache +*.egg-info +dist +build +.venv +.idea +.cache From 8f4897d2b25ac6a17a2386786553400be15b35cd Mon Sep 17 00:00:00 2001 From: Maki Date: Wed, 20 Nov 2024 20:38:05 +0900 Subject: [PATCH 2/5] =?UTF-8?q?=F0=9F=94=A7=20[chore]=20Update=20.gitignor?= =?UTF-8?q?e=20with=20cache=20and=20certificate=20entries?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add Gradio certificate and cache directory exclusions - Ensure sensitive and temporary files are not tracked --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..41bd476 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +.cache +.gradio/certificate.pem From 710344ec65e2f933784e31ccb60ed38d01c300a5 Mon Sep 17 00:00:00 2001 From: Maki Date: Wed, 20 Nov 2024 20:38:12 +0900 Subject: [PATCH 3/5] =?UTF-8?q?=F0=9F=90=B3=20[feat]=20Create=20Dockerfile?= =?UTF-8?q?=20for=20PyTorch=20GPU=20environment?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Set up PyTorch 2.2.1 with CUDA 12.1 support - Configure system dependencies and Python packages - Establish working directory and application deployment structure --- Dockerfile | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..8e6d534 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,22 @@ +FROM pytorch/pytorch:2.2.1-cuda12.1-cudnn8-runtime + +WORKDIR /app + +# Install system dependencies +RUN apt-get update && apt-get install -y \ + git \ + python3-pip \ + && rm -rf /var/lib/apt/lists/* + +# Install Python dependencies +COPY requirements.txt . +RUN pip install --no-cache-dir -r requirements.txt + +# Copy application code +COPY . . + +# Expose port for Gradio +EXPOSE 7860 + +# Command to run the application +CMD ["python", "app.py"] From bae26c5fdc41ee6d1f3f917819587a1034c24212 Mon Sep 17 00:00:00 2001 From: Maki Date: Wed, 20 Nov 2024 20:38:18 +0900 Subject: [PATCH 4/5] =?UTF-8?q?=F0=9F=94=84=20[feat]=20Enable=20share=20mo?= =?UTF-8?q?de=20in=20Gradio=20application?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Modify launch configuration to allow remote access - Enable sharing capability for wider accessibility --- app.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app.py b/app.py index 3c3cb1d..8373be7 100644 --- a/app.py +++ b/app.py @@ -235,5 +235,5 @@ def chat_llama3_8b(message: str, ) if __name__ == "__main__": - demo.launch() + demo.launch(share=True) From a5592e1d8a06d2492c5553a8981d01932108646f Mon Sep 17 00:00:00 2001 From: Maki Date: Wed, 20 Nov 2024 20:38:25 +0900 Subject: [PATCH 5/5] =?UTF-8?q?=E2=9A=A1=20[feat]=20Add=20docker-compose?= =?UTF-8?q?=20configuration=20with=20GPU=20support?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Configure service with NVIDIA GPU integration - Set up volume mounts for application code and model caching - Define port mapping and resource allocations - Enable GPU capabilities for ML operations --- docker-compose.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 docker-compose.yml diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..4ef0541 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,25 @@ +version: '3.8' + +services: + llama-mesh: + build: + context: . + dockerfile: Dockerfile + # runtime: nvidia + environment: + - NVIDIA_VISIBLE_DEVICES=all + - NVIDIA_DRIVER_CAPABILITIES=all + ports: + - "7878:7860" # Gradio UI port + volumes: + - .:/app + - .cache/huggingface:/root/.cache/huggingface # Cache HuggingFace models + command: python app.py + tty: true + deploy: + resources: + reservations: + devices: + - driver: nvidia + count: all + capabilities: [gpu]