orb / Dockerfile
marcosmaceo's picture
Pin ORB_REF to full sha
e1a841e verified
Raw History Blame Contribute Delete
1.89 kB
# ORB demo Space (Docker SDK).
#
# Serves the ORB project page (site/) from the pinned GitHub commit and pulls the Apache-2.0
# planner from the Hub. The CC BY-NC detail model is deliberately NOT
# downloaded: this Space runs the planner + DSP path only.
FROM python:3.12-slim
RUN apt-get update && \
apt-get install -y --no-install-recommends git && \
rm -rf /var/lib/apt/lists/*
# Hugging Face Spaces run the container as uid 1000.
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH \
PYTHONUNBUFFERED=1 \
PIP_NO_CACHE_DIR=1 \
HF_HOME=/home/user/.cache/huggingface
# Pinned source: a tag, branch or commit. Override ORB_REPO / ORB_REF at build
# time to test a branch.
ARG ORB_REPO=https://github.com/stdevMac/orb-audio.git
# One page everywhere: site/ served with the server engine (47e5cec).
ARG ORB_REF=47e5cec59f3964058dfa2db46b7e16f2e78efec0
RUN git init -q $HOME/app && cd $HOME/app && \
git fetch -q --depth 1 "${ORB_REPO}" "${ORB_REF}" && git checkout -q FETCH_HEAD
WORKDIR $HOME/app
# CPU-only torch keeps the image ~1.5 GB smaller than the default CUDA wheel.
RUN pip install --user torch --index-url https://download.pytorch.org/whl/cpu && \
pip install --user ".[train,hub]"
# Apache-2.0 planner weights + config from the Hub. git-lfs is not installed,
# so the cloned weights/planner.pt is only an LFS pointer: remove it so every
# code path resolves to the .safetensors sibling.
ARG HF_MODEL=marcosmaceo/orb-planner
ENV HF_MODEL=${HF_MODEL}
RUN rm -f weights/planner.pt && python -c "\
import os, shutil; \
from huggingface_hub import hf_hub_download as d; \
[shutil.copy(d(os.environ['HF_MODEL'], f), 'weights/' + f) for f in ('planner.safetensors', 'config.json')]"
ENV ORB_PLANNER=weights/planner.safetensors
EXPOSE 7860
CMD ["python", "web/server.py", "--host", "0.0.0.0", "--port", "7860"]