cache-management

#951
by alozowski HF staff - opened
Files changed (2) hide show
  1. app.py +7 -10
  2. pyproject.toml +5 -5
app.py CHANGED
@@ -1,4 +1,3 @@
1
- import os
2
  import logging
3
  import time
4
  import schedule
@@ -100,29 +99,27 @@ def download_dataset(repo_id, local_dir, repo_type="dataset", max_attempts=3, ba
100
  attempt += 1
101
  raise Exception(f"Failed to download {repo_id} after {max_attempts} attempts")
102
 
103
- def get_latest_data_leaderboard(leaderboard_initial_df = None):
104
  global NEW_DATA_ON_LEADERBOARD
105
  global LEADERBOARD_DF
106
  if NEW_DATA_ON_LEADERBOARD:
107
  print("Leaderboard updated at reload!")
108
  leaderboard_dataset = datasets.load_dataset(
109
- AGGREGATED_REPO,
110
- "default",
111
- split="train",
112
- cache_dir=HF_HOME,
113
- download_mode=datasets.DownloadMode.REUSE_DATASET_IF_EXISTS, # Uses the cached dataset
114
  verification_mode="no_checks"
115
  )
116
  LEADERBOARD_DF = get_leaderboard_df(
117
- leaderboard_dataset=leaderboard_dataset,
118
  cols=COLS,
119
  benchmark_cols=BENCHMARK_COLS,
120
  )
121
  NEW_DATA_ON_LEADERBOARD = False
122
-
123
  else:
124
  LEADERBOARD_DF = leaderboard_initial_df
125
-
126
  return LEADERBOARD_DF
127
 
128
 
 
 
1
  import logging
2
  import time
3
  import schedule
 
99
  attempt += 1
100
  raise Exception(f"Failed to download {repo_id} after {max_attempts} attempts")
101
 
102
+ def get_latest_data_leaderboard(leaderboard_initial_df=None):
103
  global NEW_DATA_ON_LEADERBOARD
104
  global LEADERBOARD_DF
105
  if NEW_DATA_ON_LEADERBOARD:
106
  print("Leaderboard updated at reload!")
107
  leaderboard_dataset = datasets.load_dataset(
108
+ AGGREGATED_REPO,
109
+ "default",
110
+ split="train",
111
+ cache_dir=None, # Disable cache directory usage
112
+ download_mode=datasets.DownloadMode.FORCE_REDOWNLOAD, # Always download fresh data
113
  verification_mode="no_checks"
114
  )
115
  LEADERBOARD_DF = get_leaderboard_df(
116
+ leaderboard_dataset=leaderboard_dataset,
117
  cols=COLS,
118
  benchmark_cols=BENCHMARK_COLS,
119
  )
120
  NEW_DATA_ON_LEADERBOARD = False
 
121
  else:
122
  LEADERBOARD_DF = leaderboard_initial_df
 
123
  return LEADERBOARD_DF
124
 
125
 
pyproject.toml CHANGED
@@ -17,7 +17,7 @@ dependencies = [
17
  "sentencepiece>=0.2.0",
18
  "transformers==4.44.2",
19
  "tokenizers>=0.19.0",
20
- "gradio-space-ci @ git+https://huggingface.co/spaces/Wauplin/gradio-space-ci@0.2.3",
21
  "isort>=5.13.2",
22
  "ruff>=0.6.4",
23
  "gradio-leaderboard==0.0.11",
@@ -34,16 +34,16 @@ ignore=["I","EM","FBT","TRY003","S101","D101","D102","D103","D104","D105","G004"
34
  fixable=["ALL"]
35
  select=["ALL"]
36
 
37
- [tool.ruff.lint]
38
  select = ["E", "F"]
39
  fixable = ["ALL"]
40
  ignore = ["E501"] # line too long (black is taking care of this)
41
 
42
- [tool.isort]
43
  profile = "black"
44
 
45
  [tool.black]
46
  line-length = 119
47
 
48
- [tool.hatch.metadata]
49
- allow-direct-references = true
 
17
  "sentencepiece>=0.2.0",
18
  "transformers==4.44.2",
19
  "tokenizers>=0.19.0",
20
+ "gradio-space-ci",
21
  "isort>=5.13.2",
22
  "ruff>=0.6.4",
23
  "gradio-leaderboard==0.0.11",
 
34
  fixable=["ALL"]
35
  select=["ALL"]
36
 
37
+ [tool.ruff.lint]
38
  select = ["E", "F"]
39
  fixable = ["ALL"]
40
  ignore = ["E501"] # line too long (black is taking care of this)
41
 
42
+ [tool.isort]
43
  profile = "black"
44
 
45
  [tool.black]
46
  line-length = 119
47
 
48
+ [tool.uv.sources]
49
+ gradio-space-ci = { git = "https://huggingface.co/spaces/Wauplin/gradio-space-ci" }