Datasets:
Tasks:
Text Classification
Modalities:
Text
Formats:
json
Languages:
Vietnamese
Size:
1K - 10K
DOI:
License:
Vu Anh
commited on
Commit
Β·
6b29edc
1
Parent(s):
0702fa5
Refactor validation script - simple and elegant
Browse files- Reduced from 41 lines to 29 lines
- Single main() function with clear logic
- Concise output with essential information
- Added shebang for direct execution
- Returns boolean for programmatic use
- Clean, readable, and maintainable code
- validate.py +15 -27
validate.py
CHANGED
|
@@ -1,41 +1,29 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
"""
|
| 4 |
|
| 5 |
from datasets import load_dataset
|
| 6 |
|
| 7 |
|
| 8 |
-
def
|
| 9 |
-
"""
|
| 10 |
-
|
| 11 |
-
print("π UTS2017_Bank Dataset Validation")
|
| 12 |
-
print("=" * 60)
|
| 13 |
-
print("VALIDATING HUGGINGFACE HUB LOADING")
|
| 14 |
-
print("=" * 60)
|
| 15 |
-
|
| 16 |
configs = ["classification", "sentiment", "aspect_sentiment"]
|
| 17 |
|
|
|
|
|
|
|
| 18 |
for config in configs:
|
| 19 |
try:
|
| 20 |
-
print(f"\nπ€ Loading from Hub - config: {config}")
|
| 21 |
dataset = load_dataset("undertheseanlp/UTS2017_Bank", config)
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
print(f"
|
| 25 |
-
print(f" β Test: {len(dataset['test'])} examples")
|
| 26 |
-
|
| 27 |
-
sample = dataset["train"][0]
|
| 28 |
-
print(f" β Sample keys: {list(sample.keys())}")
|
| 29 |
-
|
| 30 |
except Exception as e:
|
| 31 |
-
print(f"
|
|
|
|
| 32 |
|
| 33 |
-
print("\n
|
| 34 |
-
print("
|
| 35 |
-
|
| 36 |
-
print("π Dataset can be loaded from HuggingFace Hub!")
|
| 37 |
-
print("π‘ Usage: load_dataset('undertheseanlp/UTS2017_Bank', config_name)")
|
| 38 |
|
| 39 |
|
| 40 |
if __name__ == "__main__":
|
| 41 |
-
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""Validate UTS2017_Bank dataset loading from HuggingFace Hub."""
|
|
|
|
| 3 |
|
| 4 |
from datasets import load_dataset
|
| 5 |
|
| 6 |
|
| 7 |
+
def main():
|
| 8 |
+
"""Test loading all dataset configurations from HuggingFace Hub."""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
configs = ["classification", "sentiment", "aspect_sentiment"]
|
| 10 |
|
| 11 |
+
print("π Validating UTS2017_Bank dataset...")
|
| 12 |
+
|
| 13 |
for config in configs:
|
| 14 |
try:
|
|
|
|
| 15 |
dataset = load_dataset("undertheseanlp/UTS2017_Bank", config)
|
| 16 |
+
train_size = len(dataset["train"])
|
| 17 |
+
test_size = len(dataset["test"])
|
| 18 |
+
print(f"β
{config}: {train_size} train, {test_size} test")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
except Exception as e:
|
| 20 |
+
print(f"β {config}: {e}")
|
| 21 |
+
return False
|
| 22 |
|
| 23 |
+
print("\nπ All configurations loaded successfully!")
|
| 24 |
+
print("π‘ Usage: load_dataset('undertheseanlp/UTS2017_Bank', '<config>')")
|
| 25 |
+
return True
|
|
|
|
|
|
|
| 26 |
|
| 27 |
|
| 28 |
if __name__ == "__main__":
|
| 29 |
+
main()
|