File size: 1,688 Bytes
b111af8 c548ae9 b111af8 f356ef8 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
import datasets
import pyarrow
def test_local_hf_match(
dataset_tag,
split):
print(f"For dataset '{dataset_tag}' and split '{split}' testing if local and remote ids match ...")
ids_hf = datasets.load_dataset(
path = "maom/MegaScale",
name = dataset_tag,
data_dir = dataset_tag,
cache_dir = "/scratch/maom_root/maom0/maom",
keep_in_memory = True).data[split].select(['id']).to_pandas()
ids_local = pyarrow.parquet.read_table(
source = f"intermediate/{dataset_tag}_{split}.parquet",
columns = ["id"]).to_pandas()
assert ids_local.equals(ids_hf)
test_local_hf_match("dataset1", "train")
test_local_hf_match("dataset2", "train")
test_local_hf_match("dataset3", "train")
test_local_hf_match("dataset3_single", "train")
test_local_hf_match("dataset3_single", "val")
test_local_hf_match("dataset3_single", "test")
test_local_hf_match("dataset3_single_cv", "train_0")
test_local_hf_match("dataset3_single_cv", "train_1")
test_local_hf_match("dataset3_single_cv", "train_2")
test_local_hf_match("dataset3_single_cv", "train_3")
test_local_hf_match("dataset3_single_cv", "train_4")
test_local_hf_match("dataset3_single_cv", "val_0")
test_local_hf_match("dataset3_single_cv", "val_1")
test_local_hf_match("dataset3_single_cv", "val_2")
test_local_hf_match("dataset3_single_cv", "val_3")
test_local_hf_match("dataset3_single_cv", "val_4")
test_local_hf_match("dataset3_single_cv", "test_0")
test_local_hf_match("dataset3_single_cv", "test_1")
test_local_hf_match("dataset3_single_cv", "test_2")
test_local_hf_match("dataset3_single_cv", "test_3")
test_local_hf_match("dataset3_single_cv", "test_4")
|