Spaces:
Build error
Build error
meg-huggingface
commited on
Commit
·
101aa18
1
Parent(s):
db74ba9
More flexibility in specifying cache directory.
Browse files- run_data_measurements.py +11 -1
run_data_measurements.py
CHANGED
|
@@ -1,12 +1,14 @@
|
|
| 1 |
import argparse
|
| 2 |
import json
|
| 3 |
import textwrap
|
| 4 |
-
from os
|
|
|
|
| 5 |
|
| 6 |
from data_measurements import dataset_statistics
|
| 7 |
from data_measurements import dataset_utils
|
| 8 |
|
| 9 |
|
|
|
|
| 10 |
def load_or_prepare_widgets(ds_args, show_embeddings=False, use_cache=False):
|
| 11 |
"""
|
| 12 |
Loader specifically for the widgets used in the app.
|
|
@@ -18,6 +20,14 @@ def load_or_prepare_widgets(ds_args, show_embeddings=False, use_cache=False):
|
|
| 18 |
Returns:
|
| 19 |
|
| 20 |
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
dstats = dataset_statistics.DatasetStatisticsCacheClass(**ds_args,
|
| 22 |
use_cache=use_cache)
|
| 23 |
# Header widget
|
|
|
|
| 1 |
import argparse
|
| 2 |
import json
|
| 3 |
import textwrap
|
| 4 |
+
from os import mkdir
|
| 5 |
+
from os.path import join as pjoin, isdir
|
| 6 |
|
| 7 |
from data_measurements import dataset_statistics
|
| 8 |
from data_measurements import dataset_utils
|
| 9 |
|
| 10 |
|
| 11 |
+
|
| 12 |
def load_or_prepare_widgets(ds_args, show_embeddings=False, use_cache=False):
|
| 13 |
"""
|
| 14 |
Loader specifically for the widgets used in the app.
|
|
|
|
| 20 |
Returns:
|
| 21 |
|
| 22 |
"""
|
| 23 |
+
|
| 24 |
+
if not isdir(ds_args["cache_dir"]):
|
| 25 |
+
print("Creating cache")
|
| 26 |
+
# We need to preprocess everything.
|
| 27 |
+
# This should eventually all go into a prepare_dataset CLI
|
| 28 |
+
mkdir(ds_args["cache_dir"])
|
| 29 |
+
|
| 30 |
+
|
| 31 |
dstats = dataset_statistics.DatasetStatisticsCacheClass(**ds_args,
|
| 32 |
use_cache=use_cache)
|
| 33 |
# Header widget
|