Spaces:
Runtime error
Runtime error
ronald
commited on
Commit
·
eec7791
1
Parent(s):
09b2ea7
cache dir
Browse files- app.py +2 -1
- my_perplexity.py +1 -0
app.py
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
import evaluate
|
2 |
from evaluate.utils import launch_gradio_widget
|
3 |
|
4 |
-
|
|
|
5 |
launch_gradio_widget(module)
|
|
|
1 |
import evaluate
|
2 |
from evaluate.utils import launch_gradio_widget
|
3 |
|
4 |
+
CACHE_DIR="/gfs/team/nlp/users/rcardena/tools/huggingface/evaluate"
|
5 |
+
module = evaluate.load("my_perplexity", module_type="measurement",cache_dir=CACHE_DIR)
|
6 |
launch_gradio_widget(module)
|
my_perplexity.py
CHANGED
@@ -107,6 +107,7 @@ class MyPerplexity(evaluate.Metric):
|
|
107 |
|
108 |
def _compute(self, predictions, model_id, batch_size: int = 16, add_start_token: bool = True, device=None):
|
109 |
|
|
|
110 |
if device is not None:
|
111 |
assert device in ["gpu", "cpu", "cuda"], "device should be either gpu or cpu."
|
112 |
if device == "gpu":
|
|
|
107 |
|
108 |
def _compute(self, predictions, model_id, batch_size: int = 16, add_start_token: bool = True, device=None):
|
109 |
|
110 |
+
CACHE_DIR="/gfs/team/nlp/users/rcardena/tools/huggingface/evaluate"
|
111 |
if device is not None:
|
112 |
assert device in ["gpu", "cpu", "cuda"], "device should be either gpu or cpu."
|
113 |
if device == "gpu":
|