Alina Lozovskaia commited on
Commit
6a5081f
1 Parent(s): 63dac32

debugging CACHE_PATH in envs.py

Browse files
Files changed (1) hide show
  1. src/envs.py +25 -3
src/envs.py CHANGED
@@ -1,7 +1,13 @@
1
  import os
 
2
 
3
  from huggingface_hub import HfApi
4
 
 
 
 
 
 
5
  # clone / pull the lmeh eval data
6
  H4_TOKEN = os.environ.get("H4_TOKEN", None)
7
 
@@ -16,12 +22,28 @@ PRIVATE_RESULTS_REPO = "open-llm-leaderboard/private-results"
16
  IS_PUBLIC = bool(os.environ.get("IS_PUBLIC", True))
17
 
18
  CACHE_PATH = os.getenv("HF_HOME", ".")
19
- # Check if the CACHE_PATH is a directory and if we have write access, if not set to '.'
20
- if not os.path.isdir(CACHE_PATH):
21
- os.makedirs(CACHE_PATH, exist_ok=True) # Create directory if it doesn't exist
22
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
  if not os.access(CACHE_PATH, os.W_OK):
 
24
  CACHE_PATH = "."
 
 
 
 
25
 
26
  EVAL_REQUESTS_PATH = os.path.join(CACHE_PATH, "eval-queue")
27
  EVAL_RESULTS_PATH = os.path.join(CACHE_PATH, "eval-results")
 
1
  import os
2
+ 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
 
 
22
  IS_PUBLIC = bool(os.environ.get("IS_PUBLIC", True))
23
 
24
  CACHE_PATH = os.getenv("HF_HOME", ".")
 
 
 
25
 
26
+ # DEBUG STARTS
27
+ print(f"Initial CACHE_PATH set to: {CACHE_PATH}")
28
+
29
+ # Create directory if it doesn't exist and check write permission
30
+ if not os.path.isdir(CACHE_PATH):
31
+ try:
32
+ os.makedirs(CACHE_PATH, exist_ok=True)
33
+ print(f"Created directory at: {CACHE_PATH}")
34
+ except PermissionError as e:
35
+ print(f"PermissionError: Unable to create directory at {CACHE_PATH}. {str(e)}")
36
+ else:
37
+ print(f"Directory already exists at: {CACHE_PATH}")
38
+
39
+ # Check write access
40
  if not os.access(CACHE_PATH, os.W_OK):
41
+ print(f"No write access to CACHE_PATH: {CACHE_PATH}. Resetting to current directory.")
42
  CACHE_PATH = "."
43
+ else:
44
+ print(f"Write access confirmed for CACHE_PATH: {CACHE_PATH}")
45
+
46
+ # DEBUG ENDS
47
 
48
  EVAL_REQUESTS_PATH = os.path.join(CACHE_PATH, "eval-queue")
49
  EVAL_RESULTS_PATH = os.path.join(CACHE_PATH, "eval-results")