mohanz commited on
Commit
615feff
·
1 Parent(s): a8e6d06

use persistant storage for some of the library

Browse files
Files changed (1) hide show
  1. start.sh +12 -30
start.sh CHANGED
@@ -1,17 +1,15 @@
1
  #!/bin/bash
2
 
3
- # Set up cache directories
4
- export HF_HUB_CACHE=/tmp/huggingface
5
- export TRANSFORMERS_CACHE=/tmp/transformers
6
- export TORCH_HOME=/tmp/torch
 
 
 
7
 
8
- # Clean up old cache files
9
- echo "Cleaning up cache directories..."
10
- rm -rf /tmp/huggingface/* /tmp/transformers/* /tmp/torch/* 2>/dev/null || true
11
-
12
- # Clean up system temp files
13
- echo "Cleaning up system temporary files..."
14
- rm -rf /tmp/*.log /tmp/*.tmp /tmp/*.cache 2>/dev/null || true
15
 
16
  if [ ! -d "llama.cpp" ]; then
17
  # only run in dev env
@@ -32,9 +30,8 @@ rm -rf build
32
 
33
  cd ..
34
 
35
- # Comprehensive cleanup before starting
36
- echo "Performing comprehensive cleanup..."
37
- # Clean Python cache files
38
  find . -type f -name "*.pyc" -delete
39
  find . -type f -name "*.pyo" -delete
40
  find . -type f -name "*.pyd" -delete
@@ -42,25 +39,10 @@ find . -type d -name "__pycache__" -exec rm -r {} + 2>/dev/null || true
42
  find . -type d -name ".pytest_cache" -exec rm -r {} + 2>/dev/null || true
43
  find . -type d -name ".coverage" -exec rm -r {} + 2>/dev/null || true
44
 
45
- # Clean temporary files
46
- find . -type f -name "*.tmp" -delete
47
- find . -type f -name "*.temp" -delete
48
- find . -type f -name "*.log" -delete
49
- find . -type f -name "*.cache" -delete
50
-
51
  # Clean build artifacts
52
  find . -type d -name "build" -exec rm -r {} + 2>/dev/null || true
53
  find . -type d -name "dist" -exec rm -r {} + 2>/dev/null || true
54
  find . -type d -name "*.egg-info" -exec rm -r {} + 2>/dev/null || true
55
 
56
- # Clean downloads directory if it exists
57
- if [ -d "downloads" ]; then
58
- echo "Cleaning downloads directory..."
59
- find downloads -type f -mtime +1 -delete 2>/dev/null || true
60
- fi
61
-
62
- # Clean up any remaining temporary files in the current directory
63
- rm -f *.log *.tmp *.temp 2>/dev/null || true
64
-
65
- echo "Cleanup completed. Starting application..."
66
  python app.py
 
1
  #!/bin/bash
2
 
3
+ # Set up persistent cache directories
4
+ export HF_HOME=/data/.huggingface
5
+ export HF_HUB_CACHE=${HF_HOME}/hub
6
+ export TRANSFORMERS_CACHE=${HF_HOME}/transformers
7
+ export TORCH_HOME=${HF_HOME}/torch
8
+ export DATASETS_CACHE=${HF_HOME}/datasets
9
+ export DIFFUSERS_CACHE=${HF_HOME}/diffusers
10
 
11
+ # Create cache directories if they don't exist
12
+ mkdir -p ${HF_HOME} ${HF_HUB_CACHE} ${TRANSFORMERS_CACHE} ${TORCH_HOME} ${DATASETS_CACHE} ${DIFFUSERS_CACHE}
 
 
 
 
 
13
 
14
  if [ ! -d "llama.cpp" ]; then
15
  # only run in dev env
 
30
 
31
  cd ..
32
 
33
+ # Clean only non-persistent temporary files
34
+ echo "Cleaning temporary files..."
 
35
  find . -type f -name "*.pyc" -delete
36
  find . -type f -name "*.pyo" -delete
37
  find . -type f -name "*.pyd" -delete
 
39
  find . -type d -name ".pytest_cache" -exec rm -r {} + 2>/dev/null || true
40
  find . -type d -name ".coverage" -exec rm -r {} + 2>/dev/null || true
41
 
 
 
 
 
 
 
42
  # Clean build artifacts
43
  find . -type d -name "build" -exec rm -r {} + 2>/dev/null || true
44
  find . -type d -name "dist" -exec rm -r {} + 2>/dev/null || true
45
  find . -type d -name "*.egg-info" -exec rm -r {} + 2>/dev/null || true
46
 
47
+ echo "Starting application..."
 
 
 
 
 
 
 
 
 
48
  python app.py