File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -63,6 +63,12 @@ RUN git clone --branch n7.1 --depth 1 https://github.com/FFmpeg/FFmpeg.git ffmpe
6363 cd .. \
6464 rm -rf ffmpeg
6565
66+ # Common environment variables for AI runner pipelines
67+ ENV MAX_WORKERS=1 \
68+ HUGGINGFACE_HUB_CACHE=/models \
69+ DIFFUSERS_CACHE=/models \
70+ MODEL_DIR=/models
71+
6672# -----------------------------------------------------------------------------
6773# live-base: End of section
6874# -----------------------------------------------------------------------------
@@ -113,12 +119,6 @@ COPY live/comfyui/main.py ./main.py
113119# Final sync to install the project
114120RUN uv sync --active --locked --inexact
115121
116- # Set environment variables
117- ENV MAX_WORKERS=1 \
118- HUGGINGFACE_HUB_CACHE=/models \
119- DIFFUSERS_CACHE=/models \
120- MODEL_DIR=/models
121-
122122# Keep these args/envs last to maximize cache reuse when only runtime envs change
123123ARG GIT_SHA
124124ARG VERSION="undefined"
Original file line number Diff line number Diff line change @@ -29,11 +29,7 @@ RUN uv sync --locked --inexact
2929# Configure Scope models directory
3030ENV DAYDREAM_SCOPE_MODELS_DIR="/models/Scope--models"
3131
32- ENV HF_HUB_OFFLINE=1 \
33- MAX_WORKERS=1 \
34- HUGGINGFACE_HUB_CACHE=/models \
35- DIFFUSERS_CACHE=/models \
36- MODEL_DIR=/models
32+ ENV HF_HUB_OFFLINE=1
3733
3834ARG GIT_SHA
3935ARG VERSION="undefined"
Original file line number Diff line number Diff line change @@ -31,11 +31,7 @@ RUN ln -s /models/StreamDiffusion--engines ./engines \
3131 && ln -s /models/StreamDiffusion--models ./models
3232
3333ENV HF_HUB_ENABLE_HF_TRANSFER=1 \
34- HF_HUB_OFFLINE=1 \
35- MAX_WORKERS=1 \
36- HUGGINGFACE_HUB_CACHE=/models \
37- DIFFUSERS_CACHE=/models \
38- MODEL_DIR=/models
34+ HF_HUB_OFFLINE=1
3935
4036ARG GIT_SHA
4137ARG VERSION="undefined"
Original file line number Diff line number Diff line change @@ -65,3 +65,9 @@ RUN git clone --branch n7.1 --depth 1 https://github.com/FFmpeg/FFmpeg.git ffmpe
6565 cp -R /compiled/* /usr/local/ && \
6666 cd .. \
6767 rm -rf ffmpeg
68+
69+ # Common environment variables for AI runner pipelines
70+ ENV MAX_WORKERS=1 \
71+ HUGGINGFACE_HUB_CACHE=/models \
72+ DIFFUSERS_CACHE=/models \
73+ MODEL_DIR=/models
Original file line number Diff line number Diff line change @@ -113,7 +113,9 @@ def start_process(self):
113113 # TODO: set torch device from self.torch_device
114114
115115 env = os .environ .copy ()
116- env ["HUGGINGFACE_HUB_CACHE" ] = str (self .model_dir )
116+ env .setdefault ("HUGGINGFACE_HUB_CACHE" , str (self .model_dir ))
117+ env .setdefault ("DIFFUSERS_CACHE" , str (self .model_dir ))
118+ env .setdefault ("MODEL_DIR" , str (self .model_dir ))
117119
118120 try :
119121 self .process = subprocess .Popen (
Original file line number Diff line number Diff line change 2323
2424
2525def get_model_dir () -> Path :
26- return Path (os .environ [ "MODEL_DIR" ] )
26+ return Path (os .environ . get ( "MODEL_DIR" , os . path . expanduser ( "~/.lpData/models" )) )
2727
2828
2929def get_model_path (model_id : str ) -> Path :
@@ -154,7 +154,7 @@ def __init__(
154154
155155 self .device = device
156156 self ._dtype = dtype
157-
157+
158158 from diffusers .pipelines .stable_diffusion import StableDiffusionSafetyChecker
159159 self ._safety_checker = StableDiffusionSafetyChecker .from_pretrained (
160160 "CompVis/stable-diffusion-safety-checker"
You can’t perform that action at this time.
0 commit comments