Alina Lozovskaia commited on
Commit
5a8f7dc
1 Parent(s): e243a5f

debugging CACHE_PATH in envs.py

Browse files
Files changed (1) hide show
  1. src/envs.py +11 -32
src/envs.py CHANGED
@@ -3,11 +3,6 @@ import logging
3
 
4
  from huggingface_hub import HfApi
5
 
6
- # DEBUG
7
- # Logging the environment variable to debug
8
- hf_home_env = os.getenv("HF_HOME", "Not Set")
9
- print(f"HF_HOME environment variable is set to: {hf_home_env}")
10
-
11
  # clone / pull the lmeh eval data
12
  H4_TOKEN = os.environ.get("H4_TOKEN", None)
13
 
@@ -21,37 +16,21 @@ PRIVATE_RESULTS_REPO = "open-llm-leaderboard/private-results"
21
 
22
  IS_PUBLIC = bool(os.environ.get("IS_PUBLIC", True))
23
 
24
- CACHE_PATH = os.getenv("HF_HOME", ".")
25
-
26
- if not os.access(CACHE_PATH, os.W_OK | os.X_OK):
27
- print(f"No write and execute rights to: {CACHE_PATH}, using default CACHE_PATH")
28
- CACHE_PATH = "."
29
 
30
- # DEBUG STARTS
31
- print(f"Initial CACHE_PATH set to: {CACHE_PATH}")
32
 
33
- # Create directory if it doesn't exist and check write permission
34
- if not os.path.isdir(CACHE_PATH):
35
- try:
36
- os.makedirs(CACHE_PATH, exist_ok=True)
37
- print(f"Created directory at: {CACHE_PATH}")
38
- except PermissionError as e:
39
- print(f"PermissionError: Unable to create directory at {CACHE_PATH}. {str(e)}")
40
  else:
41
- print(f"Directory already exists at: {CACHE_PATH}")
42
-
43
- # Check write access
44
- if not os.access(CACHE_PATH, os.W_OK):
45
- print(f"No write access to CACHE_PATH: {CACHE_PATH}. Resetting to current directory.")
46
- CACHE_PATH = "."
47
- else:
48
- print(f"Write access confirmed for CACHE_PATH: {CACHE_PATH}")
49
-
50
- # DEBUG ENDS
51
 
52
- EVAL_REQUESTS_PATH = os.path.join(CACHE_PATH, "eval-queue")
53
- EVAL_RESULTS_PATH = os.path.join(CACHE_PATH, "eval-results")
54
- DYNAMIC_INFO_PATH = os.path.join(CACHE_PATH, "dynamic-info")
55
  DYNAMIC_INFO_FILE_PATH = os.path.join(DYNAMIC_INFO_PATH, "model_infos.json")
56
 
57
  EVAL_REQUESTS_PATH_PRIVATE = "eval-queue-private"
 
3
 
4
  from huggingface_hub import HfApi
5
 
 
 
 
 
 
6
  # clone / pull the lmeh eval data
7
  H4_TOKEN = os.environ.get("H4_TOKEN", None)
8
 
 
16
 
17
  IS_PUBLIC = bool(os.environ.get("IS_PUBLIC", True))
18
 
19
+ HF_HOME = os.getenv("HF_HOME", ".")
 
 
 
 
20
 
21
+ # Check HF_HOME write access
22
+ print(f"Initial HF_HOME set to: {HF_HOME}")
23
 
24
+ if not os.access(HF_HOME, os.W_OK):
25
+ print(f"No write access to HF_HOME: {HF_HOME}. Resetting to current directory.")
26
+ HF_HOME = "."
27
+ os.environ["HF_HOME"] = HF_HOME
 
 
 
28
  else:
29
+ print(f"Write access confirmed for HF_HOME")
 
 
 
 
 
 
 
 
 
30
 
31
+ EVAL_REQUESTS_PATH = os.path.join(HF_HOME, "eval-queue")
32
+ EVAL_RESULTS_PATH = os.path.join(HF_HOME, "eval-results")
33
+ DYNAMIC_INFO_PATH = os.path.join(HF_HOME, "dynamic-info")
34
  DYNAMIC_INFO_FILE_PATH = os.path.join(DYNAMIC_INFO_PATH, "model_infos.json")
35
 
36
  EVAL_REQUESTS_PATH_PRIVATE = "eval-queue-private"