|
import logging |
|
|
|
import datasets |
|
|
|
|
|
def check_dataset_and_get_config(dataset_id): |
|
try: |
|
configs = datasets.get_dataset_config_names(dataset_id, trust_remote_code=True) |
|
return configs |
|
except Exception: |
|
|
|
return None |
|
|
|
|
|
def check_dataset_and_get_split(dataset_id, dataset_config): |
|
try: |
|
splits = datasets.get_dataset_split_names(dataset_id, dataset_config, trust_remote_code=True) |
|
except Exception as e: |
|
|
|
logging.warning( |
|
f"Failed to load dataset {dataset_id} with config {dataset_config}: {e}" |
|
) |
|
return None |
|
if isinstance(splits, list): |
|
return splits |
|
else: |
|
|
|
logging.warning( |
|
f"Dataset {dataset_id} with config {dataset_config} has no splits" |
|
) |
|
return None |
|
|