Fix CLIP model caching #88 (#95)

Refs #88
hacky solution but works for now
This commit is contained in:
AbdBarho 2022-09-24 09:57:57 +02:00 committed by GitHub
parent 15a61a99d6
commit 7638fb4e5e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -61,8 +61,12 @@ RUN pip install --prefer-binary -U --no-cache-dir opencv-python-headless
ENV TRANSFORMERS_CACHE=/cache/transformers TORCH_HOME=/cache/torch CLI_ARGS=""
COPY . /docker
RUN chmod +x /docker/mount.sh && python3 /docker/info.py ${ROOT}/modules/ui.py
RUN <<EOF
chmod +x /docker/mount.sh && python3 /docker/info.py ${ROOT}/modules/ui.py
# hackiest of hacks, change default cache dir of clip #88
# https://github.com/openai/CLIP/blob/d50d76daa670286dd6cacf3bcd80b5e4823fc8e1/clip/clip.py#L94
sed -i -- 's/download_root: str = None/download_root: str = "\/cache\/weights"/' /opt/conda/lib/python3.8/site-packages/clip/clip.py
EOF
WORKDIR ${WORKDIR}
EXPOSE 7860