Spaces:
Running
Running
kovacsvi
commited on
Commit
·
af77a1c
1
Parent(s):
d6c2bce
scan cache
Browse files
app.py
CHANGED
|
@@ -13,7 +13,7 @@ from interfaces.ontolisst import demo as ontolisst_demo
|
|
| 13 |
from interfaces.emotion9 import demo as e9_demo
|
| 14 |
from interfaces.cap_media_demo import demo as cap_media_demo
|
| 15 |
from interfaces.cap_minor_media import demo as cap_minor_media_demo
|
| 16 |
-
from utils import download_hf_models, df_h, set_hf_cache_dir
|
| 17 |
|
| 18 |
|
| 19 |
|
|
@@ -52,6 +52,7 @@ with gr.Blocks(css=css) as demo:
|
|
| 52 |
|
| 53 |
if __name__ == "__main__":
|
| 54 |
set_hf_cache_dir("/data")
|
|
|
|
| 55 |
download_spacy_models()
|
| 56 |
download_hf_models() # does this affect the build?
|
| 57 |
df_h() # debug -> check disk space before launching demo
|
|
|
|
| 13 |
from interfaces.emotion9 import demo as e9_demo
|
| 14 |
from interfaces.cap_media_demo import demo as cap_media_demo
|
| 15 |
from interfaces.cap_minor_media import demo as cap_minor_media_demo
|
| 16 |
+
from utils import download_hf_models, df_h, set_hf_cache_dir, scan_cache
|
| 17 |
|
| 18 |
|
| 19 |
|
|
|
|
| 52 |
|
| 53 |
if __name__ == "__main__":
|
| 54 |
set_hf_cache_dir("/data")
|
| 55 |
+
scan_cache()
|
| 56 |
download_spacy_models()
|
| 57 |
download_hf_models() # does this affect the build?
|
| 58 |
df_h() # debug -> check disk space before launching demo
|
utils.py
CHANGED
|
@@ -58,6 +58,10 @@ def df_h():
|
|
| 58 |
result = subprocess.run(["df", "-H"], capture_output=True, text=True)
|
| 59 |
print(result.stdout)
|
| 60 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 61 |
|
| 62 |
def set_hf_cache_dir(path:str):
|
| 63 |
os.environ['TRANSFORMERS_CACHE'] = path
|
|
|
|
| 58 |
result = subprocess.run(["df", "-H"], capture_output=True, text=True)
|
| 59 |
print(result.stdout)
|
| 60 |
|
| 61 |
+
def scan_cache():
|
| 62 |
+
result = subprocess.run(["huggingface-cli", "scan-cache"], capture_output=True, text=True)
|
| 63 |
+
print(result.stdout)
|
| 64 |
+
|
| 65 |
|
| 66 |
def set_hf_cache_dir(path:str):
|
| 67 |
os.environ['TRANSFORMERS_CACHE'] = path
|