Nolwenn commited on
Commit
93f3b22
·
1 Parent(s): c9bae4b

Update cache to save memory

Browse files
Files changed (2) hide show
  1. crs_arena/arena.py +1 -1
  2. crs_arena/utils.py +3 -1
crs_arena/arena.py CHANGED
@@ -61,7 +61,7 @@ if not os.path.exists("data/models"):
61
  logger.info("Downloading models...")
62
  download_and_extract_models()
63
  # Cache some CRS fighters at startup
64
- cache_fighters()
65
  if not os.path.exists("data/embed_items"):
66
  logger.info("Downloading item embeddings...")
67
  download_and_extract_item_embeddings()
 
61
  logger.info("Downloading models...")
62
  download_and_extract_models()
63
  # Cache some CRS fighters at startup
64
+ cache_fighters(n=6)
65
  if not os.path.exists("data/embed_items"):
66
  logger.info("Downloading item embeddings...")
67
  download_and_extract_item_embeddings()
crs_arena/utils.py CHANGED
@@ -25,7 +25,9 @@ from src.model.crs_model import CRSModel
25
  HF_API = HfApi(token=st.secrets["hf_token"])
26
 
27
 
28
- @st.cache_resource(show_spinner="Loading CRS...")
 
 
29
  def get_crs_model(model_name: str, model_config_file: str) -> CRSModel:
30
  """Returns a CRS model.
31
 
 
25
  HF_API = HfApi(token=st.secrets["hf_token"])
26
 
27
 
28
+ @st.cache_resource(
29
+ show_spinner="Loading CRS...", max_entries=6, ttl=timedelta(days=1)
30
+ )
31
  def get_crs_model(model_name: str, model_config_file: str) -> CRSModel:
32
  """Returns a CRS model.
33