2525
2626# github actions repo cache limit is 10 GB so using 9 GB
2727CACHE_LIMIT = 9 * 10 ** 9
28- # exclude model larger than 200 MB
29- MODEL_SIZE_THRESHOLD = 200 * 10 ** 6
28+ # exclude model larger than 500 MB
29+ MODEL_SIZE_THRESHOLD = 500 * 10 ** 6
3030
3131
3232def hub_size (api : HfApi , repo_id : str ) -> int :
@@ -41,7 +41,6 @@ def hub_size(api: HfApi, repo_id: str) -> int:
4141def main () -> None :
4242 api = HfApi ()
4343 candidates = {}
44-
4544 for name , repo_id in MODEL_NAMES .items ():
4645 if not isinstance (repo_id , str ) or not repo_id or repo_id .startswith ("/" ):
4746 continue
@@ -89,6 +88,25 @@ def main() -> None:
8988 print (f"Skipped (too large) : { len (skipped_too_large )} ({ ', ' .join (skipped_too_large )} )" )
9089 print (f"Skipped (cache full): { len (skipped_cache_full )} ({ ', ' .join (skipped_cache_full )} )" )
9190 print (f"Loading failed : { len (failed )} ({ ', ' .join (failed )} )" )
91+ final_cache_info = scan_cache_dir ()
92+ actual_size = final_cache_info .size_on_disk / 10 ** 9
93+ print (f"Actual cache : { actual_size :.2f} GB, sum_repo_size { sum_repo_size / 10 ** 9 :.0f} GB" )
94+
95+ final_cached_repos = {repo .repo_id for repo in final_cache_info .repos }
96+ name_of = {repo_id : name for name , repo_id in MODEL_NAMES .items ()}
97+ downloaded_repo_ids = {repo_id for name , repo_id in MODEL_NAMES .items () if name in set (downloaded )}
98+
99+ in_cache_not_downloaded = final_cached_repos - downloaded_repo_ids
100+ in_downloaded_not_in_cache = downloaded_repo_ids - final_cached_repos
101+
102+ print (
103+ f"In cache but not in downloaded ({ len (in_cache_not_downloaded )} ): "
104+ f"{ ', ' .join (name_of .get (r , r ) for r in sorted (in_cache_not_downloaded ))} "
105+ )
106+ print (
107+ f"In downloaded but not in cache ({ len (in_downloaded_not_in_cache )} ): "
108+ f"{ ', ' .join (name_of .get (r , r ) for r in sorted (in_downloaded_not_in_cache ))} "
109+ )
92110
93111
94112if __name__ == "__main__" :
0 commit comments