nalin0503 commited on
Commit
9c65818
·
1 Parent(s): b8b0697

implement caching for models..

Browse files
Files changed (2) hide show
  1. Dockerfile +3 -0
  2. Image-Morpher/main.py +3 -0
Dockerfile CHANGED
@@ -48,6 +48,9 @@ RUN pip install -r requirements.txt
48
  # Copy the rest of your repository into the container
49
  COPY . .
50
 
 
 
 
51
  # Set environment variable to mitigate CUDA memory fragmentation
52
  ENV PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True
53
 
 
48
  # Copy the rest of your repository into the container
49
  COPY . .
50
 
51
+ # make persistent cache for models
52
+ RUN mkdir -p /app/hf_cache
53
+
54
  # Set environment variable to mitigate CUDA memory fragmentation
55
  ENV PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True
56
 
Image-Morpher/main.py CHANGED
@@ -11,6 +11,9 @@ import time
11
  import logging
12
  import gc
13
 
 
 
 
14
  logs_folder = "logs"
15
  os.makedirs(logs_folder, exist_ok=True)
16
 
 
11
  import logging
12
  import gc
13
 
14
+ os.environ["HF_HOME"] = "/app/hf_cache"
15
+ os.environ["DIFFUSERS_CACHE"] = "/app/hf_cache"
16
+
17
  logs_folder = "logs"
18
  os.makedirs(logs_folder, exist_ok=True)
19