Spaces:
Runtime error
Runtime error
testbot
commited on
Commit
β’
8c68c2f
1
Parent(s):
95c4e87
delete cache between each run
Browse files
app.py
CHANGED
@@ -3,7 +3,7 @@ from pathlib import Path
|
|
3 |
from tempfile import TemporaryDirectory
|
4 |
|
5 |
import gradio as gr
|
6 |
-
from huggingface_hub import HfApi, ModelCard
|
7 |
from huggingface_hub.utils import EntryNotFoundError, RepositoryNotFoundError
|
8 |
|
9 |
from convert import convert
|
@@ -129,12 +129,22 @@ def run(
|
|
129 |
yield _log(
|
130 |
f"### Success π₯\n\nYay! This model was successfully converted! Make sure to let the repo owner know about it and review your PR. You might need to complete the PR manually, especially to add information in the model card."
|
131 |
)
|
|
|
132 |
return
|
133 |
except Exception as e:
|
134 |
yield _log(f"### Error π’π’π’\n\n{e}")
|
|
|
135 |
return
|
136 |
|
137 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
138 |
TITLE = """
|
139 |
<h1 style="font-weight: 900; font-size: 32px; margin-bottom: 10px; margin-top: 10px; text-align: center;">
|
140 |
Make any BLOOM-like model compatible with bloomz.cpp
|
@@ -168,7 +178,9 @@ with gr.Blocks() as demo:
|
|
168 |
gr.Markdown(DESCRIPTION)
|
169 |
|
170 |
with gr.Column(scale=50):
|
171 |
-
input_token = gr.Text(
|
|
|
|
|
172 |
input_model = gr.Text(
|
173 |
max_lines=1, label="Model id (e.g.: bigscience/bloomz-7b1)"
|
174 |
)
|
|
|
3 |
from tempfile import TemporaryDirectory
|
4 |
|
5 |
import gradio as gr
|
6 |
+
from huggingface_hub import HfApi, ModelCard, scan_cache_dir
|
7 |
from huggingface_hub.utils import EntryNotFoundError, RepositoryNotFoundError
|
8 |
|
9 |
from convert import convert
|
|
|
129 |
yield _log(
|
130 |
f"### Success π₯\n\nYay! This model was successfully converted! Make sure to let the repo owner know about it and review your PR. You might need to complete the PR manually, especially to add information in the model card."
|
131 |
)
|
132 |
+
_delete_cache()
|
133 |
return
|
134 |
except Exception as e:
|
135 |
yield _log(f"### Error π’π’π’\n\n{e}")
|
136 |
+
_delete_cache()
|
137 |
return
|
138 |
|
139 |
|
140 |
+
def _delete_cache():
|
141 |
+
"""Delete cache dir between each run to avoid filling up the Space disk."""
|
142 |
+
scan = scan_cache_dir()
|
143 |
+
scan.delete_revisions(
|
144 |
+
*[rev.commit_hash for repo in scan.repos for rev in repo.revisions]
|
145 |
+
)
|
146 |
+
|
147 |
+
|
148 |
TITLE = """
|
149 |
<h1 style="font-weight: 900; font-size: 32px; margin-bottom: 10px; margin-top: 10px; text-align: center;">
|
150 |
Make any BLOOM-like model compatible with bloomz.cpp
|
|
|
178 |
gr.Markdown(DESCRIPTION)
|
179 |
|
180 |
with gr.Column(scale=50):
|
181 |
+
input_token = gr.Text(
|
182 |
+
max_lines=1, label="Hugging Face token", type="password"
|
183 |
+
)
|
184 |
input_model = gr.Text(
|
185 |
max_lines=1, label="Model id (e.g.: bigscience/bloomz-7b1)"
|
186 |
)
|