Spaces:
Paused
Paused
add transformers_cache in /data
Browse filesStore the models in the persistent storage.
app.py
CHANGED
|
@@ -70,7 +70,7 @@ def merge_models() -> None:
|
|
| 70 |
"""
|
| 71 |
Use mergekit to create a merge.
|
| 72 |
"""
|
| 73 |
-
command = ["mergekit-yaml", "config.yaml", "/data/merge", "--copy-tokenizer"]
|
| 74 |
|
| 75 |
with open("output.log", "a") as log_file:
|
| 76 |
try:
|
|
@@ -122,7 +122,7 @@ def get_name(models: list[pd.Series], username: str, version=0) -> str:
|
|
| 122 |
get_name(models, username, version+1)
|
| 123 |
|
| 124 |
return model_name
|
| 125 |
-
|
| 126 |
|
| 127 |
def get_license(models: list[pd.Series]) -> str:
|
| 128 |
license1 = models[0]["Hub License"]
|
|
@@ -359,12 +359,15 @@ def clear_data():
|
|
| 359 |
"""
|
| 360 |
Clear data so the Space doesn't crash...
|
| 361 |
"""
|
| 362 |
-
dir_path = "/data
|
| 363 |
-
|
| 364 |
-
|
| 365 |
-
|
| 366 |
-
|
| 367 |
-
|
|
|
|
|
|
|
|
|
|
| 368 |
|
| 369 |
|
| 370 |
def get_size(start_path):
|
|
|
|
| 70 |
"""
|
| 71 |
Use mergekit to create a merge.
|
| 72 |
"""
|
| 73 |
+
command = ["mergekit-yaml", "config.yaml", "/data/merge", "--copy-tokenizer", "--transformers_cache", "/data"]
|
| 74 |
|
| 75 |
with open("output.log", "a") as log_file:
|
| 76 |
try:
|
|
|
|
| 122 |
get_name(models, username, version+1)
|
| 123 |
|
| 124 |
return model_name
|
| 125 |
+
|
| 126 |
|
| 127 |
def get_license(models: list[pd.Series]) -> str:
|
| 128 |
license1 = models[0]["Hub License"]
|
|
|
|
| 359 |
"""
|
| 360 |
Clear data so the Space doesn't crash...
|
| 361 |
"""
|
| 362 |
+
dir_path = "/data"
|
| 363 |
+
try:
|
| 364 |
+
with os.scandir(dir_path) as entries:
|
| 365 |
+
for entry in entries:
|
| 366 |
+
if entry.is_file():
|
| 367 |
+
os.unlink(entry.path)
|
| 368 |
+
print("All files deleted successfully.")
|
| 369 |
+
except OSError:
|
| 370 |
+
print("Error occurred while deleting files.")
|
| 371 |
|
| 372 |
|
| 373 |
def get_size(start_path):
|