Instructions to use deepsafe/deepsafe-services with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use deepsafe/deepsafe-services with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("deepsafe/deepsafe-services", dtype=torch.bfloat16, device_map="cuda") prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k" image = pipe(prompt).images[0] - Notebooks
- Google Colab
- Kaggle
Download video/mintime/Dockerfile from deepsafe/deepsafe-services: direct link, hf CLI and curl.
- Browser
- Download file 1.52 kB
-
https://huggingface.co/deepsafe/deepsafe-services/resolve/main/video/mintime/Dockerfile
- Command line
-
hf download hf://deepsafe/deepsafe-services/video/mintime/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/deepsafe/deepsafe-services/resolve/main/video/mintime/Dockerfile
1.52 kB
| FROM nvidia/cuda:12.1.1-cudnn8-runtime-ubuntu22.04 | |
| ENV DEBIAN_FRONTEND=noninteractive | |
| ENV PYTHONUNBUFFERED=1 | |
| WORKDIR /app | |
| # Install Python 3.10 and system dependencies for OpenCV | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| python3 python3-pip \ | |
| libgl1 \ | |
| libglib2.0-0 \ | |
| libsm6 \ | |
| libxext6 \ | |
| libxrender-dev \ | |
| && rm -rf /var/lib/apt/lists/* | |
| RUN ln -sf /usr/bin/python3 /usr/bin/python | |
| # Install PyTorch with CUDA 12.1 | |
| RUN pip install --no-cache-dir \ | |
| torch==2.5.1 torchvision==0.20.1 \ | |
| --index-url https://download.pytorch.org/whl/cu121 | |
| # Copy requirements and install (facenet-pytorch needs --no-deps due to torch<2.3 pin) | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir --no-deps facenet-pytorch && \ | |
| pip install --no-cache-dir -r requirements.txt | |
| # Create logs and weights directories | |
| RUN mkdir -p logs weights | |
| # Copy model code (vendored from MINTIME repo) | |
| COPY model_code/ /app/model_code/ | |
| # Copy weights | |
| COPY weights/ /app/weights/ | |
| # Copy application code | |
| COPY app.py . | |
| # Environment variables | |
| ENV MODEL_PORT=7008 | |
| ENV PRELOAD_MODEL=false | |
| ENV MODEL_TIMEOUT=1800 | |
| ENV EXTRACTOR_WEIGHTS_PATH=/app/weights/MINTIME/MINTIME_XC_Extractor_checkpoint30 | |
| ENV MODEL_WEIGHTS_PATH=/app/weights/MINTIME/MINTIME_XC_Model_checkpoint30 | |
| # Expose port | |
| EXPOSE 7008 | |
| # Drop root privileges | |
| RUN adduser --disabled-password --gecos '' appuser && \ | |
| chown -R appuser:appuser /app/logs /app/weights | |
| USER appuser | |
| # Run the service | |
| CMD ["python", "app.py"] | |