Spaces:
Sleeping
Sleeping
apehex commited on
Commit ·
8efa8a6
1
Parent(s): c2b2d5f
Frontload the model + use the latest gradio + psaiops APIs
Browse files- app.py +6 -3
- requirements.txt +2 -2
app.py
CHANGED
|
@@ -8,8 +8,11 @@ import psaiops.score.residual.app as app
|
|
| 8 |
# META #########################################################################
|
| 9 |
|
| 10 |
# frontload the model on the CPU to avoid downloading it from the GPU slot
|
| 11 |
-
|
| 12 |
-
|
|
|
|
|
|
|
|
|
|
| 13 |
|
| 14 |
# LAZY #########################################################################
|
| 15 |
|
|
@@ -69,4 +72,4 @@ def compute_states(
|
|
| 69 |
|
| 70 |
demo = app.create_app(highlight=highlight_tokens, compute=compute_states)
|
| 71 |
demo.queue()
|
| 72 |
-
demo.launch()
|
|
|
|
| 8 |
# META #########################################################################
|
| 9 |
|
| 10 |
# frontload the model on the CPU to avoid downloading it from the GPU slot
|
| 11 |
+
psaiops.common.tokenizer.get_tokenizer(name=app.MODEL, device='cpu')
|
| 12 |
+
|
| 13 |
+
# but do not instantiate unless necessary
|
| 14 |
+
_MODELS = {'cpu': None, 'cuda': None,}
|
| 15 |
+
_TOKENIZERS = {'cpu': None, 'cuda': None,}
|
| 16 |
|
| 17 |
# LAZY #########################################################################
|
| 18 |
|
|
|
|
| 72 |
|
| 73 |
demo = app.create_app(highlight=highlight_tokens, compute=compute_states)
|
| 74 |
demo.queue()
|
| 75 |
+
demo.launch(theme=gradio.themes.Soft(), css=app.STYLE)
|
requirements.txt
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
accelerate>=1.10
|
| 2 |
deformers>=0.0
|
| 3 |
-
gradio>=
|
| 4 |
kernels>=0.10
|
| 5 |
-
psaiops>=0.
|
| 6 |
spaces>=0.44
|
| 7 |
triton==3.4
|
|
|
|
| 1 |
accelerate>=1.10
|
| 2 |
deformers>=0.0
|
| 3 |
+
gradio>=6.0
|
| 4 |
kernels>=0.10
|
| 5 |
+
psaiops>=0.5
|
| 6 |
spaces>=0.44
|
| 7 |
triton==3.4
|