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 audio/nes2net/Dockerfile from deepsafe/deepsafe-services: direct link, hf CLI and curl.
- Browser
- Download file 1.17 kB
-
https://huggingface.co/deepsafe/deepsafe-services/resolve/main/audio/nes2net/Dockerfile
- Command line
-
hf download hf://deepsafe/deepsafe-services/audio/nes2net/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/deepsafe/deepsafe-services/resolve/main/audio/nes2net/Dockerfile
1.17 kB
| FROM nvidia/cuda:12.1.1-cudnn8-runtime-ubuntu22.04 | |
| ENV DEBIAN_FRONTEND=noninteractive | |
| ENV PYTHONUNBUFFERED=1 | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| python3 python3-pip python3-dev \ | |
| git ffmpeg libsndfile1 wget \ | |
| build-essential g++ \ | |
| && rm -rf /var/lib/apt/lists/* | |
| RUN ln -sf /usr/bin/python3 /usr/bin/python | |
| WORKDIR /app | |
| # Install PyTorch with CUDA 12.1 | |
| RUN pip install --no-cache-dir \ | |
| torch==2.5.1 torchaudio==2.5.1 \ | |
| --index-url https://download.pytorch.org/whl/cu121 | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Clone fairseq with patched C extensions (same as ShiftySpeech) | |
| RUN git clone https://github.com/facebookresearch/fairseq.git /app/fairseq_repo && \ | |
| cd /app/fairseq_repo && \ | |
| git checkout a54021305d6b3c4c5959ac9395135f63202db8f1 && \ | |
| sed -i 's/ext_modules=extensions/ext_modules=[]/' setup.py && \ | |
| pip install --no-cache-dir --no-deps -e . | |
| COPY model_scripts /app/model_scripts | |
| COPY api.py . | |
| RUN mkdir -p /app/weights | |
| COPY weights/ /app/weights/ | |
| EXPOSE 8004 | |
| RUN adduser --disabled-password --gecos '' appuser | |
| USER appuser | |
| CMD ["python", "api.py"] | |