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

add further caching for torch, hf cache datasets

Browse files
Files changed (2) hide show
  1. Dockerfile +1 -1
  2. Image-Morpher/main.py +3 -0
Dockerfile CHANGED
@@ -49,7 +49,7 @@ RUN pip install -r requirements.txt
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
 
49
  COPY . .
50
 
51
  # make persistent cache for models
52
+ RUN mkdir -p /app/hf_cache /app/torch_cache /app/hf_cache/datasets
53
 
54
  # Set environment variable to mitigate CUDA memory fragmentation
55
  ENV PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True
Image-Morpher/main.py CHANGED
@@ -13,6 +13,9 @@ 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)
 
13
 
14
  os.environ["HF_HOME"] = "/app/hf_cache"
15
  os.environ["DIFFUSERS_CACHE"] = "/app/hf_cache"
16
+ os.environ["TORCH_HOME"] = "/app/torch_cache"
17
+ os.environ["TRANSFORMERS_CACHE"] = "/app/hf_cache"
18
+ os.environ["HF_DATASETS_CACHE"] = "/app/hf_cache/datasets"
19
 
20
  logs_folder = "logs"
21
  os.makedirs(logs_folder, exist_ok=True)