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 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 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"] 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) 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]